org.springframework.integration.ftp.client
Class AbstractFtpClientFactory<T extends org.apache.commons.net.ftp.FTPClient>
java.lang.Object
org.springframework.integration.ftp.client.AbstractFtpClientFactory<T>
- All Implemented Interfaces:
- FtpClientFactory<T>
- Direct Known Subclasses:
- DefaultFtpClientFactory, DefaultFtpsClientFactory
public abstract class AbstractFtpClientFactory<T extends org.apache.commons.net.ftp.FTPClient>
- extends java.lang.Object
- implements FtpClientFactory<T>
base class for the other FtpClientFactory
implementations.
Most of this came out of the DefaultFtpClientFactory
and was refactored into a base class
Method Summary |
protected abstract T |
createSingleInstanceOfClient()
|
T |
getClient()
|
protected void |
onAfterConnect(T t)
this is a hook to setup the state of the FTPClient impl *after* the
implementation's SocketClient.connect(String) method's been called but before any
action's been taken. |
protected void |
setClientMode(org.apache.commons.net.ftp.FTPClient client)
Sets the mode of the connection. |
void |
setClientMode(int clientMode)
Set client mode, for example
FTPClient.ACTIVE_LOCAL_CONNECTION_MODE (default)
Only local modes are supported. |
void |
setConfig(org.apache.commons.net.ftp.FTPClientConfig config)
|
void |
setFileType(int fileType)
|
void |
setHost(java.lang.String host)
|
void |
setPassword(java.lang.String pass)
|
void |
setPort(int port)
|
void |
setRemoteWorkingDirectory(java.lang.String remoteWorkingDirectory)
|
void |
setUsername(java.lang.String user)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
config
protected org.apache.commons.net.ftp.FTPClientConfig config
username
protected java.lang.String username
host
protected java.lang.String host
password
protected java.lang.String password
port
protected int port
remoteWorkingDirectory
protected java.lang.String remoteWorkingDirectory
clientMode
protected int clientMode
fileType
protected int fileType
AbstractFtpClientFactory
public AbstractFtpClientFactory()
setFileType
public void setFileType(int fileType)
setConfig
public void setConfig(org.apache.commons.net.ftp.FTPClientConfig config)
setHost
public void setHost(java.lang.String host)
setPort
public void setPort(int port)
setUsername
public void setUsername(java.lang.String user)
setPassword
public void setPassword(java.lang.String pass)
setRemoteWorkingDirectory
public void setRemoteWorkingDirectory(java.lang.String remoteWorkingDirectory)
setClientMode
public void setClientMode(int clientMode)
- Set client mode, for example
FTPClient.ACTIVE_LOCAL_CONNECTION_MODE
(default)
Only local modes are supported.
createSingleInstanceOfClient
protected abstract T createSingleInstanceOfClient()
onAfterConnect
protected void onAfterConnect(T t)
throws java.io.IOException
- this is a hook to setup the state of the
FTPClient
impl *after* the
implementation's SocketClient.connect(String)
method's been called but before any
action's been taken.
- Parameters:
t
- the ftp client instance on which to act
- Throws:
java.io.IOException
- if anything should go wrong
getClient
public T getClient()
throws java.net.SocketException,
java.io.IOException
- Specified by:
getClient
in interface FtpClientFactory<T extends org.apache.commons.net.ftp.FTPClient>
- Returns:
- Fully configured and connected FTPClient. Never
null
.
- Throws:
java.io.IOException
- thrown when a networking IO subsystem error occurs
java.net.SocketException
setClientMode
protected void setClientMode(org.apache.commons.net.ftp.FTPClient client)
- Sets the mode of the connection. Only local modes are supported.