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/07 09:25:19 UTC

[1/5] camel git commit: CAMEL-9224 : Camel shell commands adapter for Spring Boot Remote shell

Repository: camel
Updated Branches:
  refs/heads/master fb6601193 -> e55597f17


CAMEL-9224 : Camel shell commands adapter for Spring Boot Remote shell


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

Branch: refs/heads/master
Commit: 15d4be0cf39f70948276f7b1fa30b5edc6885120
Parents: fb66011
Author: Evgeny Minkevich <ev...@gmail.com>
Authored: Fri Nov 6 11:27:20 2015 +1100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 08:56:08 2015 +0100

----------------------------------------------------------------------
 .../commands/commands-spring-boot/README.md     |  34 +++
 platforms/commands/commands-spring-boot/pom.xml |  30 ++
 .../commands/crsh/ArgumentCamelContext.java     |  31 +++
 .../commands/crsh/ArgumentRouteID.java          |  31 +++
 .../commands/crsh/CamelCommandsFacade.java      | 111 ++++++++
 .../commands/crsh/CamelCommandsPlugin.java      |  56 ++++
 .../commands/crsh/CamelCompleter.java           |  74 +++++
 .../commands/crsh/CamelControllerImpl.java      |  83 ++++++
 .../commands/crsh/NoopStringEscape.java         |  34 +++
 .../springboot/commands/crsh/OutputBuffer.java  |  47 ++++
 .../services/org.crsh.plugin.CRaSHPlugin        |   1 +
 .../resources/crash/commands/camel/camel.groovy | 278 +++++++++++++++++++
 12 files changed, 810 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/README.md
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/README.md b/platforms/commands/commands-spring-boot/README.md
new file mode 100644
index 0000000..d82732b
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/README.md
@@ -0,0 +1,34 @@
+# Camel Shell Commands for Spring Boot
+
+This component is implemented as a plugin for [CRuSH Java Shell](http://www.crashub.org/), a component used by the Spring Boot platform for the remote shell.
+It is essentially an adapter for the available Camel commands, responsible for passing through the options and arguments.
+
+# Installation
+
+To enable Spring Boot remote shell support:
+
+```xml
+
+<dependency>
+    <groupId>org.springframework.boot</groupId>
+    <artifactId>spring-boot-starter-remote-shell</artifactId>
+    <version>x.x.x</version>
+    <!-- use the version that is used as the depndency by the Camel -->
+</dependency>
+
+```
+
+To enable Camel Commands for the Spring Boot remote shell:
+
+```xml
+
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-commands-springboot</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+
+```
+
+

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/pom.xml b/platforms/commands/commands-spring-boot/pom.xml
new file mode 100755
index 0000000..6904ac1
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/pom.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>commands</artifactId>
+        <version>2.17-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-commands-springboot</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Platforms :: Commands :: Spring Boot</name>
+    <description>Camel Commands using Spring Boot Shell</description>
+    <modelVersion>4.0.0</modelVersion>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-commands-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-remote-shell</artifactId>
+            <version>${spring-boot-version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
new file mode 100644
index 0000000..226378a
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
@@ -0,0 +1,31 @@
+/**
+ *
+ * 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.springboot.commands.crsh;
+
+import org.crsh.cli.Argument;
+import org.crsh.cli.Man;
+import org.crsh.cli.Usage;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Usage("Camel context name")
+@Man("Camel context name")
+@Argument(name = "Camel Context", completer = CamelCompleter.class)
+@interface ArgumentCamelContext {}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
new file mode 100644
index 0000000..94d61d1
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
@@ -0,0 +1,31 @@
+/**
+ *
+ * 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.springboot.commands.crsh;
+
+import org.crsh.cli.Argument;
+import org.crsh.cli.Man;
+import org.crsh.cli.Usage;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Usage("Route ID")
+@Man("Route ID")
+@Argument(name = "Route ID", completer = CamelCompleter.class)
+@interface ArgumentRouteID {}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/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
new file mode 100644
index 0000000..b73c10d
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsFacade.java
@@ -0,0 +1,111 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.springboot.commands.crsh;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.commands.AbstractCamelCommand;
+import org.apache.camel.commands.AbstractRouteCommand;
+import org.apache.camel.commands.LocalCamelController;
+import org.apache.camel.commands.StringEscape;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.PrintStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+public class CamelCommandsFacade {
+
+    protected final Logger log = LoggerFactory.getLogger(getClass().getName());
+
+    private LocalCamelController camelController;
+    private StringEscape stringEscape = new NoopStringEscape();
+
+    CamelCommandsFacade(LocalCamelController controller) {
+        this.camelController = controller;
+    }
+
+    LocalCamelController getCamelController() {
+        return this.camelController;
+    }
+
+    public <T extends AbstractCamelCommand> String runCommand(Class<T> clazz, Object... commandArgs) throws Exception {
+        OutputBuffer buffer = new OutputBuffer();
+        PrintStream ops = buffer.getPrintStream();
+
+        // Trying to infer the camel context if not given
+        // The order of the varargs for Route Command
+        // [0] - route id
+        // [1] - camel context
+        if (AbstractRouteCommand.class.isAssignableFrom(clazz) && null == commandArgs[1]) {
+            commandArgs[1] = getCamelContextForRoute((String) commandArgs[0]);
+            ops.println("Automatically inferred context name : "+commandArgs[1]);
+        }
+
+        // Finding the right constructor
+        Class[] types = new Class[commandArgs.length];
+        for (int i = 0; i < commandArgs.length; i++) {
+            types[i] = commandArgs[i].getClass();
+
+            // Commands require primitives
+            if (types[i] == Boolean.class) types[i] = boolean.class;
+            if (types[i] == Integer.class) types[i] = int.class;
+        }
+
+        // Instantiating an object
+        Constructor<T> constructor = clazz.getConstructor(types);
+        T command = constructor.newInstance(commandArgs);
+
+        // Some commands require StringEscape property to be set
+        try {
+            Method m = clazz.getMethod("setStringEscape", org.apache.camel.commands.StringEscape.class);
+            m.invoke(command, stringEscape);
+        } catch (Exception e) {
+        }
+
+        // Executing
+        command.execute(camelController, ops, ops);
+        return buffer.toString();
+    }
+
+    private String getCamelContextForRoute(String routeId) throws Exception {
+        ArrayList<String> contextNames = new ArrayList<String>();
+
+        for (CamelContext camelContext : camelController.getLocalCamelContexts()) {
+            for (Route route : camelContext.getRoutes()) {
+                if (routeId.equals(route.getId())) {
+                    contextNames.add(camelContext.getName());
+                    break;
+                }
+            }
+        }
+
+        if (contextNames.size() != 1) {
+            StringBuffer error = new StringBuffer();
+            error.append("Cannot infer Camel Context. Please provide manually.");
+
+            if (contextNames.size() > 1)
+                error.append(" Contexts : "+contextNames.toString());
+
+            throw new org.crsh.cli.impl.SyntaxException(error.toString());
+        }
+
+        return contextNames.get(0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
new file mode 100644
index 0000000..51e5820
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
@@ -0,0 +1,56 @@
+/**
+ *
+ * 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.springboot.commands.crsh;
+
+import org.crsh.plugin.CRaSHPlugin;
+import org.springframework.beans.factory.ListableBeanFactory;
+
+public class CamelCommandsPlugin extends CRaSHPlugin<CamelCommandsPlugin> {
+
+    private static CamelCommandsPlugin camelPlugin;
+
+    private static void setCamelPlugin(CamelCommandsPlugin plugin){
+        camelPlugin = plugin;
+    }
+
+    static CamelCommandsPlugin getInstance(){
+        return camelPlugin;
+    }
+
+    private CamelCommandsFacade facade;
+
+    @Override
+    public CamelCommandsPlugin getImplementation() {
+        return this;
+    }
+
+    @Override
+    public void init() {
+        ListableBeanFactory beanFactory = (ListableBeanFactory) getContext().getAttributes().get("spring.beanfactory");
+        this.facade = new CamelCommandsFacade(new CamelControllerImpl(beanFactory));
+        setCamelPlugin(this);
+    }
+
+    @Override
+    public void destroy() {
+    }
+
+    CamelCommandsFacade getCamelCommandsFacade(){
+        return this.facade;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
new file mode 100644
index 0000000..ffcd78c
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
@@ -0,0 +1,74 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.springboot.commands.crsh;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.commands.LocalCamelController;
+import org.crsh.cli.descriptor.ParameterDescriptor;
+import org.crsh.cli.spi.Completer;
+import org.crsh.cli.spi.Completion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.LinkedList;
+
+public class CamelCompleter implements Completer {
+
+    private LocalCamelController camelController = CamelCommandsPlugin.getInstance().getCamelCommandsFacade().getCamelController();
+    private Logger log = LoggerFactory.getLogger(CamelCompleter.class);
+
+    public Completion complete(ParameterDescriptor parameterDescriptor, String prefix) throws Exception {
+
+
+        LinkedList<String> values = new LinkedList<String>();
+        Completion.Builder builder = new Completion.Builder(prefix);
+
+        if (parameterDescriptor.getAnnotation() instanceof ArgumentCamelContext) {
+            values.addAll(getContextNames());
+        }
+
+        if (parameterDescriptor.getAnnotation() instanceof ArgumentRouteID) {
+            values.addAll(getRouteIds());
+        }
+
+        for (String value : values) {
+            if (value.startsWith(prefix))
+                builder.add(value.substring(prefix.length()), true);
+        }
+
+        return builder.build();
+    }
+
+    private LinkedList<String> getContextNames() throws Exception {
+        LinkedList<String> values = new LinkedList<String>();
+        for (CamelContext camelContext : camelController.getLocalCamelContexts()) {
+            values.add(camelContext.getName());
+        }
+        return values;
+    }
+
+    private LinkedList<String> getRouteIds() throws Exception {
+        LinkedList<String> values = new LinkedList<String>();
+        for (CamelContext camelContext : camelController.getLocalCamelContexts()) {
+            for (Route route : camelContext.getRoutes()) {
+                values.add(route.getId());
+            }
+        }
+        return values;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
new file mode 100644
index 0000000..3464f9f
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
@@ -0,0 +1,83 @@
+/**
+ * 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.springboot.commands.crsh;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.commands.AbstractLocalCamelController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.ListableBeanFactory;
+
+public class CamelControllerImpl extends AbstractLocalCamelController {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CamelControllerImpl.class);
+
+    private ListableBeanFactory beanFactory;
+
+    CamelControllerImpl(ListableBeanFactory factory){
+        beanFactory = factory;
+    }
+
+    public List<CamelContext> getLocalCamelContexts() {
+        List<CamelContext> camelContexts = new ArrayList<CamelContext>();
+        try {
+            camelContexts.addAll( beanFactory.getBeansOfType(CamelContext.class).values() );
+        } catch (Exception e) {
+            LOG.warn("Cannot retrieve the list of Camel contexts.", e);
+        }
+
+        Collections.sort(camelContexts, new Comparator<CamelContext>() {
+            public int compare(CamelContext o1, CamelContext o2) {
+                return o1.getName().compareTo(o2.getName());
+            }
+        });
+
+        return camelContexts;
+    }
+
+    public List<Map<String, String>> getCamelContexts() throws Exception {
+        List<Map<String, String>> answer = new ArrayList<Map<String, String>>();
+
+        List<CamelContext> camelContexts = getLocalCamelContexts();
+        for (CamelContext camelContext : camelContexts) {
+            Map<String, String> row = new LinkedHashMap<String, String>();
+            row.put("name", camelContext.getName());
+            row.put("state", camelContext.getStatus().name());
+            row.put("uptime", camelContext.getUptime());
+            if (camelContext.getManagedCamelContext() != null) {
+                row.put("exchangesTotal", "" + camelContext.getManagedCamelContext().getExchangesTotal());
+                row.put("exchangesInflight", "" + camelContext.getManagedCamelContext().getExchangesInflight());
+                row.put("exchangesFailed", "" + camelContext.getManagedCamelContext().getExchangesFailed());
+            } else {
+                row.put("exchangesTotal", "0");
+                row.put("exchangesInflight", "0");
+                row.put("exchangesFailed", "0");
+            }
+            answer.add(row);
+        }
+
+        return answer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/NoopStringEscape.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/NoopStringEscape.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/NoopStringEscape.java
new file mode 100644
index 0000000..b46828e
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/NoopStringEscape.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.springboot.commands.crsh;
+
+import org.apache.camel.commands.StringEscape;
+
+class NoopStringEscape implements StringEscape {
+
+    public String unescapeJava(String s) {
+        return s;
+    }
+
+    public String escapeJava(String s) {
+        return s;
+    }
+
+    public String hex(char c) {
+        return Character.toString(c);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
new file mode 100644
index 0000000..a9b8488
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
@@ -0,0 +1,47 @@
+/**
+ *
+ * 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.springboot.commands.crsh;
+
+import java.io.*;
+
+class OutputBuffer {
+
+    private ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    private PrintStream ps = new PrintStream(baos);
+
+    public PrintStream getPrintStream(){
+        return ps;
+    }
+
+    @Override
+    public String toString() {
+        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(baos.toByteArray())));
+        StringBuffer sb = new StringBuffer();
+        String line = null;
+        String lineSeparator = System.getProperty("line.separator");
+        try {
+            while ((line = bufferedReader.readLine()) != null) {
+                sb.append(line);
+                sb.append(lineSeparator);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/platforms/commands/commands-spring-boot/src/main/resources/META-INF/services/org.crsh.plugin.CRaSHPlugin
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/resources/META-INF/services/org.crsh.plugin.CRaSHPlugin b/platforms/commands/commands-spring-boot/src/main/resources/META-INF/services/org.crsh.plugin.CRaSHPlugin
new file mode 100755
index 0000000..b3b459a
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/resources/META-INF/services/org.crsh.plugin.CRaSHPlugin
@@ -0,0 +1 @@
+org.apache.camel.springboot.commands.crsh.CamelCommandsPlugin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/15d4be0c/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
new file mode 100644
index 0000000..5886f48
--- /dev/null
+++ b/platforms/commands/commands-spring-boot/src/main/resources/crash/commands/camel/camel.groovy
@@ -0,0 +1,278 @@
+/**
+ *
+ * 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 crash.commands.camel
+
+import org.apache.camel.commands.ComponentListCommand
+import org.apache.camel.commands.ContextInflightCommand
+import org.apache.camel.commands.ContextInfoCommand
+import org.apache.camel.commands.ContextListCommand
+import org.apache.camel.commands.ContextResumeCommand
+import org.apache.camel.commands.ContextStartCommand
+import org.apache.camel.commands.ContextStopCommand
+import org.apache.camel.commands.ContextSuspendCommand
+import org.apache.camel.commands.EipExplainCommand
+import org.apache.camel.commands.EndpointExplainCommand
+import org.apache.camel.commands.EndpointListCommand
+import org.apache.camel.commands.EndpointStatisticCommand
+import org.apache.camel.commands.RestRegistryListCommand
+import org.apache.camel.commands.RouteInfoCommand
+import org.apache.camel.commands.RouteListCommand
+import org.apache.camel.commands.RouteProfileCommand
+import org.apache.camel.commands.RouteResetStatsCommand
+import org.apache.camel.commands.RouteResumeCommand
+import org.apache.camel.commands.RouteShowCommand
+import org.apache.camel.commands.RouteStartCommand
+import org.apache.camel.commands.RouteStopCommand
+import org.apache.camel.commands.RouteSuspendCommand
+import org.apache.camel.springboot.commands.crsh.ArgumentCamelContext
+import org.apache.camel.springboot.commands.crsh.ArgumentRouteID
+import org.apache.camel.springboot.commands.crsh.CamelCommandsFacade
+import org.crsh.cli.Argument
+import org.crsh.cli.Command
+import org.crsh.cli.Option
+import org.crsh.cli.Usage
+import org.crsh.cli.Named
+import org.crsh.cli.Required
+import org.apache.camel.springboot.commands.crsh.CamelCommandsPlugin
+import org.crsh.groovy.GroovyCommand
+
+@Usage("Camel related commands")
+public class camel extends GroovyCommand {
+
+    private CamelCommandsFacade getCommandsFacade() {
+        return context.session["crash"].
+                context.getPlugin(CamelCommandsPlugin.class).getCamelCommandsFacade()
+    }
+    // ===============================
+    //    Components and EIP
+    // ===============================
+    @Command
+    @Usage("Lists all Camel components available in the context.")
+    @Named("component-list")
+    public String component_list(@Required @ArgumentCamelContext String camelContext,
+                                 @Usage("Verbose output")
+                                 @Option(names = ["v", "verbose"]) Boolean verbose) {
+        Boolean v = (null != verbose && Boolean.valueOf(verbose))
+        return getCommandsFacade().runCommand(ComponentListCommand.class, camelContext, v)
+    }
+
+    @Command
+    @Usage("Explains the EIP in the Camel context.")
+    @Named("eip-explain")
+    public String eip_explain(@Required @ArgumentCamelContext String camelContext,
+                              @Required @Argument String nameOrId,
+                                 @Usage("Verbose output")
+                                 @Option(names = ["v", "verbose"]) Boolean verbose) {
+        Boolean v = (null != verbose && Boolean.valueOf(verbose))
+        return getCommandsFacade().runCommand(EipExplainCommand.class, camelContext, nameOrId, v)
+    }
+
+    // ===============================
+    //    Context
+    // ===============================
+    @Command
+    @Usage("Lists all Camel contexts.")
+    @Named("context-list")
+    public String context_list() {
+        return getCommandsFacade().runCommand(ContextListCommand.class)
+    }
+
+    @Command
+    @Usage("Displays detailed information about the Camel context.")
+    @Named("context-info")
+    public String context_info(@Required @ArgumentCamelContext String camelContext,
+                               @Usage("Verbose output")
+                               @Option(names = ["v", "verbose"]) Boolean verbose) {
+        Boolean v = (null != verbose && Boolean.valueOf(verbose))
+        return getCommandsFacade().runCommand(ContextInfoCommand.class, camelContext, v)
+    }
+
+    @Command
+    @Usage("Displays detailed information about the Camel context.")
+    @Named("context-inflight")
+    public String context_inflight(@Required @ArgumentCamelContext String camelContext,
+                                   @Usage("Sort by longest duration")
+                                   @Option(names = ["s", "sort"]) Boolean sort,
+                                   @Usage("Limit output to number of messages")
+                                   @Option(names = ["l", "limit"]) Integer limit) {
+
+        Boolean _sort = (null != sort && Boolean.valueOf(sort))
+        Integer _limit = null != limit ? limit : -1;
+
+        if (_limit != -1)
+            out.println("Limiting output to "+_limit+" messages.")
+
+        return getCommandsFacade().runCommand(ContextInflightCommand.class, camelContext, _limit, _sort)
+    }
+
+    @Command
+    @Usage("Starts the Camel context.")
+    @Named("context-start")
+    public String context_start(@Required @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(ContextStartCommand.class, camelContext)
+    }
+
+    @Command
+    @Usage("Stops the Camel context.")
+    @Named("context-stop")
+    public String context_stop(@Required @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(ContextStopCommand.class, camelContext)
+    }
+
+    @Command
+    @Usage("Suspends the Camel context.")
+    @Named("context-suspend")
+    public String context_suspend(@Required @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(ContextSuspendCommand.class, camelContext)
+    }
+
+    @Command
+    @Usage("Resumes the Camel context.")
+    @Named("context-resume")
+    public String context_resume(@Required @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(ContextResumeCommand.class, camelContext)
+    }
+
+    // ===============================
+    //    Endpoints
+    // ===============================
+    @Command
+    @Usage("Lists Camel endpoints.")
+    @Named("endpoint-list")
+    public String endpoint_list(@Required @ArgumentCamelContext String camelContext,
+                                 @Usage("Decode URI so they are human readable")
+                                 @Option(names = ["d", "decode"]) Boolean decode,
+                                 @Usage("Verbose output")
+                                 @Option(names = ["v", "verbose"]) Boolean verbose,
+                                 @Usage("Explain the endpoint options")
+                                 @Option(names = ["e", "explain"]) Boolean explain) {
+        Boolean _verbose = (null != verbose && Boolean.valueOf(verbose))
+        Boolean _decode  = (null != decode && Boolean.valueOf(decode))
+        Boolean _explain  = (null != explain && Boolean.valueOf(explain))
+        return getCommandsFacade().runCommand(EndpointListCommand.class, camelContext, _decode, _verbose, _explain);
+    }
+
+    @Command
+    @Usage("Explain all Camel endpoints available in the CamelContext.")
+    @Named("endpoint-explain")
+    public String endpoint_explain(@Required @ArgumentCamelContext String camelContext,
+                                 @Usage("Verbose output")
+                                 @Option(names = ["v", "verbose"]) Boolean verbose,
+                                 @Usage("Filter endpoint by pattern")
+                                 @Option(names = ["f", "filter"]) String filter) {
+        Boolean _verbose = (null != verbose && Boolean.valueOf(verbose))
+        String  _filter =  null != filter ? filter : "*";
+        return getCommandsFacade().runCommand(EndpointExplainCommand.class, camelContext, _verbose, _filter);
+    }
+
+    @Command
+    @Usage("Explain all Camel endpoints available in the CamelContext.")
+    @Named("endpoint-stats")
+    public String endpoint_stats(@Required @ArgumentCamelContext String camelContext,
+                                 @Usage("Decode URI so they are human readable")
+                                 @Option(names = ["d", "decode"]) Boolean decode,
+                                 @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"];
+        return getCommandsFacade().runCommand(EndpointStatisticCommand.class, camelContext, _decode, _filter);
+    }
+
+    @Command
+    @Usage("Lists all Camel REST services enlisted in the Rest Registry from a CamelContext.")
+    @Named("rest-registry-list")
+    public String rest_registry_list(@Required @ArgumentCamelContext String camelContext,
+                                 @Usage("Decode URI so they are human readable")
+                                 @Option(names = ["d", "decode"]) Boolean decode,
+                                 @Usage("Verbose output")
+                                 @Option(names = ["v", "verbose"]) Boolean verbose){
+        Boolean _verbose = (null != verbose && Boolean.valueOf(verbose))
+        Boolean _decode  = (null != decode && Boolean.valueOf(decode))
+        return getCommandsFacade().runCommand(RestRegistryListCommand.class, camelContext, _decode, _verbose);
+    }
+
+    // ===============================
+    //    Route
+    // ===============================
+    @Command
+    @Usage("Lists Camel routes for the given Camel context.")
+    @Named("route-list")
+    public String route_list(@Required @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteListCommand.class, camelContext)
+    }
+
+    @Command
+    @Usage("Displays information about a Camel route")
+    @Named("route-info")
+    public String route_info(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteInfoCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Displays Camel route profile")
+    @Named("route-profile")
+    public String route_profile(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteProfileCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Display the Camel route definition in XML.")
+    @Named("route-show")
+    public String route_show(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteShowCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Resets route performance stats.")
+    @Named("route-reset-stats")
+    public String route_reset_stats(
+            @Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteResetStatsCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Resumes the route operation.")
+    @Named("route-resume")
+    public String route_resume(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteResumeCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Suspends the route operation.")
+    @Named("route-suspend")
+    public String route_suspend(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteSuspendCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Stops the route operation.")
+    @Named("route-stop")
+    public String route_stop(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteStopCommand.class, route, camelContext)
+    }
+
+    @Command
+    @Usage("Starts the route operation.")
+    @Named("route-start")
+    public String route_start(@Required @ArgumentRouteID String route, @ArgumentCamelContext String camelContext) {
+        return getCommandsFacade().runCommand(RouteStartCommand.class, route, camelContext)
+    }
+
+
+}
+


[4/5] camel git commit: Fixed CS

Posted by da...@apache.org.
Fixed CS


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

Branch: refs/heads/master
Commit: 94d3aeefd20d01a124ca24d6a60ccc9109869cec
Parents: 2588b97
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Nov 7 09:26:28 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 09:26:28 2015 +0100

----------------------------------------------------------------------
 .../commands/crsh/ArgumentCamelContext.java     | 12 ++++----
 .../commands/crsh/ArgumentRouteID.java          | 12 ++++----
 .../commands/crsh/CamelCommandsFacade.java      | 31 ++++++++++++--------
 .../commands/crsh/CamelCommandsPlugin.java      | 14 ++++-----
 .../commands/crsh/CamelCompleter.java           | 17 +++++------
 .../commands/crsh/CamelControllerImpl.java      |  4 +--
 .../springboot/commands/crsh/OutputBuffer.java  | 14 +++++----
 7 files changed, 55 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
index 226378a..f1fc1f3 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentCamelContext.java
@@ -1,5 +1,4 @@
 /**
- *
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -17,15 +16,16 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 import org.crsh.cli.Argument;
 import org.crsh.cli.Man;
 import org.crsh.cli.Usage;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
 @Retention(RetentionPolicy.RUNTIME)
 @Usage("Camel context name")
 @Man("Camel context name")
 @Argument(name = "Camel Context", completer = CamelCompleter.class)
-@interface ArgumentCamelContext {}
+@interface ArgumentCamelContext {
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
index 94d61d1..1446444 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/ArgumentRouteID.java
@@ -1,5 +1,4 @@
 /**
- *
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -17,15 +16,16 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 import org.crsh.cli.Argument;
 import org.crsh.cli.Man;
 import org.crsh.cli.Usage;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
 @Retention(RetentionPolicy.RUNTIME)
 @Usage("Route ID")
 @Man("Route ID")
 @Argument(name = "Route ID", completer = CamelCompleter.class)
-@interface ArgumentRouteID {}
+@interface ArgumentRouteID {
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/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 b73c10d..90e0ebe 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
@@ -5,9 +5,9 @@
  * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ *      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.
@@ -16,6 +16,11 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.io.PrintStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.commands.AbstractCamelCommand;
@@ -25,11 +30,6 @@ import org.apache.camel.commands.StringEscape;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.PrintStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
 public class CamelCommandsFacade {
 
     protected final Logger log = LoggerFactory.getLogger(getClass().getName());
@@ -55,7 +55,7 @@ public class CamelCommandsFacade {
         // [1] - camel context
         if (AbstractRouteCommand.class.isAssignableFrom(clazz) && null == commandArgs[1]) {
             commandArgs[1] = getCamelContextForRoute((String) commandArgs[0]);
-            ops.println("Automatically inferred context name : "+commandArgs[1]);
+            ops.println("Automatically inferred context name : " + commandArgs[1]);
         }
 
         // Finding the right constructor
@@ -64,8 +64,12 @@ public class CamelCommandsFacade {
             types[i] = commandArgs[i].getClass();
 
             // Commands require primitives
-            if (types[i] == Boolean.class) types[i] = boolean.class;
-            if (types[i] == Integer.class) types[i] = int.class;
+            if (types[i] == Boolean.class) {
+                types[i] = boolean.class;
+            }
+            if (types[i] == Integer.class) {
+                types[i] = int.class;
+            }
         }
 
         // Instantiating an object
@@ -100,8 +104,9 @@ public class CamelCommandsFacade {
             StringBuffer error = new StringBuffer();
             error.append("Cannot infer Camel Context. Please provide manually.");
 
-            if (contextNames.size() > 1)
-                error.append(" Contexts : "+contextNames.toString());
+            if (contextNames.size() > 1) {
+                error.append(" Contexts : " + contextNames.toString());
+            }
 
             throw new org.crsh.cli.impl.SyntaxException(error.toString());
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
index 51e5820..b183ec5 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCommandsPlugin.java
@@ -1,5 +1,4 @@
 /**
- *
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -24,16 +23,16 @@ public class CamelCommandsPlugin extends CRaSHPlugin<CamelCommandsPlugin> {
 
     private static CamelCommandsPlugin camelPlugin;
 
-    private static void setCamelPlugin(CamelCommandsPlugin plugin){
+    private CamelCommandsFacade facade;
+
+    private static void setCamelPlugin(CamelCommandsPlugin plugin) {
         camelPlugin = plugin;
     }
 
-    static CamelCommandsPlugin getInstance(){
+    static CamelCommandsPlugin getInstance() {
         return camelPlugin;
     }
 
-    private CamelCommandsFacade facade;
-
     @Override
     public CamelCommandsPlugin getImplementation() {
         return this;
@@ -48,9 +47,10 @@ public class CamelCommandsPlugin extends CRaSHPlugin<CamelCommandsPlugin> {
 
     @Override
     public void destroy() {
+        // noop
     }
 
-    CamelCommandsFacade getCamelCommandsFacade(){
+    CamelCommandsFacade getCamelCommandsFacade() {
         return this.facade;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
index ffcd78c..1355661 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelCompleter.java
@@ -5,9 +5,9 @@
  * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ *      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.
@@ -16,25 +16,21 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
+import java.util.LinkedList;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.commands.LocalCamelController;
 import org.crsh.cli.descriptor.ParameterDescriptor;
 import org.crsh.cli.spi.Completer;
 import org.crsh.cli.spi.Completion;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.LinkedList;
 
 public class CamelCompleter implements Completer {
 
     private LocalCamelController camelController = CamelCommandsPlugin.getInstance().getCamelCommandsFacade().getCamelController();
-    private Logger log = LoggerFactory.getLogger(CamelCompleter.class);
 
     public Completion complete(ParameterDescriptor parameterDescriptor, String prefix) throws Exception {
 
-
         LinkedList<String> values = new LinkedList<String>();
         Completion.Builder builder = new Completion.Builder(prefix);
 
@@ -47,8 +43,9 @@ public class CamelCompleter implements Completer {
         }
 
         for (String value : values) {
-            if (value.startsWith(prefix))
+            if (value.startsWith(prefix)) {
                 builder.add(value.substring(prefix.length()), true);
+            }
         }
 
         return builder.build();

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
index 3464f9f..af837e3 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/CamelControllerImpl.java
@@ -35,14 +35,14 @@ public class CamelControllerImpl extends AbstractLocalCamelController {
 
     private ListableBeanFactory beanFactory;
 
-    CamelControllerImpl(ListableBeanFactory factory){
+    CamelControllerImpl(ListableBeanFactory factory) {
         beanFactory = factory;
     }
 
     public List<CamelContext> getLocalCamelContexts() {
         List<CamelContext> camelContexts = new ArrayList<CamelContext>();
         try {
-            camelContexts.addAll( beanFactory.getBeansOfType(CamelContext.class).values() );
+            camelContexts.addAll(beanFactory.getBeansOfType(CamelContext.class).values());
         } catch (Exception e) {
             LOG.warn("Cannot retrieve the list of Camel contexts.", e);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/94d3aeef/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
index a9b8488..5f54004 100644
--- a/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
+++ b/platforms/commands/commands-spring-boot/src/main/java/org/apache/camel/springboot/commands/crsh/OutputBuffer.java
@@ -1,5 +1,4 @@
 /**
- *
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -17,14 +16,19 @@
  */
 package org.apache.camel.springboot.commands.crsh;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
 
 class OutputBuffer {
 
     private ByteArrayOutputStream baos = new ByteArrayOutputStream();
     private PrintStream ps = new PrintStream(baos);
 
-    public PrintStream getPrintStream(){
+    public PrintStream getPrintStream() {
         return ps;
     }
 
@@ -32,7 +36,7 @@ class OutputBuffer {
     public String toString() {
         BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(baos.toByteArray())));
         StringBuffer sb = new StringBuffer();
-        String line = null;
+        String line;
         String lineSeparator = System.getProperty("line.separator");
         try {
             while ((line = bufferedReader.readLine()) != null) {


[3/5] camel git commit: CAMEL-9224 : Camel shell commands adapter for Spring Boot Remote shell.

Posted by da...@apache.org.
CAMEL-9224 : Camel shell commands adapter for Spring Boot Remote shell.


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

Branch: refs/heads/master
Commit: 2588b971027886744ad05ce9e65e1bde3c7c19c7
Parents: 897bf98
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Nov 7 09:17:34 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 09:17:34 2015 +0100

----------------------------------------------------------------------
 apache-camel/pom.xml                              |  4 ++++
 apache-camel/src/main/descriptors/common-bin.xml  |  1 +
 examples/camel-example-spring-boot/pom.xml        | 10 ++++++++++
 parent/pom.xml                                    |  5 +++++
 platforms/commands/commands-spring-boot/README.md |  2 +-
 platforms/commands/commands-spring-boot/pom.xml   |  2 +-
 6 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2588b971/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 11660fe..ce6df66 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -908,6 +908,10 @@
       <groupId>org.apache.camel.karaf</groupId>
       <artifactId>camel-karaf-commands</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-commands-spring-boot</artifactId>
+    </dependency>
 
     <!-- camel examples -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/2588b971/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 205ceb3..09585d4 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -237,6 +237,7 @@
         <include>org.apache.camel:camel-catalog</include>
         <include>org.apache.camel:camel-commands-core</include>
         <include>org.apache.camel:camel-commands-jolokia</include>
+        <include>org.apache.camel:camel-commands-spring-boot</include>
         <include>org.apache.camel.karaf:camel-karaf-commands</include>
         <!-- this jar is mandatory -->
         <include>org.slf4j:slf4j-api</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/2588b971/examples/camel-example-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot/pom.xml b/examples/camel-example-spring-boot/pom.xml
index adcecc8..ca67d00 100755
--- a/examples/camel-example-spring-boot/pom.xml
+++ b/examples/camel-example-spring-boot/pom.xml
@@ -65,6 +65,16 @@
       <artifactId>spring-boot-starter-actuator</artifactId>
     </dependency>
 
+    <!-- remote shell -->
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-remote-shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-commands-spring-boot</artifactId>
+    </dependency>
+
     <!-- testing -->
     <dependency>
       <groupId>org.springframework.boot</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/2588b971/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 7a3c2e4..44b47ba 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1709,6 +1709,11 @@
         <version>${project.version}</version>
       </dependency>
       <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-commands-spring-boot</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.camel.karaf</groupId>
         <artifactId>camel-karaf-commands</artifactId>
         <version>${project.version}</version>

http://git-wip-us.apache.org/repos/asf/camel/blob/2588b971/platforms/commands/commands-spring-boot/README.md
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/README.md b/platforms/commands/commands-spring-boot/README.md
index d82732b..f37986a 100644
--- a/platforms/commands/commands-spring-boot/README.md
+++ b/platforms/commands/commands-spring-boot/README.md
@@ -24,7 +24,7 @@ To enable Camel Commands for the Spring Boot remote shell:
 
 <dependency>
     <groupId>org.apache.camel</groupId>
-    <artifactId>camel-commands-springboot</artifactId>
+    <artifactId>camel-commands-spring-boot</artifactId>
     <version>x.x.x</version>
     <!-- use the same version as your Camel core version -->
 </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/2588b971/platforms/commands/commands-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-spring-boot/pom.xml b/platforms/commands/commands-spring-boot/pom.xml
index 6904ac1..f1742d0 100755
--- a/platforms/commands/commands-spring-boot/pom.xml
+++ b/platforms/commands/commands-spring-boot/pom.xml
@@ -8,7 +8,7 @@
         <version>2.17-SNAPSHOT</version>
     </parent>
 
-    <artifactId>camel-commands-springboot</artifactId>
+    <artifactId>camel-commands-spring-boot</artifactId>
     <packaging>jar</packaging>
     <name>Camel :: Platforms :: Commands :: Spring Boot</name>
     <description>Camel Commands using Spring Boot Shell</description>


[2/5] camel git commit: CAMEL-9224 : Camel shell commands adapter for Spring Boot Remote shell. Fixes #670

Posted by da...@apache.org.
CAMEL-9224 : Camel shell commands adapter for Spring Boot Remote shell. Fixes #670


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

Branch: refs/heads/master
Commit: 897bf98c656611d8985148d304a3128e3e7706a0
Parents: 15d4be0
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Nov 7 08:58:13 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 08:58:13 2015 +0100

----------------------------------------------------------------------
 platforms/commands/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/897bf98c/platforms/commands/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/commands/pom.xml b/platforms/commands/pom.xml
index 22e91ed..9c00dff 100644
--- a/platforms/commands/pom.xml
+++ b/platforms/commands/pom.xml
@@ -31,6 +31,7 @@
   <modules>
     <module>commands-core</module>
     <module>commands-jolokia</module>
+    <module>commands-spring-boot</module>
   </modules>
 
 </project>


[5/5] camel git commit: Fixed CS

Posted by da...@apache.org.
Fixed CS


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

Branch: refs/heads/master
Commit: e55597f17d86fdf410613e3edf40f4657e2d4f2b
Parents: 94d3aee
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Nov 7 09:27:38 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Nov 7 09:27:38 2015 +0100

----------------------------------------------------------------------
 .../resources/crash/commands/camel/camel.groovy | 83 +++++++-------------
 1 file changed, 28 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e55597f1/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 5886f48..6ba23bf 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
@@ -1,5 +1,4 @@
 /**
- *
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -17,38 +16,12 @@
  */
 package crash.commands.camel
 
-import org.apache.camel.commands.ComponentListCommand
-import org.apache.camel.commands.ContextInflightCommand
-import org.apache.camel.commands.ContextInfoCommand
-import org.apache.camel.commands.ContextListCommand
-import org.apache.camel.commands.ContextResumeCommand
-import org.apache.camel.commands.ContextStartCommand
-import org.apache.camel.commands.ContextStopCommand
-import org.apache.camel.commands.ContextSuspendCommand
-import org.apache.camel.commands.EipExplainCommand
-import org.apache.camel.commands.EndpointExplainCommand
-import org.apache.camel.commands.EndpointListCommand
-import org.apache.camel.commands.EndpointStatisticCommand
-import org.apache.camel.commands.RestRegistryListCommand
-import org.apache.camel.commands.RouteInfoCommand
-import org.apache.camel.commands.RouteListCommand
-import org.apache.camel.commands.RouteProfileCommand
-import org.apache.camel.commands.RouteResetStatsCommand
-import org.apache.camel.commands.RouteResumeCommand
-import org.apache.camel.commands.RouteShowCommand
-import org.apache.camel.commands.RouteStartCommand
-import org.apache.camel.commands.RouteStopCommand
-import org.apache.camel.commands.RouteSuspendCommand
+import org.apache.camel.commands.*
 import org.apache.camel.springboot.commands.crsh.ArgumentCamelContext
 import org.apache.camel.springboot.commands.crsh.ArgumentRouteID
 import org.apache.camel.springboot.commands.crsh.CamelCommandsFacade
-import org.crsh.cli.Argument
-import org.crsh.cli.Command
-import org.crsh.cli.Option
-import org.crsh.cli.Usage
-import org.crsh.cli.Named
-import org.crsh.cli.Required
 import org.apache.camel.springboot.commands.crsh.CamelCommandsPlugin
+import org.crsh.cli.*
 import org.crsh.groovy.GroovyCommand
 
 @Usage("Camel related commands")
@@ -76,8 +49,8 @@ public class camel extends GroovyCommand {
     @Named("eip-explain")
     public String eip_explain(@Required @ArgumentCamelContext String camelContext,
                               @Required @Argument String nameOrId,
-                                 @Usage("Verbose output")
-                                 @Option(names = ["v", "verbose"]) Boolean verbose) {
+                              @Usage("Verbose output")
+                              @Option(names = ["v", "verbose"]) Boolean verbose) {
         Boolean v = (null != verbose && Boolean.valueOf(verbose))
         return getCommandsFacade().runCommand(EipExplainCommand.class, camelContext, nameOrId, v)
     }
@@ -114,8 +87,9 @@ public class camel extends GroovyCommand {
         Boolean _sort = (null != sort && Boolean.valueOf(sort))
         Integer _limit = null != limit ? limit : -1;
 
-        if (_limit != -1)
-            out.println("Limiting output to "+_limit+" messages.")
+        if (_limit != -1) {
+            out.println("Limiting output to " + _limit + " messages.")
+        }
 
         return getCommandsFacade().runCommand(ContextInflightCommand.class, camelContext, _limit, _sort)
     }
@@ -155,15 +129,15 @@ public class camel extends GroovyCommand {
     @Usage("Lists Camel endpoints.")
     @Named("endpoint-list")
     public String endpoint_list(@Required @ArgumentCamelContext String camelContext,
-                                 @Usage("Decode URI so they are human readable")
-                                 @Option(names = ["d", "decode"]) Boolean decode,
-                                 @Usage("Verbose output")
-                                 @Option(names = ["v", "verbose"]) Boolean verbose,
-                                 @Usage("Explain the endpoint options")
-                                 @Option(names = ["e", "explain"]) Boolean explain) {
+                                @Usage("Decode URI so they are human readable")
+                                @Option(names = ["d", "decode"]) Boolean decode,
+                                @Usage("Verbose output")
+                                @Option(names = ["v", "verbose"]) Boolean verbose,
+                                @Usage("Explain the endpoint options")
+                                @Option(names = ["e", "explain"]) Boolean explain) {
         Boolean _verbose = (null != verbose && Boolean.valueOf(verbose))
-        Boolean _decode  = (null != decode && Boolean.valueOf(decode))
-        Boolean _explain  = (null != explain && Boolean.valueOf(explain))
+        Boolean _decode = (null != decode && Boolean.valueOf(decode))
+        Boolean _explain = (null != explain && Boolean.valueOf(explain))
         return getCommandsFacade().runCommand(EndpointListCommand.class, camelContext, _decode, _verbose, _explain);
     }
 
@@ -171,12 +145,12 @@ public class camel extends GroovyCommand {
     @Usage("Explain all Camel endpoints available in the CamelContext.")
     @Named("endpoint-explain")
     public String endpoint_explain(@Required @ArgumentCamelContext String camelContext,
-                                 @Usage("Verbose output")
-                                 @Option(names = ["v", "verbose"]) Boolean verbose,
-                                 @Usage("Filter endpoint by pattern")
-                                 @Option(names = ["f", "filter"]) String filter) {
+                                   @Usage("Verbose output")
+                                   @Option(names = ["v", "verbose"]) Boolean verbose,
+                                   @Usage("Filter endpoint by pattern")
+                                   @Option(names = ["f", "filter"]) String filter) {
         Boolean _verbose = (null != verbose && Boolean.valueOf(verbose))
-        String  _filter =  null != filter ? filter : "*";
+        String _filter = null != filter ? filter : "*";
         return getCommandsFacade().runCommand(EndpointExplainCommand.class, camelContext, _verbose, _filter);
     }
 
@@ -188,8 +162,8 @@ public class camel extends GroovyCommand {
                                  @Option(names = ["d", "decode"]) Boolean decode,
                                  @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"];
+        Boolean _decode = (null != decode && Boolean.valueOf(decode))
+        String[] _filter = null != filter ? filter.split(",") : ["in", "out", "static", "dynamic"];
         return getCommandsFacade().runCommand(EndpointStatisticCommand.class, camelContext, _decode, _filter);
     }
 
@@ -197,12 +171,12 @@ public class camel extends GroovyCommand {
     @Usage("Lists all Camel REST services enlisted in the Rest Registry from a CamelContext.")
     @Named("rest-registry-list")
     public String rest_registry_list(@Required @ArgumentCamelContext String camelContext,
-                                 @Usage("Decode URI so they are human readable")
-                                 @Option(names = ["d", "decode"]) Boolean decode,
-                                 @Usage("Verbose output")
-                                 @Option(names = ["v", "verbose"]) Boolean verbose){
+                                     @Usage("Decode URI so they are human readable")
+                                     @Option(names = ["d", "decode"]) Boolean decode,
+                                     @Usage("Verbose output")
+                                     @Option(names = ["v", "verbose"]) Boolean verbose) {
         Boolean _verbose = (null != verbose && Boolean.valueOf(verbose))
-        Boolean _decode  = (null != decode && Boolean.valueOf(decode))
+        Boolean _decode = (null != decode && Boolean.valueOf(decode))
         return getCommandsFacade().runCommand(RestRegistryListCommand.class, camelContext, _decode, _verbose);
     }
 
@@ -273,6 +247,5 @@ public class camel extends GroovyCommand {
         return getCommandsFacade().runCommand(RouteStartCommand.class, route, camelContext)
     }
 
-
 }