|
20 | 20 | import java.io.FileNotFoundException;
|
21 | 21 | import java.io.IOException;
|
22 | 22 | import java.net.URI;
|
23 |
| -import java.util.Arrays; |
24 | 23 | import java.util.Comparator;
|
| 24 | +import java.util.List; |
25 | 25 | import java.util.regex.Pattern;
|
26 | 26 |
|
27 | 27 | import org.springframework.beans.factory.BeanFactory;
|
|
31 | 31 | import org.springframework.integration.file.DirectoryScanner;
|
32 | 32 | import org.springframework.integration.file.FileHeaders;
|
33 | 33 | import org.springframework.integration.file.FileReadingMessageSource;
|
34 |
| -import org.springframework.integration.file.filters.CompositeFileListFilter; |
| 34 | +import org.springframework.integration.file.filters.ChainFileListFilter; |
35 | 35 | import org.springframework.integration.file.filters.FileListFilter;
|
36 | 36 | import org.springframework.integration.file.filters.FileSystemPersistentAcceptOnceFileListFilter;
|
37 | 37 | import org.springframework.integration.file.filters.RegexPatternFileListFilter;
|
|
49 | 49 | * from an 'inbound' adapter).
|
50 | 50 | * <p>
|
51 | 51 | * The base class supports configuration of whether the remote file system and
|
52 |
| - * local file system's directories should be created on start (what 'creating a |
53 |
| - * directory' means to the specific adapter is of course implementation |
54 |
| - * specific). |
| 52 | + * local file system's directories should be created on start. |
55 | 53 | * <p>
|
56 | 54 | * This class is to be used as a pair with an implementation of
|
57 | 55 | * {@link AbstractInboundFileSynchronizer}. The synchronizer must
|
@@ -193,9 +191,7 @@ protected void onInit() {
|
193 | 191 | this.fileSource.setDirectory(this.localDirectory);
|
194 | 192 | initFiltersAndScanner();
|
195 | 193 | BeanFactory beanFactory = getBeanFactory();
|
196 |
| - if (beanFactory != null) { |
197 |
| - this.fileSource.setBeanFactory(beanFactory); |
198 |
| - } |
| 194 | + this.fileSource.setBeanFactory(beanFactory); |
199 | 195 | this.fileSource.afterPropertiesSet();
|
200 | 196 | this.synchronizer.afterPropertiesSet();
|
201 | 197 | }
|
@@ -281,9 +277,9 @@ public final AbstractIntegrationMessageBuilder<File> doReceive(int maxFetchSize)
|
281 | 277 | }
|
282 | 278 |
|
283 | 279 | private FileListFilter<File> buildFilter() {
|
284 |
| - Pattern completePattern = Pattern.compile("^.*(?<!" + this.synchronizer.getTemporaryFileSuffix() + ")$"); |
285 |
| - return new CompositeFileListFilter<>( |
286 |
| - Arrays.asList(this.localFileListFilter, new RegexPatternFileListFilter(completePattern))); |
| 280 | + var ignoreTemporaryFilesPattern = Pattern.compile("^.*(?<!" + this.synchronizer.getTemporaryFileSuffix() + ")$"); |
| 281 | + return new ChainFileListFilter<>( |
| 282 | + List.of(new RegexPatternFileListFilter(ignoreTemporaryFilesPattern), this.localFileListFilter)); |
287 | 283 | }
|
288 | 284 |
|
289 | 285 | /**
|
|
0 commit comments