Class RemoteFileInboundChannelAdapterSpec<F,​S extends RemoteFileInboundChannelAdapterSpec<F,​S,​MS>,​MS extends AbstractInboundFileSynchronizingMessageSource<F>>

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,​H>
org.springframework.integration.dsl.MessageSourceSpec<S,​MS>
org.springframework.integration.file.dsl.RemoteFileInboundChannelAdapterSpec<F,​S,​MS>
Type Parameters:
F - the target file type.
S - the target RemoteFileInboundChannelAdapterSpec implementation type.
MS - the target AbstractInboundFileSynchronizingMessageSource implementation type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<MS>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.dsl.ComponentsRegistration

public abstract class RemoteFileInboundChannelAdapterSpec<F,​S extends RemoteFileInboundChannelAdapterSpec<F,​S,​MS>,​MS extends AbstractInboundFileSynchronizingMessageSource<F>>
extends org.springframework.integration.dsl.MessageSourceSpec<S,​MS>
implements org.springframework.integration.dsl.ComponentsRegistration
Since:
5.0
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected AbstractInboundFileSynchronizer<F> synchronizer  

    Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    PARSER, target

    Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    logger

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected RemoteFileInboundChannelAdapterSpec​(AbstractInboundFileSynchronizer<F> synchronizer)  
  • Method Summary

    Modifier and Type Method Description
    S autoCreateLocalDirectory​(boolean autoCreateLocalDirectory)
    Configure whether the local directory should be created by the adapter.
    S deleteRemoteFiles​(boolean deleteRemoteFiles)
    Set to true to enable deletion of remote files after successful transfer.
    S filter​(FileListFilter<F> filter)
    Configure a FileListFilter to be applied to the remote files before copying them.
    S filterExpression​(java.lang.String expression)
    S filterFunction​(java.util.function.Function<F,​java.lang.Boolean> filterFunction)
    java.util.Map<java.lang.Object,​java.lang.String> getComponentsToRegister()  
    S localDirectory​(java.io.File localDirectory)
    Configure the local directory to copy files to.
    S localFilename​(java.util.function.Function<java.lang.String,​java.lang.String> localFilenameFunction)
    Configure a Function to be invoked to generate the local file name; argument passed to the apply method is the remote file name.
    S localFilenameExpression​(java.lang.String localFilenameExpression)
    Configure a SpEL expression to generate the local file name; the root object for the evaluation is the remote file name.
    S localFilenameExpression​(org.springframework.expression.Expression localFilenameExpression)
    Configure a SpEL expression to generate the local file name; the root object for the evaluation is the remote file name.
    S localFilter​(FileListFilter<java.io.File> localFileListFilter)
    A FileListFilter used to determine which files will generate messages after they have been synchronized.
    S maxFetchSize​(int maxFetchSize)
    Specify the maximum number of remote files that will be fetched on each fetch attempt.
    S metadataStorePrefix​(java.lang.String metadataStorePrefix)
    Configure a prefix for remote files metadata keys.
    abstract S patternFilter​(java.lang.String pattern)
    Configure a simple pattern filter (e.g.
    S preserveTimestamp​(boolean preserveTimestamp)
    Set to true to enable the preservation of the remote file timestamp when transferring.
    abstract S regexFilter​(java.lang.String regex)
    Configure a regex pattern filter (e.g.
    S remoteComparator​(java.util.Comparator<F> remoteComparator)
    Set a comparator to sort the retrieved list of F (the Type that represents the remote file) prior to applying filters and max fetch size.
    S remoteDirectory​(java.lang.String remoteDirectory)
    Specify the full path to the remote directory.
    S remoteDirectoryExpression​(org.springframework.expression.Expression remoteDirectoryExpression)
    Specify an expression that evaluates to the full path to the remote directory.
    S remoteFileMetadataStore​(org.springframework.integration.metadata.MetadataStore remoteFileMetadataStore)
    Configure a MetadataStore for remote files metadata.
    S remoteFileSeparator​(java.lang.String remoteFileSeparator)
    Configure the file name path separator used by the remote system.
    S scanner​(DirectoryScanner scanner)
    Configure a scanner to use for the file system scan after transfer.
    S temporaryFileSuffix​(java.lang.String temporaryFileSuffix)
    Configure a suffix to temporarily apply to the local filename; when copied the file is renamed to its final name.

    Methods inherited from class org.springframework.integration.dsl.MessageSourceSpec

    messageHeaders

    Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    _this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • autoCreateLocalDirectory

      public S autoCreateLocalDirectory​(boolean autoCreateLocalDirectory)
      Configure whether the local directory should be created by the adapter.
      Parameters:
      autoCreateLocalDirectory - the autoCreateLocalDirectory
      Returns:
      the spec.
    • localDirectory

      public S localDirectory​(java.io.File localDirectory)
      Configure the local directory to copy files to.
      Parameters:
      localDirectory - the localDirectory.
      Returns:
      the spec.
    • localFilter

      public S localFilter​(FileListFilter<java.io.File> localFileListFilter)
      A FileListFilter used to determine which files will generate messages after they have been synchronized.
      Parameters:
      localFileListFilter - the localFileListFilter.
      Returns:
      the spec.
      See Also:
      AbstractInboundFileSynchronizingMessageSource.setLocalFilter(FileListFilter)
    • remoteFileSeparator

      public S remoteFileSeparator​(java.lang.String remoteFileSeparator)
      Configure the file name path separator used by the remote system. Defaults to '/'.
      Parameters:
      remoteFileSeparator - the remoteFileSeparator.
      Returns:
      the spec.
    • localFilenameExpression

      public S localFilenameExpression​(java.lang.String localFilenameExpression)
      Configure a SpEL expression to generate the local file name; the root object for the evaluation is the remote file name.
      Parameters:
      localFilenameExpression - the localFilenameExpression.
      Returns:
      the spec.
    • localFilename

      public S localFilename​(java.util.function.Function<java.lang.String,​java.lang.String> localFilenameFunction)
      Configure a Function to be invoked to generate the local file name; argument passed to the apply method is the remote file name.
      Parameters:
      localFilenameFunction - the localFilenameFunction.
      Returns:
      the spec.
      See Also:
      FunctionExpression
    • localFilenameExpression

      public S localFilenameExpression​(org.springframework.expression.Expression localFilenameExpression)
      Configure a SpEL expression to generate the local file name; the root object for the evaluation is the remote file name.
      Parameters:
      localFilenameExpression - the localFilenameExpression.
      Returns:
      the spec.
    • temporaryFileSuffix

      public S temporaryFileSuffix​(java.lang.String temporaryFileSuffix)
      Configure a suffix to temporarily apply to the local filename; when copied the file is renamed to its final name. Default: '.writing'.
      Parameters:
      temporaryFileSuffix - the temporaryFileSuffix.
      Returns:
      the spec.
    • remoteDirectory

      public S remoteDirectory​(java.lang.String remoteDirectory)
      Specify the full path to the remote directory.
      Parameters:
      remoteDirectory - the remoteDirectory.
      Returns:
      the spec.
      See Also:
      AbstractInboundFileSynchronizer.setRemoteDirectory(String)
    • remoteDirectoryExpression

      public S remoteDirectoryExpression​(org.springframework.expression.Expression remoteDirectoryExpression)
      Specify an expression that evaluates to the full path to the remote directory.
      Parameters:
      remoteDirectoryExpression - The remote directory expression.
      Returns:
      the spec.
    • filter

      public S filter​(FileListFilter<F> filter)
      Configure a FileListFilter to be applied to the remote files before copying them.
      Parameters:
      filter - the filter.
      Returns:
      the spec.
    • filterExpression

      public S filterExpression​(java.lang.String expression)
      Parameters:
      expression - the SpEL expression for files filtering.
      Returns:
      the spec.
      See Also:
      FileReadingMessageSource.setFilter(FileListFilter), ExpressionFileListFilter
    • filterFunction

      public S filterFunction​(java.util.function.Function<F,​java.lang.Boolean> filterFunction)
      Parameters:
      filterFunction - the Function for files filtering.
      Returns:
      the spec.
      See Also:
      FileReadingMessageSource.setFilter(FileListFilter), ExpressionFileListFilter
    • patternFilter

      public abstract S patternFilter​(java.lang.String pattern)
      Configure a simple pattern filter (e.g. '*.txt').
      Parameters:
      pattern - the pattern.
      Returns:
      the spec.
      See Also:
      filter(FileListFilter)
    • regexFilter

      public abstract S regexFilter​(java.lang.String regex)
      Configure a regex pattern filter (e.g. '[0-9].*.txt').
      Parameters:
      regex - the regex.
      Returns:
      the spec.
      See Also:
      filter(FileListFilter)
    • deleteRemoteFiles

      public S deleteRemoteFiles​(boolean deleteRemoteFiles)
      Set to true to enable deletion of remote files after successful transfer.
      Parameters:
      deleteRemoteFiles - true to delete.
      Returns:
      the spec.
    • preserveTimestamp

      public S preserveTimestamp​(boolean preserveTimestamp)
      Set to true to enable the preservation of the remote file timestamp when transferring.
      Parameters:
      preserveTimestamp - true to preserve.
      Returns:
      the spec.
    • maxFetchSize

      public S maxFetchSize​(int maxFetchSize)
      Specify the maximum number of remote files that will be fetched on each fetch attempt. A small number is recommended when multiple application instances are running, to avoid one instance from "grabbing" all the files.
      Parameters:
      maxFetchSize - the max fetch size.
      Returns:
      the spec.
      See Also:
      MessageSourceManagement.setMaxFetchSize(int)
    • remoteFileMetadataStore

      public S remoteFileMetadataStore​(org.springframework.integration.metadata.MetadataStore remoteFileMetadataStore)
      Configure a MetadataStore for remote files metadata.
      Parameters:
      remoteFileMetadataStore - the MetadataStore to use.
      Returns:
      the spec.
      Since:
      5.2
      See Also:
      AbstractInboundFileSynchronizer.setRemoteFileMetadataStore(MetadataStore)
    • metadataStorePrefix

      public S metadataStorePrefix​(java.lang.String metadataStorePrefix)
      Configure a prefix for remote files metadata keys.
      Parameters:
      metadataStorePrefix - the metadata key prefix to use.
      Returns:
      the spec.
      Since:
      5.2
      See Also:
      remoteFileMetadataStore(org.springframework.integration.metadata.MetadataStore)
    • scanner

      public S scanner​(DirectoryScanner scanner)
      Configure a scanner to use for the file system scan after transfer.
      Parameters:
      scanner - the scanner.
      Returns:
      the spec.
      Since:
      5.2.4
    • remoteComparator

      public S remoteComparator​(java.util.Comparator<F> remoteComparator)
      Set a comparator to sort the retrieved list of F (the Type that represents the remote file) prior to applying filters and max fetch size.
      Parameters:
      remoteComparator - the Comparator for remote files.
      Returns:
      the spec.
      Since:
      5.2.9
    • getComponentsToRegister

      public java.util.Map<java.lang.Object,​java.lang.String> getComponentsToRegister()
      Specified by:
      getComponentsToRegister in interface org.springframework.integration.dsl.ComponentsRegistration