INT-697 Adjusted schema for recipient-list-router attributes.

This commit is contained in:
Mark Fisher
2009-07-02 00:49:38 +00:00
parent 6817d053d9
commit f285f5ffe0
2 changed files with 22 additions and 13 deletions

View File

@@ -13,17 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.config.xml;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.util.Assert;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
/**
* Parser for the <recipient-list-router/> element.
@@ -34,13 +36,13 @@ import org.w3c.dom.Element;
public class RecipientListRouterParser extends AbstractConsumerEndpointParser {
@Override
@SuppressWarnings("unchecked")
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder recipientListRouterBuilder = BeanDefinitionBuilder.genericBeanDefinition(
IntegrationNamespaceUtils.BASE_PACKAGE + ".router.RecipientListRouter");
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "recipient");
Assert.notEmpty(childElements,
"Recipient channel(s) must be defined (e.g., <recipient channel=\"channel1\"/>)");
"At least one recipient channel must be defined (e.g., <recipient channel=\"channel1\"/>).");
ManagedList channelList = new ManagedList();
for (Element childElement : childElements) {
channelList.add(new RuntimeBeanReference(childElement.getAttribute("channel")));

View File

@@ -863,7 +863,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="routerType">
<xsd:extension base="channelResolvingRouterType">
<xsd:sequence>
<xsd:element name="mapping" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
@@ -892,7 +892,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="routerType">
<xsd:extension base="baseRouterType">
<xsd:sequence>
<xsd:element name="recipient" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
@@ -900,6 +900,8 @@
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="ignore-send-failures" type="xsd:string"/>
<xsd:attribute name="apply-sequence" type="xsd:string"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -914,7 +916,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="routerType">
<xsd:extension base="channelResolvingRouterType">
<xsd:sequence>
<xsd:element name="mapping" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
@@ -937,7 +939,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="routerType">
<xsd:extension base="channelResolvingRouterType">
<xsd:choice>
<xsd:element ref="beans:bean" minOccurs="0" maxOccurs="1" />
</xsd:choice>
@@ -968,12 +970,11 @@
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="routerType">
<xsd:complexType name="channelResolvingRouterType">
<xsd:complexContent>
<xsd:extension base="inputEndpointType">
<xsd:extension base="baseRouterType">
<xsd:attribute name="default-output-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
@@ -984,10 +985,16 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="timeout" type="xsd:string" />
<xsd:attribute name="resolution-required" type="xsd:string" />
<xsd:attribute name="ignore-channel-name-resolution-failures"
type="xsd:string" />
<xsd:attribute name="ignore-channel-name-resolution-failures" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="baseRouterType">
<xsd:complexContent>
<xsd:extension base="inputEndpointType">
<xsd:attribute name="timeout" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>