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:
committed by
Artem Bilan
parent
67d6cd0c89
commit
a43299213e
@@ -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.
|
||||
@@ -27,6 +27,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
* Implementation of {@link AbstractRegexPatternFileListFilter} for SFTP.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SftpRegexPatternFileListFilter extends AbstractRegexPatternFileListFilter<ChannelSftp.LsEntry> {
|
||||
@@ -45,4 +46,9 @@ public class SftpRegexPatternFileListFilter extends AbstractRegexPatternFileList
|
||||
return (entry != null) ? entry.getFilename() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDirectory(LsEntry file) {
|
||||
return file.getAttrs().isDir();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -25,6 +25,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
* Implementation of {@link AbstractSimplePatternFileListFilter} for SFTP.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SftpSimplePatternFileListFilter extends AbstractSimplePatternFileListFilter<ChannelSftp.LsEntry> {
|
||||
@@ -39,4 +40,9 @@ public class SftpSimplePatternFileListFilter extends AbstractSimplePatternFileLi
|
||||
return (entry != null) ? entry.getFilename() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDirectory(LsEntry file) {
|
||||
return file.getAttrs().isDir();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,10 +51,17 @@
|
||||
command="mget"
|
||||
expression="payload"
|
||||
command-options="-R"
|
||||
filter="dotStarDotTxtFilter"
|
||||
local-directory-expression="@extraConfig.targetLocalDirectoryName + #remoteDirectory"
|
||||
local-filename-generator-expression="#remoteFileName.replaceFirst('sftpSource', 'localTarget')"
|
||||
reply-channel="output"/>
|
||||
|
||||
<bean id="dotStarDotTxtFilter"
|
||||
class="org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilter">
|
||||
<constructor-arg value="^.*\.txt$" />
|
||||
<property name="alwaysAcceptDirectories" value="true" />
|
||||
</bean>
|
||||
|
||||
<int:channel id="inboundMGetRecursiveFiltered"/>
|
||||
|
||||
<int-sftp:outbound-gateway session-factory="sftpSessionFactory"
|
||||
|
||||
Reference in New Issue
Block a user