Refactored XPath namespace support to allow input-channel and output-channel parser now extends AbstractConsumerEndpointParser
This commit is contained in:
@@ -18,8 +18,8 @@ package org.springframework.integration.xml.config;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractConsumerEndpointParser;
|
||||
import org.springframework.integration.xml.splitter.XPathMessageSplitter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -29,12 +29,8 @@ import org.w3c.dom.NodeList;
|
||||
/**
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public class XPathMessageSplitterParser extends AbstractSingleBeanDefinitionParser {
|
||||
public class XPathMessageSplitterParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
@Override
|
||||
protected Class getBeanClass(Element element) {
|
||||
return XPathMessageSplitter.class;
|
||||
}
|
||||
|
||||
private XPathExpressionParser xpathParser = new XPathExpressionParser();
|
||||
|
||||
@@ -48,10 +44,10 @@ public class XPathMessageSplitterParser extends AbstractSingleBeanDefinitionPars
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
|
||||
boolean multiChannel = Boolean.parseBoolean(element.getAttribute("multi-channel"));
|
||||
@Override
|
||||
protected BeanDefinitionBuilder parseConsumer(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(XPathMessageSplitter.class);
|
||||
String xPathExpressionRef = element.getAttribute("xpath-expression-ref");
|
||||
|
||||
NodeList xPathExpressionNodes = element.getElementsByTagNameNS(element.getNamespaceURI(), "xpath-expression");
|
||||
@@ -69,6 +65,7 @@ public class XPathMessageSplitterParser extends AbstractSingleBeanDefinitionPars
|
||||
} else {
|
||||
builder.addConstructorArgReference(xPathExpressionRef);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
xmlns:si-core="http://www.springframework.org/schema/integration"
|
||||
targetNamespace="http://www.springframework.org/schema/integration/xml"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/integration" />
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
@@ -16,14 +18,14 @@
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:element name="marshalling-transformer">
|
||||
<xsd:complexType>
|
||||
<xsd:complexType >
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines an XML marshalling transformer.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="transformerType">
|
||||
<xsd:extension base="inputOutputEndpoint">
|
||||
<xsd:attribute name="marshaller" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="result-type" use="optional">
|
||||
<xsd:simpleType>
|
||||
@@ -48,7 +50,7 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="transformerType">
|
||||
<xsd:extension base="inputOutputEndpoint">
|
||||
<xsd:attribute name="unmarshaller" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
@@ -63,7 +65,7 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="transformerType">
|
||||
<xsd:extension base="inputOutputEndpoint">
|
||||
<xsd:attribute name="xsl-resource" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="xsl-templates" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="source-factory" type="xsd:string" use="optional" />
|
||||
@@ -142,28 +144,36 @@
|
||||
|
||||
<xsd:element name="xpath-splitter">
|
||||
<xsd:complexType>
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines an XPath splitter.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="xpath-expression" maxOccurs="1" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="xpath-expression-ref" type="xsd:string"
|
||||
use="optional" />
|
||||
<xsd:attribute name="doc-builder-factory" type="xsd:string"
|
||||
use="optional" />
|
||||
<xsd:attribute name="create-documents" type="xsd:boolean"
|
||||
use="optional" />
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="inputOutputEndpoint">
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="xpath-expression" maxOccurs="1" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="xpath-expression-ref" type="xsd:string"
|
||||
use="optional" />
|
||||
<xsd:attribute name="doc-builder-factory" type="xsd:string"
|
||||
use="optional" />
|
||||
<xsd:attribute name="create-documents" type="xsd:boolean"
|
||||
use="optional" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="transformerType">
|
||||
|
||||
|
||||
<xsd:complexType name="inputOutputEndpoint">
|
||||
<xsd:attribute name="id" type="xsd:string" use="optional" />
|
||||
<xsd:attribute name="input-channel" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="output-channel" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
|
||||
</xsd:schema>
|
||||
Reference in New Issue
Block a user