Class FTPClientWrapper
- java.lang.Object
-
- org.apache.commons.vfs2.provider.ftp.FTPClientWrapper
-
- All Implemented Interfaces:
FtpClient
public class FTPClientWrapper extends java.lang.Object implements 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
Fields Modifier and Type Field Description protected FileSystemOptionsfileSystemOptions
-
Constructor Summary
Constructors Modifier Constructor Description protectedFTPClientWrapper(GenericFileName root, FileSystemOptions fileSystemOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanabort()java.io.OutputStreamappendFileStream(java.lang.String relPath)booleancompletePendingCommand()protected org.apache.commons.net.ftp.FTPClientcreateClient(GenericFileName rootName, UserAuthenticationData authData)booleandeleteFile(java.lang.String relPath)voiddisconnect()FileSystemOptionsgetFileSystemOptions()java.lang.StringgetReplyString()GenericFileNamegetRoot()booleanisConnected()org.apache.commons.net.ftp.FTPFile[]listFiles(java.lang.String relPath)booleanmakeDirectory(java.lang.String relPath)booleanremoveDirectory(java.lang.String relPath)booleanrename(java.lang.String oldName, java.lang.String newName)java.io.InputStreamretrieveFileStream(java.lang.String relPath)java.io.InputStreamretrieveFileStream(java.lang.String relPath, long restartOffset)java.io.OutputStreamstoreFileStream(java.lang.String relPath)
-
-
-
Field Detail
-
fileSystemOptions
protected final FileSystemOptions fileSystemOptions
-
-
Constructor Detail
-
FTPClientWrapper
protected FTPClientWrapper(GenericFileName root, FileSystemOptions fileSystemOptions) throws FileSystemException
- Throws:
FileSystemException
-
-
Method Detail
-
getRoot
public GenericFileName getRoot()
-
getFileSystemOptions
public FileSystemOptions getFileSystemOptions()
-
createClient
protected org.apache.commons.net.ftp.FTPClient createClient(GenericFileName rootName, UserAuthenticationData authData) throws FileSystemException
- Throws:
FileSystemException
-
isConnected
public boolean isConnected() throws FileSystemException- Specified by:
isConnectedin interfaceFtpClient- Throws:
FileSystemException
-
disconnect
public void disconnect() throws java.io.IOException- Specified by:
disconnectin interfaceFtpClient- Throws:
java.io.IOException
-
listFiles
public org.apache.commons.net.ftp.FTPFile[] listFiles(java.lang.String relPath) throws java.io.IOException
-
removeDirectory
public boolean removeDirectory(java.lang.String relPath) throws java.io.IOException- Specified by:
removeDirectoryin interfaceFtpClient- Throws:
java.io.IOException
-
deleteFile
public boolean deleteFile(java.lang.String relPath) throws java.io.IOException- Specified by:
deleteFilein interfaceFtpClient- Throws:
java.io.IOException
-
rename
public boolean rename(java.lang.String oldName, java.lang.String newName) throws java.io.IOException
-
makeDirectory
public boolean makeDirectory(java.lang.String relPath) throws java.io.IOException- Specified by:
makeDirectoryin interfaceFtpClient- Throws:
java.io.IOException
-
completePendingCommand
public boolean completePendingCommand() throws java.io.IOException- Specified by:
completePendingCommandin interfaceFtpClient- Throws:
java.io.IOException
-
retrieveFileStream
public java.io.InputStream retrieveFileStream(java.lang.String relPath) throws java.io.IOException- Specified by:
retrieveFileStreamin interfaceFtpClient- Throws:
java.io.IOException
-
retrieveFileStream
public java.io.InputStream retrieveFileStream(java.lang.String relPath, long restartOffset) throws java.io.IOException- Specified by:
retrieveFileStreamin interfaceFtpClient- Throws:
java.io.IOException
-
appendFileStream
public java.io.OutputStream appendFileStream(java.lang.String relPath) throws java.io.IOException- Specified by:
appendFileStreamin interfaceFtpClient- Throws:
java.io.IOException
-
storeFileStream
public java.io.OutputStream storeFileStream(java.lang.String relPath) throws java.io.IOException- Specified by:
storeFileStreamin interfaceFtpClient- Throws:
java.io.IOException
-
abort
public boolean abort() throws java.io.IOException
-
getReplyString
public java.lang.String getReplyString() throws java.io.IOException- Specified by:
getReplyStringin interfaceFtpClient- Throws:
java.io.IOException
-
-