camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject git commit: CAMEL-6985: Clean-up the codebase of the Karaf commands. See the JIRA ticket for details.
Date Wed, 20 Nov 2013 02:00:09 GMT
Updated Branches:
  refs/heads/master 21b7e3576 -> f29888779


CAMEL-6985: Clean-up the codebase of the Karaf commands. See the JIRA ticket for details.

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

Branch: refs/heads/master
Commit: f2988877942d2a70114f2c6cb4ce9fa3bd81d542
Parents: 21b7e35
Author: Babak Vahdat <bvahdat@apache.org>
Authored: Wed Nov 20 03:00:00 2013 +0100
Committer: Babak Vahdat <bvahdat@apache.org>
Committed: Wed Nov 20 03:00:00 2013 +0100

----------------------------------------------------------------------
 .../karaf/commands/AbstractRouteCommand.java    |  9 +----
 .../camel/karaf/commands/BacklogTracerDump.java |  9 +----
 .../camel/karaf/commands/BacklogTracerInfo.java |  9 +----
 .../karaf/commands/BacklogTracerStart.java      |  9 +----
 .../camel/karaf/commands/BacklogTracerStop.java |  9 +----
 .../karaf/commands/CamelCommandSupport.java     | 32 ++++++++++++++++
 .../camel/karaf/commands/CamelController.java   |  8 ----
 .../camel/karaf/commands/ContextInfo.java       | 18 +++------
 .../camel/karaf/commands/ContextList.java       |  9 +----
 .../camel/karaf/commands/ContextStart.java      |  9 +----
 .../camel/karaf/commands/ContextStop.java       |  9 +----
 .../camel/karaf/commands/EndpointList.java      |  9 +----
 .../apache/camel/karaf/commands/RouteInfo.java  | 14 ++-----
 .../apache/camel/karaf/commands/RouteList.java  |  9 +----
 .../apache/camel/karaf/commands/RouteShow.java  |  9 +----
 .../completers/CamelCompleterSupport.java       | 34 +++++++++++++++++
 .../completers/CamelContextCompleter.java       | 10 +----
 .../commands/completers/RouteCompleter.java     | 10 +----
 .../commands/internal/CamelControllerImpl.java  | 40 --------------------
 19 files changed, 89 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/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 756243c..c2edac0 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
@@ -24,23 +24,16 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.karaf.commands.internal.RegexUtil;
 import org.apache.felix.gogo.commands.Argument;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 import static org.apache.camel.util.CamelContextHelper.getRouteStartupOrder;
 
