AbstractEndpoint no longer implements ChannelRegistryAware. AbstractMessageHandlingEndpoint and RouterEndpoint do.

This commit is contained in:
Mark Fisher
2008-10-02 00:56:05 +00:00
parent 64158f454e
commit c24df55e06
3 changed files with 12 additions and 20 deletions

View File

@@ -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;
}

View File

@@ -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 {

View File

@@ -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);
}