INT-1614 refactored inbound parsers to inherit from common class
This commit is contained in:
@@ -16,42 +16,19 @@
|
||||
|
||||
package org.springframework.integration.ftp.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
|
||||
/**
|
||||
* Parser for the FTP inbound-channel-adapter.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class FtpInboundChannelAdapterParser extends AbstractPollingInboundChannelAdapterParser {
|
||||
|
||||
private Set<String> receiveAttrs = new HashSet<String>(Arrays.asList(
|
||||
"auto-delete-remote-files-on-sync,filename-pattern,local-working-directory".split(",")));
|
||||
public class FtpInboundChannelAdapterParser extends AbstractFtpInboundChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
FtpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.class.getName());
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "filter");
|
||||
for (String a : receiveAttrs) {
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, a);
|
||||
}
|
||||
FtpNamespaceParserSupport.configureCoreFtpClient(builder, element, parserContext);
|
||||
String beanName = BeanDefinitionReaderUtils.registerWithGeneratedName(
|
||||
builder.getBeanDefinition(), parserContext.getRegistry());
|
||||
return new RuntimeBeanReference(beanName);
|
||||
protected String getClassName() {
|
||||
return "org.springframework.integration.ftp.config.FtpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,38 +16,18 @@
|
||||
|
||||
package org.springframework.integration.ftp.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
|
||||
/**
|
||||
* Parser for the FTPS inbound-channel-adapter
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class FtpsInboundChannelAdapterParser extends AbstractPollingInboundChannelAdapterParser {
|
||||
|
||||
private Set<String> receiveAttrs = new HashSet<String>(Arrays.asList(
|
||||
"auto-delete-remote-files-on-sync,filename-pattern,local-working-directory".split(",")));
|
||||
public class FtpsInboundChannelAdapterParser extends AbstractFtpInboundChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
FtpsInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean.class.getName());
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "filter");
|
||||
for (String a : receiveAttrs) {
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, a);
|
||||
}
|
||||
FtpNamespaceParserSupport.configureCoreFtpClient(builder, element, parserContext);
|
||||
return builder.getBeanDefinition();
|
||||
protected String getClassName() {
|
||||
return "org.springframework.integration.ftp.config.FtpInboundRemoteFileSystemSynchronizingMessageSourceFactoryBean";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user