public abstract class AbstractWagon extends Object implements Wagon
| Modifier and Type | Field and Description |
|---|---|
protected AuthenticationInfo |
authenticationInfo |
protected static int |
DEFAULT_BUFFER_SIZE |
protected boolean |
interactive |
protected ProxyInfo |
proxyInfo
Deprecated.
|
protected Repository |
repository |
protected SessionEventSupport |
sessionEventSupport |
protected TransferEventSupport |
transferEventSupport |
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE| Constructor and Description |
|---|
AbstractWagon() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionListener(SessionListener listener) |
void |
addTransferListener(TransferListener listener) |
protected void |
cleanupGetTransfer(Resource resource) |
protected void |
cleanupPutTransfer(Resource resource) |
protected abstract void |
closeConnection() |
void |
connect(Repository repository)
Initiate the connection to the repository.
|
void |
connect(Repository repository,
AuthenticationInfo authenticationInfo)
Initiate the connection to the repository.
|
void |
connect(Repository repository,
AuthenticationInfo authenticationInfo,
ProxyInfo proxyInfo)
Initiate the connection to the repository.
|
void |
connect(Repository repository,
AuthenticationInfo authenticationInfo,
ProxyInfoProvider proxyInfoProvider)
Initiate the connection to the repository.
|
void |
connect(Repository repository,
ProxyInfo proxyInfo)
Initiate the connection to the repository.
|
void |
connect(Repository repository,
ProxyInfoProvider proxyInfoProvider)
Initiate the connection to the repository.
|
protected void |
createParentDirectories(File destination) |
void |
disconnect()
Disconnect from the repository.
|
protected void |
finishGetTransfer(Resource resource,
InputStream input,
OutputStream output) |
protected void |
finishPutTransfer(Resource resource,
InputStream input,
OutputStream output) |
protected void |
fireGetCompleted(Resource resource,
File localFile) |
protected void |
fireGetInitiated(Resource resource,
File localFile) |
protected void |
fireGetStarted(Resource resource,
File localFile) |
protected void |
firePutCompleted(Resource resource,
File localFile) |
protected void |
firePutInitiated(Resource resource,
File localFile) |
protected void |
firePutStarted(Resource resource,
File localFile) |
protected void |
fireSessionConnectionRefused() |
protected void |
fireSessionDebug(String message) |
protected void |
fireSessionDisconnected() |
protected void |
fireSessionDisconnecting() |
protected void |
fireSessionError(Exception exception) |
protected void |
fireSessionLoggedIn() |
protected void |
fireSessionLoggedOff() |
protected void |
fireSessionOpened() |
protected void |
fireSessionOpening() |
protected void |
fireTransferDebug(String message) |
protected void |
fireTransferError(Resource resource,
Exception e,
int requestType) |
protected void |
fireTransferProgress(TransferEvent transferEvent,
byte[] buffer,
int n) |
AuthenticationInfo |
getAuthenticationInfo() |
List<String> |
getFileList(String destinationDirectory)
Returns a
List of strings naming the files and directories in the directory denoted by
this abstract pathname. |
protected static String |
getPath(String basedir,
String dir) |
RepositoryPermissions |
getPermissionsOverride() |
ProxyInfo |
getProxyInfo() |
protected ProxyInfo |
getProxyInfo(String protocol,
String host) |
int |
getReadTimeout()
Get the read timeout limit in milliseconds
|
Repository |
getRepository() |
SessionEventSupport |
getSessionEventSupport() |
int |
getTimeout()
Get the connection timeout limit in milliseconds
|
protected void |
getTransfer(Resource resource,
File destination,
InputStream input) |
protected void |
getTransfer(Resource resource,
File destination,
InputStream input,
boolean closeInput,
int maxSize)
Deprecated.
|
protected void |
getTransfer(Resource resource,
File destination,
InputStream input,
boolean closeInput,
long maxSize) |
protected void |
getTransfer(Resource resource,
OutputStream output,
InputStream input) |
protected void |
getTransfer(Resource resource,
OutputStream output,
InputStream input,
boolean closeInput,
int maxSize)
Deprecated.
|
protected void |
getTransfer(Resource resource,
OutputStream output,
InputStream input,
boolean closeInput,
long maxSize) |
TransferEventSupport |
getTransferEventSupport() |
boolean |
hasSessionListener(SessionListener listener) |
boolean |
hasTransferListener(TransferListener listener) |
boolean |
isInteractive() |
void |
openConnection()
Initiate the connection to the repository.
|
protected abstract void |
openConnectionInternal() |
protected void |
postProcessListeners(Resource resource,
File source,
int requestType)
This method is used if you are not streaming the transfer, to make sure any listeners dependent on state
(eg checksum observers) succeed.
|
void |
putDirectory(File sourceDirectory,
String destinationDirectory)
Copy a directory from local system to remote
|
protected void |
putTransfer(Resource resource,
File source,
OutputStream output,
boolean closeOutput) |
protected void |
putTransfer(Resource resource,
InputStream input,
OutputStream output,
boolean closeOutput) |
void |
removeSessionListener(SessionListener listener) |
void |
removeTransferListener(TransferListener listener) |
boolean |
resourceExists(String resourceName)
Check if a remote resource exists
|
void |
setInteractive(boolean interactive) |
void |
setPermissionsOverride(RepositoryPermissions permissionsOverride) |
void |
setReadTimeout(int readTimeout)
Set the read timeout limit in milliseconds
|
void |
setSessionEventSupport(SessionEventSupport sessionEventSupport) |
void |
setTimeout(int timeoutValue)
Set the connection timeout limit in milliseconds
|
void |
setTransferEventSupport(TransferEventSupport transferEventSupport) |
boolean |
supportsDirectoryCopy()
Flag indicating if this wagon supports directory copy operations.
|
protected void |
transfer(Resource resource,
File source,
OutputStream output,
boolean closeOutput)
Write from
File to OutputStream |
protected void |
transfer(Resource resource,
InputStream input,
OutputStream output,
int requestType)
Write from
InputStream to OutputStream. |
protected void |
transfer(Resource resource,
InputStream input,
OutputStream output,
int requestType,
int maxSize)
Deprecated.
Please use the transfer using long as type of maxSize
|
protected void |
transfer(Resource resource,
InputStream input,
OutputStream output,
int requestType,
long maxSize)
Write from
InputStream to OutputStream. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, getIfNewer, putprotected static final int DEFAULT_BUFFER_SIZE
protected Repository repository
protected SessionEventSupport sessionEventSupport
protected TransferEventSupport transferEventSupport
protected AuthenticationInfo authenticationInfo
protected boolean interactive
public AbstractWagon()
public Repository getRepository()
getRepository in interface Wagonpublic ProxyInfo getProxyInfo()
public AuthenticationInfo getAuthenticationInfo()
public void openConnection() throws ConnectionException, AuthenticationException
WagonopenConnection in interface WagonConnectionException - if there is a problem connectingAuthenticationException - if ther credentials for connecting are not sufficientpublic void connect(Repository repository) throws ConnectionException, AuthenticationException
Wagonconnect in interface Wagonrepository - the repository to connect toConnectionException - if there is a problem connectingAuthenticationException - if the credentials for connecting are not sufficientpublic void connect(Repository repository, ProxyInfo proxyInfo) throws ConnectionException, AuthenticationException
Wagonconnect in interface Wagonrepository - the repository to connect toConnectionException - if there is a problem connectingAuthenticationException - if the credentials for connecting are not sufficientpublic void connect(Repository repository, ProxyInfoProvider proxyInfoProvider) throws ConnectionException, AuthenticationException
Wagonconnect in interface Wagonrepository - the repository to connect toproxyInfoProvider - the provider to obtain a network proxy to use to connect to the remote repositoryConnectionException - if there is a problem connectingAuthenticationException - if the credentials for connecting are not sufficientpublic void connect(Repository repository, AuthenticationInfo authenticationInfo) throws ConnectionException, AuthenticationException
Wagonconnect in interface Wagonrepository - the repository to connect toauthenticationInfo - authentication credentials for connectingConnectionException - if there is a problem connectingAuthenticationException - if the credentials for connecting are not sufficientpublic void connect(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo) throws ConnectionException, AuthenticationException
Wagonconnect in interface Wagonrepository - the repository to connect toauthenticationInfo - authentication credentials for connectingproxyInfo - the network proxy to use to connect to the remote repositoryConnectionException - if there is a problem connectingAuthenticationException - if the credentials for connecting are not sufficientpublic void connect(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider) throws ConnectionException, AuthenticationException
Wagonconnect in interface Wagonrepository - the repository to connect toauthenticationInfo - authentication credentials for connectingproxyInfoProvider - the provider to obtain a network proxy to use to connect to the remote repositoryConnectionException - if there is a problem connectingAuthenticationException - if the credentials for connecting are not sufficientprotected abstract void openConnectionInternal() throws ConnectionException, AuthenticationException
public void disconnect() throws ConnectionException
Wagondisconnect in interface WagonConnectionException - if there is a problem disconnectingprotected abstract void closeConnection() throws ConnectionException
ConnectionExceptionprotected void createParentDirectories(File destination) throws TransferFailedException
TransferFailedExceptionpublic void setTimeout(int timeoutValue)
WagonsetTimeout in interface Wagonpublic int getTimeout()
WagongetTimeout in interface Wagonprotected void getTransfer(Resource resource, File destination, InputStream input) throws TransferFailedException
TransferFailedExceptionprotected void getTransfer(Resource resource, OutputStream output, InputStream input) throws TransferFailedException
TransferFailedException@Deprecated protected void getTransfer(Resource resource, File destination, InputStream input, boolean closeInput, int maxSize) throws TransferFailedException
TransferFailedExceptionprotected void getTransfer(Resource resource, File destination, InputStream input, boolean closeInput, long maxSize) throws TransferFailedException
TransferFailedException@Deprecated protected void getTransfer(Resource resource, OutputStream output, InputStream input, boolean closeInput, int maxSize) throws TransferFailedException
TransferFailedExceptionprotected void getTransfer(Resource resource, OutputStream output, InputStream input, boolean closeInput, long maxSize) throws TransferFailedException
TransferFailedExceptionprotected void finishGetTransfer(Resource resource, InputStream input, OutputStream output) throws TransferFailedException
TransferFailedExceptionprotected void cleanupGetTransfer(Resource resource)
protected void putTransfer(Resource resource, File source, OutputStream output, boolean closeOutput) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException
protected void transfer(Resource resource, File source, OutputStream output, boolean closeOutput) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException
File to OutputStreamresource - resource to transfersource - file to read fromoutput - output streamcloseOutput - whether the output stream should be closed or notTransferFailedExceptionResourceDoesNotExistExceptionAuthorizationExceptionprotected void putTransfer(Resource resource, InputStream input, OutputStream output, boolean closeOutput) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException
protected void cleanupPutTransfer(Resource resource)
protected void finishPutTransfer(Resource resource, InputStream input, OutputStream output) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException
protected void transfer(Resource resource, InputStream input, OutputStream output, int requestType) throws IOException
InputStream to OutputStream.
Equivalent to transfer(Resource, InputStream, OutputStream, int, int) with a maxSize equals to
Integer.MAX_VALUEresource - resource to transferinput - input streamoutput - output streamrequestType - one of TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUTIOException@Deprecated protected void transfer(Resource resource, InputStream input, OutputStream output, int requestType, int maxSize) throws IOException
InputStream to OutputStream.
Equivalent to transfer(Resource, InputStream, OutputStream, int, int) with a maxSize equals to
Integer.MAX_VALUEresource - resource to transferinput - input streamoutput - output streamrequestType - one of TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUTmaxSize - size of the bufferIOExceptionprotected void transfer(Resource resource, InputStream input, OutputStream output, int requestType, long maxSize) throws IOException
InputStream to OutputStream.
Equivalent to transfer(Resource, InputStream, OutputStream, int, long) with a maxSize equals to
Integer.MAX_VALUEresource - resource to transferinput - input streamoutput - output streamrequestType - one of TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUTmaxSize - size of the bufferIOExceptionprotected void fireTransferProgress(TransferEvent transferEvent, byte[] buffer, int n)
protected void fireGetCompleted(Resource resource, File localFile)
protected void fireGetStarted(Resource resource, File localFile)
protected void fireGetInitiated(Resource resource, File localFile)
protected void firePutInitiated(Resource resource, File localFile)
protected void firePutCompleted(Resource resource, File localFile)
protected void firePutStarted(Resource resource, File localFile)
protected void fireSessionDisconnected()
protected void fireSessionDisconnecting()
protected void fireSessionLoggedIn()
protected void fireSessionLoggedOff()
protected void fireSessionOpened()
protected void fireSessionOpening()
protected void fireSessionConnectionRefused()
protected void fireSessionError(Exception exception)
protected void fireTransferDebug(String message)
protected void fireSessionDebug(String message)
public boolean hasTransferListener(TransferListener listener)
hasTransferListener in interface Wagonpublic void addTransferListener(TransferListener listener)
addTransferListener in interface Wagonpublic void removeTransferListener(TransferListener listener)
removeTransferListener in interface Wagonpublic void addSessionListener(SessionListener listener)
addSessionListener in interface Wagonpublic boolean hasSessionListener(SessionListener listener)
hasSessionListener in interface Wagonpublic void removeSessionListener(SessionListener listener)
removeSessionListener in interface Wagonprotected void fireTransferError(Resource resource, Exception e, int requestType)
public SessionEventSupport getSessionEventSupport()
public void setSessionEventSupport(SessionEventSupport sessionEventSupport)
public TransferEventSupport getTransferEventSupport()
public void setTransferEventSupport(TransferEventSupport transferEventSupport)
protected void postProcessListeners(Resource resource, File source, int requestType) throws TransferFailedException
TransferFailedExceptionpublic void putDirectory(File sourceDirectory, String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
WagonputDirectory in interface WagonsourceDirectory - the local directorydestinationDirectory - the remote destinationTransferFailedExceptionResourceDoesNotExistExceptionAuthorizationExceptionpublic boolean supportsDirectoryCopy()
WagonsupportsDirectoryCopy in interface Wagonpublic boolean isInteractive()
isInteractive in interface Wagonpublic void setInteractive(boolean interactive)
setInteractive in interface Wagonpublic List<String> getFileList(String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
WagonList of strings naming the files and directories in the directory denoted by
this abstract pathname.
If this abstract pathname does not denote a directory, or does not exist, then this method throws
ResourceDoesNotExistException.
Otherwise a List of strings is returned, one for each file or directory in the directory.
Names denoting the directory itself and the directory's parent directory are not included in
the result. Each string is a file name rather than a complete path.
There is no guarantee that the name strings in the resulting list will appear in any specific
order; they are not, in particular, guaranteed to appear in alphabetical order.
getFileList in interface WagondestinationDirectory - directory to list contents ofList of strings naming the files and directories in the directory denoted by
this abstract pathname. The List will be empty if the directory is empty.TransferFailedException - if there's an error trying to access the remote sideResourceDoesNotExistException - if destinationDirectory does not exist or is not a directoryAuthorizationException - if not authorized to list the contents of the directorypublic boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException
WagonresourceExists in interface WagonTransferFailedException - if there's an error trying to access the remote sideAuthorizationException - if not authorized to verify the existence of the resourceprotected ProxyInfo getProxyInfo(String protocol, String host)
public RepositoryPermissions getPermissionsOverride()
public void setPermissionsOverride(RepositoryPermissions permissionsOverride)
public void setReadTimeout(int readTimeout)
WagonsetReadTimeout in interface Wagonpublic int getReadTimeout()
WagongetReadTimeout in interface WagonCopyright © 2003–2014 The Apache Software Foundation. All rights reserved.