Repository: camel
Updated Branches:
  refs/heads/master d5cd1344e -> f5503d562


CAMEL-8044: Camel commands useable for remote JVMs using jolokia


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

Branch: refs/heads/master
Commit: f5503d5626f0a672d3e577b2699fe635c128459e
Parents: d5cd134
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue Dec 16 11:37:15 2014 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Dec 16 11:37:15 2014 +0100

----------------------------------------------------------------------
 .../camel/commands/ContextInfoCommand.java      |  1 -
 .../camel/commands/RestRegistryListCommand.java | 14 ++++++------
 .../camel/commands/RouteProfileCommand.java     | 24 +++++++++++---------
 .../camel/karaf/commands/RestRegistryList.java  |  4 ++--
 4 files changed, 22 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f5503d56/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
----------------------------------------------------------------------
diff --git 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
index 6722ab9..6a7a954 100644
--- 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
+++ 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
@@ -39,7 +39,6 @@ public class ContextInfoCommand extends AbstractCamelCommand {
     private String context;
     private boolean verbose;
 
-
     /**
      * @param context The name of the Camel context
      * @param verbose Whether to output verbose

http://git-wip-us.apache.org/repos/asf/camel/blob/f5503d56/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
----------------------------------------------------------------------
diff --git 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
index 8e43eea..f1d4b9f 100644
--- 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
+++ 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestRegistryListCommand.java
@@ -46,10 +46,10 @@ public class RestRegistryListCommand extends 
AbstractContextCommand {
     private static final int MAX_COLUMN_WIDTH = 120;
     private static final int MIN_COLUMN_WIDTH = 12;
 
-    Boolean decode = true;
-    Boolean verbose = false;
+    boolean decode = true;
+    boolean verbose;
 
-    public RestRegistryListCommand(String context, Boolean decode, Boolean 
verbose) {
+    public RestRegistryListCommand(String context, boolean decode, boolean 
verbose) {
         super(context);
         this.decode = decode;
         this.verbose = verbose;
@@ -79,7 +79,7 @@ public class RestRegistryListCommand extends 
AbstractContextCommand {
                 String uri = null;
                 if (verbose) {
                     uri = row.get("url");
-                    if (decode == null || decode) {
+                    if (decode) {
                         // decode uri so its more human readable
                         uri = URLDecoder.decode(uri, "UTF-8");
                     }
@@ -94,7 +94,7 @@ public class RestRegistryListCommand extends 
AbstractContextCommand {
                 if (verbose) {
                     out.println(String.format(rowFormat, uri, basePath, 
uriTemplate, method, state, route));
                 } else {
-                    out.println(String.format(rowFormat, basePath, 
uriTemplate, method, state));
+                    out.println(String.format(rowFormat, basePath, 
uriTemplate, method, state, route));
                 }
             }
         }
@@ -112,7 +112,7 @@ public class RestRegistryListCommand extends 
AbstractContextCommand {
 
         for (Map<String, String> row : services) {
             String uri = row.get("url");
-            if (decode == null || decode) {
+            if (decode) {
                 // decode uri so its more human readable
                 uri = URLDecoder.decode(uri, "UTF-8");
             }
@@ -189,7 +189,7 @@ public class RestRegistryListCommand extends 
AbstractContextCommand {
     }
 
     private int getMaxColumnWidth() {
-        if (verbose != null && verbose) {
+        if (verbose) {
             return Integer.MAX_VALUE;
         } else {
             return MAX_COLUMN_WIDTH;

http://git-wip-us.apache.org/repos/asf/camel/blob/f5503d56/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
----------------------------------------------------------------------
diff --git 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
index c6fc82e..6cafc2c 100644
--- 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
+++ 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RouteProfileCommand.java
@@ -61,19 +61,21 @@ public class RouteProfileCommand extends 
AbstractRouteCommand {
         }
 
         String xml = camelController.getRouteStatsAsXml(routeId, contextName, 
true, true);
-        RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new 
StringReader(xml));
+        if (xml != null) {
+            RouteStatDump route = (RouteStatDump) unmarshaller.unmarshal(new 
StringReader(xml));
 
-        long count = route.getExchangesCompleted() + 
route.getExchangesFailed();
-        out.println(String.format(OUTPUT_FORMAT, route.getId(), count, 
route.getLastProcessingTime(), route.getDeltaProcessingTime(),
-                route.getMeanProcessingTime(), route.getMinProcessingTime(), 
route.getMaxProcessingTime(), route.getTotalProcessingTime(), 
route.getSelfProcessingTime()));
+            long count = route.getExchangesCompleted() + 
route.getExchangesFailed();
+            out.println(String.format(OUTPUT_FORMAT, route.getId(), count, 
route.getLastProcessingTime(), route.getDeltaProcessingTime(),
+                    route.getMeanProcessingTime(), 
route.getMinProcessingTime(), route.getMaxProcessingTime(), 
route.getTotalProcessingTime(), route.getSelfProcessingTime()));
 
-        for (ProcessorStatDump ps : route.getProcessorStats()) {
-            // the self time is the total time of the processor itself
-            long selfTime = ps.getTotalProcessingTime();
-            count = ps.getExchangesCompleted() + ps.getExchangesFailed();
-            // indent route id with 2 spaces
-            out.println(String.format(OUTPUT_FORMAT, "  " + ps.getId(), count, 
ps.getLastProcessingTime(), ps.getDeltaProcessingTime(),
-                    ps.getMeanProcessingTime(), ps.getMinProcessingTime(), 
ps.getMaxProcessingTime(), ps.getAccumulatedProcessingTime(), selfTime));
+            for (ProcessorStatDump ps : route.getProcessorStats()) {
+                // the self time is the total time of the processor itself
+                long selfTime = ps.getTotalProcessingTime();
+                count = ps.getExchangesCompleted() + ps.getExchangesFailed();
+                // indent route id with 2 spaces
+                out.println(String.format(OUTPUT_FORMAT, "  " + ps.getId(), 
count, ps.getLastProcessingTime(), ps.getDeltaProcessingTime(),
+                        ps.getMeanProcessingTime(), ps.getMinProcessingTime(), 
ps.getMaxProcessingTime(), ps.getAccumulatedProcessingTime(), selfTime));
+            }
         }
 
         // we want to group routes from the same context in the same table

http://git-wip-us.apache.org/repos/asf/camel/blob/f5503d56/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestRegistryList.java
----------------------------------------------------------------------
diff --git 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestRegistryList.java
 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestRegistryList.java
index 2fc92d8..3e57177 100644
--- 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestRegistryList.java
+++ 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestRegistryList.java
@@ -21,10 +21,10 @@ import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 import org.apache.felix.gogo.commands.Option;
 
-@Command(scope = "camel", name = "rest-registry-list", description = "Lists 
all Camel REST services enlisted in the Rest Registry from one or more 
CamelContexts.")
+@Command(scope = "camel", name = "rest-registry-list", description = "Lists 
all Camel REST services enlisted in the Rest Registry from a CamelContext")
 public class RestRegistryList extends CamelCommandSupport {
 
-    @Argument(index = 0, name = "name", description = "The Camel context name 
where to look for the REST services", required = false, multiValued = false)
+    @Argument(index = 0, name = "name", description = "The Camel context name 
where to look for the REST services", required = true, multiValued = false)
     String name;
 
     @Option(name = "--decode", aliases = "-d", description = "Whether to 
decode the endpoint uri so its human readable",

Reply via email to