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:
- Aware,- BeanFactoryAware,- InitializingBean,- RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
FTP version of 
RemoteFileTemplate providing type-safe access to
 the underlying FTPClient object.- Since:
- 4.1
- Author:
- Gary Russell, Artem Bilan
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from interface org.springframework.integration.file.remote.RemoteFileOperationsRemoteFileOperations.OperationsCallback<F,T> 
- 
Field SummaryFields inherited from class org.springframework.integration.file.remote.RemoteFileTemplatelogger, sessionFactory
- 
Constructor SummaryConstructorsConstructorDescriptionFtpRemoteFileTemplate(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected <T> TdoExecuteWithClient(ClientCallback<org.apache.commons.net.ftp.FTPClient, T> callback) <T,C> T executeWithClient(ClientCallback<C, T> callback) Execute the callback's doWithClient method after obtaining a session's client, providing access to low level methods.booleanThis 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.protected booleanisStatusDirty(String ftpErrorMessage) Check ifThrowable.getMessage()is treated as fatal.voidsetExistsMode(FtpRemoteFileTemplate.ExistsMode existsMode) Specify anFtpRemoteFileTemplate.ExistsModeforexists(String)operation.protected booleanDetermine whetherSession.dirty()should be called in theRemoteFileTemplate.execute(SessionCallback)when an exception is thrown from the callback.Methods inherited from class org.springframework.integration.file.remote.RemoteFileTemplateafterPropertiesSet, append, append, execute, get, get, getDirectoryExpressionProcessor, getRemoteFileSeparator, getSession, getSessionFactory, getTemporaryFileSuffix, invoke, isUseTemporaryFileName, list, remove, rename, send, send, setAutoCreateDirectory, setBeanFactory, setCharset, setFileNameExpression, setFileNameGenerator, setRemoteDirectoryExpression, setRemoteFileSeparator, setTemporaryFileSuffix, setTemporaryRemoteDirectoryExpression, setUseTemporaryFileName
- 
Constructor Details- 
FtpRemoteFileTemplate
 
- 
- 
Method Details- 
executeWithClientDescription copied from interface:RemoteFileOperationsExecute the callback's doWithClient method after obtaining a session's client, providing access to low level methods. Reliably closes the session when the method exits.- Specified by:
- executeWithClientin interface- RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
- Overrides:
- executeWithClientin class- RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
- Type Parameters:
- T- The type returned by- ClientCallback.doWithClient(Object).
- C- The type of the underlying client object.
- Parameters:
- callback- the ClientCallback.
- Returns:
- The result of the callback method.
 
- 
setExistsModeSpecify anFtpRemoteFileTemplate.ExistsModeforexists(String)operation. Defaults toFtpRemoteFileTemplate.ExistsMode.STAT. When used internally by framework components for file operation, switched toFtpRemoteFileTemplate.ExistsMode.NLST.- Parameters:
- existsMode- the- FtpRemoteFileTemplate.ExistsModeto use.
- Since:
- 4.1.9
 
- 
doExecuteWithClientprotected <T> T doExecuteWithClient(ClientCallback<org.apache.commons.net.ftp.FTPClient, T> callback) 
- 
existsThis 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 interface- RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
- Overrides:
- existsin class- 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.
 
- 
shouldMarkSessionAsDirtyDescription copied from class:RemoteFileTemplateDetermine whetherSession.dirty()should be called in theRemoteFileTemplate.execute(SessionCallback)when an exception is thrown from the callback. By default, this method returnstrue. Remote file protocol extensions can override this method to provide a specific strategy against the thrown exception, e.g.file not founderror is not a signal that session is broken.- Overrides:
- shouldMarkSessionAsDirtyin class- RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
- Parameters:
- ex- the exception to check if- Sessionmust be marked as dirty.
- Returns:
- true if Session.dirty()should be called.
 
- 
isStatusDirtyCheck ifThrowable.getMessage()is treated as fatal.- Parameters:
- ftpErrorMessage- the value from- Throwable.getMessage().
- Returns:
- true if Throwable.getMessage()is treated as fatal.
- Since:
- 6.0.8
 
 
-