-public abstract class AbstractRouteCommand extends OsgiCommandSupport {
+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
= false, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     public abstract void executeOnRoute(CamelContext camelContext, Route camelRoute) throws
Exception;
 
     public Object doExecute() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerDump.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerDump.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerDump.java
index 8945951..429e0a5 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerDump.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerDump.java
@@ -30,13 +30,12 @@ import org.apache.camel.util.MessageDump;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 import org.apache.felix.gogo.commands.Option;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to use the <a href="camel.apache.org/backlogtracer">Backlog Tracer</a>.
  */
 @Command(scope = "camel", name = "backlog-tracer-dump", description = "Dumps traced messages
from the Backlog tracer")
-public class BacklogTracerDump extends OsgiCommandSupport {
+public class BacklogTracerDump extends CamelCommandSupport {
 
     @Argument(index = 0, name = "context", description = "The name of the Camel context.",
required = true, multiValued = false)
     String context;
@@ -50,12 +49,6 @@ public class BacklogTracerDump extends OsgiCommandSupport {
     @Option(name = "--bodySize", aliases = "-bs", description = "To limit the body size when
using text format", required = false, multiValued = false)
     Integer bodySize;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     @Override
     protected Object doExecute() throws Exception {
         CamelContext camel = camelController.getCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerInfo.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerInfo.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerInfo.java
index 47bc15f..7ef9af9 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerInfo.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerInfo.java
@@ -20,23 +20,16 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to use the <a href="camel.apache.org/backlogtracer">Backlog Tracer</a>.
  */
 @Command(scope = "camel", name = "backlog-tracer-info", description = "Displays the current
status of the Backlog tracer")
-public class BacklogTracerInfo extends OsgiCommandSupport {
+public class BacklogTracerInfo extends CamelCommandSupport {
 
     @Argument(index = 0, name = "context", description = "The name of the Camel context.",
required = true, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     @Override
     protected Object doExecute() throws Exception {
         CamelContext camel = camelController.getCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStart.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStart.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStart.java
index f77225d..4f88091 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStart.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStart.java
@@ -21,13 +21,12 @@ import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 import org.apache.felix.gogo.commands.Option;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to use the <a href="camel.apache.org/backlogtracer">Backlog Tracer</a>.
  */
 @Command(scope = "camel", name = "backlog-tracer-start", description = "Starts the Backlog
tracer")
-public class BacklogTracerStart extends OsgiCommandSupport {
+public class BacklogTracerStart extends CamelCommandSupport {
 
     @Argument(index = 0, name = "context", description = "The name of the Camel context.",
             required = true, multiValued = false)
@@ -49,12 +48,6 @@ public class BacklogTracerStart extends OsgiCommandSupport {
             required = false, multiValued = false)
     Boolean removeOnDump;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     @Override
     protected Object doExecute() throws Exception {
         CamelContext camel = camelController.getCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStop.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStop.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStop.java
index 402dabf..d1d9d76 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStop.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/BacklogTracerStop.java
@@ -20,23 +20,16 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to use the <a href="camel.apache.org/backlogtracer">Backlog Tracer</a>.
  */
 @Command(scope = "camel", name = "backlog-tracer-stop", description = "Stops the Backlog
tracer")
-public class BacklogTracerStop extends OsgiCommandSupport {
+public class BacklogTracerStop extends CamelCommandSupport {
 
     @Argument(index = 0, name = "context", description = "The name of the Camel context.",
required = true, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     @Override
     protected Object doExecute() throws Exception {
         CamelContext camel = camelController.getCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelCommandSupport.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelCommandSupport.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelCommandSupport.java
new file mode 100644
index 0000000..a1edfe2
--- /dev/null
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelCommandSupport.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.karaf.commands;
+
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+
+/**
+ * The abstract base class for karaf commands.
+ */
+public abstract class CamelCommandSupport extends OsgiCommandSupport {
+
+    protected CamelController camelController;
+
+    public void setCamelController(CamelController camelController) {
+        this.camelController = camelController;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelController.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelController.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelController.java
index 2252589..b62a5f3 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelController.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelController.java
@@ -61,14 +61,6 @@ public interface CamelController {
     List<Route> getRoutes(String camelContextName, String filter);
 
     /**
-     * Get all route definitions. If Camel context name is null, all route definitions from
all contexts are listed.
-     *
-     * @param camelContextName the Camel context name. If null, all contexts are considered.
-     * @return the list of the Camel route definitions.
-     */
-    List<RouteDefinition> getRouteDefinitions(String camelContextName);
-
-    /**
      * Return the route with the given route ID.
      *
      * @param routeId the route ID.

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
index 0cee886..1fd1508 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
@@ -20,6 +20,7 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -30,7 +31,6 @@ import org.apache.camel.Route;
 import org.apache.camel.spi.ManagementAgent;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.apache.karaf.util.StringEscapeUtils;
 
 import static org.apache.camel.util.UnitUtils.printUnitFromBytes;
@@ -39,7 +39,7 @@ import static org.apache.camel.util.UnitUtils.printUnitFromBytes;
  * Command to display detailed information about a Camel context.
  */
 @Command(scope = "camel", name = "context-info", description = "Display detailed information
about a Camel context.")
-public class ContextInfo extends OsgiCommandSupport {
+public class ContextInfo extends CamelCommandSupport {
 
     @Argument(index = 0, name = "name", description = "The name of the Camel context", required
= true, multiValued = false)
     String name;
@@ -47,12 +47,6 @@ public class ContextInfo extends OsgiCommandSupport {
     @Argument(index = 1, name = "mode", description = "Allows for different display modes
(--verbose, etc)", required = false, multiValued = false)
     String mode;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     public Object doExecute() throws Exception {
         CamelContext camelContext = camelController.getCamelContext(name);
 
@@ -82,8 +76,8 @@ public class ContextInfo extends OsgiCommandSupport {
         System.out.println(StringEscapeUtils.unescapeJava("\tTracing: " + camelContext.isTracing()));
         System.out.println("");
         System.out.println(StringEscapeUtils.unescapeJava("\u001B[1mProperties\u001B[0m"));
-        for (String property : camelContext.getProperties().keySet()) {
-            System.out.println(StringEscapeUtils.unescapeJava("\t" + property + " = " + camelContext.getProperty(property)));
+        for (Map.Entry<String, String> entry : camelContext.getProperties().entrySet())
{
+            System.out.println(StringEscapeUtils.unescapeJava("\t" + entry.getKey() + " =
" + entry.getValue()));
         }
 
         System.out.println("");
@@ -100,8 +94,8 @@ public class ContextInfo extends OsgiCommandSupport {
 
         System.out.println("");
         System.out.println(StringEscapeUtils.unescapeJava("\u001B[1mDataformats\u001B[0m"));
-        for (String names : camelContext.getDataFormats().keySet()) {
-            System.out.println(StringEscapeUtils.unescapeJava("\t" + names));
+        for (String name : camelContext.getDataFormats().keySet()) {
+            System.out.println(StringEscapeUtils.unescapeJava("\t" + name));
         }
 
         System.out.println("");

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextList.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextList.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextList.java
index 1dfe09c..ea69598 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextList.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextList.java
@@ -23,13 +23,12 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * List the Camel contexts available in the Karaf instance.
  */
 @Command(scope = "camel", name = "context-list", description = "Lists all Camel contexts.")
-public class ContextList extends OsgiCommandSupport {
+public class ContextList extends CamelCommandSupport {
 
     private static final String CONTEXT_COLUMN_LABEL = "Context";
     private static final String STATUS_COLUMN_LABEL = "Status";
@@ -43,12 +42,6 @@ public class ContextList extends OsgiCommandSupport {
     private static final int MAX_COLUMN_WIDTH = Integer.MAX_VALUE;
     private static final int MIN_COLUMN_WIDTH = 12;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     protected Object doExecute() throws Exception {
         final List<CamelContext> camelContexts = camelController.getCamelContexts();
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStart.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStart.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStart.java
index b30fe0a..229ccc6 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStart.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStart.java
@@ -19,23 +19,16 @@ package org.apache.camel.karaf.commands;
 import org.apache.camel.CamelContext;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to start a Camel context.
  */
 @Command(scope = "camel", name = "context-start", description = "Start a Camel context.")
-public class ContextStart extends OsgiCommandSupport {
+public class ContextStart extends CamelCommandSupport {
 
     @Argument(index = 0, name = "context", description = "The name of the Camel context.",
required = true, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     public Object doExecute() throws Exception {
         CamelContext camelContext = camelController.getCamelContext(context);
         if (camelContext == null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStop.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStop.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStop.java
index 5cbd330..7503602 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStop.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextStop.java
@@ -19,23 +19,16 @@ package org.apache.camel.karaf.commands;
 import org.apache.camel.CamelContext;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to stop a Camel context.
  */
 @Command(scope = "camel", name = "context-stop", description = "Stop a Camel context.")
-public class ContextStop extends OsgiCommandSupport {
+public class ContextStop extends CamelCommandSupport {
 
     @Argument(index = 0, name = "context", description = "The name of the Camel context.",
required = true, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     public Object doExecute() throws Exception {
         CamelContext camelContext = camelController.getCamelContext(context);
         if (camelContext == null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/EndpointList.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/EndpointList.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/EndpointList.java
index 598c0d4..1056269 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/EndpointList.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/EndpointList.java
@@ -29,13 +29,12 @@ import org.apache.camel.util.URISupport;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 import org.apache.felix.gogo.commands.Option;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * List the Camel endpoints available in the Karaf instance.
  */
 @Command(scope = "camel", name = "endpoint-list", description = "Lists all Camel endpoints
available in CamelContexts.")
-public class EndpointList extends OsgiCommandSupport {
+public class EndpointList extends CamelCommandSupport {
 
     private static final String CONTEXT_COLUMN_LABEL = "Context";
     private static final String URI_COLUMN_LABEL = "Uri";
@@ -62,12 +61,6 @@ public class EndpointList extends OsgiCommandSupport {
             required = false, multiValued = false, valueToShowInHelp = "false")
     Boolean verbose;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     protected Object doExecute() throws Exception {
         List<Endpoint> endpoints = camelController.getEndpoints(name);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/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 5391a40..5fdb214 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
@@ -19,6 +19,7 @@ package org.apache.camel.karaf.commands;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Set;
 
 import javax.management.MBeanServer;
@@ -31,14 +32,13 @@ import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.spi.ManagementAgent;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.apache.karaf.util.StringEscapeUtils;
 
 /**
  * Command to display detailed information about a Camel route.
  */
 @Command(scope = "camel", name = "route-info", description = "Display information about a
Camel route.")
-public class RouteInfo extends OsgiCommandSupport {
+public class RouteInfo extends CamelCommandSupport {
 
     @Argument(index = 0, name = "route", description = "The Camel route ID.", required =
true, multiValued = false)
     String route;
@@ -46,12 +46,6 @@ public class RouteInfo extends OsgiCommandSupport {
     @Argument(index = 1, name = "context", description = "The Camel context name.", required
= false, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     public Object doExecute() throws Exception {
         Route camelRoute = camelController.getRoute(route, context);
 
@@ -64,8 +58,8 @@ public class RouteInfo extends OsgiCommandSupport {
         System.out.println(StringEscapeUtils.unescapeJava("\tCamel Context: " + camelRoute.getRouteContext().getCamelContext().getName()));
         System.out.println("");
         System.out.println(StringEscapeUtils.unescapeJava("\u001B[1mProperties\u001B[0m"));
-        for (String property : camelRoute.getProperties().keySet()) {
-            System.out.println(StringEscapeUtils.unescapeJava("\t\t" + property + " = " +
camelRoute.getProperties().get(property)));
+        for (Map.Entry<String, Object> entry : camelRoute.getProperties().entrySet())
{
+            System.out.println(StringEscapeUtils.unescapeJava("\t" + entry.getKey() + " =
" + entry.getValue()));
         }
         System.out.println("");
         System.out.println(StringEscapeUtils.unescapeJava("\u001B[1mStatistics\u001B[0m"));

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteList.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteList.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteList.java
index df081c1..b1e2988 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteList.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteList.java
@@ -25,13 +25,12 @@ import org.apache.camel.Route;
 import org.apache.camel.ServiceStatus;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to list all Camel routes.
  */
 @Command(scope = "camel", name = "route-list", description = "List Camel routes.")
-public class RouteList extends OsgiCommandSupport {
+public class RouteList extends CamelCommandSupport {
 
     private static final String CONTEXT_COLUMN_LABEL = "Context";
     private static final String ROUTE_COLUMN_LABEL = "Route";
@@ -49,12 +48,6 @@ public class RouteList extends OsgiCommandSupport {
     @Argument(index = 0, name = "name", description = "The Camel context name where to look
for the route", required = false, multiValued = false)
     String name;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     protected Object doExecute() throws Exception {
         List<Route> routes = camelController.getRoutes(name);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/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 31f4b2e..87a71fa 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
@@ -21,13 +21,12 @@ import org.apache.camel.model.ModelHelper;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 /**
  * Command to show the route marshaled in XML.
  */
 @Command(scope = "camel", name = "route-show", description = "Display the Camel route definition
in XML.")
-public class RouteShow extends OsgiCommandSupport {
+public class RouteShow extends CamelCommandSupport {
 
     @Argument(index = 0, name = "route", description = "The Camel route ID.", required =
true, multiValued = false)
     String route;
@@ -35,12 +34,6 @@ public class RouteShow extends OsgiCommandSupport {
     @Argument(index = 1, name = "context", description = "The Camel context name.", required
= false, multiValued = false)
     String context;
 
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
-
     public Object doExecute() throws Exception {
         Route camelRoute = camelController.getRoute(route, context);
         if (camelRoute == null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelCompleterSupport.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelCompleterSupport.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelCompleterSupport.java
new file mode 100644
index 0000000..ff17d94
--- /dev/null
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelCompleterSupport.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.karaf.commands.completers;
+
+import org.apache.camel.karaf.commands.CamelController;
+
+import org.apache.karaf.shell.console.Completer;
+
+/**
+ * The abstract base class for completers.
+ */
+public abstract class CamelCompleterSupport implements Completer {
+
+    protected CamelController camelController;
+
+    public void setCamelController(CamelController camelController) {
+        this.camelController = camelController;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
index 7026e0b..54ced21 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
@@ -20,19 +20,11 @@ import java.util.List;
 
 import jline.console.completer.StringsCompleter;
 import org.apache.camel.CamelContext;
-import org.apache.camel.karaf.commands.CamelController;
-import org.apache.karaf.shell.console.Completer;
 
 /**
  * A JLine completer for the Camel contexts.
  */
-public class CamelContextCompleter implements Completer {
-
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
+public class CamelContextCompleter extends CamelCompleterSupport {
 
     @SuppressWarnings({"unchecked", "rawtypes"})
     public int complete(String buffer, int cursor, List candidates) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
index 92f04ad..53a3d4d 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
@@ -20,19 +20,11 @@ import java.util.List;
 
 import jline.console.completer.StringsCompleter;
 import org.apache.camel.Route;
-import org.apache.camel.karaf.commands.CamelController;
-import org.apache.karaf.shell.console.Completer;
 
 /**
  * A Jline completer for the Camel routes.
  */
-public class RouteCompleter implements Completer {
-
-    private CamelController camelController;
-
-    public void setCamelController(CamelController camelController) {
-        this.camelController = camelController;
-    }
+public class RouteCompleter extends CamelCompleterSupport {
 
     @SuppressWarnings({"unchecked", "rawtypes"})
     public int complete(String buffer, int cursor, List candidates) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f2988877/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
index 6648856..2bf1451 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
@@ -128,46 +128,6 @@ public class CamelControllerImpl implements CamelController {
         return routes;
     }
 
-    @SuppressWarnings("deprecation")
-    public List<RouteDefinition> getRouteDefinitions(String camelContextName) {
-        List<RouteDefinition> answer = new ArrayList<RouteDefinition>();
-
-        if (camelContextName != null) {
-            CamelContext context = this.getCamelContext(camelContextName);
-            if (context != null) {
-                List<RouteDefinition> routes = context.getRouteDefinitions();
-                // sort routes
-                Collections.sort(routes, new Comparator<RouteDefinition>() {
-                    @Override
-                    public int compare(RouteDefinition o1, RouteDefinition o2) {
-                        // already sorted by camel context first, so just sort the ids
-                        return o1.getId().compareTo(o2.getId());
-                    }
-                });
-                answer.addAll(routes);
-            }
-        } else {
-            // already sorted by camel context
-            List<CamelContext> camelContexts = this.getCamelContexts();
-            for (CamelContext camelContext : camelContexts) {
-                for (RouteDefinition routeDefinition : camelContext.getRouteDefinitions())
{
-                    List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
-                    // sort routes
-                    Collections.sort(routes, new Comparator<RouteDefinition>() {
-                        @Override
-                        public int compare(RouteDefinition o1, RouteDefinition o2) {
-                            // already sorted by camel context first, so just sort the ids
-                            return o1.getId().compareTo(o2.getId());
-                        }
-                    });
-                    answer.addAll(routes);
-                }
-            }
-        }
-        // already sorted
-        return answer;
-    }
-
     public Route getRoute(String routeId, String camelContextName) {
         List<Route> routes = this.getRoutes(camelContextName);
         for (Route route : routes) {


Mime
View raw message