Class AbstractPersistentAcceptOnceFileListFilter<F>
java.lang.Object
org.springframework.integration.file.filters.AbstractFileListFilter<F>
org.springframework.integration.file.filters.AbstractDirectoryAwareFileListFilter<F>
org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter<F>
- Type Parameters:
F- the file type.
- All Implemented Interfaces:
Closeable,AutoCloseable,FileListFilter<F>,ResettableFileListFilter<F>,ReversibleFileListFilter<F>
- Direct Known Subclasses:
FileSystemPersistentAcceptOnceFileListFilter,FtpPersistentAcceptOnceFileListFilter,SftpPersistentAcceptOnceFileListFilter,SmbPersistentAcceptOnceFileListFilter
public abstract class AbstractPersistentAcceptOnceFileListFilter<F>
extends AbstractDirectoryAwareFileListFilter<F>
implements ReversibleFileListFilter<F>, ResettableFileListFilter<F>, Closeable
Stores "seen" files in a MetadataStore to survive application restarts.
The default key is 'prefix' plus the absolute file name; value is the timestamp of the file.
Files are deemed as already 'seen' if they exist in the store and have the
same modified time as the current file.
- Since:
- 3.0
- Author:
- Gary Russell, Artem Bilan
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Flushableprotected booleanprotected final Stringprotected final ConcurrentMetadataStore -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanSubclasses must implement this method.protected StringThe default key is theprefixplus the full filename.voidclose()protected abstract Stringprotected booleanfileStillExists(F file) Check if the file still exists; default implementation returns true.protected voidFlush the store if it's aFlushableandflushOnUpdateis true.protected booleanisDirectory(F file) Subclasses must implement this method to indicate whether the file is a directory or not.protected booleanOverride this method if you wish to use something other than the modified timestamp to determine equality.protected abstract longbooleanRemove the specified file from the filter, so it will pass on the next attempt.voidIndicate that not all files previously passed by this filter (inFileListFilter.filterFiles(Object[])have been processed; the file must be in the list of files; it, and all files after it, will be considered to have not been processed and will be considered next time.voidsetFlushOnUpdate(boolean flushOnUpdate) Determine whether the metadataStore should be flushed on each update (ifFlushable).Methods inherited from class org.springframework.integration.file.filters.AbstractDirectoryAwareFileListFilter
alwaysAccept, isForRecursion, setAlwaysAcceptDirectories, setForRecursionMethods inherited from class org.springframework.integration.file.filters.AbstractFileListFilter
filterFiles, supportsSingleFileFilteringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.file.filters.FileListFilter
filterFiles, isForRecursion, supportsSingleFileFiltering
-
Field Details
-
store
-
prefix
-
flushableStore
-
flushOnUpdate
protected boolean flushOnUpdate
-
-
Constructor Details
-
AbstractPersistentAcceptOnceFileListFilter
-
-
Method Details
-
setFlushOnUpdate
public void setFlushOnUpdate(boolean flushOnUpdate) Determine whether the metadataStore should be flushed on each update (ifFlushable).- Parameters:
flushOnUpdate- true to flush.- Since:
- 4.1.5
-
accept
Description copied from class:AbstractFileListFilterSubclasses must implement this method.- Specified by:
acceptin interfaceFileListFilter<F>- Specified by:
acceptin classAbstractFileListFilter<F>- Parameters:
file- The file.- Returns:
- true if the file passes the filter.
- See Also:
-
fileStillExists
Check if the file still exists; default implementation returns true.- Parameters:
file- the file.- Returns:
- true if the filter should return true.
- Since:
- 4.3.19
-
rollback
Indicate that not all files previously passed by this filter (inFileListFilter.filterFiles(Object[])have been processed; the file must be in the list of files; it, and all files after it, will be considered to have not been processed and will be considered next time.- Specified by:
rollbackin interfaceReversibleFileListFilter<F>- Parameters:
file- the file which failed.files- the list of files that were returned byFileListFilter.filterFiles(Object[]).- Since:
- 4.0.4
-
remove
Description copied from interface:ResettableFileListFilterRemove the specified file from the filter, so it will pass on the next attempt.- Specified by:
removein interfaceResettableFileListFilter<F>- Parameters:
fileToRemove- the element to remove.- Returns:
- true if the file was removed as a result of this call.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isEqual
Override this method if you wish to use something other than the modified timestamp to determine equality.- Parameters:
file- The file.value- The current value for the key in the store.- Returns:
- true if equal.
-
buildKey
The default key is theprefixplus the full filename.- Parameters:
file- The file.- Returns:
- The key.
-
flushIfNeeded
protected void flushIfNeeded()Flush the store if it's aFlushableandflushOnUpdateis true.- Since:
- 1.4.5
-
isDirectory
Description copied from class:AbstractDirectoryAwareFileListFilterSubclasses must implement this method to indicate whether the file is a directory or not.- Specified by:
isDirectoryin classAbstractDirectoryAwareFileListFilter<F>- Parameters:
file- the file.- Returns:
- true if it's a directory.
-
modified
-
fileName
-