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
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler.RequestHandler
Nested 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
messagingTemplate
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionFtpOutboundGateway
(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 void
doChmod
(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations, String path, int chmod) protected void
doInit()
protected org.apache.commons.net.ftp.FTPFile
enhanceNameWithSubDirectory
(org.apache.commons.net.ftp.FTPFile file, String directory) 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) protected String
getFilename
(org.apache.commons.net.ftp.FTPFile file) protected String
getFilename
(org.springframework.integration.file.remote.AbstractFileInfo<org.apache.commons.net.ftp.FTPFile> file) protected long
getModified
(org.apache.commons.net.ftp.FTPFile file) boolean
protected boolean
isDirectory
(org.apache.commons.net.ftp.FTPFile file) protected boolean
isLink
(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 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) nlst
(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String dir) protected String
put
(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String subDirectory) protected boolean
rm
(org.springframework.messaging.Message<?> message, org.springframework.integration.file.remote.session.Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath) void
setWorkingDirExpression
(org.springframework.expression.Expression workingDirExpression) Specify anExpression
to evaluate FTP client working directory against request message.void
setWorkingDirExpressionString
(String workingDirExpression) Specify a SpELExpression
to 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, setUseTemporaryFileName
Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
Methods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConvention
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
Methods 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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface reactor.core.CoreSubscriber
currentContext
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods 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
remoteDirectory
expression isnull
assuming to use theworkingDirectory
from 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
remoteDirectory
expression isnull
assuming to use theworkingDirectory
from 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 anExpression
to evaluate FTP client working directory against request message.- Parameters:
workingDirExpression
- the expression to evaluate working directory- Since:
- 5.0
-
setWorkingDirExpressionString
Specify a SpELExpression
to evaluate FTP client working directory against request message.- Parameters:
workingDirExpression
- the SpEL expression to evaluate working directory- Since:
- 5.0
-
getComponentType
- Specified by:
getComponentType
in interfaceorg.springframework.integration.support.context.NamedComponent
- Overrides:
getComponentType
in classorg.springframework.integration.handler.MessageHandlerSupport
-
isDirectory
protected boolean isDirectory(org.apache.commons.net.ftp.FTPFile file) - Specified by:
isDirectory
in 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:
isLink
in classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
getFilename
- Specified by:
getFilename
in 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:
getFilename
in 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:
getModified
in 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:
asFileInfoList
in classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
doInit
protected void doInit()- Overrides:
doInit
in 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:
enhanceNameWithSubDirectory
in 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:
ls
in 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:
nlst
in 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:
get
in 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:
mGet
in 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:
rm
in 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:
mv
in 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:
put
in 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:
mPut
in classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-
isChmodCapable
public boolean isChmodCapable()- Overrides:
isChmodCapable
in 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:
doChmod
in classorg.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
-