camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [25/29] camel git commit: CAMEL-7999: apt compiler to generate json schema documentation for the model, whcih we later use to enrich the xml xsd to include documentation. Work in progress.
Date Tue, 30 Dec 2014 10:42:41 GMT
CAMEL-7999: apt compiler to generate json schema documentation for the model, whcih we later
use to enrich the xml xsd to include documentation. Work in progress.


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

Branch: refs/heads/master
Commit: a371de7b5ab353963e35510dbd3e26b61db0d2f3
Parents: e9e16b8
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Dec 28 16:58:37 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Dec 30 10:56:47 2014 +0100

----------------------------------------------------------------------
 .../api/management/mbean/ManagedCamelContextMBean.java   | 11 +++++++++++
 .../java/org/apache/camel/impl/DefaultCamelContext.java  |  5 ++++-
 .../camel/management/mbean/ManagedCamelContext.java      |  4 ++++
 3 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a371de7b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
index bbe2f3d..448cacd 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
@@ -251,6 +251,17 @@ public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean
     String eipParameterJsonSchema(String eipName) throws Exception;
 
     /**
+     * Returns a JSON schema representation of the EIP parameters for the given EIP by its
id.
+     *
+     * @param eipName the name of the EIP ({@link org.apache.camel.NamedNode#getShortName()}
+     * @param id optional id of an EIP in use from any of the routes to explain
+     * @param includeAllOptions whether to include non configured options also (eg default
options)
+     * @return the json or <tt>null</tt> if the eipName or the id was not found
+     */
+    @ManagedOperation(description = "Returns a JSON schema representation of the EIP parameters
for the given EIP by its id")
+    String explainEipJson(String eipName, String id, boolean includeAllOptions);
+
+    /**
      * Returns a JSON schema representation of the endpoint parameters for the given endpoint
uri
      *
      * @param uri the endpoint uri

http://git-wip-us.apache.org/repos/asf/camel/blob/a371de7b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index c074ece..5d8dc95 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -1162,13 +1162,14 @@ public class DefaultCamelContext extends ServiceSupport implements
ModelCamelCon
     }
 
     public String getEipParameterJsonSchema(String eipName) throws IOException {
+        // the eip json schema may be in some of the sub-packages so look until we find it
         String[] subPackages = new String[]{"", "/config", "/dataformat", "/language", "/loadbalancer",
"/rest"};
         for (String sub : subPackages) {
             String path = CamelContextHelper.MODEL_DOCUMENTATION_PREFIX + sub + "/" + eipName
+ ".json";
             ClassResolver resolver = getClassResolver();
             InputStream inputStream = resolver.loadResourceAsStream(path);
-            log.debug("Loading component JSON Schema for: {} using class resolver: {} ->
{}", new Object[]{eipName, resolver, inputStream});
             if (inputStream != null) {
+                log.debug("Loading component JSON Schema for: {} using class resolver: {}
-> {}", new Object[]{eipName, resolver, inputStream});
                 try {
                     return IOHelper.loadText(inputStream);
                 } finally {
@@ -1181,6 +1182,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
 
     public String explainEipJson(String eipName, String id, boolean includeAllOptions) {
         try {
+            // TODO: if eipName is null, then we can find it from the id if its found
+            // and use the getShortName to find the eipName
             String json = getEipParameterJsonSchema(eipName);
             if (json == null) {
                 return null;

http://git-wip-us.apache.org/repos/asf/camel/blob/a371de7b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
index e7230d5..c8868fe 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
@@ -573,6 +573,10 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements
Ti
         return context.getEipParameterJsonSchema(eipName);
     }
 
+    public String explainEipJson(String eipName, String id, boolean includeAllOptions) {
+        return context.explainEipJson(eipName, id, includeAllOptions);
+    }
+
     public String explainEndpointJson(String uri, boolean includeAllOptions) throws Exception
{
         return context.explainEndpointJson(uri, includeAllOptions);
     }


Mime
View raw message