CAMEL-8963: Make the Camel Karaf commands not require context as parameter as 
it can be optional.


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

Branch: refs/heads/master
Commit: aee2b579441b55d9941441fdb3c2c010fbbc2495
Parents: 4bbc7f3
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue Jul 14 09:47:22 2015 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Jul 14 09:47:22 2015 +0200

----------------------------------------------------------------------
 .../apache/camel/karaf/commands/AbstractRouteCommand.java   | 2 +-
 .../main/java/org/apache/camel/karaf/commands/RestShow.java | 6 +-----
 .../java/org/apache/camel/karaf/commands/RouteInfo.java     | 9 +--------
 .../java/org/apache/camel/karaf/commands/RouteShow.java     | 9 +--------
 .../main/resources/OSGI-INF/blueprint/camel-commands.xml    | 4 ++--
 5 files changed, 6 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/aee2b579/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/AbstractRouteCommand.java
----------------------------------------------------------------------
diff --git 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/AbstractRouteCommand.java
 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/AbstractRouteCommand.java
index ac9ddf6..8d4b00f 100644
--- 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/AbstractRouteCommand.java
+++ 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/AbstractRouteCommand.java
@@ -23,7 +23,7 @@ public abstract class AbstractRouteCommand extends 
CamelCommandSupport {
     @Argument(index = 0, name = "route", description = "The Camel route ID or 
a wildcard expression", required = true, multiValued = false)
     String route;
 
-    @Argument(index = 1, name = "context", description = "The Camel context 
name.", required = true, multiValued = false)
+    @Argument(index = 1, name = "context", description = "The Camel context 
name.", required = false, multiValued = false)
     String context;
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/aee2b579/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestShow.java
----------------------------------------------------------------------
diff --git 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestShow.java
 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestShow.java
index dd5fb63..686f935 100644
--- 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestShow.java
+++ 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestShow.java
@@ -17,14 +17,10 @@
 package org.apache.camel.karaf.commands;
 
 import org.apache.camel.commands.RestShowCommand;
-import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 
 @Command(scope = "camel", name = "rest-show", description = "Display the Camel 
REST definition in XML")
-public class RestShow extends CamelCommandSupport {
-
-    @Argument(index = 0, name = "context", description = "The Camel context 
name.", required = true, multiValued = false)
-    String context;
+public class RestShow extends AbstractRouteCommand {
 
     public Object doExecute() throws Exception {
         RestShowCommand command = new RestShowCommand(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/aee2b579/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
----------------------------------------------------------------------
diff --git 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
index 8c519ba..6156377 100644
--- 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
+++ 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
@@ -18,17 +18,10 @@ package org.apache.camel.karaf.commands;
 
 import org.apache.camel.commands.RouteInfoCommand;
 import org.apache.camel.commands.StringEscape;
-import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 
 @Command(scope = "camel", name = "route-info", description = "Display 
information about a Camel route.")
-public class RouteInfo extends CamelCommandSupport {
-
-    @Argument(index = 0, name = "route", description = "The Camel route ID.", 
required = true, multiValued = false)
-    String route;
-
-    @Argument(index = 1, name = "context", description = "The Camel context 
name.", required = false, multiValued = false)
-    String context;
+public class RouteInfo extends AbstractRouteCommand {
 
     private StringEscape stringEscape;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/aee2b579/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteShow.java
----------------------------------------------------------------------
diff --git 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteShow.java
 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteShow.java
index 1b421c1..950df70 100644
--- 
a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteShow.java
+++ 
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteShow.java
@@ -17,17 +17,10 @@
 package org.apache.camel.karaf.commands;
 
 import org.apache.camel.commands.RouteShowCommand;
-import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 
 @Command(scope = "camel", name = "route-show", description = "Display the 
Camel route definition in XML")
-public class RouteShow extends CamelCommandSupport {
-
-    @Argument(index = 0, name = "route", description = "The Camel route ID.", 
required = true, multiValued = false)
-    String route;
-
-    @Argument(index = 1, name = "context", description = "The Camel context 
name.", required = false, multiValued = false)
-    String context;
+public class RouteShow extends AbstractRouteCommand {
 
     public Object doExecute() throws Exception {
         RouteShowCommand command = new RouteShowCommand(route, context);

http://git-wip-us.apache.org/repos/asf/camel/blob/aee2b579/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
----------------------------------------------------------------------
diff --git 
a/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
 
b/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
index bb827da..8603db2 100644
--- 
a/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
+++ 
b/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
@@ -94,7 +94,7 @@
       </action>
       <completers>
         <ref component-id="routeCompleter"/>
-        <null/>
+        <ref component-id="camelContextCompleter"/>
       </completers>
     </command>
     <command name="camel/route-profile">
@@ -122,7 +122,7 @@
       </action>
       <completers>
         <ref component-id="routeCompleter"/>
-        <null/>
+        <ref component-id="camelContextCompleter"/>
       </completers>
     </command>
     <command name="camel/route-start">

Reply via email to