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

    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 void doChmod​(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations, java.lang.String path, int chmod)  
    protected void doInit()  
    protected org.apache.commons.net.ftp.FTPFile enhanceNameWithSubDirectory​(org.apache.commons.net.ftp.FTPFile file, java.lang.String directory)  
    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)  
    java.lang.String getComponentType()  
    protected java.lang.String getFilename​(org.apache.commons.net.ftp.FTPFile file)  
    protected java.lang.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 isChmodCapable()  
    protected boolean isDirectory​(org.apache.commons.net.ftp.FTPFile file)  
    protected boolean isLink​(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 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)  
    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.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)  
    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)  
    void setWorkingDirExpression​(org.springframework.expression.Expression workingDirExpression)
    Specify an Expression to evaluate FTP client working directory against request message.
    void setWorkingDirExpressionString​(java.lang.String workingDirExpression)
    Specify a SpEL Expression 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, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders

    Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler

    handleMessage, onComplete, onError, onNext, onSubscribe

    Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport

    buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, 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, 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 remoteDirectory expression is null assuming to use the workingDirectory 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, java.lang.String command)
      Construct an instance with the supplied remote file template and command ('ls', 'nlst', 'put' or 'mput').

      The remoteDirectory expression is null assuming to use the workingDirectory 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 an Expression to 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 SpEL Expression to 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:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.handler.MessageHandlerSupport
    • isDirectory

      protected boolean isDirectory​(org.apache.commons.net.ftp.FTPFile file)
      Specified by:
      isDirectory in class org.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 class org.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:
      getFilename in class org.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:
      getFilename in class org.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 class org.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:
      asFileInfoList in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
    • doInit

      protected void doInit()
      Overrides:
      doInit in class org.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:
      enhanceNameWithSubDirectory in class org.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:
      ls in class org.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:
      nlst in class org.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:
      get in class org.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:
      mGet in class org.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:
      rm in class org.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:
      mv in class org.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:
      put in class org.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:
      mPut in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
    • isChmodCapable

      public boolean isChmodCapable()
      Overrides:
      isChmodCapable in class org.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:
      doChmod in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>