camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-9224 : FIX1 - Removed command syntax exceptions. Fixed the default option for endpoint stats filter.
Date Tue, 10 Nov 2015 07:44:06 GMT
Repository: camel
Updated Branches:
  refs/heads/master 69068911b -> 5a464ef70


CAMEL-9224 : FIX1 - Removed command syntax exceptions. Fixed the default option for endpoint
stats filter.


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

Branch: refs/heads/master
Commit: 610107fefcef693b4bfe2b5c48ef96bd816e4b3e
Parents: 6906891
Author: Evgeny Minkevich <evgeny.minkevich@gmail.com>
Authored: Tue Nov 10 13:14:05 2015 +1100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Nov 10 08:26:43 2015 +0100

----------------------------------------------------------------------
 .../commands/crsh/CamelCommandsFacade.java         | 17 +++++++++++++++++
 .../resources/crash/commands/camel/camel.groovy    |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/610107fe/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
index 90e0ebe..8bd71b6 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.commands.AbstractCamelCommand;
+import org.apache.camel.commands.AbstractContextCommand;
 import org.apache.camel.commands.AbstractRouteCommand;
 import org.apache.camel.commands.LocalCamelController;
 import org.apache.camel.commands.StringEscape;
@@ -58,6 +59,13 @@ public class CamelCommandsFacade {
             ops.println("Automatically inferred context name : " + commandArgs[1]);
         }
 
+        // The order of the varargs for Context Command
+        // [0] - camel context
+        if (AbstractContextCommand.class.isAssignableFrom(clazz) && null == commandArgs[0])
{
+            commandArgs[0] = getFirstCamelContextName();
+            ops.println("Context name is not provided. Using the first : " + commandArgs[0]);
+        }
+
         // Finding the right constructor
         Class[] types = new Class[commandArgs.length];
         for (int i = 0; i < commandArgs.length; i++) {
@@ -113,4 +121,13 @@ public class CamelCommandsFacade {
 
         return contextNames.get(0);
     }
+
+    private String getFirstCamelContextName() throws Exception {
+        if (null == camelController.getLocalCamelContexts() ||
+                camelController.getLocalCamelContexts().size() == 0) {
+            throw new org.crsh.cli.impl.SyntaxException("No camel contexts available");
+        }
+
+        return camelController.getLocalCamelContexts().get(0).getName();
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/610107fe/platforms/commands/commands-spring-boot/src/main/resources/crash/commands/camel/camel.groovy
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/resources/crash/commands/camel/camel.groovy
b/platforms/commands/commands-spring-boot/src/main/resources/crash/commands/camel/camel.groovy
index 6ba23bf..670bffc 100644
--- a/platforms/commands/commands-spring-boot/src/main/resources/crash/commands/camel/camel.groovy
+++ b/platforms/commands/commands-spring-boot/src/main/resources/crash/commands/camel/camel.groovy
@@ -163,7 +163,7 @@ public class camel extends GroovyCommand {
                                  @Usage("Filter the list by in,out,static,dynamic")
                                  @Option(names = ["f", "filter"]) String filter) {
         Boolean _decode = (null != decode && Boolean.valueOf(decode))
-        String[] _filter = null != filter ? filter.split(",") : ["in", "out", "static", "dynamic"];
+        String[] _filter = filter == null ? [] : filter.split(",")
         return getCommandsFacade().runCommand(EndpointStatisticCommand.class, camelContext,
_decode, _filter);
     }
 


Mime
View raw message