Renamed MethodInvokingSource to MethodInvokingMessageSource.

This commit is contained in:
Mark Fisher
2008-11-03 15:45:46 +00:00
parent 93585ce32a
commit 4b64978bdd
4 changed files with 13 additions and 13 deletions

View File

@@ -34,7 +34,7 @@ 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.MethodInvokingSource;
import org.springframework.integration.message.MethodInvokingMessageSource;
import org.springframework.integration.scheduling.IntervalTrigger;
import org.springframework.integration.scheduling.Trigger;
import org.springframework.util.Assert;
@@ -65,7 +65,7 @@ public class ChannelAdapterAnnotationPostProcessor implements MethodAnnotationPo
MessageChannel channel = this.resolveOrCreateChannel(annotation.value());
Poller pollerAnnotation = AnnotationUtils.findAnnotation(method, Poller.class);
if (method.getParameterTypes().length == 0 && hasReturnValue(method)) {
MethodInvokingSource source = new MethodInvokingSource();
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(bean);
source.setMethod(method);
endpoint = this.createInboundChannelAdapter(source, channel, pollerAnnotation);
@@ -99,7 +99,7 @@ public class ChannelAdapterAnnotationPostProcessor implements MethodAnnotationPo
}
}
private SourcePollingChannelAdapter createInboundChannelAdapter(MethodInvokingSource source, MessageChannel channel, Poller pollerAnnotation) {
private SourcePollingChannelAdapter createInboundChannelAdapter(MethodInvokingMessageSource source, MessageChannel channel, Poller pollerAnnotation) {
Assert.notNull(pollerAnnotation, "The @Poller annotation is required (at method-level) "
+ "when using the @ChannelAdapter annotation with a no-arg method.");
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter();

View File

@@ -21,7 +21,7 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.message.MethodInvokingSource;
import org.springframework.integration.message.MethodInvokingMessageSource;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -38,7 +38,7 @@ public class MethodInvokingInboundChannelAdapterParser extends AbstractPollingIn
Assert.hasText(sourceRef, "The 'ref' attribute is required.");
String methodName = element.getAttribute("method");
if (StringUtils.hasText(methodName)) {
BeanDefinitionBuilder invokerBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodInvokingSource.class);
BeanDefinitionBuilder invokerBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodInvokingMessageSource.class);
invokerBuilder.addPropertyReference("object", sourceRef);
invokerBuilder.addPropertyValue("methodName", methodName);
sourceRef = BeanDefinitionReaderUtils.registerWithGeneratedName(

View File

@@ -29,12 +29,12 @@ import org.springframework.integration.util.NameResolvingMethodInvoker;
import org.springframework.util.Assert;
/**
* A pollable source that invokes a no-argument method so that its return value
* may be sent to a channel.
* A {@link MessageSource} implementation that invokes a no-argument method so
* that its return value may be sent to a channel.
*
* @author Mark Fisher
*/
public class MethodInvokingSource implements MessageSource<Object>, InitializingBean {
public class MethodInvokingMessageSource implements MessageSource<Object>, InitializingBean {
private volatile Object object;

View File

@@ -23,7 +23,7 @@ import org.junit.Test;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.message.MethodInvokingSource;
import org.springframework.integration.message.MethodInvokingMessageSource;
/**
* @author Mark Fisher
@@ -32,7 +32,7 @@ public class MethodInvokingSourceTests {
@Test
public void testValidMethod() {
MethodInvokingSource source = new MethodInvokingSource();
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(new TestBean());
source.setMethodName("validMethod");
Message<?> result = source.receive();
@@ -43,7 +43,7 @@ public class MethodInvokingSourceTests {
@Test(expected=MessagingException.class)
public void testNoMatchingMethodName() {
MethodInvokingSource source = new MethodInvokingSource();
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(new TestBean());
source.setMethodName("noMatchingMethod");
source.receive();
@@ -51,7 +51,7 @@ public class MethodInvokingSourceTests {
@Test(expected=MessagingException.class)
public void testInvalidMethodWithArg() {
MethodInvokingSource source = new MethodInvokingSource();
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(new TestBean());
source.setMethodName("invalidMethodWithArg");
source.receive();
@@ -59,7 +59,7 @@ public class MethodInvokingSourceTests {
@Test(expected=MessagingException.class)
public void testInvalidMethodWithNoReturnValue() {
MethodInvokingSource source = new MethodInvokingSource();
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(new TestBean());
source.setMethodName("invalidMethodWithNoReturnValue");
source.receive();