You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/10/08 12:02:47 UTC

[04/13] camel git commit: Camel java dsl parser prototype

Camel java dsl parser prototype


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

Branch: refs/heads/parser2
Commit: 84cb66bfdd450f142632ebfe0ca7c2a2df4c53d9
Parents: 7aef656
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Oct 7 18:05:59 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Oct 7 18:05:59 2017 +0200

----------------------------------------------------------------------
 .../management/mbean/RouteCoverageXmlParser.java     | 15 ++++++++++++++-
 .../parser/helper/AdvancedCamelJavaParserHelper.java |  6 +++---
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/84cb66bf/camel-core/src/main/java/org/apache/camel/management/mbean/RouteCoverageXmlParser.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/RouteCoverageXmlParser.java b/camel-core/src/main/java/org/apache/camel/management/mbean/RouteCoverageXmlParser.java
index c260e67..a28ff71 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/RouteCoverageXmlParser.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/RouteCoverageXmlParser.java
@@ -96,7 +96,20 @@ public final class RouteCoverageXmlParser {
                                 el.setAttribute("totalProcessingTime", "" + totalTime);
                             }
                         } else if ("from".equals(qName)) {
-                            // TODO: include the stats from the route mbean as that would be the same
+                            // grab statistics from the parent route as from would be the same
+                            Element parent = elementStack.peek();
+                            if (parent != null) {
+                                String routeId = parent.getAttribute("id");
+                                ManagedRouteMBean route = camelContext.getManagedRoute(routeId, ManagedRouteMBean.class);
+                                if (route != null) {
+                                    long total = route.getExchangesTotal();
+                                    el.setAttribute("exchangesTotal", "" + total);
+                                    long totalTime = route.getTotalProcessingTime();
+                                    el.setAttribute("totalProcessingTime", "" + totalTime);
+                                    // from is index-0
+                                    el.setAttribute("index", "0");
+                                }
+                            }
                         } else {
                             ManagedProcessorMBean processor = camelContext.getManagedProcessor(id, ManagedProcessorMBean.class);
                             if (processor != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/84cb66bf/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/AdvancedCamelJavaParserHelper.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/AdvancedCamelJavaParserHelper.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/AdvancedCamelJavaParserHelper.java
index 322997b..e57a09b 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/AdvancedCamelJavaParserHelper.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/AdvancedCamelJavaParserHelper.java
@@ -88,13 +88,13 @@ public final class AdvancedCamelJavaParserHelper {
             }
         }
 
-        // now parse the route node and build a tree structure of the EIPs
-        String root = route.getOutputs().get(0).getName();
+        // now parse the route node and build the correct model/tree structure of the EIPs
 
         // re-create factory as we rebuild the tree
         nodeFactory = CamelNodeDetailsFactory.newInstance();
 
-        CamelNodeDetails answer = nodeFactory.newNode(null, root);
+        CamelNodeDetails from = route.getOutputs().get(0);
+        CamelNodeDetails answer = nodeFactory.copyNode(null, "from", from);
         answer.setFileName(fullyQualifiedFileName);
 
         CamelNodeDetails parent = answer;