Author: janstey
Date: Wed Nov 5 11:07:10 2008
New Revision: 711662
URL: http://svn.apache.org/viewvc?rev=711662&view=rev
Log:
Merged revisions 711655-711656 via svnmerge from
https://svn.apache.org/repos/asf/activemq/camel/trunk
........
r711655 | janstey | 2008-11-05 15:20:12 -0330 (Wed, 05 Nov 2008) | 1 line
CAMEL-1038 - add support for a custom aggregation collection in the Spring DSL
........
r711656 | janstey | 2008-11-05 15:24:38 -0330 (Wed, 05 Nov 2008) | 1 line
Add wiki snippet tags
........
Added:
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/MyReverseAggregationCollection.java
- copied unchanged from r711656,
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/MyReverseAggregationCollection.java
activemq/camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringAggregatorWithCustomCollectionTest.java
- copied unchanged from r711656,
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringAggregatorWithCustomCollectionTest.java
activemq/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator-custom-collection.xml
- copied unchanged from r711656,
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator-custom-collection.xml
Modified:
activemq/camel/branches/camel-1.x/ (props changed)
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/CustomAggregationCollectionTest.java
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Nov 5 11:07:10 2008
@@ -1 +1 @@
-/activemq/camel/trunk:1-708421,708553-709447,709449-709612,709614-709634,709636-710013,711200,711206,711219-711220,711523,711531,711599
+/activemq/camel/trunk:1-708421,708553-709447,709449-709612,709614-709634,709636-710013,711200,711206,711219-711220,711523,711531,711599,711655-711656
Modified:
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java?rev=711662&r1=711661&r2=711662&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
(original)
+++
activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
Wed Nov 5 11:07:10 2008
@@ -59,6 +59,8 @@
private Long batchTimeout;
@XmlAttribute(required = false)
private String strategyRef;
+ @XmlAttribute(required = false)
+ private String collectionRef;
@XmlElement(name = "completedPredicate", required = false)
private ExpressionSubElementType completedPredicate;
@@ -121,6 +123,10 @@
final Processor processor = routeContext.createProcessor(this);
final Aggregator aggregator;
+ if (getAggregationCollection() == null) {
+
setAggregationCollection(createAggregationCollection(routeContext));
+ }
+
if (aggregationCollection != null) {
// create the aggregator using the collection
// pre configure the collection if its expression and strategy is
not set, then
@@ -177,6 +183,14 @@
return strategy;
}
+ private AggregationCollection createAggregationCollection(RouteContext
routeContext) {
+ AggregationCollection collection = getAggregationCollection();
+ if (collection == null && collectionRef != null) {
+ collection = routeContext.lookup(collectionRef,
AggregationCollection.class);
+ }
+ return collection;
+ }
+
public AggregationCollection getAggregationCollection() {
return aggregationCollection;
}
Modified:
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/CustomAggregationCollectionTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/CustomAggregationCollectionTest.java?rev=711662&r1=711661&r2=711662&view=diff
==============================================================================
---
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/CustomAggregationCollectionTest.java
(original)
+++
activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/CustomAggregationCollectionTest.java
Wed Nov 5 11:07:10 2008
@@ -71,52 +71,4 @@
}
};
}
-
- // START SNIPPET: e3
- private static class MyReverseAggregationCollection extends
AbstractCollection<Exchange> implements AggregationCollection {
-
- private List<Exchange> collection = new ArrayList<Exchange>();
- private Expression<Exchange> correlation;
- private AggregationStrategy strategy;
-
- public Expression<Exchange> getCorrelationExpression() {
- return correlation;
- }
-
- public void setCorrelationExpression(Expression<Exchange>
correlationExpression) {
- this.correlation = correlationExpression;
- }
-
- public AggregationStrategy getAggregationStrategy() {
- return strategy;
- }
-
- public void setAggregationStrategy(AggregationStrategy
aggregationStrategy) {
- this.strategy = aggregationStrategy;
- }
-
- public boolean add(Exchange exchange) {
- return collection.add(exchange);
- }
-
- public Iterator<Exchange> iterator() {
- // demonstrate the we can do something with this collection, so we
reverse it
- Collections.reverse(collection);
-
- return collection.iterator();
- }
-
- public int size() {
- return collection.size();
- }
-
- public void clear() {
- collection.clear();
- }
-
- public void onAggregation(Object correlationKey, Exchange newExchange)
{
- add(newExchange);
- }
- }
- // END SNIPPET: e3
}
\ No newline at end of file