Class AcceptOnceFileListFilter<F>
java.lang.Object
org.springframework.integration.file.filters.AbstractFileListFilter<F>
org.springframework.integration.file.filters.AcceptOnceFileListFilter<F>
- Type Parameters:
F
- the file type.
- All Implemented Interfaces:
FileListFilter<F>
,ResettableFileListFilter<F>
,ReversibleFileListFilter<F>
public class AcceptOnceFileListFilter<F>
extends AbstractFileListFilter<F>
implements ReversibleFileListFilter<F>, ResettableFileListFilter<F>
FileListFilter
that passes files only one time. This can
conveniently be used to prevent duplication of files, as is done in
FileReadingMessageSource
.
This implementation is thread safe.
- Author:
- Iwein Fuld, Josh Long, Gary Russell, Artem Bilan, Christian Tzolov, Ngoc Nhan
-
Constructor Summary
ConstructorDescriptionCreates an AcceptOnceFileListFilter based on an unbounded queue.AcceptOnceFileListFilter
(int maxCapacity) Creates an AcceptOnceFileListFilter that is based on a bounded queue. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Subclasses must implement this method.boolean
Remove the specified file from the filter, so it will pass on the next attempt.void
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.Methods inherited from class org.springframework.integration.file.filters.AbstractFileListFilter
filterFiles, supportsSingleFileFiltering
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.file.filters.FileListFilter
filterFiles, isForRecursion, supportsSingleFileFiltering
-
Constructor Details
-
AcceptOnceFileListFilter
public AcceptOnceFileListFilter(int maxCapacity) Creates an AcceptOnceFileListFilter that is based on a bounded queue. If the queue overflows, files that fall out will be passed through this filter again if passed to theAbstractFileListFilter.filterFiles(Object[])
- Parameters:
maxCapacity
- the maximum number of Files to maintain in the 'seen' queue.
-
AcceptOnceFileListFilter
public AcceptOnceFileListFilter()Creates an AcceptOnceFileListFilter based on an unbounded queue.
-
-
Method Details
-
accept
Description copied from class:AbstractFileListFilter
Subclasses must implement this method.- Specified by:
accept
in interfaceFileListFilter<F>
- Specified by:
accept
in classAbstractFileListFilter<F>
- Parameters:
file
- The file.- Returns:
- true if the file passes the filter.
- See Also:
-
rollback
Description copied from interface:ReversibleFileListFilter
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:
rollback
in interfaceReversibleFileListFilter<F>
- Parameters:
file
- the file which failed.files
- the list of files that were returned byFileListFilter.filterFiles(Object[])
.
-
remove
Description copied from interface:ResettableFileListFilter
Remove the specified file from the filter, so it will pass on the next attempt.- Specified by:
remove
in interfaceResettableFileListFilter<F>
- Parameters:
fileToRemove
- the element to remove.- Returns:
- true if the file was removed as a result of this call.
-