Class AbstractRemoteFileStreamingMessageSource<F>

java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<T>
org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource<InputStream>
org.springframework.integration.file.remote.AbstractRemoteFileStreamingMessageSource<F>
Type Parameters:
F - The target protocol file type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.integration.core.MessageSource<InputStream>, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationInboundManagement, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.integration.support.management.MessageSourceManagement

public abstract class AbstractRemoteFileStreamingMessageSource<F> extends org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource<InputStream> implements org.springframework.integration.support.management.ManageableLifecycle
A message source that produces a message with an InputStream payload referencing a remote file.
Since:
4.3
  • Nested Class Summary

    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.util.AbstractExpressionEvaluator

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<? extends F> template, Comparator<? extends F> comparator)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract List<AbstractFileInfo<F>>
     
    protected void
    Subclasses can override to perform initialization - called from InitializingBean.afterPropertiesSet().
    protected Object
    doReceive(int maxFetchSize)
     
    protected final void
     
    protected RemoteFileTemplate<? extends F>
     
    protected abstract boolean
    isDirectory(F file)
     
    boolean
     
    final void
     
    protected AbstractFileInfo<F>
     
    protected String
     
    protected void
    rollbackFromFileToListEnd(List<F> filteredFiles, F file)
     
    void
    setFileInfoJson(boolean fileInfoJson)
    Set to false to add the FileHeaders.REMOTE_FILE_INFO header to the raw FileInfo.
    void
    Set the filter to be applied to the remote files before transferring.
    void
    setRemoteDirectory(String remoteDirectory)
    Specify the full path to the remote directory.
    void
    setRemoteDirectoryExpression(org.springframework.expression.Expression remoteDirectoryExpression)
    Specify an expression that evaluates to the full path to the remote directory.
    void
    setRemoteFileSeparator(String remoteFileSeparator)
    Set the remote file separator; default '/'.
    void
    setStrictOrder(boolean strictOrder)
    The flag indicating if the local cache has to be fully clear on failure to preserve a processing order of remote files on the next AbstractMessageSource.receive() attempt.
    void
     
    void
     

    Methods inherited from class org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource

    doReceive, getMaxFetchSize, setMaxFetchSize

    Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource

    buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedType

    Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator

    afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs, isObserved, registerObservationRegistry

    Methods inherited from interface org.springframework.integration.core.MessageSource

    getIntegrationPatternType

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getComponentType
  • Constructor Details

    • AbstractRemoteFileStreamingMessageSource

      protected AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<? extends F> template, @Nullable Comparator<? extends F> comparator)
  • 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(org.springframework.expression.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
    • setStrictOrder

      public void setStrictOrder(boolean strictOrder)
      The flag indicating if the local cache has to be fully clear on failure to preserve a processing order of remote files on the next AbstractMessageSource.receive() attempt. By default, only the failed file will be re-fetched from remote directory, but only when local cache is already empty, essential out of order.
      Parameters:
      strictOrder - if cached files has to be cleared on failure.
      Since:
      5.5.17
    • getRemoteFileTemplate

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

      public final void onInit()
      Overrides:
      onInit in class org.springframework.integration.util.AbstractExpressionEvaluator
    • doInit

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

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
      Specified by:
      start in interface org.springframework.integration.support.management.ManageableLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
      Specified by:
      stop in interface org.springframework.integration.support.management.ManageableLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
      Specified by:
      isRunning in interface org.springframework.integration.support.management.ManageableLifecycle
    • doReceive

      protected Object doReceive(int maxFetchSize)
      Specified by:
      doReceive in class org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource<InputStream>
    • 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)