Removed the MessageEndpoint interface (it defined no methods). AbstractEndpoint is still the base class for all Message-producing and Message-consuming components.

This commit is contained in:
Mark Fisher
2008-11-13 02:15:25 +00:00
parent 0da19e9b66
commit f5cc9b3591
8 changed files with 17 additions and 44 deletions

View File

@@ -17,11 +17,10 @@
package org.springframework.integration.channel;
import org.springframework.integration.dispatcher.SimpleDispatcher;
import org.springframework.integration.endpoint.MessageEndpoint;
/**
* A channel that invokes the subscribed {@link MessageEndpoint endpoint(s)}
* in the sender's thread (returning after at most one accepts the message).
* A channel that invokes a single subscriber for each sent Message.
* The invocation will occur in the sender's thread.
*
* @author Dave Syer
* @author Mark Fisher

View File

@@ -29,7 +29,7 @@ import org.springframework.integration.channel.ChannelResolver;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.message.MessageHandler;
@@ -61,7 +61,7 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
public Object postProcess(Object bean, String beanName, Method method, T annotation) {
MessageHandler handler = this.createHandler(bean, method, annotation);
Poller pollerAnnotation = AnnotationUtils.findAnnotation(method, Poller.class);
MessageEndpoint endpoint = this.createEndpoint(handler, annotation, pollerAnnotation);
AbstractEndpoint endpoint = this.createEndpoint(handler, annotation, pollerAnnotation);
if (endpoint != null) {
return endpoint;
}
@@ -72,8 +72,8 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
return (StringUtils.hasText((String) AnnotationUtils.getValue(annotation, INPUT_CHANNEL_ATTRIBUTE)));
}
private MessageEndpoint createEndpoint(MessageHandler handler, T annotation, Poller pollerAnnotation) {
MessageEndpoint endpoint = null;
private AbstractEndpoint createEndpoint(MessageHandler handler, T annotation, Poller pollerAnnotation) {
AbstractEndpoint endpoint = null;
String inputChannelName = (String) AnnotationUtils.getValue(annotation, INPUT_CHANNEL_ATTRIBUTE);
if (StringUtils.hasText(inputChannelName)) {
MessageChannel inputChannel = this.channelResolver.resolveChannelName(inputChannelName);

View File

@@ -32,10 +32,10 @@ import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.SubscribableChannel;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.handler.MethodInvokingMessageHandler;
import org.springframework.integration.message.MethodInvokingMessageSource;
import org.springframework.integration.scheduling.IntervalTrigger;
@@ -64,7 +64,7 @@ public class ChannelAdapterAnnotationPostProcessor implements MethodAnnotationPo
public Object postProcess(Object bean, String beanName, Method method, ChannelAdapter annotation) {
Assert.notNull(this.beanFactory, "BeanFactory must not be null");
MessageEndpoint endpoint = null;
AbstractEndpoint endpoint = null;
MessageChannel channel = this.resolveOrCreateChannel(annotation.value());
Poller pollerAnnotation = AnnotationUtils.findAnnotation(method, Poller.class);
if (method.getParameterTypes().length == 0 && hasReturnValue(method)) {
@@ -125,7 +125,7 @@ public class ChannelAdapterAnnotationPostProcessor implements MethodAnnotationPo
return adapter;
}
private MessageEndpoint createOutboundChannelAdapter(MessageChannel channel, MethodInvokingMessageHandler handler, Poller pollerAnnotation) {
private AbstractEndpoint createOutboundChannelAdapter(MessageChannel channel, MethodInvokingMessageHandler handler, Poller pollerAnnotation) {
if (channel instanceof PollableChannel) {
Trigger trigger = (pollerAnnotation != null)
? AnnotationConfigUtils.parseTriggerFromPollerAnnotation(pollerAnnotation)

View File

@@ -44,7 +44,7 @@ import org.springframework.integration.annotation.Router;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.annotation.Splitter;
import org.springframework.integration.annotation.Transformer;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -104,7 +104,7 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Bean
MethodAnnotationPostProcessor postProcessor = postProcessors.get(annotation.annotationType());
if (postProcessor != null && shouldCreateEndpoint(annotation)) {
Object result = postProcessor.postProcess(bean, beanName, method, annotation);
if (result != null && result instanceof MessageEndpoint) {
if (result != null && result instanceof AbstractEndpoint) {
String endpointBeanName = generateBeanName(beanName, method, annotation.annotationType());
if (result instanceof BeanNameAware) {
((BeanNameAware) result).setBeanName(endpointBeanName);

View File

@@ -31,7 +31,7 @@ import org.springframework.util.Assert;
*
* @author Mark Fisher
*/
public abstract class AbstractEndpoint extends LifecycleSupport implements MessageEndpoint, BeanNameAware, BeanFactoryAware {
public abstract class AbstractEndpoint extends LifecycleSupport implements BeanNameAware, BeanFactoryAware {
private volatile String beanName;

View File

@@ -1,26 +0,0 @@
/*
* 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.endpoint;
/**
* Base interface for Message Endpoints.
*
* @author Mark Fisher
*/
public interface MessageEndpoint {
}

View File

@@ -24,7 +24,6 @@ import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.MessageEndpoint;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
@@ -52,7 +51,7 @@ public abstract class AbstractMessagingGateway extends AbstractEndpoint implemen
private volatile boolean shouldThrowErrors = true;
private volatile MessageEndpoint replyMessageCorrelator;
private volatile AbstractEndpoint replyMessageCorrelator;
private final Object replyMessageCorrelatorMonitor = new Object();
@@ -165,7 +164,7 @@ public abstract class AbstractMessagingGateway extends AbstractEndpoint implemen
if (this.replyMessageCorrelator != null) {
return;
}
MessageEndpoint correlator = null;
AbstractEndpoint correlator = null;
MessageHandler handler = new AbstractReplyProducingMessageHandler() {
@Override
protected void handleRequestMessage(Message<?> message, ReplyMessageHolder replyHolder) {

View File

@@ -42,6 +42,7 @@ import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.MessageHandler;
@@ -68,7 +69,7 @@ public class MessagingAnnotationPostProcessorTests {
postProcessor.postProcessAfterInitialization(bean, "testBean");
assertTrue(context.containsBean("testBean.test.serviceActivator"));
Object endpoint = context.getBean("testBean.test.serviceActivator");
assertTrue(endpoint instanceof org.springframework.integration.endpoint.MessageEndpoint);
assertTrue(endpoint instanceof AbstractEndpoint);
}
@Test