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 2015/11/10 08:44:06 UTC

[1/2] camel git commit: CAMEL-9224 : FIX1 - Removed command syntax exceptions. Fixed the default option for endpoint stats filter.

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 <ev...@gmail.com>
Authored: Tue Nov 10 13:14:05 2015 +1100
Committer: Claus Ibsen <da...@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);
     }
 


[2/2] camel git commit: CAMEL-9224: ContextInfo command should extend the correct base class that is about a context like the others. Thanks to Evgeny Minkevich for spotting this.

Posted by da...@apache.org.
CAMEL-9224: ContextInfo command should extend the correct base class that is about a context like the others. Thanks to Evgeny Minkevich for spotting this.


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

Branch: refs/heads/master
Commit: 5a464ef7097c717a9ade67a8e943ff8b268874cc
Parents: 610107f
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Nov 10 08:46:54 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Nov 10 08:46:54 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/commands/ContextInfoCommand.java    | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5a464ef7/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 698e809..9ca57b1 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
@@ -31,12 +31,11 @@ import static org.apache.camel.util.ObjectHelper.isEmpty;
 /**
  * Command to display detailed information about a given {@link org.apache.camel.CamelContext}.
  */
-public class ContextInfoCommand extends AbstractCamelCommand {
+public class ContextInfoCommand extends AbstractContextCommand {
 
     public static final String XML_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
     public static final String OUTPUT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss";
     private StringEscape stringEscape;
-    private String context;
     private boolean verbose;
 
     /**
@@ -44,7 +43,7 @@ public class ContextInfoCommand extends AbstractCamelCommand {
      * @param verbose Whether to output verbose
      */
     public ContextInfoCommand(String context, boolean verbose) {
-        this.context = context;
+        super(context);
         this.verbose = verbose;
     }
 
@@ -56,7 +55,7 @@ public class ContextInfoCommand extends AbstractCamelCommand {
     }
 
     @Override
-    public Object execute(CamelController camelController, PrintStream out, PrintStream err) throws Exception {
+    protected Object performContextCommand(CamelController camelController, String contextName, PrintStream out, PrintStream err) throws Exception {
         Map<String, Object> row = camelController.getCamelContextInformation(context);
         if (row == null || row.isEmpty()) {
             err.println("Camel context " + context + " not found.");