diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java
index c2cb6837d6..cbf333ed96 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * 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.
@@ -24,8 +24,7 @@ import java.lang.annotation.Target;
/**
* Indicates that a method is capable of splitting a single message or message
- * payload to produce multiple messages which are then sent to the channel whose
- * name is provided with the 'channel' attribute.
+ * payload to produce multiple messages or payloads.
*
* @author Mark Fisher
*/
@@ -35,6 +34,4 @@ import java.lang.annotation.Target;
@Handler
public @interface Splitter {
- String channel();
-
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/AggregatorParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/AggregatorParser.java
index 1a318e040c..a88b420b68 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/AggregatorParser.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/AggregatorParser.java
@@ -16,6 +16,9 @@
package org.springframework.integration.config;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
@@ -27,8 +30,6 @@ import org.springframework.integration.router.AggregatingMessageHandler;
import org.springframework.integration.router.AggregatorAdapter;
import org.springframework.integration.router.CompletionStrategyAdapter;
import org.springframework.util.StringUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
/**
* Parser for the aggregator element of the integration namespace.
@@ -80,6 +81,7 @@ public class AggregatorParser implements BeanDefinitionParser {
public static final String COMPLETION_STRATEGY_ELEMENT = "completion-strategy";
+
public BeanDefinition parse(Element element, ParserContext parserContext) {
return parseAggregatorElement(element, parserContext, true);
}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/MessageEndpointAnnotationPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/MessageEndpointAnnotationPostProcessor.java
index 35062f1b95..8b18198c50 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/MessageEndpointAnnotationPostProcessor.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/MessageEndpointAnnotationPostProcessor.java
@@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
@@ -52,6 +53,7 @@ import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.SimpleChannel;
import org.springframework.integration.endpoint.ConcurrencyPolicy;
import org.springframework.integration.endpoint.DefaultMessageEndpoint;
+import org.springframework.integration.handler.AbstractMessageHandlerAdapter;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.handler.MessageHandlerChain;
import org.springframework.integration.handler.config.DefaultMessageHandlerCreator;
@@ -83,11 +85,13 @@ public class MessageEndpointAnnotationPostProcessor implements BeanPostProcessor
private final MessageBus messageBus;
+
public MessageEndpointAnnotationPostProcessor(MessageBus messageBus) {
Assert.notNull(messageBus, "'messageBus' must not be null");
this.messageBus = messageBus;
}
+
public void setCustomHandlerCreators(Map, MessageHandlerCreator> customHandlerCreators) {
for (Map.Entry, MessageHandlerCreator> entry : customHandlerCreators.entrySet()) {
this.handlerCreators.put(entry.getKey(), entry.getValue());
@@ -114,10 +118,16 @@ public class MessageEndpointAnnotationPostProcessor implements BeanPostProcessor
if (bean instanceof ChannelRegistryAware) {
((ChannelRegistryAware) bean).setChannelRegistry(this.messageBus);
}
- MessageHandlerChain handlerChain = this.createHandlerChain(bean);
+ String defaultOutputChannelName = endpointAnnotation.defaultOutput();
+ MessageHandlerChain handlerChain = this.createHandlerChain(bean, defaultOutputChannelName);
DefaultMessageEndpoint endpoint = new DefaultMessageEndpoint(handlerChain);
this.configureInput(bean, beanName, endpointAnnotation, endpoint);
- this.configureDefaultOutput(bean, beanName, endpointAnnotation, endpoint);
+ if (StringUtils.hasText(defaultOutputChannelName)) {
+ endpoint.setDefaultOutputChannelName(defaultOutputChannelName);
+ }
+ else {
+ this.configureDefaultOutput(bean, beanName, endpoint);
+ }
Concurrency concurrencyAnnotation = AnnotationUtils.findAnnotation(beanClass, Concurrency.class);
if (concurrencyAnnotation != null) {
ConcurrencyPolicy concurrencyPolicy = new ConcurrencyPolicy(concurrencyAnnotation.coreSize(),
@@ -173,16 +183,9 @@ public class MessageEndpointAnnotationPostProcessor implements BeanPostProcessor
});
}
- private void configureDefaultOutput(final Object bean, final String beanName, final MessageEndpoint annotation,
- final DefaultMessageEndpoint endpoint) {
- String channelName = annotation.defaultOutput();
- if (StringUtils.hasText(channelName)) {
- endpoint.setDefaultOutputChannelName(channelName);
- return;
- }
+ private void configureDefaultOutput(final Object bean, final String beanName, final DefaultMessageEndpoint endpoint) {
ReflectionUtils.doWithMethods(this.getBeanClass(bean), new ReflectionUtils.MethodCallback() {
boolean foundDefaultOutput = false;
-
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.getAnnotation(method, DefaultOutput.class);
if (annotation != null) {
@@ -246,14 +249,15 @@ public class MessageEndpointAnnotationPostProcessor implements BeanPostProcessor
}
@SuppressWarnings("unchecked")
- private MessageHandlerChain createHandlerChain(final Object bean) {
+ private MessageHandlerChain createHandlerChain(final Object bean, final String defaultOutputChannelName) {
final List handlers = new ArrayList();
ReflectionUtils.doWithMethods(this.getBeanClass(bean), new ReflectionUtils.MethodCallback() {
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
Annotation[] annotations = AnnotationUtils.getAnnotations(method);
for (Annotation annotation : annotations) {
if (isHandlerAnnotation(annotation)) {
- Map attributes = AnnotationUtils.getAnnotationAttributes(annotation);
+ Map attributes = AnnotationUtils.getAnnotationAttributes(annotation);
+ attributes.put(AbstractMessageHandlerAdapter.DEFAULT_OUTPUT_CHANNEL_NAME_KEY, defaultOutputChannelName);
MessageHandlerCreator handlerCreator = handlerCreators.get(annotation.annotationType());
if (handlerCreator == null) {
if (logger.isWarnEnabled()) {
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd b/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
index 8e55b36a0e..3f9bb45240 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
+++ b/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
@@ -240,7 +240,7 @@
-
+
@@ -252,12 +252,12 @@
-
+
- Defines a completion strategy.
+ Defines a completion strategy.
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java
index 9ffe276448..23c0f17957 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java
@@ -39,6 +39,9 @@ import org.springframework.util.Assert;
*/
public abstract class AbstractMessageHandlerAdapter implements MessageHandler, Ordered, InitializingBean {
+ public static final String DEFAULT_OUTPUT_CHANNEL_NAME_KEY = "defaultOutputChannelName";
+
+
protected final Log logger = LogFactory.getLog(this.getClass());
private volatile T object;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java
index 428473c4bc..d6460a2d92 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java
@@ -33,6 +33,7 @@ public class MessageHandlerChain implements MessageHandler {
private final List handlers = new CopyOnWriteArrayList();
+
/**
* Add a handler to the end of the chain.
*/
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/router/AggregatorAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/router/AggregatorAdapter.java
index de89f84aa1..1cdcc6c4a7 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/router/AggregatorAdapter.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/router/AggregatorAdapter.java
@@ -38,7 +38,7 @@ import org.springframework.util.ReflectionUtils;
* @author Marius Bogoevici
* @author Mark Fisher
*/
-public class AggregatorAdapter extends MessageListMethodAdapter implements Aggregator {
+public class AggregatorAdapter extends MessageListMethodAdapter implements Aggregator {
public AggregatorAdapter(Object object, Method method) {
super(object, method);
@@ -48,6 +48,7 @@ public class AggregatorAdapter extends MessageListMethodAdapter implements Aggr
super(object, methodName);
}
+
public Message> aggregate(List> messages) {
Object returnedValue = this.executeMethod(messages);
if (returnedValue == null) {
@@ -59,6 +60,4 @@ public class AggregatorAdapter extends MessageListMethodAdapter implements Aggr
return new GenericMessage