From 447355be03b3605eb988a4088063570def93ef72 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Tue, 4 May 2010 15:28:11 +0000 Subject: [PATCH] INT-1076 The element no longer accepts an 'ignore-channel-name-resolution-failures' attribute. --- .../config/xml/AbstractRouterParser.java | 2 +- ...ractChannelNameResolvingMessageRouter.java | 22 +++++-- .../config/xml/spring-integration-2.0.xsd | 63 +++++++++++-------- .../config/PayloadTypeRouterParserTests.java | 10 +-- 4 files changed, 61 insertions(+), 36 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractRouterParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractRouterParser.java index 4a9407028e..45f6d9d181 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractRouterParser.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractRouterParser.java @@ -35,9 +35,9 @@ public abstract class AbstractRouterParser extends AbstractConsumerEndpointParse IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "default-output-channel"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "timeout"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "resolution-required"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-channel-name-resolution-failures"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "apply-sequence"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-send-failures"); + IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-channel-name-resolution-failures"); this.parseRouter(element, builder, parserContext); return builder; } diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java index a807f44f86..d69e153e33 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/AbstractChannelNameResolvingMessageRouter.java @@ -47,18 +47,32 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract private volatile boolean ignoreChannelNameResolutionFailures; + /** + * Specify the {@link ChannelResolver} strategy to use. + * The default is a BeanFactoryChannelResolver. + */ public void setChannelResolver(ChannelResolver channelResolver) { super.setChannelResolver(channelResolver); } + /** + * Specify a prefix to be added to each channel name prior to resolution. + */ public void setPrefix(String prefix) { this.prefix = prefix; } + /** + * Specify a suffix to be added to each channel name prior to resolution. + */ public void setSuffix(String suffix) { this.suffix = suffix; } + /** + * Specify whether this router should ignore any failure to resolve a channel name to + * an actual MessageChannel instance when delegating to the ChannelResolver strategy. + */ public void setIgnoreChannelNameResolutionFailures(boolean ignoreChannelNameResolutionFailures) { this.ignoreChannelNameResolutionFailures = ignoreChannelNameResolutionFailures; } @@ -69,7 +83,7 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract "either a ChannelResolver or BeanFactory is required"); } - protected MessageChannel resolveChannelForName(String channelName, Message message) { + private MessageChannel resolveChannelForName(String channelName, Message message) { Assert.state(this.getChannelResolver() != null, "unable to resolve channel names, no ChannelResolver available"); @@ -98,8 +112,8 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract return channels; } - - protected void addToCollection(Collection channels, Collection channelIndicators, Message message) { + @SuppressWarnings("unchecked") + private void addToCollection(Collection channels, Collection channelIndicators, Message message) { if (channelIndicators == null) { return; } @@ -135,7 +149,7 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract } } - protected void addChannelFromString(Collection channels, String channelName, Message message) { + private void addChannelFromString(Collection channels, String channelName, Message message) { if (channelName.indexOf(',') != -1) { for (String name : StringUtils.commaDelimitedListToStringArray(channelName)) { addChannelFromString(channels, name, message); diff --git a/org.springframework.integration/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd b/org.springframework.integration/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd index 0143b2bcd0..d6bcc7be0d 100644 --- a/org.springframework.integration/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd +++ b/org.springframework.integration/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd @@ -1383,7 +1383,7 @@ - + @@ -1438,8 +1438,6 @@ - - @@ -1486,7 +1484,7 @@ - + @@ -1530,6 +1528,20 @@ + + + + + + + Specify whether a failure to resolve a channel name returned by this router should be ignored. + + + + + + + @@ -1540,6 +1552,12 @@ + + Reference to the default channel where Messages should be sent if channel + resolution fails to return any channels. If no default channel is + provided, the router will either drop the Message or throw an Exception + depending on the value of the "resolution-required" attribute. + @@ -1550,28 +1568,6 @@ - - - - Specify whether a failure to resolve a channel name returned by this router should be ignored. - - - - - - - Specify whether a failure to send to a single channel should be ignored. - Otherwise MessageDeliveryExceptions will be thrown. - - - - - - - Specify whether sequence number and size headers should be added to each Message. - - - @@ -1587,6 +1583,21 @@ + + + + Specify whether a failure to send to a single channel should be ignored. + Otherwise MessageDeliveryExceptions will be thrown. + + + + + + + Specify whether sequence number and size headers should be added to each Message. + + + diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java index 7af18601c6..99df728582 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -84,9 +84,9 @@ public class PayloadTypeRouterParserTests { "" + + " http://www.springframework.org/schema/integration/spring-integration.xsd\">" + " " + " " + " " + @@ -98,9 +98,9 @@ public class PayloadTypeRouterParserTests { "" + + " http://www.springframework.org/schema/integration/spring-integration.xsd\">" + " " + " " + "";