Class FTPClientWrapper
java.lang.Object
org.apache.commons.vfs2.provider.ftp.FTPClientWrapper
- All Implemented Interfaces:
FtpClient
A wrapper to the FTPClient to allow automatic reconnect on connection loss.
I decided to not to use eg. noop() to determine the state of the connection to avoid unnecessary server round-trips.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FileSystemOptionsprivate org.apache.commons.net.ftp.FTPClientprivate static final org.apache.commons.logging.Logprivate final GenericFileName -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFTPClientWrapper(GenericFileName root, FileSystemOptions fileSystemOptions) -
Method Summary
Modifier and TypeMethodDescriptionbooleanabort()appendFileStream(String relPath) booleanprivate org.apache.commons.net.ftp.FTPClientprotected org.apache.commons.net.ftp.FTPClientcreateClient(GenericFileName rootName, UserAuthenticationData authData) booleandeleteFile(String relPath) voidprivate org.apache.commons.net.ftp.FTPClientintgetRoot()booleanhasFeature(String feature) Queries the server for a supported feature.booleanorg.apache.commons.net.ftp.FTPFile[]private org.apache.commons.net.ftp.FTPFile[]listFilesInDirectory(String relPath) booleanmakeDirectory(String relPath) mdtmInstant(String relPath) Sends the MDTM command to get a file's date and time information after file transfer.booleanremoveDirectory(String relPath) booleanretrieveFileStream(String relPath) retrieveFileStream(String relPath, int bufferSize) retrieveFileStream(String relPath, long restartOffset) voidsetBufferSize(int bufferSize) storeFileStream(String relPath)
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
fileSystemOptions
-
ftpClient
private org.apache.commons.net.ftp.FTPClient ftpClient -
root
-
-
Constructor Details
-
FTPClientWrapper
protected FTPClientWrapper(GenericFileName root, FileSystemOptions fileSystemOptions) throws FileSystemException - Throws:
FileSystemException
-
-
Method Details
-
abort
- Specified by:
abortin interfaceFtpClient- Throws:
IOException
-
appendFileStream
- Specified by:
appendFileStreamin interfaceFtpClient- Throws:
IOException
-
completePendingCommand
- Specified by:
completePendingCommandin interfaceFtpClient- Throws:
IOException
-
createClient
- Throws:
FileSystemException
-
createClient
protected org.apache.commons.net.ftp.FTPClient createClient(GenericFileName rootName, UserAuthenticationData authData) throws FileSystemException - Throws:
FileSystemException
-
deleteFile
- Specified by:
deleteFilein interfaceFtpClient- Throws:
IOException
-
disconnect
- Specified by:
disconnectin interfaceFtpClient- Throws:
IOException
-
getFileSystemOptions
-
getFtpClient
- Throws:
FileSystemException
-
getReplyCode
- Specified by:
getReplyCodein interfaceFtpClient- Throws:
IOException
-
getReplyString
- Specified by:
getReplyStringin interfaceFtpClient- Throws:
IOException
-
getRoot
-
hasFeature
Queries the server for a supported feature.- Specified by:
hasFeaturein interfaceFtpClient- Parameters:
feature- the name of the feature, converted to upper case.- Returns:
trueif the feature is present,falseif the feature is not present or the FTP command failed.- Throws:
IOException- on error
-
isConnected
- Specified by:
isConnectedin interfaceFtpClient- Throws:
FileSystemException
-
listFiles
- Specified by:
listFilesin interfaceFtpClient- Throws:
IOException
-
listFilesInDirectory
private org.apache.commons.net.ftp.FTPFile[] listFilesInDirectory(String relPath) throws IOException - Throws:
IOException
-
makeDirectory
- Specified by:
makeDirectoryin interfaceFtpClient- Throws:
IOException
-
mdtmInstant
Sends the MDTM command to get a file's date and time information after file transfer. It is typically more accurate than the"LIST"command response. Time values are always represented in UTC (GMT), and in the Gregorian calendar regardless of what calendar may have been in use at the date and time the file was last modified.NOTE: not all remote FTP servers support
MDTM.- Specified by:
mdtmInstantin interfaceFtpClient- Parameters:
relPath- The relative path of the file object to executeMDTMcommand against- Returns:
- new
Instantobject containing theMDTMtimestamp. - Throws:
IOException- If the underlying FTP client encountered an error.
-
removeDirectory
- Specified by:
removeDirectoryin interfaceFtpClient- Throws:
IOException
-
rename
- Specified by:
renamein interfaceFtpClient- Throws:
IOException
-
retrieveFileStream
- Specified by:
retrieveFileStreamin interfaceFtpClient- Throws:
IOException
-
retrieveFileStream
- Specified by:
retrieveFileStreamin interfaceFtpClient- Throws:
IOException
-
retrieveFileStream
- Specified by:
retrieveFileStreamin interfaceFtpClient- Throws:
IOException
-
setBufferSize
- Specified by:
setBufferSizein interfaceFtpClient- Throws:
FileSystemException
-
storeFileStream
- Specified by:
storeFileStreamin interfaceFtpClient- Throws:
IOException
-