From c24df55e06bd93f2b39951e76575b2e2b96c728d Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 2 Oct 2008 00:56:05 +0000 Subject: [PATCH] AbstractEndpoint no longer implements ChannelRegistryAware. AbstractMessageHandlingEndpoint and RouterEndpoint do. --- .../integration/endpoint/AbstractEndpoint.java | 14 +------------- .../endpoint/AbstractMessageHandlingEndpoint.java | 14 ++++++++++---- .../integration/router/RouterEndpoint.java | 4 +--- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java index ace23d21b6..8c8691c7bc 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractEndpoint.java @@ -22,8 +22,6 @@ import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; import org.springframework.integration.ConfigurationException; -import org.springframework.integration.channel.ChannelRegistry; -import org.springframework.integration.channel.ChannelRegistryAware; import org.springframework.integration.channel.MessageChannelTemplate; import org.springframework.integration.message.MessagingException; import org.springframework.integration.scheduling.TaskScheduler; @@ -37,14 +35,12 @@ import org.springframework.transaction.TransactionDefinition; * * @author Mark Fisher */ -public abstract class AbstractEndpoint implements MessageEndpoint, ChannelRegistryAware, TaskSchedulerAware, BeanNameAware, InitializingBean { +public abstract class AbstractEndpoint implements MessageEndpoint, TaskSchedulerAware, BeanNameAware, InitializingBean { protected final Log logger = LogFactory.getLog(this.getClass()); private volatile String name; - private volatile ChannelRegistry channelRegistry; - private volatile TaskScheduler taskScheduler; private volatile PlatformTransactionManager transactionManager; @@ -67,14 +63,6 @@ public abstract class AbstractEndpoint implements MessageEndpoint, ChannelRegist this.name = name; } - protected ChannelRegistry getChannelRegistry() { - return this.channelRegistry; - } - - public void setChannelRegistry(ChannelRegistry channelRegistry) { - this.channelRegistry = channelRegistry; - } - protected TaskScheduler getTaskScheduler() { return this.taskScheduler; } diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageHandlingEndpoint.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageHandlingEndpoint.java index 63e423f430..7de6944d21 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageHandlingEndpoint.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageHandlingEndpoint.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import org.springframework.integration.channel.ChannelRegistry; +import org.springframework.integration.channel.ChannelRegistryAware; import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.message.CompositeMessage; import org.springframework.integration.message.Message; @@ -34,10 +35,12 @@ import org.springframework.integration.message.selector.MessageSelector; /** * @author Mark Fisher */ -public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageConsumingEndpoint { +public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageConsumingEndpoint implements ChannelRegistryAware { private MessageChannel outputChannel; + private volatile ChannelRegistry channelRegistry; + private volatile MessageSelector selector; private volatile boolean requiresReply = false; @@ -53,6 +56,10 @@ public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageCon return this.outputChannel; } + public void setChannelRegistry(ChannelRegistry channelRegistry) { + this.channelRegistry = channelRegistry; + } + public void setSelector(MessageSelector selector) { this.selector = selector; } @@ -174,9 +181,8 @@ public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageCon replyChannel = (MessageChannel) returnAddress; } else if (returnAddress instanceof String) { - ChannelRegistry channelRegistry = this.getChannelRegistry(); - if (channelRegistry != null) { - replyChannel = channelRegistry.lookupChannel((String) returnAddress); + if (this.channelRegistry != null) { + replyChannel = this.channelRegistry.lookupChannel((String) returnAddress); } } else { diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/RouterEndpoint.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/RouterEndpoint.java index 08c870e7af..56521ac4cb 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/router/RouterEndpoint.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/RouterEndpoint.java @@ -29,7 +29,7 @@ import org.springframework.util.Assert; /** * @author Mark Fisher */ -public class RouterEndpoint extends AbstractMessageConsumingEndpoint { +public class RouterEndpoint extends AbstractMessageConsumingEndpoint implements ChannelRegistryAware { private final ChannelResolver channelResolver; @@ -44,9 +44,7 @@ public class RouterEndpoint extends AbstractMessageConsumingEndpoint { } - @Override public void setChannelRegistry(ChannelRegistry channelRegistry) { - super.setChannelRegistry(channelRegistry); if (this.channelResolver instanceof ChannelRegistryAware) { ((ChannelRegistryAware) this.channelResolver).setChannelRegistry(channelRegistry); }