Class SftpOutboundGateway

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.sshd.sftp.client.SftpClient.DirEntry>
org.springframework.integration.sftp.gateway.SftpOutboundGateway
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 SftpOutboundGateway extends org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
Outbound Gateway for performing remote file operations via SFTP.
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
    SftpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.sshd.sftp.client.SftpClient.DirEntry> 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.
    SftpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.sshd.sftp.client.SftpClient.DirEntry> remoteFileTemplate, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.sshd.sftp.client.SftpClient.DirEntry,?> messageSessionCallback)
    Construct an instance with the supplied remote file template and callback for performing operations on the session.
    SftpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.sshd.sftp.client.SftpClient.DirEntry> 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.
    SftpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.sshd.sftp.client.SftpClient.DirEntry> sessionFactory, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.sshd.sftp.client.SftpClient.DirEntry,?> 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 List<org.springframework.integration.file.remote.AbstractFileInfo<org.apache.sshd.sftp.client.SftpClient.DirEntry>>
    asFileInfoList(Collection<org.apache.sshd.sftp.client.SftpClient.DirEntry> files)
     
    protected void
    doChmod(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.sshd.sftp.client.SftpClient.DirEntry> remoteFileOperations, String path, int chmod)
     
    protected org.apache.sshd.sftp.client.SftpClient.DirEntry
    enhanceNameWithSubDirectory(org.apache.sshd.sftp.client.SftpClient.DirEntry file, String directory)
     
     
    protected String
    getFilename(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
     
    protected String
    getFilename(org.springframework.integration.file.remote.AbstractFileInfo<org.apache.sshd.sftp.client.SftpClient.DirEntry> file)
     
    protected long
    getModified(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
     
    boolean
     
    protected boolean
    isDirectory(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
     
    protected boolean
    isLink(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
     

    Methods inherited from class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway

    assertRemoteFileTemplateMutability, doInit, filterFile, filterFiles, filterMputFiles, get, getRemoteFilename, getRemoteFileTemplate, handleRequestMessage, ls, mGet, mPut, mv, nlst, purgeDots, purgeLinks, put, remoteFileTemplateExplicitlySet, rm, 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

    • SftpOutboundGateway

      public SftpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.sshd.sftp.client.SftpClient.DirEntry> sessionFactory, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.sshd.sftp.client.SftpClient.DirEntry,?> 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.
    • SftpOutboundGateway

      public SftpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.sshd.sftp.client.SftpClient.DirEntry> remoteFileTemplate, org.springframework.integration.file.remote.MessageSessionCallback<org.apache.sshd.sftp.client.SftpClient.DirEntry,?> 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.
    • SftpOutboundGateway

      public SftpOutboundGateway(org.springframework.integration.file.remote.session.SessionFactory<org.apache.sshd.sftp.client.SftpClient.DirEntry> 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.
    • SftpOutboundGateway

      public SftpOutboundGateway(org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.sshd.sftp.client.SftpClient.DirEntry> 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.
  • Method Details

    • isDirectory

      protected boolean isDirectory(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
      Specified by:
      isDirectory in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • isLink

      protected boolean isLink(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
      Specified by:
      isLink in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • getFilename

      protected String getFilename(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
      Specified by:
      getFilename in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • getFilename

      protected String getFilename(org.springframework.integration.file.remote.AbstractFileInfo<org.apache.sshd.sftp.client.SftpClient.DirEntry> file)
      Specified by:
      getFilename in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • asFileInfoList

      protected List<org.springframework.integration.file.remote.AbstractFileInfo<org.apache.sshd.sftp.client.SftpClient.DirEntry>> asFileInfoList(Collection<org.apache.sshd.sftp.client.SftpClient.DirEntry> files)
      Specified by:
      asFileInfoList in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • getModified

      protected long getModified(org.apache.sshd.sftp.client.SftpClient.DirEntry file)
      Specified by:
      getModified in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • enhanceNameWithSubDirectory

      protected org.apache.sshd.sftp.client.SftpClient.DirEntry enhanceNameWithSubDirectory(org.apache.sshd.sftp.client.SftpClient.DirEntry file, String directory)
      Specified by:
      enhanceNameWithSubDirectory in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.handler.MessageHandlerSupport
    • isChmodCapable

      public boolean isChmodCapable()
      Overrides:
      isChmodCapable in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>
    • doChmod

      protected void doChmod(org.springframework.integration.file.remote.RemoteFileOperations<org.apache.sshd.sftp.client.SftpClient.DirEntry> remoteFileOperations, String path, int chmod)
      Overrides:
      doChmod in class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<org.apache.sshd.sftp.client.SftpClient.DirEntry>