public class FtpWagon extends StreamWagon
| Modifier and Type | Class and Description |
|---|---|
class |
FtpWagon.PrintCommandListener |
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
controlEncoding |
private org.apache.commons.net.ftp.FTPClient |
ftp |
private boolean |
passiveMode |
authenticationInfo, DEFAULT_BUFFER_SIZE, interactive, proxyInfo, repository, sessionEventSupport, transferEventSupportDEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE| Constructor and Description |
|---|
FtpWagon() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnection() |
protected org.apache.commons.net.ftp.FTPClient |
createClient() |
void |
fillInputData(InputData inputData) |
void |
fillOutputData(OutputData outputData) |
protected void |
fireGetCompleted(Resource resource,
java.io.File localFile) |
protected void |
firePutCompleted(Resource resource,
java.io.File file) |
protected void |
fireSessionDebug(java.lang.String msg) |
private void |
ftpChangeDirectory(Resource resource) |
private void |
ftpRecursivePut(java.io.File sourceFile,
java.lang.String fileName) |
java.lang.String |
getControlEncoding() |
java.util.List<java.lang.String> |
getFileList(java.lang.String destinationDirectory)
Returns a
List of strings naming the files and directories in the directory denoted by
this abstract pathname. |
boolean |
isPassiveMode() |
private boolean |
makeFtpDirectoryRecursive(java.lang.String fileName,
RepositoryPermissions permissions)
Recursively create directories.
|
protected void |
openConnectionInternal() |
void |
putDirectory(java.io.File sourceDirectory,
java.lang.String destinationDirectory)
Copy a directory from local system to remote
|
boolean |
resourceExists(java.lang.String resourceName)
Check if a remote resource exists
|
void |
setControlEncoding(java.lang.String controlEncoding) |
void |
setPassiveMode(boolean passiveMode) |
private void |
setPermissions(RepositoryPermissions permissions)
Set the permissions (if given) for the underlying folder.
|
boolean |
supportsDirectoryCopy()
Flag indicating if this wagon supports directory copy operations.
|
checkInputStream, checkOutputStream, get, getIfNewer, getIfNewerToStream, getInputStream, getOutputStream, getToStream, put, putFromStream, putFromStream, putFromStreamaddSessionListener, addTransferListener, cleanupGetTransfer, cleanupPutTransfer, connect, connect, connect, connect, connect, connect, createParentDirectories, disconnect, finishGetTransfer, finishPutTransfer, fireGetInitiated, fireGetStarted, firePutInitiated, firePutStarted, fireSessionConnectionRefused, fireSessionDisconnected, fireSessionDisconnecting, fireSessionError, fireSessionLoggedIn, fireSessionLoggedOff, fireSessionOpened, fireSessionOpening, fireTransferDebug, fireTransferError, fireTransferProgress, getAuthenticationInfo, getPath, getPermissionsOverride, getProxyInfo, getProxyInfo, getReadTimeout, getRepository, getSessionEventSupport, getTimeout, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, openConnection, postProcessListeners, putTransfer, putTransfer, removeSessionListener, removeTransferListener, setInteractive, setPermissionsOverride, setReadTimeout, setSessionEventSupport, setTimeout, setTransferEventSupport, transfer, transfer, transfer, transferclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddSessionListener, addTransferListener, connect, connect, connect, connect, connect, connect, disconnect, getReadTimeout, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, removeSessionListener, removeTransferListener, setInteractive, setReadTimeout, setTimeoutprivate org.apache.commons.net.ftp.FTPClient ftp
private boolean passiveMode
private java.lang.String controlEncoding
public boolean isPassiveMode()
public void setPassiveMode(boolean passiveMode)
protected void openConnectionInternal()
throws ConnectionException,
AuthenticationException
openConnectionInternal in class AbstractWagonConnectionExceptionAuthenticationExceptionprotected org.apache.commons.net.ftp.FTPClient createClient()
protected void firePutCompleted(Resource resource, java.io.File file)
firePutCompleted in class AbstractWagonprotected void fireGetCompleted(Resource resource, java.io.File localFile)
fireGetCompleted in class AbstractWagonpublic void closeConnection()
throws ConnectionException
closeConnection in class StreamWagonConnectionExceptionpublic void fillOutputData(OutputData outputData) throws TransferFailedException
fillOutputData in class StreamWagonTransferFailedExceptionpublic void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException
fillInputData in class StreamWagonTransferFailedExceptionResourceDoesNotExistExceptionprivate void ftpChangeDirectory(Resource resource) throws java.io.IOException, TransferFailedException, ResourceDoesNotExistException
java.io.IOExceptionTransferFailedExceptionResourceDoesNotExistExceptionprotected void fireSessionDebug(java.lang.String msg)
fireSessionDebug in class AbstractWagonpublic java.util.List<java.lang.String> getFileList(java.lang.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 WagongetFileList in class AbstractWagondestinationDirectory - 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(java.lang.String resourceName)
throws TransferFailedException,
AuthorizationException
WagonresourceExists in interface WagonresourceExists in class AbstractWagonTransferFailedException - if there's an error trying to access the remote sideAuthorizationException - if not authorized to verify the existence of the resourcepublic boolean supportsDirectoryCopy()
WagonsupportsDirectoryCopy in interface WagonsupportsDirectoryCopy in class AbstractWagonpublic void putDirectory(java.io.File sourceDirectory,
java.lang.String destinationDirectory)
throws TransferFailedException,
ResourceDoesNotExistException,
AuthorizationException
WagonputDirectory in interface WagonputDirectory in class AbstractWagonsourceDirectory - the local directorydestinationDirectory - the remote destinationTransferFailedExceptionResourceDoesNotExistExceptionAuthorizationExceptionprivate void ftpRecursivePut(java.io.File sourceFile,
java.lang.String fileName)
throws TransferFailedException
TransferFailedExceptionprivate void setPermissions(RepositoryPermissions permissions)
permissions - group and directory permissionsprivate boolean makeFtpDirectoryRecursive(java.lang.String fileName,
RepositoryPermissions permissions)
throws java.io.IOException
fileName - the path to create (might be nested)permissions - java.io.IOExceptionpublic java.lang.String getControlEncoding()
public void setControlEncoding(java.lang.String controlEncoding)