Class FtpRemoteFileTemplate
java.lang.Object
org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
org.springframework.integration.ftp.session.FtpRemoteFileTemplate
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.InitializingBean,org.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
public class FtpRemoteFileTemplate
extends org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
FTP version of
RemoteFileTemplate providing type-safe access to
the underlying FTPClient object.- Since:
- 4.1
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFtpRemoteFileTemplate.ExistsModeTheexists(String)operation mode. -
Field Summary
-
Constructor Summary
Constructors Constructor Description FtpRemoteFileTemplate(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory) -
Method Summary
Modifier and Type Method Description protected <T> TdoExecuteWithClient(org.springframework.integration.file.remote.ClientCallback<org.apache.commons.net.ftp.FTPClient,T> callback)<T, C> TexecuteWithClient(org.springframework.integration.file.remote.ClientCallback<C,T> callback)booleanexists(java.lang.String path)This particular FTP implementation is based on theFTPClient.getStatus(String)by default, but since not all FTP servers properly implement theSTATcommand, the framework internalFtpRemoteFileTemplateinstances are switched to theFTPClient.listNames(String)for only files operations.voidsetExistsMode(FtpRemoteFileTemplate.ExistsMode existsMode)Specify anFtpRemoteFileTemplate.ExistsModeforexists(String)operation.Methods inherited from class org.springframework.integration.file.remote.RemoteFileTemplate
afterPropertiesSet, append, append, execute, get, get, getRemoteFileSeparator, getSession, getSessionFactory, getTemporaryFileSuffix, invoke, isUseTemporaryFileName, list, remove, rename, send, send, setAutoCreateDirectory, setBeanFactory, setCharset, setFileNameExpression, setFileNameGenerator, setRemoteDirectoryExpression, setRemoteFileSeparator, setTemporaryFileSuffix, setTemporaryRemoteDirectoryExpression, setUseTemporaryFileName
-
Constructor Details
-
FtpRemoteFileTemplate
public FtpRemoteFileTemplate(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory)
-
-
Method Details
-
executeWithClient
public <T, C> T executeWithClient(org.springframework.integration.file.remote.ClientCallback<C,T> callback)- Specified by:
executeWithClientin interfaceorg.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>- Overrides:
executeWithClientin classorg.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
-
setExistsMode
Specify anFtpRemoteFileTemplate.ExistsModeforexists(String)operation. Defaults toFtpRemoteFileTemplate.ExistsMode.STAT. When used internally by framework components for file operation, switched toFtpRemoteFileTemplate.ExistsMode.NLST.- Parameters:
existsMode- theFtpRemoteFileTemplate.ExistsModeto use.- Since:
- 4.1.9
-
doExecuteWithClient
protected <T> T doExecuteWithClient(org.springframework.integration.file.remote.ClientCallback<org.apache.commons.net.ftp.FTPClient,T> callback) -
exists
public boolean exists(java.lang.String path)This particular FTP implementation is based on theFTPClient.getStatus(String)by default, but since not all FTP servers properly implement theSTATcommand, the framework internalFtpRemoteFileTemplateinstances are switched to theFTPClient.listNames(String)for only files operations.The mode can be switched with the
setExistsMode(ExistsMode)property.Any custom implementation can be done in an extension of the
FtpRemoteFileTemplate.- Specified by:
existsin interfaceorg.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>- Overrides:
existsin classorg.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>- Parameters:
path- the remote file path to check.- Returns:
- true or false if remote file exists or not.
-