Class AbstractRemoteFileStreamingMessageSource<F>

Type Parameters:
F - The target protocol file type.
All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, Lifecycle, MessageSource<InputStream>, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement, ManageableLifecycle, MessageSourceManagement
Direct Known Subclasses:
FtpStreamingMessageSource, SftpStreamingMessageSource, SmbStreamingMessageSource

public abstract class AbstractRemoteFileStreamingMessageSource<F> extends AbstractFetchLimitingMessageSource<InputStream> implements ManageableLifecycle
A message source that produces a message with an InputStream payload referencing a remote file.
Since:
4.3
Author:
Gary Russell, Artem Bilan, Lukas Gemela, Trung Pham
  • Constructor Details

  • Method Details

    • setRemoteDirectory

      public void setRemoteDirectory(String remoteDirectory)
      Specify the full path to the remote directory.
      Parameters:
      remoteDirectory - The remote directory.
    • setRemoteDirectoryExpression

      public void setRemoteDirectoryExpression(Expression remoteDirectoryExpression)
      Specify an expression that evaluates to the full path to the remote directory.
      Parameters:
      remoteDirectoryExpression - The remote directory expression.
    • setRemoteFileSeparator

      public void setRemoteFileSeparator(String remoteFileSeparator)
      Set the remote file separator; default '/'.
      Parameters:
      remoteFileSeparator - the remote file separator.
    • setFilter

      public void setFilter(FileListFilter<F> filter)
      Set the filter to be applied to the remote files before transferring.
      Parameters:
      filter - the file list filter.
    • doSetFilter

      protected final void doSetFilter(FileListFilter<F> filterToSet)
    • setFileInfoJson

      public void setFileInfoJson(boolean fileInfoJson)
      Set to false to add the FileHeaders.REMOTE_FILE_INFO header to the raw FileInfo. Default is true meaning that common file information properties are provided in that header as JSON.
      Parameters:
      fileInfoJson - false to set the raw object.
      Since:
      5.0
    • getRemoteFileTemplate

      protected RemoteFileTemplate<? extends F> getRemoteFileTemplate()
    • onInit

      public final void onInit()
      Overrides:
      onInit in class AbstractExpressionEvaluator
    • doInit

      protected void doInit()
      Subclasses can override to perform initialization - called from InitializingBean.afterPropertiesSet().
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
      Specified by:
      start in interface ManageableLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
      Specified by:
      stop in interface ManageableLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
      Specified by:
      isRunning in interface ManageableLifecycle
    • doReceive

      protected Object doReceive(int maxFetchSize)
      Description copied from class: AbstractFetchLimitingMessageSource
      Subclasses must implement this method. Typically the returned value will be the payload of type T, but the returned value may also be a Message instance whose payload is of type T.
      Specified by:
      doReceive in class AbstractFetchLimitingMessageSource<InputStream>
      Parameters:
      maxFetchSize - the maximum number of messages to fetch if a fetch is necessary.
      Returns:
      The value returned.
    • poll

      protected AbstractFileInfo<F> poll()
    • remotePath

      protected String remotePath(AbstractFileInfo<F> file)
    • rollbackFromFileToListEnd

      protected void rollbackFromFileToListEnd(List<F> filteredFiles, F file)
    • asFileInfoList

      protected abstract List<AbstractFileInfo<F>> asFileInfoList(Collection<F> files)
    • isDirectory

      protected abstract boolean isDirectory(F file)