diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java
index ed8fb5fdfa..793bd25b76 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java
@@ -70,6 +70,7 @@ public class IntegrationNamespaceHandler extends NamespaceHandlerSupport {
registerBeanDefinitionParser("gateway", new GatewayParser());
registerBeanDefinitionParser("handler", new HandlerParser());
registerBeanDefinitionParser("handler-chain", new HandlerParser());
+ registerBeanDefinitionParser("selector-chain", new SelectorChainParser());
registerBeanDefinitionParser("router", new RouterParser());
registerBeanDefinitionParser("splitter", new SplitterParser());
registerBeanDefinitionParser("aggregator", new AggregatorParser());
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/SelectorChainParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/SelectorChainParser.java
new file mode 100644
index 0000000000..3ae37b3230
--- /dev/null
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/SelectorChainParser.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.config;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+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.AbstractSingleBeanDefinitionParser;
+import org.springframework.integration.message.selector.MessageSelectorChain;
+
+/**
+ * Parser for the <selector-chain/> element.
+ *
+ * @author Mark Fisher
+ */
+public class SelectorChainParser extends AbstractSingleBeanDefinitionParser {
+
+ @Override
+ protected Class> getBeanClass(Element element) {
+ return MessageSelectorChain.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void doParse(Element element, BeanDefinitionBuilder builder) {
+ ManagedList selectors = new ManagedList();
+ NodeList childNodes = element.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node child = childNodes.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE && "selector".equals(child.getLocalName())) {
+ selectors.add(new RuntimeBeanReference(((Element) child).getAttribute("ref")));
+ }
+ }
+ builder.addPropertyValue("selectors", selectors);
+ }
+
+}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd b/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
index cd396eb888..38dd12aa88 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
@@ -255,7 +255,7 @@
- Defines a handler.
+ Defines a MessageHandler.
@@ -264,6 +264,31 @@
+
+
+
+
+ Defines a MessageSelector chain.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Provides a MessageSelector reference.
+
+
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java
new file mode 100644
index 0000000000..0f812e9df4
--- /dev/null
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/SelectorChainParserTests.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.config;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import org.springframework.beans.DirectFieldAccessor;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.message.selector.MessageSelector;
+import org.springframework.integration.message.selector.MessageSelectorChain;
+
+/**
+ * @author Mark Fisher
+ */
+public class SelectorChainParserTests {
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testSelectorChain() {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "selectorChainParserTests.xml", this.getClass());
+ MessageSelector selector1 = (MessageSelector) context.getBean("selector1");
+ MessageSelector selector2 = (MessageSelector) context.getBean("selector2");
+ MessageSelectorChain chain = (MessageSelectorChain) context.getBean("selectorChain");
+ DirectFieldAccessor accessor = new DirectFieldAccessor(chain);
+ List selectors = (List)
+ accessor.getPropertyValue("selectors");
+ assertEquals(selector1, selectors.get(0));
+ assertEquals(selector2, selectors.get(1));
+ }
+
+}
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/StubMessageSelector.java b/org.springframework.integration/src/test/java/org/springframework/integration/config/StubMessageSelector.java
new file mode 100644
index 0000000000..b625949019
--- /dev/null
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/StubMessageSelector.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.config;
+
+import org.springframework.integration.message.Message;
+import org.springframework.integration.message.selector.MessageSelector;
+
+/**
+ * @author Mark Fisher
+ */
+public class StubMessageSelector implements MessageSelector {
+
+ public boolean accept(Message> message) {
+ return true;
+ }
+
+}
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/selectorChainParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/selectorChainParserTests.xml
new file mode 100644
index 0000000000..681db829c2
--- /dev/null
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/selectorChainParserTests.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+