Class FsConsumerImpl

    • Field Detail

      • fileFilter

        protected transient java.io.FileFilter fileFilter
      • fsWorker

        protected transient FsWorker fsWorker
    • Constructor Detail

      • FsConsumerImpl

        public FsConsumerImpl()
    • Method Detail

      • baseDirUrl

        protected java.lang.String baseDirUrl()
      • filterExpression

        protected java.lang.String filterExpression()
      • processMessages

        protected int processMessages()

        If reacquire-lock-between-messages is set to true, this.reaquireLock is called after each message has been processed. This gives other Threads (e.g. something stopping the adapter) the opportunity to obtain the lock without waiting for all messages to be processed.

        Specified by:
        processMessages in class AdaptrisPollingConsumer
        See Also:
        AdaptrisPollingConsumer.processMessages()
      • checkModified

        protected boolean checkModified​(java.io.File f)
                                 throws java.io.IOException
        Does this file match the quiet period directive.
        Parameters:
        f - the file.
        Returns:
        whether the file has been modified or not.
        Throws:
        java.io.IOException
      • isFileAccessible

        protected boolean isFileAccessible​(java.io.File f)
        Could we read and process this file.
        Parameters:
        f - the file.
        Returns:
        true, if the file is a file, can be read, and can be written to (for renaming purposes).
      • processFile

        protected abstract int processFile​(java.io.File f)
                                    throws CoreException
        Attempt to process this file which might be a directory.
        Parameters:
        f - the File
        Returns:
        the number of files processed.
        Throws:
        CoreException - wrapping any other Exception.
      • verifyDirectory

        protected java.io.File verifyDirectory()
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • shouldCreateDirs

        public boolean shouldCreateDirs()
      • logAllExceptions

        public boolean logAllExceptions()
      • consumeLocationKey

        public java.lang.String consumeLocationKey()
        Provides the metadata key '"fsConsumeDir"' that contains the directory (if not null) where the file was read from.
        Returns:
        the metadata key;
        Since:
        3.9.0
      • withBaseDirectoryUrl

        public <T extends FsConsumerImpl> T withBaseDirectoryUrl​(java.lang.String s)
      • withFilterExpression

        public <T extends FsConsumerImpl> T withFilterExpression​(java.lang.String s)
      • getFileFilterImp

        public java.lang.String getFileFilterImp()
        Set the filename filter implementation that will be used for filtering files.

        The file filter implementation that is used in conjunction with the getFilterExpression(), if not specified, then the default is org.apache.commons.io.filefilter.RegexFileFilter which uses the java.util regular expressions to perform filtering

        The expression that is used to filter messages is derived from getFilterExpression().

        See Also:
        getFilterExpression()
      • setFileFilterImp

        public void setFileFilterImp​(java.lang.String fileFilterImp)
        Set the filename filter implementation that will be used for filtering files.

        The file filter implementation that is used in conjunction with the getFilterExpression(), if not specified, then the default is org.apache.commons.io.filefilter.RegexFileFilter which uses the java.util regular expressions to perform filtering

        The expression that is used to filter messages is derived from getFilterExpression().

        See Also:
        getFilterExpression()
      • getCreateDirs

        public java.lang.Boolean getCreateDirs()
        Create missing directories when trying to poll

        this defaults to false because we consider it a dangerous thing to do especially if you have bad configuration. The last thing we want is for you to accuse interlok of creating random directories.

      • setCreateDirs

        public void setCreateDirs​(java.lang.Boolean createDirs)
        Create missing directories when trying to poll

        this defaults to false because we consider it a dangerous thing to do especially if you have bad configuration. The last thing we want is for you to accuse interlok of creating random directories.

      • getLogAllExceptions

        public java.lang.Boolean getLogAllExceptions()
        Log all the stack traces or not.
      • setLogAllExceptions

        public void setLogAllExceptions​(java.lang.Boolean logAllExceptions)
        Log all the stack traces or not.
      • getQuietInterval

        public TimeInterval getQuietInterval()
        Specify how old a file must be before a file is deemed safe to be processed.

        The purpose of this is to delay processing of files that may be currently being written to by another process. On certain platforms (e.g. most Unix) it is still possible to obtain an exclusive lock on the file even though it is being written to by another process.

        An alternative to specifying a last-modified is to specify CompositeFileFilter as the filter implementation and then a combination of OlderThan along with your actual filter-implementation.

        Note: your mileage may vary when using this setting. The only surefire way is for the triggering application to write the file to a staging area and use an atomic operation (such as move) to move the file into the target directory.

        See Also:
        File.lastModified(), CompositeFileFilter, setFileFilterImp(String)
      • setQuietInterval

        public void setQuietInterval​(TimeInterval quietInterval)
        Specify how old a file must be before a file is deemed safe to be processed.

        The purpose of this is to delay processing of files that may be currently being written to by another process. On certain platforms (e.g. most Unix) it is still possible to obtain an exclusive lock on the file even though it is being written to by another process.

        An alternative to specifying a last-modified is to specify CompositeFileFilter as the filter implementation and then a combination of OlderThan along with your actual filter-implementation.

        Note: your mileage may vary when using this setting. The only surefire way is for the triggering application to write the file to a staging area and use an atomic operation (such as move) to move the file into the target directory.

        See Also:
        File.lastModified(), CompositeFileFilter, setFileFilterImp(String)
      • getFileSorter

        @NonNull
        public @NonNull FileSorter getFileSorter()
        Set the filesorter implementation to use.

        The file sorter is responsible for sorting the list of files that is collected for processing. The sorted list is then processed.

      • setFileSorter

        public void setFileSorter​(@NonNull
                                  @NonNull FileSorter fileSorter)
        Set the filesorter implementation to use.

        The file sorter is responsible for sorting the list of files that is collected for processing. The sorted list is then processed.

      • getBaseDirectoryUrl

        public java.lang.String getBaseDirectoryUrl()
        The base directory specified as a URL.
      • setBaseDirectoryUrl

        public void setBaseDirectoryUrl​(java.lang.String baseDirectoryUrl)
        The base directory specified as a URL.
      • getFilterExpression

        public java.lang.String getFilterExpression()
        The filter expression to use when listing files.

        If not specified then will default in a file filter that matches all files.

      • setFilterExpression

        public void setFilterExpression​(java.lang.String filterExpression)
        The filter expression to use when listing files.

        If not specified then will default in a file filter that matches all files.