INT-1614 'auto-delete-remote-files-on-sync' is now 'delete-remote-files'
This commit is contained in:
@@ -68,10 +68,10 @@ public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileS
|
||||
private volatile FileListFilter<F> filter;
|
||||
|
||||
/**
|
||||
* Should we <emphasis>delete</emphasis> the <b>source</b> file? For an FTP
|
||||
* server, for example, this would delete the original FTPFile instance.
|
||||
* Should we <emphasis>delete</emphasis> the remote <b>source</b> files
|
||||
* after copying to the local directory? By default this is false.
|
||||
*/
|
||||
protected boolean shouldDeleteSourceFile;
|
||||
private boolean deleteRemoteFiles;
|
||||
|
||||
|
||||
/**
|
||||
@@ -94,8 +94,8 @@ public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileS
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public void setShouldDeleteSourceFile(boolean shouldDeleteSourceFile) {
|
||||
this.shouldDeleteSourceFile = shouldDeleteSourceFile;
|
||||
public void setDeleteRemoteFiles(boolean deleteRemoteFiles) {
|
||||
this.deleteRemoteFiles = deleteRemoteFiles;
|
||||
}
|
||||
|
||||
public final void afterPropertiesSet() {
|
||||
@@ -182,7 +182,7 @@ public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileS
|
||||
}
|
||||
}
|
||||
if (tempFile.renameTo(localFile)) {
|
||||
if (this.shouldDeleteSourceFile) {
|
||||
if (this.deleteRemoteFiles) {
|
||||
session.rm(remoteFilePath);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("deleted " + remoteFilePath);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class FtpInboundChannelAdapterParser extends AbstractPollingInboundChanne
|
||||
"org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizer");
|
||||
synchronizerBuilder.addConstructorArgValue(sessionFactoryBuilder.getBeanDefinition());
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-directory");
|
||||
// IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "auto-delete-remote-files-on-sync", "shouldDeleteSourceFile");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "delete-remote-files");
|
||||
String fileNamePattern = element.getAttribute("filename-pattern");
|
||||
String filter = element.getAttribute("filter");
|
||||
boolean hasFileNamePattern = StringUtils.hasText(fileNamePattern);
|
||||
|
||||
@@ -55,7 +55,14 @@
|
||||
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="auto-create-directories" type="xsd:boolean"/>
|
||||
<xsd:attribute name="auto-delete-remote-files-on-sync" type="xsd:boolean"/>
|
||||
<xsd:attribute name="delete-remote-files" type="xsd:boolean">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Specify whether to delete the remote source file after copying.
|
||||
By default, the remote files will NOT be deleted.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="filename-pattern" type="xsd:string"/>
|
||||
<xsd:attribute name="filter" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
@@ -79,7 +86,7 @@
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.integration.ftp.client.AbstractFtpClientFactory"/>
|
||||
<tool:expected-type type="org.springframework.integration.ftp.session.AbstractFtpSessionFactory"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
local-directory="target/foo"
|
||||
remote-directory="foo/bar"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="false">
|
||||
delete-remote-files="false">
|
||||
<int:poller fixed-rate="1000"/>
|
||||
</ftp:inbound-channel-adapter>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
local-directory="target"
|
||||
remote-directory="foo/bar"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="false">
|
||||
delete-remote-files="false">
|
||||
<int:poller fixed-rate="1000"/>
|
||||
</ftp:inbound-channel-adapter>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
local-directory="file:target/bar"
|
||||
remote-directory="foo/bar"
|
||||
auto-create-directories="false"
|
||||
auto-delete-remote-files-on-sync="false">
|
||||
delete-remote-files="false">
|
||||
<int:poller fixed-rate="1000"/>
|
||||
</ftp:inbound-channel-adapter>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
session-factory="ftpSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="true"
|
||||
delete-remote-files="true"
|
||||
filename-pattern=".?txt"
|
||||
local-directory="."
|
||||
remote-directory="foo/bar">
|
||||
@@ -27,7 +27,7 @@
|
||||
session-factory="ftpSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="true"
|
||||
delete-remote-files="true"
|
||||
filter="entryListFilter"
|
||||
local-directory="."
|
||||
remote-directory="foo/bar">
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
session-factory="ftpSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="true"
|
||||
delete-remote-files="true"
|
||||
local-directory="."
|
||||
remote-directory="foo/bar"
|
||||
filter="entryListFilter">
|
||||
@@ -34,7 +34,7 @@
|
||||
session-factory="ftpSessionFactory"
|
||||
charset="UTF-8"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="true"
|
||||
delete-remote-files="true"
|
||||
filename-pattern=".?txt"
|
||||
local-directory="."
|
||||
remote-directory="foo/bar">
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
auto-create-directories="true"
|
||||
local-directory="file:target/foo"
|
||||
remote-directory="foo/bar"
|
||||
auto-delete-remote-files-on-sync="false">
|
||||
delete-remote-files="false">
|
||||
<int:poller fixed-rate="1000"/>
|
||||
</ftp:inbound-channel-adapter>
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class FtpInboundRemoteFileSystemSynchronizerTest {
|
||||
new FtpInboundFileSynchronizingMessageSource();
|
||||
|
||||
FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer(ftpSessionFactory));
|
||||
synchronizer.setShouldDeleteSourceFile(true);
|
||||
synchronizer.setDeleteRemoteFiles(true);
|
||||
synchronizer.setRemoteDirectory("remote-test-dir");
|
||||
synchronizer.setFilter(new FtpPatternMatchingFileListFilter(".*\\.test$"));
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SftpInboundChannelAdapterParser extends AbstractPollingInboundChann
|
||||
"org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizer");
|
||||
synchronizerBuilder.addConstructorArgReference(sessionPollName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-directory");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "auto-delete-remote-files-on-sync", "shouldDeleteSourceFile");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "delete-remote-files");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(synchronizerBuilder, element, "filter");
|
||||
BeanDefinitionBuilder messageSourceBuilder = BeanDefinitionBuilder.rootBeanDefinition(
|
||||
"org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizingMessageSource");
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
|
||||
}
|
||||
});
|
||||
|
||||
syncronizer.setShouldDeleteSourceFile(true);
|
||||
syncronizer.setDeleteRemoteFiles(true);
|
||||
syncronizer.afterPropertiesSet();
|
||||
|
||||
File localDirectory = new File(System.getProperty("java.io.tmpdir"));
|
||||
|
||||
Reference in New Issue
Block a user