From a3923c93e7eca05f3c2c6793375f04c5f80c7186 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 31 Aug 2016 23:10:47 -0400 Subject: [PATCH] XSD refactoring to pull common attributes Also introduce `remote-file-separator` since this option is available via Java Config --- .../aws/config/spring-integration-aws-1.1.xsd | 409 ++++++------------ ...boundChannelAdapterParserTests-context.xml | 1 + .../S3InboundChannelAdapterParserTests.java | 3 +- ...amingChannelAdapterParserTests-context.xml | 1 + ...undStreamingChannelAdapterParserTests.java | 2 +- 5 files changed, 148 insertions(+), 268 deletions(-) diff --git a/src/main/resources/org/springframework/integration/aws/config/spring-integration-aws-1.1.xsd b/src/main/resources/org/springframework/integration/aws/config/spring-integration-aws-1.1.xsd index f293490..73e0c77 100644 --- a/src/main/resources/org/springframework/integration/aws/config/spring-integration-aws-1.1.xsd +++ b/src/main/resources/org/springframework/integration/aws/config/spring-integration-aws-1.1.xsd @@ -255,181 +255,96 @@ + + + Configures a 'SourcePollingChannelAdapter' Endpoint for the + 'org.springframework.integration.aws.inbound.S3InboundFileSynchronizingMessageSource' that + synchronizes a local directory with the contents of a remote Amazon S3 bucket. + + - - - Configures a 'SourcePollingChannelAdapter' Endpoint for the - 'org.springframework.integration.aws.inbound.S3InboundFileSynchronizingMessageSource' that - synchronizes a local directory with the contents of a remote Amazon S3 bucket. - - - - - - - - - - - - - - - - - - - Identifies the directory path (e.g., - "/local/mytransfers") where files - will be transferred TO. - - - - - - - Identifies the remote directory path (e.g., "/remote/mytransfers") - Mutually exclusive with 'remote-directory-expression'. - - - - - - - Specify a SpEL expression which - will be used to evaluate the directory - path from where the files will be transferred - (e.g., "@someBean.fetchDirectory"); - Mutually exclusive with 'remote-directory'. - - - - - - - Extension used when downloading files. - We change it right after we know it's downloaded. - - - - - - - Allows you to provide a file name pattern to - determine the file names - that need to be scanned. - This is based on - simple pattern matching (e.g., "*.txt, fo*.txt" etc.) - - - - - - - Allows you to provide a SpEL expression to - generate the file name of - the local (transferred) file. The root - object of the SpEL - evaluation is the name of the original - file. - For example, a valid expression would be "#this.toUpperCase() + - '.a'" where #this represents the - original name of the remote - file. - - - - - - - Allows you to provide a Regular Expression to - determine the file names - that need to be scanned. - (e.g., "f[o]+\.txt" etc.) - - - - - - - Specify a Comparator to be used when ordering Files. If none is provided, the - order will be determined by the java.io.File implementation of Comparable. - - - - - - - - - - - - - - - - - Allows you to specify a reference to a - [org.springframework.integration.file.filters.FileListFilter] - bean. This filter is applied to files on the remote server and - only files that pass the filter are retrieved. - - - - - - - - - - - - Allows you to specify a reference to a - [org.springframework.integration.file.filters.FileListFilter] - bean. This filter is applied to files after they have been - retrieved. The default is an AcceptOnceFileListFilter which means that, - even if a new instance of a file is retrieved from the remote server, - a message won't be generated. The filter provided here is combined - with a filter that prevents the message source from processing - files that are currently being downloaded. - - - - - - - Tells this adapter if the local directory must - be auto-created if it - doesn't exist. Default is TRUE. - - - - - - - Specify whether to delete the remote source - file after copying. - By default, the remote files will NOT be - deleted. - - - - - - - Specify whether to preserve the modified timestamp from the remote source - file on the local file after copying. - By default, the remote timestamp will NOT be - preserved. - - - - + + + + + + Identifies the directory path (e.g., + "/local/mytransfers") where files + will be transferred TO. + + + + + + + Extension used when downloading files. + We change it right after we know it's downloaded. + + + + + + + Allows you to provide a SpEL expression to + generate the file name of + the local (transferred) file. The root + object of the SpEL + evaluation is the name of the original + file. + For example, a valid expression would be "#this.toUpperCase() + + '.a'" where #this represents the + original name of the remote + file. + + + + + + + + + + + + Allows you to specify a reference to a + [org.springframework.integration.file.filters.FileListFilter] + bean. This filter is applied to files after they have been + retrieved. The default is an AcceptOnceFileListFilter which means that, + even if a new instance of a file is retrieved from the remote server, + a message won't be generated. The filter provided here is combined + with a filter that prevents the message source from processing + files that are currently being downloaded. + + + + + + + Tells this adapter if the local directory must + be auto-created if it doesn't exist. Default is TRUE. + + + + + + + Specify whether to delete the remote source file after copying. + By default, the remote files will NOT be deleted. + + + + + + + Specify whether to preserve the modified timestamp from the remote source + file on the local file after copying. + By default, the remote timestamp will NOT be preserved. + + + + + @@ -442,87 +357,16 @@ - - - - - - - + - - - - - - - - - - - - - - - Identifies channel attached to this adapter. - The channel to which messages will be sent - by this adapter. - - - - - - - Allows you to provide a file name pattern to - determine the file names - that need to be scanned. - This is based on - simple pattern matching (e.g., "*.txt, fo*.txt" - etc.) - - - - - - - Allows you to provide a Regular Expression to - determine the file names - that need to be scanned. - (e.g., - "f[o]+\.txt" etc.) - - - - - - - - - - - - Allows you to specify a reference to a - [org.springframework.integration.file.filters.FileListFilter] - bean. This filter is applied to files on the remote server and - only files that pass the filter are retrieved. - - - - - - - - - + + + + + @@ -531,20 +375,18 @@ type="org.springframework.integration.file.remote.session.SessionFactory" /> - Reference to an [org.springframework.integration.file.remote.session.SessionFactory] bean with a [com.amazonaws.services.s3.model.S3ObjectSummary] generic type parameter. - ]]> + - + - - Allows you to provide remote file/directory - separator character. DEFAULT: - '/' - + + Allows you to provide remote file/directory + separator character. DEFAULT: '/' + @@ -555,12 +397,10 @@ - + - Specify a SpEL expression which - will be used to evaluate the directory + Specify a SpEL expression which will be used to evaluate the directory path to where the files will be transferred (e.g., "headers.['remote_dir'] + '/myTransfers'" for outbound endpoints) There is no root object (message) for inbound endpoints @@ -568,7 +408,46 @@ - + + + + Allows you to provide a file name pattern to determine the file names that need to be scanned. + This is based on simple pattern matching (e.g., "*.txt, fo*.txt" etc.) + + + + + + + Allows you to provide a Regular Expression to determine the file names that need to be scanned. + (e.g., "f[o]+\.txt" etc.) + + + + + + + + + + + + Allows you to specify a reference to a + [org.springframework.integration.file.filters.FileListFilter] + bean. This filter is applied to files on the remote server and + only files that pass the filter are retrieved. + + + + + + + Specify a Comparator to be used when ordering Files. If none is provided, the + order in which files are processed is the order they are received from the S3 server. + The generic type of the Comparator must be 'S3FileInfo'. + + + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml index 045e002..15050ba 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml @@ -38,6 +38,7 @@ preserve-timestamp="true" filename-pattern="*.txt" local-directory="." + remote-file-separator="\" local-filename-generator-expression="#this.toUpperCase() + '.a' + @fooString" comparator="comparator" temporary-file-suffix=".foo" diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java index 415189c..3639854 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java @@ -87,8 +87,7 @@ public class S3InboundChannelAdapterParserTests { assertThat(TestUtils.getPropertyValue(fisync, "preserveTimestamp", Boolean.class)).isTrue(); assertThat(TestUtils.getPropertyValue(fisync, "temporaryFileSuffix", String.class)).isEqualTo(".foo"); String remoteFileSeparator = (String) TestUtils.getPropertyValue(fisync, "remoteFileSeparator"); - assertThat(remoteFileSeparator).isNotNull(); - assertThat(remoteFileSeparator).isEmpty(); + assertThat(remoteFileSeparator).isEqualTo("\\"); S3SimplePatternFileListFilter filter = TestUtils.getPropertyValue(fisync, "filter", S3SimplePatternFileListFilter.class); assertThat(filter).isNotNull(); diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests-context.xml index 08a0beb..9db3417 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests-context.xml @@ -36,6 +36,7 @@ auto-startup="false" comparator="comparator" filter="acceptOnceFilter" + remote-file-separator="\" remote-directory-expression="foo/bar"> diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests.java index e2d5c16..50546b0 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundStreamingChannelAdapterParserTests.java @@ -78,7 +78,7 @@ public class S3InboundStreamingChannelAdapterParserTests { assertThat(TestUtils.getPropertyValue(source, "comparator")).isSameAs(this.comparator); String remoteFileSeparator = (String) TestUtils.getPropertyValue(source, "remoteFileSeparator"); assertThat(remoteFileSeparator).isNotNull(); - assertThat(remoteFileSeparator).isEqualTo("/"); + assertThat(remoteFileSeparator).isEqualTo("\\"); S3PersistentAcceptOnceFileListFilter filter = TestUtils.getPropertyValue(source, "filter", S3PersistentAcceptOnceFileListFilter.class);