camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: CAMEL-6642: Allow to configure custom ExpressionResultComparator for resequencer eip in xml
Date Fri, 16 Aug 2013 06:17:13 GMT
CAMEL-6642: Allow to configure custom ExpressionResultComparator for resequencer eip in xml


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ce51227b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ce51227b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ce51227b

Branch: refs/heads/camel-2.11.x
Commit: ce51227be424bdfab799cabe41192806423f2873
Parents: 5b599a2
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Aug 16 08:15:30 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Aug 16 08:15:58 2013 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/model/ResequenceDefinition.java |  8 +++++++-
 .../camel/model/config/StreamResequencerConfig.java       | 10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ce51227b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
index cdece76..811c475 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
@@ -37,6 +37,7 @@ import org.apache.camel.processor.StreamResequencer;
 import org.apache.camel.processor.resequencer.ExpressionResultComparator;
 import org.apache.camel.spi.Required;
 import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -374,7 +375,12 @@ public class ResequenceDefinition extends ProcessorDefinition<ResequenceDefiniti
         ObjectHelper.notNull(config, "config", this);
         ObjectHelper.notNull(expression, "expression", this);
 
-        ExpressionResultComparator comparator = config.getComparator();
+        ExpressionResultComparator comparator;
+        if (config.getComparatorRef() != null) {
+            comparator = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(),
config.getComparatorRef(), ExpressionResultComparator.class);
+        } else {
+            comparator = config.getComparator();
+        }
         comparator.setExpression(expression);
 
         StreamResequencer resequencer = new StreamResequencer(routeContext.getCamelContext(),
processor, comparator);

http://git-wip-us.apache.org/repos/asf/camel/blob/ce51227b/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java
b/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java
index ac1aae2..7ae8f6c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java
+++ b/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java
@@ -42,6 +42,8 @@ public class StreamResequencerConfig extends ResequencerConfig {
     @XmlTransient
     private ExpressionResultComparator comparator;
     @XmlAttribute
+    private String comparatorRef;
+    @XmlAttribute
     private Boolean rejectOld;
 
     /**
@@ -156,6 +158,14 @@ public class StreamResequencerConfig extends ResequencerConfig {
         this.comparator = comparator;
     }
 
+    public String getComparatorRef() {
+        return comparatorRef;
+    }
+
+    public void setComparatorRef(String comparatorRef) {
+        this.comparatorRef = comparatorRef;
+    }
+
     public void setRejectOld(boolean value) {
         this.rejectOld = value;
     }


Mime
View raw message