diff --git a/docs/src/reference/docbook/sftp.xml b/docs/src/reference/docbook/sftp.xml index 9c35d11664..88f7d642f0 100644 --- a/docs/src/reference/docbook/sftp.xml +++ b/docs/src/reference/docbook/sftp.xml @@ -103,7 +103,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp channel="inputChannel" charset="UTF-8" remote-directory="foo/bar" - remote-filename-expression="payload.getName() + '-foo'"/>]]> + remote-filename-generator-expression="payload.getName() + '-foo'"/>]]> As you can see form the configuration above you can configure SFTP Outbound Channel Adapter via outbound-channel-adapter. @@ -115,9 +115,9 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp As with many other components in Spring Integration, you can benefit from Spring Expression Language (SpEL) when configuring SFTP Outbound Channel Adapter, by specifying two attributes remote-directory-expression and - remote-filename-expression (see above). Expression evaluation context will have Message as its root object, thus allowing + remote-filename-generator-expression (see above). Expression evaluation context will have Message as its root object, thus allowing you to provide expressions which can dynamically compute the file name or the existing directory path - based on the data in the Message. In the example above we are defining remote-filename-expression attribute with expression + based on the data in the Message. In the example above we are defining remote-filename-generator-expression attribute with expression value which computes the file name based on its original name while also appending suffix '-foo'. diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpOutboundChannelAdapterParser.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpOutboundChannelAdapterParser.java index 44027ccb2e..aea274e0b4 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpOutboundChannelAdapterParser.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpOutboundChannelAdapterParser.java @@ -68,13 +68,13 @@ public class SftpOutboundChannelAdapterParser extends AbstractOutboundChannelAda } handlerBuilder.addPropertyValue("remoteDirectoryExpression", expressionDef); - String remoteFileExpression = element.getAttribute("remote-filename-expression"); - String fileNameGenerator = element.getAttribute("filename-generator"); + String remoteFileExpression = element.getAttribute("remote-filename-generator-expression"); + String fileNameGenerator = element.getAttribute("remote-filename-generator"); boolean hasRemoteFileExp = StringUtils.hasText(remoteFileExpression); boolean hasFileNameGener = StringUtils.hasText(fileNameGenerator); if (hasRemoteFileExp | hasFileNameGener){ if (!(hasRemoteFileExp ^ hasFileNameGener)) { - throw new BeanDefinitionStoreException("exactly one of 'remote-filename-expression' or 'filename-generator' " + + throw new BeanDefinitionStoreException("exactly one of 'remote-filename-generator-expression' or 'remote-filename-generator' " + "is allowed on SFTP outbound adapter"); } if (StringUtils.hasText(remoteFileExpression)){ @@ -86,7 +86,7 @@ public class SftpOutboundChannelAdapterParser extends AbstractOutboundChannelAda } - IntegrationNamespaceUtils.setReferenceIfAttributeDefined(handlerBuilder, element, "filename-generator"); + IntegrationNamespaceUtils.setReferenceIfAttributeDefined(handlerBuilder, element, "remote-filename-generator", "filenameGenerator"); return handlerBuilder.getBeanDefinition(); } } \ No newline at end of file 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 0a27f36822..e634143264 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 @@ -40,7 +40,7 @@ - + Allows you to specify a reference to @@ -55,7 +55,7 @@ - + diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail-fileFileGen.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail-fileFileGen.xml index f3687e6501..57e394ce85 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail-fileFileGen.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail-fileFileGen.xml @@ -24,9 +24,9 @@ session-factory="sftpSessionFactory" channel="inputChannel" charset="UTF-8" - filename-generator="fileNameGenerator" + remote-filename-generator="fileNameGenerator" remote-directory-expression="'foo' + '/' + 'bar'" - remote-filename-expression="payload.getName() + '-foo'"/> + remote-filename-generator-expression="payload.getName() + '-foo'"/> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail.xml index 88fc4ee97f..adce321caa 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context-fail.xml @@ -24,7 +24,7 @@ session-factory="sftpSessionFactory" channel="inputChannel" charset="UTF-8" - filename-generator="fileNameGenerator" + remote-filename-generator="fileNameGenerator" remote-directory="foo/bar" remote-directory-expression="'foo'"/> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml index f95551abe9..cbe4dbce34 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/OutboundChannelAdapaterParserTests-context.xml @@ -24,7 +24,7 @@ session-factory="sftpSessionFactory" channel="inputChannel" charset="UTF-8" - filename-generator="fileNameGenerator" + remote-filename-generator="fileNameGenerator" remote-directory="foo/bar"/> + remote-filename-generator-expression="payload.getName() + '-foo'"/> - - - + @@ -24,18 +22,7 @@ session-factory="sftpSessionFactory" channel="inputChannel" charset="UTF-8" - remote-file-expression="payload.getName() + '_foo'" + remote-file-generator-expression="payload.getName() + '_foo'" remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-test-dir"/> - - - - - - - - - - - - +