From bcc919fed757ca264c2b0c0ef7453388c21f89bd Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Mon, 22 Nov 2010 01:00:58 -0500 Subject: [PATCH] INT-1614 changed the 'auto-create-directories' attribute to 'auto-create-local-directory' since it only affects the local directory --- ...tRemoteFileInboundChannelAdapterParser.java | 2 +- ...tInboundFileSynchronizingMessageSource.java | 13 +++++++------ .../ftp/config/spring-integration-ftp-2.0.xsd | 18 +++++++++--------- .../ftp/FtpParserInboundTests-context.xml | 4 ++-- .../ftp/FtpParserInboundTests-fail-context.xml | 2 +- ...nboundChannelAdapterParserTests-context.xml | 4 ++-- ...nboundChannelAdapterParserTests-context.xml | 4 ++-- .../ftp/ftp-message-history-context.xml | 2 +- ...nboundRemoteFileSystemSynchronizerTest.java | 4 ++-- .../config/spring-integration-sftp-2.0.xsd | 11 +++++++++-- ...aterParserTests-context-fail-autocreate.xml | 2 +- ...ChannelAdapaterParserTests-context-fail.xml | 2 +- ...boundChannelAdapaterParserTests-context.xml | 8 ++++---- .../sftp/config/MessageHistory-context.xml | 2 +- ...boundRemoteFileSystemSynchronizerTests.java | 4 ++-- 15 files changed, 45 insertions(+), 37 deletions(-) diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java index 67d2a17315..29ef3435bf 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/AbstractRemoteFileInboundChannelAdapterParser.java @@ -74,7 +74,7 @@ public abstract class AbstractRemoteFileInboundChannelAdapterParser extends Abst BeanDefinitionBuilder messageSourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(this.getMessageSourceClassname()); messageSourceBuilder.addConstructorArgValue(synchronizerBuilder.getBeanDefinition()); IntegrationNamespaceUtils.setValueIfAttributeDefined(messageSourceBuilder, element, "local-directory"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(messageSourceBuilder, element, "auto-create-directories"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(messageSourceBuilder, element, "auto-create-local-directory"); return messageSourceBuilder.getBeanDefinition(); } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java index 87c047a06d..52ea431d1d 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java @@ -55,9 +55,9 @@ import org.springframework.util.Assert; public abstract class AbstractInboundFileSynchronizingMessageSource extends MessageProducerSupport implements MessageSource { /** - * Should the endpoint attempt to create the local directory? + * Should the endpoint attempt to create the local directory? True by default. */ - private volatile boolean autoCreateDirectories = true; + private volatile boolean autoCreateLocalDirectory = true; /** * An implementation that will handle the chores of actually connecting to and synchronizing @@ -82,8 +82,8 @@ public abstract class AbstractInboundFileSynchronizingMessageSource extends M } - public void setAutoCreateDirectories(boolean autoCreateDirectories) { - this.autoCreateDirectories = autoCreateDirectories; + public void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory) { + this.autoCreateLocalDirectory = autoCreateLocalDirectory; } public void setLocalDirectory(File localDirectory) { @@ -92,9 +92,10 @@ public abstract class AbstractInboundFileSynchronizingMessageSource extends M @Override protected void onInit() { + Assert.notNull(this.localDirectory, "localDirectory must not be null"); try { - if (this.localDirectory != null && !this.localDirectory.exists()) { - if (this.autoCreateDirectories) { + if (!this.localDirectory.exists()) { + if (this.autoCreateLocalDirectory) { if (logger.isDebugEnabled()) { logger.debug("The '" + this.localDirectory + "' directory doesn't exist; Will create."); } diff --git a/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd b/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd index 36ff36a7b7..e8c02330bc 100644 --- a/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd +++ b/spring-integration-ftp/src/main/resources/org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd @@ -54,15 +54,6 @@ - - - - - Specify whether to delete the remote source file after copying. - By default, the remote files will NOT be deleted. - - - @@ -75,6 +66,15 @@ + + + + + Specify whether to delete the remote source file after copying. + By default, the remote files will NOT be deleted. + + + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-context.xml index 70200a541c..3a9ebf8acd 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-context.xml @@ -26,7 +26,7 @@ filename-pattern="foo" local-directory="target/foo" remote-directory="foo/bar" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="false"> @@ -38,7 +38,7 @@ filter="filter" local-directory="target" remote-directory="foo/bar" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="false"> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-fail-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-fail-context.xml index ea1a7be484..43ebacf954 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-fail-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserInboundTests-fail-context.xml @@ -26,7 +26,7 @@ filter="filter" local-directory="file:target/bar" remote-directory="foo/bar" - auto-create-directories="false" + auto-create-local-directory="false" delete-remote-files="false"> diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml index 60e79b0f3e..1234166c34 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterParserTests-context.xml @@ -14,7 +14,7 @@ channel="ftpChannel" session-factory="ftpSessionFactory" charset="UTF-8" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="true" filename-pattern=".?txt" local-directory="." @@ -26,7 +26,7 @@ channel="ftpChannel" session-factory="ftpSessionFactory" charset="UTF-8" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="true" filter="entryListFilter" local-directory="." diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml index 1749bc1b14..17d14d4d09 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpsInboundChannelAdapterParserTests-context.xml @@ -21,7 +21,7 @@ channel="ftpChannel" session-factory="ftpSessionFactory" charset="UTF-8" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="true" local-directory="." remote-directory="foo/bar" @@ -33,7 +33,7 @@ channel="ftpChannel" session-factory="ftpSessionFactory" charset="UTF-8" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="true" filename-pattern=".?txt" local-directory="." diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/ftp-message-history-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/ftp-message-history-context.xml index 3fde3fcc77..526158d31a 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/ftp-message-history-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/ftp-message-history-context.xml @@ -24,7 +24,7 @@ diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java index f70e419208..f7067502b6 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java @@ -79,8 +79,8 @@ public class FtpInboundRemoteFileSystemSynchronizerTest { synchronizer.setFilter(new FtpRegexPatternFileListFilter(".*\\.test$")); FtpInboundFileSynchronizingMessageSource ms = - new FtpInboundFileSynchronizingMessageSource(synchronizer); - ms.setAutoCreateDirectories(true); + new FtpInboundFileSynchronizingMessageSource(synchronizer); + ms.setAutoCreateLocalDirectory(true); ms.setLocalDirectory(localDirectoy); ms.afterPropertiesSet(); diff --git a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd index 1119ee4c93..18a69e171d 100644 --- a/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd +++ b/spring-integration-sftp/src/main/resources/org/springframework/integration/sftp/config/spring-integration-sftp-2.0.xsd @@ -109,8 +109,15 @@ - - + + + + + Specify whether to delete the remote source file after copying. + By default, the remote files will NOT be deleted. + + + diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail-autocreate.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail-autocreate.xml index 64993b91cb..f368bc4767 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail-autocreate.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail-autocreate.xml @@ -36,7 +36,7 @@ filter="filter" remote-directory="/foo" local-directory="file:foo" - auto-create-directories="false" + auto-create-local-directory="false" delete-remote-files="false"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail.xml index 1d6027c522..3dfc6cfabc 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context-fail.xml @@ -37,7 +37,7 @@ filename-pattern="." remote-directory="/foo" local-directory="file:local-test-dir" - auto-create-directories="false" + auto-create-local-directory="false" auto-delete-remote-files-on-sync="false"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml index 264523678a..dce36f0ff2 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/InboundChannelAdapaterParserTests-context.xml @@ -41,7 +41,7 @@ filename-pattern="foo.txt" remote-directory="/foo" local-directory="file:local-test-dir" - auto-create-directories="false" + auto-create-local-directory="false" delete-remote-files="false"> @@ -52,7 +52,7 @@ filter="filter" remote-directory="/foo" local-directory="file:local-test-dir" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="false"> @@ -63,7 +63,7 @@ filename-pattern="pattern" remote-directory="/foo" local-directory="file:local-test-dir" - auto-create-directories="false" + auto-create-local-directory="false" delete-remote-files="false"> @@ -74,7 +74,7 @@ filename-pattern="pattern" remote-directory="/foo" local-directory="file:foo" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="false"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/MessageHistory-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/MessageHistory-context.xml index 0f95a8470c..4387adab7b 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/MessageHistory-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/MessageHistory-context.xml @@ -36,7 +36,7 @@ local-directory="file:local-test-dir" channel="inboundFilesChannel" filename-pattern=".*?jpg" - auto-create-directories="true" + auto-create-local-directory="true" delete-remote-files="true"> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java index 02efd11181..ce4b8fab5e 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java @@ -81,8 +81,8 @@ public class SftpInboundRemoteFileSystemSynchronizerTests { synchronizer.setFilter(new SftpRegexPatternFileListFilter(".*\\.test$")); SftpInboundFileSynchronizingMessageSource ms = - new SftpInboundFileSynchronizingMessageSource(synchronizer); - ms.setAutoCreateDirectories(true); + new SftpInboundFileSynchronizingMessageSource(synchronizer); + ms.setAutoCreateLocalDirectory(true); ms.setLocalDirectory(localDirectoy); ms.afterPropertiesSet(); Message atestFile = ms.receive();