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.OptionNested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionFtpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, 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, String command, 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, 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, String command, 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 TypeMethodDescriptionprotected List<org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile>>asFileInfoList(Collection<org.apache.commons.net.ftp.FTPFile> files) protected voiddoChmod(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations, String path, int chmod) protected voiddoInit()protected org.apache.commons.net.ftp.FTPFileenhanceNameWithSubDirectory(org.apache.commons.net.ftp.FTPFile file, String directory) protected Fileget(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteDir, String remoteFilePath, String remoteFilename, org.apache.commons.net.ftp.FTPFile fileInfoParam) protected StringgetFilename(org.apache.commons.net.ftp.FTPFile file) protected StringgetFilename(org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile> file) protected longgetModified(org.apache.commons.net.ftp.FTPFile file) booleanprotected booleanisDirectory(org.apache.commons.net.ftp.FTPFile file) protected booleanisLink(org.apache.commons.net.ftp.FTPFile file) protected List<?>ls(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String dir) mGet(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteDirectory, String remoteFilename) mPut(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, File localDir) protected booleanmv(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath, String remoteFileNewPath) nlst(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String dir) protected Stringput(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String subDirectory) protected booleanrm(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath) voidsetWorkingDirExpression(org.springframework.expression.Expression workingDirExpression) Specify anExpressionto evaluate FTP client working directory against request message.voidsetWorkingDirExpressionString(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, filterFile, 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, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, registerObservationRegistry, 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, waitMethods inherited from interface reactor.core.CoreSubscriber
currentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
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, String command, 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, String command, 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, 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, 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
Specify a SpELExpressionto evaluate FTP client working directory against request message.- Parameters:
workingDirExpression- the SpEL expression to evaluate working directory- Since:
- 5.0
-
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
- Specified by:
getFilenamein classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
getFilename
protected 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 List<org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile>> asFileInfoList(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, String directory) - Specified by:
enhanceNameWithSubDirectoryin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
ls
protected List<?> ls(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String dir) throws IOException - Overrides:
lsin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
IOException
-
nlst
protected List<String> nlst(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String dir) throws IOException - Overrides:
nlstin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
IOException
-
get
protected File get(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteDir, String remoteFilePath, String remoteFilename, org.apache.commons.net.ftp.FTPFile fileInfoParam) throws IOException - Overrides:
getin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
IOException
-
mGet
protected List<File> mGet(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteDirectory, String remoteFilename) throws IOException - Overrides:
mGetin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
IOException
-
rm
protected boolean rm(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath) throws IOException - Overrides:
rmin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
IOException
-
mv
protected boolean mv(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath, String remoteFileNewPath) throws IOException - Overrides:
mvin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>- Throws:
IOException
-
put
protected String put(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String subDirectory) - Overrides:
putin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
mPut
protected List<String> mPut(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, 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, String path, int chmod) - Overrides:
doChmodin classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-