MessageMappingMethodInvoker is now MethodInvokingMessageProcessor since it implements the MessageProcessor interface and is a parallel implementation to ExpressionEvaluatingMessageProcessor.
This commit is contained in:
@@ -19,7 +19,7 @@ package org.springframework.integration.aggregator;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -29,11 +29,11 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class CorrelationStrategyAdapter implements CorrelationStrategy {
|
||||
|
||||
private final MessageMappingMethodInvoker invoker;
|
||||
private final MethodInvokingMessageProcessor processor;
|
||||
|
||||
|
||||
public CorrelationStrategyAdapter(Object object, String methodName) {
|
||||
this.invoker = new MessageMappingMethodInvoker(object, methodName, true);
|
||||
this.processor = new MethodInvokingMessageProcessor(object, methodName, true);
|
||||
}
|
||||
|
||||
public CorrelationStrategyAdapter(Object object, Method method) {
|
||||
@@ -41,11 +41,11 @@ public class CorrelationStrategyAdapter implements CorrelationStrategy {
|
||||
Assert.notNull(method, "'method' must not be null");
|
||||
Assert.isTrue(method.getParameterTypes().length == 1, "Method must accept exactly one parameter");
|
||||
Assert.isTrue(!Void.TYPE.equals(method.getReturnType()), "Method return type must not be void");
|
||||
this.invoker = new MessageMappingMethodInvoker(object, method);
|
||||
this.processor = new MethodInvokingMessageProcessor(object, method);
|
||||
}
|
||||
|
||||
public Object getCorrelationKey(Message<?> message) {
|
||||
return invoker.processMessage(message);
|
||||
return processor.processMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.integration.config;
|
||||
|
||||
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
|
||||
import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.integration.transformer.MessageTransformingHandler;
|
||||
@@ -41,11 +41,11 @@ public class TransformerFactoryBean extends AbstractMessageHandlerFactoryBean {
|
||||
transformer = (Transformer) targetObject;
|
||||
}
|
||||
else if (StringUtils.hasText(targetMethodName)) {
|
||||
MessageProcessor messageProcessor = new MessageMappingMethodInvoker(targetObject, targetMethodName);
|
||||
MessageProcessor messageProcessor = new MethodInvokingMessageProcessor(targetObject, targetMethodName);
|
||||
transformer = new MessageProcessingTransformer(messageProcessor);
|
||||
}
|
||||
else {
|
||||
MessageProcessor messageProcessor = new MessageMappingMethodInvoker(
|
||||
MessageProcessor messageProcessor = new MethodInvokingMessageProcessor(
|
||||
targetObject, org.springframework.integration.annotation.Transformer.class);
|
||||
transformer = new MessageProcessingTransformer(messageProcessor);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.integration.annotation.Transformer;
|
||||
import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
import org.springframework.integration.transformer.MessageProcessingTransformer;
|
||||
@@ -41,7 +41,7 @@ public class TransformerAnnotationPostProcessor extends AbstractMethodAnnotation
|
||||
|
||||
@Override
|
||||
protected MessageHandler createHandler(Object bean, Method method, Transformer annotation) {
|
||||
MessageProcessor messageProcessor = new MessageMappingMethodInvoker(bean, method);
|
||||
MessageProcessor messageProcessor = new MethodInvokingMessageProcessor(bean, method);
|
||||
MessageProcessingTransformer transformer = new MessageProcessingTransformer(messageProcessor);
|
||||
MessageTransformingHandler handler = new MessageTransformingHandler(transformer);
|
||||
String outputChannelName = annotation.outputChannel();
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.filter;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
import org.springframework.integration.selector.MessageSelector;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
|
||||
public class MethodInvokingSelector extends AbstractMessageProcessingSelector {
|
||||
|
||||
public MethodInvokingSelector(Object object, Method method) {
|
||||
super(new MessageMappingMethodInvoker(object, method));
|
||||
super(new MethodInvokingMessageProcessor(object, method));
|
||||
Class<?> returnType = method.getReturnType();
|
||||
Assert.isTrue(boolean.class.isAssignableFrom(returnType)
|
||||
|| Boolean.class.isAssignableFrom(returnType),
|
||||
@@ -38,7 +38,7 @@ public class MethodInvokingSelector extends AbstractMessageProcessingSelector {
|
||||
}
|
||||
|
||||
public MethodInvokingSelector(Object object, String methodName) {
|
||||
super(new MessageMappingMethodInvoker(object, methodName));
|
||||
super(new MethodInvokingMessageProcessor(object, methodName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -115,15 +115,15 @@ public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]
|
||||
this.payloadParameterMetadata = getPayloadParameterFrom(this.parameterMetadata);
|
||||
}
|
||||
|
||||
public Message<?> toMessage(Object[] parameters) {
|
||||
Assert.isTrue(!ObjectUtils.isEmpty(parameters), "parameter array is required");
|
||||
Assert.isTrue(parameters.length == this.parameterMetadata.length, "wrong number of parameters: expected "
|
||||
+ this.parameterMetadata.length + ", received " + parameters.length);
|
||||
public Message<?> toMessage(Object[] arguments) {
|
||||
Assert.isTrue(!ObjectUtils.isEmpty(arguments), "argument array is required");
|
||||
Assert.isTrue(arguments.length == this.parameterMetadata.length, "wrong number of arguments: expected "
|
||||
+ this.parameterMetadata.length + ", received " + arguments.length);
|
||||
Message<?> message = null;
|
||||
Object payload = null;
|
||||
Map<String, Object> headers = new HashMap<String, Object>();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
Object value = parameters[i];
|
||||
for (int i = 0; i < arguments.length; i++) {
|
||||
Object value = arguments[i];
|
||||
MethodParameterMetadata metadata = this.parameterMetadata[i];
|
||||
Header headerAnnotation = metadata.getHeaderAnnotation();
|
||||
if (metadata == payloadParameterMetadata) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class MethodInvokingMessageHandler extends MessageMappingMethodInvoker implements MessageHandler, Ordered {
|
||||
public class MethodInvokingMessageHandler extends MethodInvokingMessageProcessor implements MessageHandler, Ordered {
|
||||
|
||||
private volatile int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
* @see MethodParameterMessageMapper
|
||||
* @see ArgumentArrayMessageMapper
|
||||
*/
|
||||
public class MessageMappingMethodInvoker implements MessageProcessor {
|
||||
public class MethodInvokingMessageProcessor implements MessageProcessor {
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(MessageMappingMethodInvoker.class);
|
||||
protected static final Log logger = LogFactory.getLog(MethodInvokingMessageProcessor.class);
|
||||
|
||||
private volatile Object object;
|
||||
|
||||
@@ -66,25 +66,25 @@ public class MessageMappingMethodInvoker implements MessageProcessor {
|
||||
private final Set<Method> methodsExpectingMessage = new HashSet<Method>();
|
||||
|
||||
|
||||
public MessageMappingMethodInvoker(Object object, Method method) {
|
||||
public MethodInvokingMessageProcessor(Object object, Method method) {
|
||||
Assert.notNull(object, "object must not be null");
|
||||
Assert.notNull(method, "method must not be null");
|
||||
this.object = object;
|
||||
this.methodResolver = new StaticHandlerMethodResolver(method);
|
||||
}
|
||||
|
||||
public MessageMappingMethodInvoker(Object object, Class<? extends Annotation> annotationType) {
|
||||
public MethodInvokingMessageProcessor(Object object, Class<? extends Annotation> annotationType) {
|
||||
Assert.notNull(object, "object must not be null");
|
||||
Assert.notNull(annotationType, "annotation type must not be null");
|
||||
this.object = object;
|
||||
this.methodResolver = this.createResolverForAnnotation(annotationType);
|
||||
}
|
||||
|
||||
public MessageMappingMethodInvoker(Object object, String methodName) {
|
||||
public MethodInvokingMessageProcessor(Object object, String methodName) {
|
||||
this(object, methodName, false);
|
||||
}
|
||||
|
||||
public MessageMappingMethodInvoker(Object object, String methodName, boolean requiresReturnValue) {
|
||||
public MethodInvokingMessageProcessor(Object object, String methodName, boolean requiresReturnValue) {
|
||||
Assert.notNull(object, "object must not be null");
|
||||
Assert.notNull(methodName, "methodName must not be null");
|
||||
this.object = object;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -27,26 +27,26 @@ import org.springframework.integration.message.MessageHandlingException;
|
||||
*/
|
||||
public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
private final MessageMappingMethodInvoker invoker;
|
||||
private final MethodInvokingMessageProcessor processor;
|
||||
|
||||
|
||||
public ServiceActivatingHandler(final Object object) {
|
||||
this.invoker = new MessageMappingMethodInvoker(object, ServiceActivator.class);
|
||||
this.processor = new MethodInvokingMessageProcessor(object, ServiceActivator.class);
|
||||
}
|
||||
|
||||
public ServiceActivatingHandler(Object object, Method method) {
|
||||
this.invoker = new MessageMappingMethodInvoker(object, method);
|
||||
this.processor = new MethodInvokingMessageProcessor(object, method);
|
||||
}
|
||||
|
||||
public ServiceActivatingHandler(Object object, String methodName) {
|
||||
this.invoker = new MessageMappingMethodInvoker(object, methodName);
|
||||
this.processor = new MethodInvokingMessageProcessor(object, methodName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void handleRequestMessage(Message<?> message, ReplyMessageHolder replyHolder) {
|
||||
try {
|
||||
Object result = this.invoker.processMessage(message);
|
||||
Object result = this.processor.processMessage(message);
|
||||
if (result != null) {
|
||||
replyHolder.set(result);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandl
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ServiceActivator for [" + this.invoker + "]";
|
||||
return "ServiceActivator for [" + this.processor + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.integration.annotation.Router;
|
||||
import org.springframework.integration.channel.ChannelResolver;
|
||||
import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
|
||||
/**
|
||||
* A Message Router that invokes the specified method on the given object. The
|
||||
@@ -34,15 +34,15 @@ import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
public class MethodInvokingRouter extends AbstractMessageProcessingRouter {
|
||||
|
||||
public MethodInvokingRouter(Object object, Method method) {
|
||||
super(new MessageMappingMethodInvoker(object, method));
|
||||
super(new MethodInvokingMessageProcessor(object, method));
|
||||
}
|
||||
|
||||
public MethodInvokingRouter(Object object, String methodName) {
|
||||
super(new MessageMappingMethodInvoker(object, methodName));
|
||||
super(new MethodInvokingMessageProcessor(object, methodName));
|
||||
}
|
||||
|
||||
public MethodInvokingRouter(Object object) {
|
||||
super(new MessageMappingMethodInvoker(object, Router.class));
|
||||
super(new MethodInvokingMessageProcessor(object, Router.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.integration.splitter;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.integration.annotation.Splitter;
|
||||
import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
|
||||
/**
|
||||
* A Message Splitter implementation that invokes the specified method
|
||||
@@ -33,15 +33,15 @@ import org.springframework.integration.handler.MessageMappingMethodInvoker;
|
||||
public class MethodInvokingSplitter extends AbstractMessageProcessingSplitter {
|
||||
|
||||
public MethodInvokingSplitter(Object object, Method method) {
|
||||
super(new MessageMappingMethodInvoker(object, method));
|
||||
super(new MethodInvokingMessageProcessor(object, method));
|
||||
}
|
||||
|
||||
public MethodInvokingSplitter(Object object, String methodName) {
|
||||
super(new MessageMappingMethodInvoker(object, methodName));
|
||||
super(new MethodInvokingMessageProcessor(object, methodName));
|
||||
}
|
||||
|
||||
public MethodInvokingSplitter(Object object) {
|
||||
super(new MessageMappingMethodInvoker(object, Splitter.class));
|
||||
super(new MethodInvokingMessageProcessor(object, Splitter.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user