camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] camel git commit: CAMEL-8526: Add more EIP as specialized mbeans
Date Fri, 24 Jul 2015 16:50:36 GMT
Repository: camel
Updated Branches:
  refs/heads/master b40d713cf -> 61ccc8215


CAMEL-8526: Add more EIP as specialized mbeans


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

Branch: refs/heads/master
Commit: 61ccc8215238af00f870d0f409b5fc221368a2a2
Parents: bfeb81c
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jul 24 18:50:55 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jul 24 18:57:34 2015 +0200

----------------------------------------------------------------------
 .../mbean/ManagedAggregateProcessorMBean.java   | 13 ++++-
 .../mbean/ManagedAggregateProcessor.java        | 55 +++++++++++++++++---
 .../apache/camel/model/AggregateDefinition.java | 18 +++----
 .../apache/camel/processor/FilterProcessor.java |  1 -
 .../ManagedAggregateControllerTest.java         | 10 +++-
 5 files changed, 76 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/61ccc821/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedAggregateProcessorMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedAggregateProcessorMBean.java
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedAggregateProcessorMBean.java
index a1810c7..845d6c7 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedAggregateProcessorMBean.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedAggregateProcessorMBean.java
@@ -21,12 +21,18 @@ import org.apache.camel.api.management.ManagedOperation;
 
 public interface ManagedAggregateProcessorMBean extends ManagedProcessorMBean {
 
+    @ManagedAttribute(description = "The language for the expression")
+    String getCorrelationExpressionLanguage();
+
     @ManagedAttribute(description = "Correlation Expression")
     String getCorrelationExpression();
 
     @ManagedAttribute(description = "Completion timeout in millis")
     long getCompletionTimeout();
 
+    @ManagedAttribute(description = "The language for the expression")
+    String getCompletionTimeoutLanguage();
+
     @ManagedAttribute(description = "Completion timeout expression")
     String getCompletionTimeoutExpression();
 
@@ -36,6 +42,9 @@ public interface ManagedAggregateProcessorMBean extends ManagedProcessorMBean
{
     @ManagedAttribute(description = "Completion size")
     int getCompletionSize();
 
+    @ManagedAttribute(description = "The language for the expression")
+    String getCompletionSizeExpressionLanguage();
+
     @ManagedAttribute(description = "Completion size expression")
     String getCompletionSizeExpression();
 
@@ -57,6 +66,9 @@ public interface ManagedAggregateProcessorMBean extends ManagedProcessorMBean
{
     @ManagedAttribute(description = "Whether or not to eager check for completion when a
new incoming Exchange has been received")
     boolean isEagerCheckCompletion();
 
+    @ManagedAttribute(description = "The language for the predicate")
+    String getCompletionPredicateLanguage();
+
     @ManagedAttribute(description = "A Predicate to indicate when an aggregated exchange
is complete")
     String getCompletionPredicate();
 
@@ -114,5 +126,4 @@ public interface ManagedAggregateProcessorMBean extends ManagedProcessorMBean
{
     @ManagedAttribute(description = "Sets whether statistics is enabled")
     void setStatisticsEnabled(boolean statisticsEnabled);
 
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/61ccc821/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedAggregateProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedAggregateProcessor.java
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedAggregateProcessor.java
index 7a7705d..2531332 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedAggregateProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedAggregateProcessor.java
@@ -22,6 +22,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.api.management.mbean.ManagedAggregateProcessorMBean;
 import org.apache.camel.model.AggregateDefinition;
+import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.processor.aggregate.AggregateProcessor;
 import org.apache.camel.spi.ManagementStrategy;
 
@@ -45,9 +46,22 @@ public class ManagedAggregateProcessor extends ManagedProcessor implements
Manag
         return processor;
     }
 
+    @Override
+    public AggregateDefinition getDefinition() {
+        return (AggregateDefinition) super.getDefinition();
+    }
+
+    public String getCorrelationExpressionLanguage() {
+        if (getDefinition().getCorrelationExpression() != null) {
+            return getDefinition().getCorrelationExpression().getExpressionType().getLanguage();
+        } else {
+            return null;
+        }
+    }
+
     public String getCorrelationExpression() {
-        if (processor.getCorrelationExpression() != null) {
-            return processor.getCorrelationExpression().toString();
+        if (getDefinition().getCorrelationExpression() != null) {
+            return getDefinition().getCorrelationExpression().getExpressionType().getExpression();
         } else {
             return null;
         }
@@ -57,9 +71,17 @@ public class ManagedAggregateProcessor extends ManagedProcessor implements
Manag
         return processor.getCompletionTimeout();
     }
 
+    public String getCompletionTimeoutLanguage() {
+        if (getDefinition().getCompletionTimeoutExpression() != null) {
+            return getDefinition().getCompletionTimeoutExpression().getExpressionType().getLanguage();
+        } else {
+            return null;
+        }
+    }
+
     public String getCompletionTimeoutExpression() {
-        if (processor.getCompletionTimeoutExpression() != null) {
-            return processor.getCompletionTimeoutExpression().toString();
+        if (getDefinition().getCompletionTimeoutExpression() != null) {
+            return getDefinition().getCompletionTimeoutExpression().getExpressionType().getExpression();
         } else {
             return null;
         }
@@ -73,9 +95,17 @@ public class ManagedAggregateProcessor extends ManagedProcessor implements
Manag
         return processor.getCompletionSize();
     }
 
+    public String getCompletionSizeExpressionLanguage() {
+        if (getDefinition().getCompletionSizeExpression() != null) {
+            return getDefinition().getCompletionSizeExpression().getExpressionType().getLanguage();
+        } else {
+            return null;
+        }
+    }
+
     public String getCompletionSizeExpression() {
-        if (processor.getCompletionSizeExpression() != null) {
-            return processor.getCompletionSizeExpression().toString();
+        if (getDefinition().getCompletionSizeExpression() != null) {
+            return getDefinition().getCompletionSizeExpression().getExpressionType().getExpression();
         } else {
             return null;
         }
@@ -105,9 +135,18 @@ public class ManagedAggregateProcessor extends ManagedProcessor implements
Manag
         return processor.isEagerCheckCompletion();
     }
 
+    @Override
+    public String getCompletionPredicateLanguage() {
+        if (getDefinition().getCompletionPredicate() != null) {
+            return getDefinition().getCompletionPredicate().getExpressionType().getLanguage();
+        } else {
+            return null;
+        }
+    }
+
     public String getCompletionPredicate() {
-        if (processor.getCompletionPredicate() != null) {
-            return processor.getCompletionPredicate().toString();
+        if (getDefinition().getCompletionPredicate() != null) {
+            return getDefinition().getCompletionPredicate().getExpressionType().getExpression();
         } else {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/61ccc821/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
index 12bebb4..b369f1e 100644
--- a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
@@ -125,19 +125,19 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
     }
 
     public AggregateDefinition(Predicate predicate) {
-        if (predicate != null) {
-            setExpression(ExpressionNodeHelper.toExpressionDefinition(predicate));
-        }
-    }    
+        this(ExpressionNodeHelper.toExpressionDefinition(predicate));
+    }
     
-    public AggregateDefinition(Expression correlationExpression) {
-        if (correlationExpression != null) {
-            setExpression(ExpressionNodeHelper.toExpressionDefinition(correlationExpression));
-        }
+    public AggregateDefinition(Expression expression) {
+        this(ExpressionNodeHelper.toExpressionDefinition(expression));
     }
 
     public AggregateDefinition(ExpressionDefinition correlationExpression) {
-        this.expression = correlationExpression;
+        setExpression(correlationExpression);
+
+        ExpressionSubElementDefinition cor = new ExpressionSubElementDefinition();
+        cor.setExpressionType(correlationExpression);
+        setCorrelationExpression(cor);
     }
 
     public AggregateDefinition(Expression correlationExpression, AggregationStrategy aggregationStrategy)
{

http://git-wip-us.apache.org/repos/asf/camel/blob/61ccc821/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
index 289c157..3963ebd 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
@@ -54,7 +54,6 @@ public class FilterProcessor extends DelegateAsyncProcessor implements Traceable
         }
 
         if (matches) {
-            filtered++;
             return processor.process(exchange, callback);
         } else {
             callback.done(true);

http://git-wip-us.apache.org/repos/asf/camel/blob/61ccc821/camel-core/src/test/java/org/apache/camel/management/ManagedAggregateControllerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedAggregateControllerTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedAggregateControllerTest.java
index ba14824..238fb47 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedAggregateControllerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedAggregateControllerTest.java
@@ -83,8 +83,11 @@ public class ManagedAggregateControllerTest extends ManagementTestSupport
{
         Integer size = (Integer) mbeanServer.getAttribute(on, "CompletionSize");
         assertEquals(10, size.longValue());
 
+        String lan = (String) mbeanServer.getAttribute(on, "CorrelationExpressionLanguage");
+        assertEquals("header", lan);
+
         String cor = (String) mbeanServer.getAttribute(on, "CorrelationExpression");
-        assertEquals("header(id)", cor);
+        assertEquals("id", cor);
 
         Integer inflight = (Integer) mbeanServer.getAttribute(on, "InProgressCompleteExchanges");
         assertEquals(0, inflight.intValue());
@@ -144,8 +147,11 @@ public class ManagedAggregateControllerTest extends ManagementTestSupport
{
         Integer size = (Integer) mbeanServer.getAttribute(on, "CompletionSize");
         assertEquals(10, size.longValue());
 
+        String lan = (String) mbeanServer.getAttribute(on, "CorrelationExpressionLanguage");
+        assertEquals("header", lan);
+
         String cor = (String) mbeanServer.getAttribute(on, "CorrelationExpression");
-        assertEquals("header(id)", cor);
+        assertEquals("id", cor);
 
         Integer inflight = (Integer) mbeanServer.getAttribute(on, "InProgressCompleteExchanges");
         assertEquals(0, inflight.intValue());


Mime
View raw message