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 FileSystemOptions
fileSystemOptions
-
Constructor Summary
Constructors Modifier Constructor Description protected
FTPClientWrapper(GenericFileName root, FileSystemOptions fileSystemOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
abort()
java.io.OutputStream
appendFileStream(java.lang.String relPath)
boolean
completePendingCommand()
protected org.apache.commons.net.ftp.FTPClient
createClient(GenericFileName rootName, UserAuthenticationData authData)
boolean
deleteFile(java.lang.String relPath)
void
disconnect()
FileSystemOptions
getFileSystemOptions()
java.lang.String
getReplyString()
GenericFileName
getRoot()
boolean
isConnected()
org.apache.commons.net.ftp.FTPFile[]
listFiles(java.lang.String relPath)
boolean
makeDirectory(java.lang.String relPath)
boolean
removeDirectory(java.lang.String relPath)
boolean
rename(java.lang.String oldName, java.lang.String newName)
java.io.InputStream
retrieveFileStream(java.lang.String relPath)
java.io.InputStream
retrieveFileStream(java.lang.String relPath, long restartOffset)
java.io.OutputStream
storeFileStream(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:
isConnected
in interfaceFtpClient
- Throws:
FileSystemException
-
disconnect
public void disconnect() throws java.io.IOException
- Specified by:
disconnect
in 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:
removeDirectory
in interfaceFtpClient
- Throws:
java.io.IOException
-
deleteFile
public boolean deleteFile(java.lang.String relPath) throws java.io.IOException
- Specified by:
deleteFile
in 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:
makeDirectory
in interfaceFtpClient
- Throws:
java.io.IOException
-
completePendingCommand
public boolean completePendingCommand() throws java.io.IOException
- Specified by:
completePendingCommand
in interfaceFtpClient
- Throws:
java.io.IOException
-
retrieveFileStream
public java.io.InputStream retrieveFileStream(java.lang.String relPath) throws java.io.IOException
- Specified by:
retrieveFileStream
in interfaceFtpClient
- Throws:
java.io.IOException
-
retrieveFileStream
public java.io.InputStream retrieveFileStream(java.lang.String relPath, long restartOffset) throws java.io.IOException
- Specified by:
retrieveFileStream
in interfaceFtpClient
- Throws:
java.io.IOException
-
appendFileStream
public java.io.OutputStream appendFileStream(java.lang.String relPath) throws java.io.IOException
- Specified by:
appendFileStream
in interfaceFtpClient
- Throws:
java.io.IOException
-
storeFileStream
public java.io.OutputStream storeFileStream(java.lang.String relPath) throws java.io.IOException
- Specified by:
storeFileStream
in 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:
getReplyString
in interfaceFtpClient
- Throws:
java.io.IOException
-
-