Class FtpOutboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
org.springframework.integration.ftp.gateway.FtpOutboundGateway
- All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.core.Ordered,org.springframework.integration.context.ExpressionCapable,org.springframework.integration.context.Orderable,org.springframework.integration.core.MessageProducer,org.springframework.integration.handler.HeaderPropagationAware,org.springframework.integration.IntegrationPattern,org.springframework.integration.support.context.NamedComponent,org.springframework.integration.support.management.IntegrationManagement,org.springframework.integration.support.management.TrackableComponent,org.springframework.messaging.MessageHandler,reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>
public class FtpOutboundGateway
extends org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
Outbound Gateway for performing remote file operations via FTP/FTPS.
- Since:
- 2.1
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway
org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Command, org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Option -
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description FtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, java.lang.String command)Construct an instance with the supplied remote file template and command ('ls', 'nlst', 'put' or 'mput').FtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, java.lang.String command, java.lang.String expression)Construct an instance with the supplied remote file template, a command ('ls', 'get' etc), and an expression to determine the filename.FtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)Construct an instance with the supplied remote file template and callback for performing operations on the session.FtpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, java.lang.String command)Construct an instance with the supplied session factory and command ('ls', 'nlst', 'put' or 'mput').FtpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, java.lang.String command, java.lang.String expression)Construct an instance with the supplied session factory, a command ('ls', 'get' etc), and an expression to determine the filename.FtpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)Construct an instance using the provided session factory and callback for performing operations on the session. -
Method Summary
Modifier and Type Method Description protected java.util.List<org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile>>asFileInfoList(java.util.Collection<org.apache.commons.net.ftp.FTPFile> files)protected voiddoChmod(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations, java.lang.String path, int chmod)protected voiddoInit()protected org.apache.commons.net.ftp.FTPFileenhanceNameWithSubDirectory(org.apache.commons.net.ftp.FTPFile file, java.lang.String directory)protected java.io.Fileget(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteDir, java.lang.String remoteFilePath, java.lang.String remoteFilename, org.apache.commons.net.ftp.FTPFile fileInfoParam)java.lang.StringgetComponentType()protected java.lang.StringgetFilename(org.apache.commons.net.ftp.FTPFile file)protected java.lang.StringgetFilename(org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile> file)protected longgetModified(org.apache.commons.net.ftp.FTPFile file)booleanisChmodCapable()protected booleanisDirectory(org.apache.commons.net.ftp.FTPFile file)protected booleanisLink(org.apache.commons.net.ftp.FTPFile file)protected java.util.List<?>ls(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String dir)protected java.util.List<java.io.File>mGet(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteDirectory, java.lang.String remoteFilename)protected java.util.List<java.lang.String>mPut(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.io.File localDir)protected booleanmv(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteFilePath, java.lang.String remoteFileNewPath)protected java.util.List<java.lang.String>nlst(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String dir)protected java.lang.Stringput(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String subDirectory)protected booleanrm(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteFilePath)voidsetWorkingDirExpression(org.springframework.expression.Expression workingDirExpression)Specify anExpressionto evaluate FTP client working directory against request message.voidsetWorkingDirExpressionString(java.lang.String workingDirExpression)Specify a SpELExpressionto evaluate FTP client working directory against request message.Methods inherited from class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway
assertRemoteFileTemplateMutability, filterFiles, filterMputFiles, getRemoteFilename, getRemoteFileTemplate, handleRequestMessage, purgeDots, purgeLinks, remoteFileTemplateExplicitlySet, setAutoCreateDirectory, setAutoCreateLocalDirectory, setCharset, setChmod, setChmodOctal, setFileExistsMode, setFileNameExpression, setFileNameGenerator, setFilter, setLocalDirectory, setLocalDirectoryExpression, setLocalDirectoryExpressionString, setLocalFilenameGeneratorExpression, setLocalFilenameGeneratorExpressionString, setMputFilter, setOption, setOptions, setRemoteDirectoryExpression, setRemoteFileSeparator, setRenameExpression, setRenameExpressionString, setTemporaryFileSuffix, setTemporaryRemoteDirectoryExpression, setUseTemporaryFileNameMethods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribeMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
FtpOutboundGateway
public FtpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)Construct an instance using the provided session factory and callback for performing operations on the session.- Parameters:
sessionFactory- the session factory.messageSessionCallback- the callback.
-
FtpOutboundGateway
public FtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)Construct an instance with the supplied remote file template and callback for performing operations on the session.- Parameters:
remoteFileTemplate- the remote file template.messageSessionCallback- the callback.
-
FtpOutboundGateway
public FtpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, java.lang.String command, java.lang.String expression)Construct an instance with the supplied session factory, a command ('ls', 'get' etc), and an expression to determine the filename.- Parameters:
sessionFactory- the session factory.command- the command.expression- the filename expression.
-
FtpOutboundGateway
public FtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, java.lang.String command, java.lang.String expression)Construct an instance with the supplied remote file template, a command ('ls', 'get' etc), and an expression to determine the filename.- Parameters:
remoteFileTemplate- the remote file template.command- the command.expression- the filename expression.
-
FtpOutboundGateway
public FtpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, java.lang.String command)Construct an instance with the supplied session factory and command ('ls', 'nlst', 'put' or 'mput').The
remoteDirectoryexpression isnullassuming to use theworkingDirectoryfrom the FTP Client.- Parameters:
sessionFactory- the session factory.command- the command.- Since:
- 4.3
-
FtpOutboundGateway
public FtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, java.lang.String command)Construct an instance with the supplied remote file template and command ('ls', 'nlst', 'put' or 'mput').The
remoteDirectoryexpression isnullassuming to use theworkingDirectoryfrom the FTP Client.- Parameters:
remoteFileTemplate- the remote file template.command- the command.- Since:
- 4.3
-
-
Method Details
-
setWorkingDirExpression
public void setWorkingDirExpression(org.springframework.expression.Expression workingDirExpression)Specify anExpressionto evaluate FTP client working directory against request message.- Parameters:
workingDirExpression- the expression to evaluate working directory- Since:
- 5.0
-
setWorkingDirExpressionString
public void setWorkingDirExpressionString(java.lang.String workingDirExpression)Specify a SpELExpressionto evaluate FTP client working directory against request message.- Parameters:
workingDirExpression- the SpEL expression to evaluate working directory- Since:
- 5.0
-
getComponentType
public java.lang.String getComponentType()- Specified by:
getComponentTypein interfaceorg.springframework.integration.support.context.NamedComponent- Overrides:
getComponentTypein classorg.springframework.integration.handler.MessageHandlerSupport
-
isDirectory
protected boolean isDirectory(org.apache.commons.net.ftp.FTPFile file)- Specified by:
isDirectoryin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
isLink
protected boolean isLink(org.apache.commons.net.ftp.FTPFile file)- Specified by:
isLinkin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
getFilename
protected java.lang.String getFilename(org.apache.commons.net.ftp.FTPFile file)- Specified by:
getFilenamein classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
getFilename
protected java.lang.String getFilename(org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile> file)- Specified by:
getFilenamein classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
getModified
protected long getModified(org.apache.commons.net.ftp.FTPFile file)- Specified by:
getModifiedin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
asFileInfoList
protected java.util.List<org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile>> asFileInfoList(java.util.Collection<org.apache.commons.net.ftp.FTPFile> files)- Specified by:
asFileInfoListin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
doInit
protected void doInit()- Overrides:
doInitin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
enhanceNameWithSubDirectory
protected org.apache.commons.net.ftp.FTPFile enhanceNameWithSubDirectory(org.apache.commons.net.ftp.FTPFile file, java.lang.String directory)- Specified by:
enhanceNameWithSubDirectoryin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
ls
protected java.util.List<?> ls(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String dir) throws java.io.IOException- Overrides:
lsin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
java.io.IOException
-
nlst
protected java.util.List<java.lang.String> nlst(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String dir) throws java.io.IOException- Overrides:
nlstin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
java.io.IOException
-
get
protected java.io.File get(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteDir, java.lang.String remoteFilePath, java.lang.String remoteFilename, org.apache.commons.net.ftp.FTPFile fileInfoParam) throws java.io.IOException- Overrides:
getin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
java.io.IOException
-
mGet
protected java.util.List<java.io.File> mGet(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteDirectory, java.lang.String remoteFilename) throws java.io.IOException- Overrides:
mGetin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
java.io.IOException
-
rm
protected boolean rm(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteFilePath) throws java.io.IOException- Overrides:
rmin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
java.io.IOException
-
mv
protected boolean mv(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String remoteFilePath, java.lang.String remoteFileNewPath) throws java.io.IOException- Overrides:
mvin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
java.io.IOException
-
put
protected java.lang.String put(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.lang.String subDirectory)- Overrides:
putin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
mPut
protected java.util.List<java.lang.String> mPut(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, java.io.File localDir)- Overrides:
mPutin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
isChmodCapable
public boolean isChmodCapable()- Overrides:
isChmodCapablein classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
doChmod
protected void doChmod(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations, java.lang.String path, int chmod)- Overrides:
doChmodin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-