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/09/24 15:16:41 UTC
[1/3] camel git commit: CAMEL-9156: Adding Camel commands for rest
api docs
Repository: camel
Updated Branches:
refs/heads/master 6ca72e1d8 -> 55d675b94
CAMEL-9156: Adding Camel commands for rest api docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/da022e78
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/da022e78
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/da022e78
Branch: refs/heads/master
Commit: da022e7861a21cf4800fad3c98473090dc762db2
Parents: 6ca72e1
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 24 15:10:22 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Sep 24 15:11:00 2015 +0200
----------------------------------------------------------------------
.../apache/camel/impl/DefaultRestRegistry.java | 62 ++++++++++++++++++++
.../management/mbean/ManagedRestRegistry.java | 58 +-----------------
.../java/org/apache/camel/spi/RestRegistry.java | 7 +++
.../commands/AbstractLocalCamelController.java | 9 +++
.../apache/camel/commands/CamelController.java | 9 +++
.../camel/commands/RestApiDocCommand.java | 42 +++++++++++++
.../jolokia/DefaultJolokiaCamelController.java | 21 +++++++
.../commands/jolokia/JolokiaRemoteTest.java | 9 +++
8 files changed, 160 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/camel-core/src/main/java/org/apache/camel/impl/DefaultRestRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRestRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRestRegistry.java
index f36d505..250566d 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRestRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRestRegistry.java
@@ -24,11 +24,17 @@ import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Producer;
import org.apache.camel.Route;
import org.apache.camel.Service;
import org.apache.camel.ServiceStatus;
import org.apache.camel.StatefulService;
import org.apache.camel.StaticService;
+import org.apache.camel.component.rest.RestApiEndpoint;
+import org.apache.camel.component.rest.RestEndpoint;
+import org.apache.camel.spi.RestConfiguration;
import org.apache.camel.spi.RestRegistry;
import org.apache.camel.support.LifecycleStrategySupport;
import org.apache.camel.support.ServiceSupport;
@@ -38,6 +44,7 @@ public class DefaultRestRegistry extends ServiceSupport implements StaticService
private CamelContext camelContext;
private final Map<Consumer, RestService> registry = new LinkedHashMap<Consumer, RestService>();
+ private transient Producer apiProducer;
public void addRestService(Consumer consumer, String url, String baseUrl, String basePath, String uriTemplate, String method,
String consumes, String produces, String inType, String outType, String routeId, String description) {
@@ -59,6 +66,61 @@ public class DefaultRestRegistry extends ServiceSupport implements StaticService
return registry.size();
}
+ @Override
+ public String apiDocAsJson() {
+ // see if there is a rest-api endpoint which would be the case if rest api-doc has been explicit enabled
+ if (apiProducer == null) {
+ Endpoint restApiEndpoint = null;
+ Endpoint restEndpoint = null;
+ for (Map.Entry<String, Endpoint> entry : camelContext.getEndpointMap().entrySet()) {
+ String uri = entry.getKey();
+ if (uri.startsWith("rest-api:")) {
+ restApiEndpoint = entry.getValue();
+ break;
+ } else if (restEndpoint == null && uri.startsWith("rest:")) {
+ restEndpoint = entry.getValue();
+ }
+ }
+
+ if (restApiEndpoint == null && restEndpoint != null) {
+ // no rest-api has been explicit enabled, then we need to create it first
+ RestEndpoint rest = (RestEndpoint) restEndpoint;
+ String componentName = rest.getComponentName();
+
+ if (componentName != null) {
+ RestConfiguration config = camelContext.getRestConfiguration(componentName, true);
+ String apiComponent = config.getApiComponent() != null ? config.getApiComponent() : RestApiEndpoint.DEFAULT_API_COMPONENT_NAME;
+ String path = config.getApiContextPath() != null ? config.getApiContextPath() : "api-doc";
+ restApiEndpoint = camelContext.getEndpoint(String.format("rest-api:%s/%s?componentName=%s&apiComponentName=%s&contextIdPattern=#name#", path, camelContext.getName(), componentName, apiComponent));
+ }
+ }
+
+ if (restApiEndpoint != null) {
+ // reuse the producer to avoid creating it
+ try {
+ apiProducer = restApiEndpoint.createProducer();
+ camelContext.addService(apiProducer, true);
+ } catch (Exception e) {
+ throw ObjectHelper.wrapRuntimeCamelException(e);
+ }
+ }
+ }
+
+ if (apiProducer != null) {
+ try {
+ Exchange dummy = apiProducer.getEndpoint().createExchange();
+ apiProducer.process(dummy);
+
+ String json = dummy.hasOut() ? dummy.getOut().getBody(String.class) : dummy.getIn().getBody(String.class);
+ return json;
+ } catch (Exception e) {
+ throw ObjectHelper.wrapRuntimeCamelException(e);
+ }
+ }
+
+ return null;
+ }
+
public CamelContext getCamelContext() {
return camelContext;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRestRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRestRegistry.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRestRegistry.java
index 3299b02..c057436 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRestRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRestRegistry.java
@@ -17,7 +17,6 @@
package org.apache.camel.management.mbean;
import java.util.List;
-import java.util.Map;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
@@ -25,15 +24,10 @@ import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport;
import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.api.management.mbean.CamelOpenMBeanTypes;
import org.apache.camel.api.management.mbean.ManagedRestRegistryMBean;
-import org.apache.camel.component.rest.RestApiEndpoint;
-import org.apache.camel.component.rest.RestEndpoint;
-import org.apache.camel.spi.RestConfiguration;
import org.apache.camel.spi.RestRegistry;
import org.apache.camel.util.ObjectHelper;
@@ -93,57 +87,7 @@ public class ManagedRestRegistry extends ManagedService implements ManagedRestRe
@Override
public String apiDocAsJson() {
- // see if there is a rest-api endpoint which would be the case if rest api-doc has been explicit enabled
- if (apiProducer == null) {
- Endpoint restApiEndpoint = null;
- Endpoint restEndpoint = null;
- for (Map.Entry<String, Endpoint> entry : getContext().getEndpointMap().entrySet()) {
- String uri = entry.getKey();
- if (uri.startsWith("rest-api:")) {
- restApiEndpoint = entry.getValue();
- break;
- } else if (restEndpoint == null && uri.startsWith("rest:")) {
- restEndpoint = entry.getValue();
- }
- }
-
- if (restApiEndpoint == null && restEndpoint != null) {
- // no rest-api has been explicit enabled, then we need to create it first
- RestEndpoint rest = (RestEndpoint) restEndpoint;
- String componentName = rest.getComponentName();
-
- if (componentName != null) {
- RestConfiguration config = getContext().getRestConfiguration(componentName, true);
- String apiComponent = config.getApiComponent() != null ? config.getApiComponent() : RestApiEndpoint.DEFAULT_API_COMPONENT_NAME;
- String path = config.getApiContextPath() != null ? config.getApiContextPath() : "api-doc";
- restApiEndpoint = getContext().getEndpoint(String.format("rest-api:%s/%s?componentName=%s&apiComponentName=%s&contextIdPattern=#name#", path, getCamelId(), componentName, apiComponent));
- }
- }
-
- if (restApiEndpoint != null) {
- // reuse the producer to avoid creating it
- try {
- apiProducer = restApiEndpoint.createProducer();
- getContext().addService(apiProducer, true);
- } catch (Exception e) {
- throw ObjectHelper.wrapRuntimeCamelException(e);
- }
- }
- }
-
- if (apiProducer != null) {
- try {
- Exchange dummy = apiProducer.getEndpoint().createExchange();
- apiProducer.process(dummy);
-
- String json = dummy.hasOut() ? dummy.getOut().getBody(String.class) : dummy.getIn().getBody(String.class);
- return json;
- } catch (Exception e) {
- throw ObjectHelper.wrapRuntimeCamelException(e);
- }
- }
-
- return null;
+ return registry.apiDocAsJson();
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/camel-core/src/main/java/org/apache/camel/spi/RestRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/RestRegistry.java b/camel-core/src/main/java/org/apache/camel/spi/RestRegistry.java
index c307383..fb8f547 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/RestRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/RestRegistry.java
@@ -143,4 +143,11 @@ public interface RestRegistry extends Service {
*/
int size();
+ /**
+ * Outputs the Rest services API documentation in JSon (requires camel-swagger-java on classpath)
+ *
+ * @return the API docs in JSon, or <tt>null</tt> if camel-swagger-java is not on classpath
+ */
+ String apiDocAsJson();
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
index ec1b997..2fd62f0 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
@@ -404,6 +404,15 @@ public abstract class AbstractLocalCamelController extends AbstractCamelControll
return ModelHelper.dumpModelAsXml(null, def);
}
+ public String getRestApiDocAsJson(String camelContextName) throws Exception {
+ CamelContext context = this.getLocalCamelContext(camelContextName);
+ if (context == null) {
+ return null;
+ }
+
+ return context.getRestRegistry().apiDocsAsJson();
+ }
+
public List<Map<String, String>> getEndpoints(String camelContextName) throws Exception {
List<Map<String, String>> answer = new ArrayList<Map<String, String>>();
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
index dd807b4..b9fbcd1 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/CamelController.java
@@ -218,6 +218,15 @@ public interface CamelController {
String getRestModelAsXml(String camelContextName) throws Exception;
/**
+ * Return the REST services API documentation as JSon (requires camel-swagger-java on classpath)
+ *
+ * @param camelContextName the Camel context.
+ * @return the REST API documentation as JSon
+ * @throws java.lang.Exception can be thrown
+ */
+ String getRestApiDocAsJson(String camelContextName) throws Exception;
+
+ /**
* Return the REST services for the given Camel context.
*
* @param camelContextName the Camel context.
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestApiDocCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestApiDocCommand.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestApiDocCommand.java
new file mode 100644
index 0000000..99bf16b
--- /dev/null
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/RestApiDocCommand.java
@@ -0,0 +1,42 @@
+/**
+ * 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.commands;
+
+import java.io.PrintStream;
+
+/**
+ * List the Camel REST services API documentation (requires camel-swagger-java on classpath)
+ */
+public class RestApiDocCommand extends AbstractContextCommand {
+
+ public RestApiDocCommand(String context) {
+ super(context);
+ }
+
+ @Override
+ protected Object performContextCommand(CamelController camelController, String contextName, PrintStream out, PrintStream err) throws Exception {
+ String json = camelController.getRestApiDocAsJson(contextName);
+ if (json != null) {
+ out.print(json);
+ } else {
+ out.print("There are no REST services");
+ }
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
index 7608f6b..6404fa2 100644
--- a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
+++ b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
@@ -510,6 +510,27 @@ public class DefaultJolokiaCamelController extends AbstractCamelController imple
}
@Override
+ public String getRestApiDocAsJson(String camelContextName) throws Exception {
+ if (jolokia == null) {
+ throw new IllegalStateException("Need to connect to remote jolokia first");
+ }
+
+ ObjectName found = lookupCamelContext(camelContextName);
+ if (found != null) {
+ String pattern = String.format("%s:context=%s,type=services,name=DefaultRestRegistry", found.getDomain(), found.getKeyProperty("context"));
+ ObjectName on = ObjectName.getInstance(pattern);
+
+ J4pExecResponse response = jolokia.execute(new J4pExecRequest(on, "apiDocAsJson()"));
+ if (response != null) {
+ String json = response.getValue();
+ return json;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
public List<Map<String, String>> getEndpoints(String camelContextName) throws Exception {
if (jolokia == null) {
throw new IllegalStateException("Need to connect to remote jolokia first");
http://git-wip-us.apache.org/repos/asf/camel/blob/da022e78/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaRemoteTest.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaRemoteTest.java b/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaRemoteTest.java
index 5165008..2b41add 100644
--- a/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaRemoteTest.java
+++ b/platforms/commands/commands-jolokia/src/test/java/org/apache/camel/commands/jolokia/JolokiaRemoteTest.java
@@ -160,6 +160,15 @@ public class JolokiaRemoteTest {
}
@Test
+ public void testRestsApiDoc() throws Exception {
+ controller = new DefaultJolokiaCamelController();
+ controller.connect(url, null, null);
+
+ String data = controller.getRestApiDocAsJson("camel-1");
+ System.out.println(data);
+ }
+
+ @Test
public void testGetEndpoints() throws Exception {
controller = new DefaultJolokiaCamelController();
controller.connect(url, null, null);
[2/3] camel git commit: CAMEL-9160: Dynamic to - Should use language:
as prefix when using other languages
Posted by da...@apache.org.
CAMEL-9160: Dynamic to - Should use language: as prefix when using other languages
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f69b6ea3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f69b6ea3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f69b6ea3
Branch: refs/heads/master
Commit: f69b6ea3a31ee4373510472fed56104166254230
Parents: da022e7
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 24 15:14:09 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Sep 24 15:14:09 2015 +0200
----------------------------------------------------------------------
.../SpringToDynamicLanguageSimpleAndXPathAndHeaderTest.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f69b6ea3/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringToDynamicLanguageSimpleAndXPathAndHeaderTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringToDynamicLanguageSimpleAndXPathAndHeaderTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringToDynamicLanguageSimpleAndXPathAndHeaderTest.xml
index 3e3b15f..1c254c5 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringToDynamicLanguageSimpleAndXPathAndHeaderTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringToDynamicLanguageSimpleAndXPathAndHeaderTest.xml
@@ -26,7 +26,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
- <toD uri="mock:+language:xpath:/order/@uri+header:sub"/>
+ <toD uri="mock:+language:xpath:/order/@uri+language:header:sub"/>
</route>
</camelContext>
<!-- END SNIPPET: e1 -->
[3/3] camel git commit: CAMEL-9156: Adding Camel commands for rest
api docs
Posted by da...@apache.org.
CAMEL-9156: Adding Camel commands for rest api docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/55d675b9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/55d675b9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/55d675b9
Branch: refs/heads/master
Commit: 55d675b941f89e1e4d3b5da2c80257f96fa1eda0
Parents: f69b6ea
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 24 15:17:20 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Sep 24 15:17:20 2015 +0200
----------------------------------------------------------------------
.../commands/AbstractLocalCamelController.java | 2 +-
.../apache/camel/karaf/commands/RestApiDoc.java | 34 ++++++++++++++++++++
.../OSGI-INF/blueprint/camel-commands.xml | 9 ++++++
3 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/55d675b9/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
index 2fd62f0..823e5b3 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
@@ -410,7 +410,7 @@ public abstract class AbstractLocalCamelController extends AbstractCamelControll
return null;
}
- return context.getRestRegistry().apiDocsAsJson();
+ return context.getRestRegistry().apiDocAsJson();
}
public List<Map<String, String>> getEndpoints(String camelContextName) throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/55d675b9/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestApiDoc.java
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestApiDoc.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestApiDoc.java
new file mode 100644
index 0000000..dfdbbbb
--- /dev/null
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RestApiDoc.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;
+
+import org.apache.camel.commands.RestApiDocCommand;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+
+@Command(scope = "camel", name = "rest-api-doc", description = "List the Camel REST services API documentation (requires camel-swagger-java on classpath)")
+public class RestApiDoc extends CamelCommandSupport {
+
+ @Argument(index = 0, name = "name", description = "The Camel context name where to look for the REST services", required = true, multiValued = false)
+ String name;
+
+ protected Object doExecute() throws Exception {
+ RestApiDocCommand command = new RestApiDocCommand(name);
+ return command.execute(camelController, System.out, System.err);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/55d675b9/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml b/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
index ba134bf..30e9a8f 100644
--- a/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
+++ b/platforms/karaf/commands/src/main/resources/OSGI-INF/blueprint/camel-commands.xml
@@ -206,6 +206,15 @@
<null/>
</completers>
</command>
+ <command name="camel/rest-api-doc">
+ <action class="org.apache.camel.karaf.commands.RestApiDoc">
+ <property name="camelController" ref="camelController"/>
+ </action>
+ <completers>
+ <ref component-id="camelContextCompleter"/>
+ <null/>
+ </completers>
+ </command>
<command name="camel/rest-show">
<action class="org.apache.camel.karaf.commands.RestShow">
<property name="camelController" ref="camelController"/>