Repository: camel
Updated Branches:
  refs/heads/master 2e00ccd9e -> b2e3c2139


CAMEL-9842: Enrich camel-spring XSD with documentation for the non EIP nodes 
which was not documented before.


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

Branch: refs/heads/master
Commit: b2e3c2139474d347460abf7b889f33c62c89d2d1
Parents: 2e00ccd
Author: Claus Ibsen <davscl...@apache.org>
Authored: Thu Aug 11 14:53:33 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Aug 11 14:53:33 2016 +0200

----------------------------------------------------------------------
 .../camel/maven/DocumentationEnricher.java      | 31 ++++++++++++++++----
 .../maven/EipDocumentationEnricherMojo.java     |  2 +-
 2 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b2e3c213/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
 
b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
index a0df87a..8546bca 100644
--- 
a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
+++ 
b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
@@ -27,6 +27,8 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.apache.maven.plugin.logging.Log;
+
 import org.apache.camel.util.JsonSchemaHelper;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.WordUtils;
@@ -53,10 +55,10 @@ public class DocumentationEnricher {
         }
     }
 
-    public void enrichTypeAttributesDocumentation(NodeList attributeElements, 
File jsonFile) throws IOException {
+    public void enrichTypeAttributesDocumentation(Log log, NodeList 
attributeElements, File jsonFile) throws IOException {
         for (int j = 0; j < attributeElements.getLength(); j++) {
             Element item = (Element) attributeElements.item(j);
-            addAttributeDocumentation(item, jsonFile);
+            addAttributeDocumentation(log, item, jsonFile);
         }
     }
 
@@ -71,26 +73,45 @@ public class DocumentationEnricher {
         }
     }
 
-    private void addAttributeDocumentation(Element item, File jsonFile) throws 
IOException {
+    private void addAttributeDocumentation(Log log, Element item, File 
jsonFile) throws IOException {
+
+        String name = item.getAttribute(Constants.NAME_ATTRIBUTE_NAME);
+        if (isNullOrEmpty(name)) {
+            return;
+        }
+
         String descriptionText = null;
         String defaultValueText = null;
 
         List<Map<String, String>> rows = 
JsonSchemaHelper.parseJsonSchema(Constants.PROPERTIES_ATTRIBUTE_NAME, 
PackageHelper.fileToString(jsonFile), true);
         for (Map<String, String> row : rows) {
-            if 
(item.getAttribute(Constants.NAME_ATTRIBUTE_NAME).equals(row.get(Constants.NAME_ATTRIBUTE_NAME)))
 {
+            if (name.equals(row.get(Constants.NAME_ATTRIBUTE_NAME))) {
                 descriptionText = 
row.get(Constants.DESCRIPTION_ATTRIBUTE_NAME);
                 defaultValueText = 
row.get(Constants.DEFAULT_VALUE_ATTRIBUTE_NAME);
             }
         }
 
+        // special as this option is only in camel-blueprint
+        if ("useBlueprintPropertyResolver".equals(name)) {
+            descriptionText = "Whether to automatic detect OSGi Blueprint 
property placeholder service in use, and bridge with Camel property 
placeholder."
+                    + " When enabled this allows you to only setup OSGi 
Blueprint property placeholder and Camel can use the properties in the 
<camelContext>.";
+            defaultValueText = "true";
+        }
+
         if (!isNullOrEmpty(descriptionText)) {
             String text = descriptionText;
             if (!isNullOrEmpty(defaultValueText)) {
                 text += ". Default value: " + defaultValueText;
             }
             addDocumentation(item, text);
+        } else {
+            // we should skip warning about these if no documentation as they 
are special
+            boolean skip = "customId".equals(name) || 
"inheritErrorHandler".equals(name)
+                    || "rest".equals(name) && 
jsonFile.getName().endsWith("route.json");
+            if (!skip) {
+                log.warn("Cannot find documentation for name: " + name + " in 
json schema: " + jsonFile);
+            }
         }
-
     }
 
     private void addDocumentation(Element item, String textContent) {

http://git-wip-us.apache.org/repos/asf/camel/blob/b2e3c213/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
 
b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
index c2ab1bf..a4c707c 100644
--- 
a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
+++ 
b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
@@ -178,7 +178,7 @@ public class EipDocumentationEnricherMojo extends 
AbstractMojo {
         injectedTypes.add(type);
         NodeList attributeElements = domFinder.findAttributesElements(type);
         if (attributeElements.getLength() > 0) {
-            
documentationEnricher.enrichTypeAttributesDocumentation(attributeElements, 
jsonFile);
+            documentationEnricher.enrichTypeAttributesDocumentation(getLog(), 
attributeElements, jsonFile);
         }
 
         String baseType = domFinder.findBaseType(type);

Reply via email to