INT-642 review

This commit is contained in:
Mark Fisher
2009-06-15 17:59:42 +00:00
parent 1ed45c6c9a
commit c668ab8366
3 changed files with 19 additions and 16 deletions

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.integration.aggregator; package org.springframework.integration.aggregator;
import java.util.ArrayList; import java.util.ArrayList;
@@ -28,10 +29,11 @@ import org.springframework.integration.message.MessageBuilder;
* is ignored except the <code>correlationId</code>. * is ignored except the <code>correlationId</code>.
* *
* <p> * <p>
* n The default strategy for determining whether a group is complete is based * The default strategy for determining whether a group is complete is based
* on the '<code>sequenceSize</code>' property of the header. Alternatively, a * on the '<code>sequenceSize</code>' property of the header. Alternatively, a
* custom implementation of the {@link CompletionStrategy} may be provided. * custom implementation of the {@link CompletionStrategy} may be provided.
* </p> * </p>
*
* <p> * <p>
* All considerations regarding <code>timeout</code> and grouping by * All considerations regarding <code>timeout</code> and grouping by
* <code>correlationId</code> from {@link AbstractMessageBarrierHandler} apply * <code>correlationId</code> from {@link AbstractMessageBarrierHandler} apply
@@ -39,7 +41,7 @@ import org.springframework.integration.message.MessageBuilder;
* </p> * </p>
* *
* @author Alex Peters * @author Alex Peters
* * @since 1.0.3
*/ */
public class DefaultMessageAggregator extends AbstractMessageAggregator { public class DefaultMessageAggregator extends AbstractMessageAggregator {

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -16,11 +16,12 @@
package org.springframework.integration.config.xml; package org.springframework.integration.config.xml;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.xml.ParserContext; import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/** /**
* Parser for the <em>aggregator</em> element of the integration namespace. * Parser for the <em>aggregator</em> element of the integration namespace.
@@ -55,14 +56,14 @@ public class AggregatorParser extends AbstractConsumerEndpointParser {
private static final String CORRELATION_STRATEGY_PROPERTY = "correlationStrategy"; private static final String CORRELATION_STRATEGY_PROPERTY = "correlationStrategy";
@Override @Override
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder; BeanDefinitionBuilder builder;
String ref = element.getAttribute(REF_ATTRIBUTE); String ref = element.getAttribute(REF_ATTRIBUTE);
if (StringUtils.hasText(ref)) { if (StringUtils.hasText(ref)) {
builder = BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
.genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE IntegrationNamespaceUtils.BASE_PACKAGE + ".aggregator.MethodInvokingAggregator");
+ ".aggregator.MethodInvokingAggregator");
builder.addConstructorArgReference(ref); builder.addConstructorArgReference(ref);
if (StringUtils.hasText(element.getAttribute(METHOD_ATTRIBUTE))) { if (StringUtils.hasText(element.getAttribute(METHOD_ATTRIBUTE))) {
String method = element.getAttribute(METHOD_ATTRIBUTE); String method = element.getAttribute(METHOD_ATTRIBUTE);
@@ -70,9 +71,8 @@ public class AggregatorParser extends AbstractConsumerEndpointParser {
} }
} }
else { else {
builder = BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
.genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE IntegrationNamespaceUtils.BASE_PACKAGE + ".aggregator.DefaultMessageAggregator");
+ ".aggregator.DefaultMessageAggregator");
} }
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
DISCARD_CHANNEL_ATTRIBUTE); DISCARD_CHANNEL_ATTRIBUTE);
@@ -114,9 +114,8 @@ public class AggregatorParser extends AbstractConsumerEndpointParser {
private String createAdapter(String ref, String method, String unqualifiedClassName, private String createAdapter(String ref, String method, String unqualifiedClassName,
ParserContext parserContext) { ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
.genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".aggregator." IntegrationNamespaceUtils.BASE_PACKAGE + ".aggregator." + unqualifiedClassName);
+ unqualifiedClassName);
builder.addConstructorArgReference(ref); builder.addConstructorArgReference(ref);
builder.addConstructorArgValue(method); builder.addConstructorArgValue(method);
return BeanDefinitionReaderUtils.registerWithGeneratedName(builder.getBeanDefinition(), return BeanDefinitionReaderUtils.registerWithGeneratedName(builder.getBeanDefinition(),

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.integration.aggregator; package org.springframework.integration.aggregator;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
@@ -23,13 +24,13 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
import org.springframework.integration.core.Message; import org.springframework.integration.core.Message;
import org.springframework.integration.message.MessageBuilder; import org.springframework.integration.message.MessageBuilder;
/** /**
* @author Alex Peters * @author Alex Peters
* @author Iwein Fuld * @author Iwein Fuld
*
*/ */
public class DefaultMessageAggregatorTests { public class DefaultMessageAggregatorTests {
@@ -46,4 +47,5 @@ public class DefaultMessageAggregatorTests {
Message<?> result = aggregator.aggregateMessages(messageGroup); Message<?> result = aggregator.aggregateMessages(messageGroup);
assertThat((List<Object>) result.getPayload(), is(anyPayloads)); assertThat((List<Object>) result.getPayload(), is(anyPayloads));
} }
} }