diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java similarity index 98% rename from spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java rename to spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java index 29a70852d3..f4e5cfa639 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.java @@ -42,7 +42,7 @@ import com.jcraft.jsch.ChannelSftp; * * @author Josh Long */ -public class SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean +class SftpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean extends AbstractFactoryBean implements ResourceLoaderAware { private volatile ResourceLoader resourceLoader; @@ -148,7 +148,7 @@ public class SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean */ @Override public Class getObjectType() { - return SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean.class; + return SftpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.class; } /** diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java index 18b0376fc3..5d2d2dab0c 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java @@ -39,19 +39,36 @@ import org.springframework.util.StringUtils; public class SftpNamespaceHandler extends AbstractIntegrationNamespaceHandler { public void init() { - registerBeanDefinitionParser("inbound-channel-adapter", new SFTPMessageSourceBeanDefinitionParser()); - registerBeanDefinitionParser("outbound-channel-adapter", new SFTPMessageSendingConsumerBeanDefinitionParser()); + registerBeanDefinitionParser("inbound-channel-adapter", new SftpInboundChannelAdapterParser()); + registerBeanDefinitionParser("outbound-channel-adapter", new SftpOutboundChannelAdapterParser()); } /** - * Configures an object that can take inbound messages and send them. + * Configures an object that can receive files from a remote SFTP endpoint and broadcast their arrival to a channel. */ - private static class SFTPMessageSendingConsumerBeanDefinitionParser extends AbstractOutboundChannelAdapterParser { + private static class SftpInboundChannelAdapterParser extends AbstractPollingInboundChannelAdapterParser { + + @Override + protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) { + BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SftpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.class.getName()); + IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "filter"); + for (String p : "filename-pattern,auto-create-directories,username,password,host,key-file,key-file-password,remote-directory,local-directory-path,auto-delete-remote-files-on-sync".split(",")) { + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, p); + } + return builder.getBeanDefinition(); + } + } + + + /** + * Configures an object that can take messages and send them via SFTP. + */ + private static class SftpOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser { @Override protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) { - BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SftpMessageSendingConsumerFactoryBean.class.getName()); + BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SftpSendingMessageHandlerFactoryBean.class.getName()); for (String p : "auto-create-directories,username,password,host,port,key-file,key-file-password,charset".split(",")) { IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, p); } @@ -77,20 +94,4 @@ public class SftpNamespaceHandler extends AbstractIntegrationNamespaceHandler { } } - /** - * Configures an object that can receive files from a remote SFTP endpoint and broadcast their arrival to the consumer. - */ - private static class SFTPMessageSourceBeanDefinitionParser extends AbstractPollingInboundChannelAdapterParser { - - @Override - protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) { - BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SftpRemoteFileSystemSynchronizingMessageSourceFactoryBean.class.getName()); - IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "filter"); - for (String p : "filename-pattern,auto-create-directories,username,password,host,key-file,key-file-password,remote-directory,local-directory-path,auto-delete-remote-files-on-sync".split(",")) { - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, p); - } - return builder.getBeanDefinition(); - } - } - } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpMessageSendingConsumerFactoryBean.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpSendingMessageHandlerFactoryBean.java similarity index 96% rename from spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpMessageSendingConsumerFactoryBean.java rename to spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpSendingMessageHandlerFactoryBean.java index 6b95ffb049..5eb9456bec 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpMessageSendingConsumerFactoryBean.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpSendingMessageHandlerFactoryBean.java @@ -30,7 +30,7 @@ import org.springframework.integration.sftp.session.SftpSessionUtils; * * @author Josh Long */ -public class SftpMessageSendingConsumerFactoryBean implements FactoryBean { +class SftpSendingMessageHandlerFactoryBean implements FactoryBean { private String host;