INT-4149: Improve (S)FTP Recursive MGET

JIRA: https://jira.spring.io/browse/INT-4149

Add an option to always pass directories while recursing.

* Fix typos in docs
* Revert `SyslogReceivingChannelAdapterTests` `Thread.sleep()` fixes
This commit is contained in:
Gary Russell
2016-10-28 13:56:43 -04:00
committed by Artem Bilan
parent 67d6cd0c89
commit a43299213e
18 changed files with 207 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.springframework.integration.file.filters.AbstractRegexPatternFileList
* Implementation of {@link AbstractRegexPatternFileListFilter} for FTP.
*
* @author Mark Fisher
* @author Gary Russell
* @since 2.0
*/
public class FtpRegexPatternFileListFilter extends AbstractRegexPatternFileListFilter<FTPFile> {
@@ -44,4 +45,9 @@ public class FtpRegexPatternFileListFilter extends AbstractRegexPatternFileListF
return (file != null) ? file.getName() : null;
}
@Override
protected boolean isDirectory(FTPFile file) {
return file.isDirectory();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.springframework.integration.file.filters.AbstractSimplePatternFileLis
* Implementation of {@link AbstractSimplePatternFileListFilter} for FTP.
*
* @author Mark Fisher
* @author Gary Russell
* @since 2.0
*/
public class FtpSimplePatternFileListFilter extends AbstractSimplePatternFileListFilter<FTPFile> {
@@ -38,4 +39,9 @@ public class FtpSimplePatternFileListFilter extends AbstractSimplePatternFileLis
return (file != null) ? file.getName() : null;
}
@Override
protected boolean isDirectory(FTPFile file) {
return file.isDirectory();
}
}

View File

@@ -52,10 +52,16 @@
command="mget"
expression="payload"
command-options="-R"
filter="startDotTxtFilter"
local-directory-expression="@extraConfig.targetLocalDirectoryName + #remoteDirectory"
local-filename-generator-expression="#remoteFileName.replaceFirst('ftpSource', 'localTarget')"
reply-channel="output"/>
<bean id="startDotTxtFilter" class="org.springframework.integration.ftp.filters.FtpSimplePatternFileListFilter">
<constructor-arg value="*.txt" />
<property name="alwaysAcceptDirectories" value="true" />
</bean>
<int:channel id="inboundMGetRecursiveFiltered"/>
<int-ftp:outbound-gateway session-factory="ftpSessionFactory"