Class AbstractMarkerFilePresentFileListFilter<F>
java.lang.Object
org.springframework.integration.file.filters.AbstractMarkerFilePresentFileListFilter<F>
- Type Parameters:
F
- the target protocol file type.
- All Implemented Interfaces:
FileListFilter<F>
- Direct Known Subclasses:
FileSystemMarkerFilePresentFileListFilter
,FtpSystemMarkerFilePresentFileListFilter
,SftpSystemMarkerFilePresentFileListFilter
,SmbSystemMarkerFilePresentFileListFilter
public abstract class AbstractMarkerFilePresentFileListFilter<F>
extends Object
implements FileListFilter<F>
A FileListFilter that only passes files matched by one or more
FileListFilter
if a corresponding marker file is also present to indicate a file transfer is complete.
Since they look at multiple files, they cannot be used for late filtering in the
streaming message source.- Since:
- 5.0
- Author:
- Gary Russell, Ngoc Nhan
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMarkerFilePresentFileListFilter
(Map<FileListFilter<F>, Function<String, String>> filtersAndFunctions) Construct an instance with a map ofFileListFilter
and functions be applied to the name of a matched file when looking for the marker file.Construct an instance with a singleFileListFilter
and ".complete" will be appended to the name of a matched file when looking for the marker file.AbstractMarkerFilePresentFileListFilter
(FileListFilter<F> filter, String suffix) Construct an instance with a singleFileListFilter
and a suffix that will will be appended to the name of a matched file when looking for the marker file.AbstractMarkerFilePresentFileListFilter
(FileListFilter<F> filter, Function<String, String> function) Construct an instance with a singleFileListFilter
and a function that will be applied to the name of a matched file when looking for the marker file. -
Method Summary
Modifier and TypeMethodDescriptiondefaultFileNameFunction
(String suffix) The default function used to create the file name for the corresponding marker file.filterFiles
(F[] files) Filters out files and returns the files that are left in a list, or an empty list when a null is passed in.protected abstract String
getFilename
(F file) Return the name of the file represented by this F.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
accept, isForRecursion, supportsSingleFileFiltering
-
Constructor Details
-
AbstractMarkerFilePresentFileListFilter
Construct an instance with a singleFileListFilter
and ".complete" will be appended to the name of a matched file when looking for the marker file. i.e. if a filefoo.txt
is matched by the filter this filter will only pass "foo.txt" if "foo.txt.complete" is present.- Parameters:
filter
- the file name filter.
-
AbstractMarkerFilePresentFileListFilter
Construct an instance with a singleFileListFilter
and a suffix that will will be appended to the name of a matched file when looking for the marker file. i.e. if a filefoo.txt
is matched by the filter and the suffix is ".complete", this filter will only pass "foo.txt" if "foo.txt.complete" is present.- Parameters:
filter
- the file name filter.suffix
- the replacement suffix.
-
AbstractMarkerFilePresentFileListFilter
public AbstractMarkerFilePresentFileListFilter(FileListFilter<F> filter, Function<String, String> function) Construct an instance with a singleFileListFilter
and a function that will be applied to the name of a matched file when looking for the marker file. The function returns the name of the marker file to match, ornull
for never match. If a filefoo.txt
is matched by the filter and the function returns "foo.txt.complete", this filter will only pass "foo.txt" if "foo.txt.complete" is present.- Parameters:
filter
- the file name filter.function
- the function to create the marker file name from the file name.
-
AbstractMarkerFilePresentFileListFilter
public AbstractMarkerFilePresentFileListFilter(Map<FileListFilter<F>, Function<String, String>> filtersAndFunctions) Construct an instance with a map ofFileListFilter
and functions be applied to the name of a matched file when looking for the marker file. i.e. if a filefoo.txt
is matched by one of the filters and the corresponding function returns "foo.txt.complete", this filter will only pass "foo.txt" if "foo.txt.complete" is present. The function returns the name of the marker file to match, ornull
for never match. Due to type erasure, we cannot provide a constructor takingMap<Filter, Function>
. For convenience, you can usedefaultFileNameFunction(String)
to use the default function used by theAbstractMarkerFilePresentFileListFilter(FileListFilter, String)
constructor.- Parameters:
filtersAndFunctions
- the filters and functions.
-
-
Method Details
-
defaultFileNameFunction
-
filterFiles
Description copied from interface:FileListFilter
Filters out files and returns the files that are left in a list, or an empty list when a null is passed in.- Specified by:
filterFiles
in interfaceFileListFilter<F>
- Parameters:
files
- The files.- Returns:
- The filtered files.
-
getFilename
-