camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: First cut of mvn goal to generate/update component readme.md file. Switch to mvel which is easier to use than freemarker.
Date Wed, 27 Jan 2016 08:53:27 GMT
First cut of mvn goal to generate/update component readme.md file. Switch to mvel which is
easier to use than freemarker.


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

Branch: refs/heads/master
Commit: 062aeaffc6cb3100608ad5472d119e0ea6fc107c
Parents: c94011b
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jan 27 09:46:19 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jan 27 09:53:19 2016 +0100

----------------------------------------------------------------------
 .../maven/packaging/ReadmeComponentMojo.java    |  1 +
 .../maven/packaging/model/ComponentModel.java   | 18 ++++++++++++
 .../packaging/model/ComponentOptionModel.java   | 10 +++++++
 .../packaging/model/EndpointOptionModel.java    | 10 +++++++
 .../src/main/resources/component-header.mvel    |  8 ++++--
 .../src/main/resources/component-options.mvel   | 29 ++++++++++++++++++--
 .../src/main/resources/endpoint-options.mvel    |  6 ++--
 7 files changed, 74 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
index ddc512b..5953ee9 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
@@ -124,6 +124,7 @@ public class ReadmeComponentMojo extends AbstractMojo {
         ComponentModel component = new ComponentModel();
         component.setScheme(JSonSchemaHelper.getSafeValue("scheme", rows));
         component.setSyntax(JSonSchemaHelper.getSafeValue("syntax", rows));
+        component.setAlternativeSyntax(JSonSchemaHelper.getSafeValue("alternativeSyntax",
rows));
         component.setTitle(JSonSchemaHelper.getSafeValue("title", rows));
         component.setDescription(JSonSchemaHelper.getSafeValue("description", rows));
         component.setLabel(JSonSchemaHelper.getSafeValue("label", rows));

http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentModel.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentModel.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentModel.java
index 280f77d..ee1f463 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentModel.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentModel.java
@@ -23,6 +23,7 @@ public class ComponentModel {
     private String kind;
     private String scheme;
     private String syntax;
+    private String alternativeSyntax;
     private String title;
     private String description;
     private String label;
@@ -60,6 +61,14 @@ public class ComponentModel {
         this.syntax = syntax;
     }
 
+    public String getAlternativeSyntax() {
+        return alternativeSyntax;
+    }
+
+    public void setAlternativeSyntax(String alternativeSyntax) {
+        this.alternativeSyntax = alternativeSyntax;
+    }
+
     public String getTitle() {
         return title;
     }
@@ -155,4 +164,13 @@ public class ComponentModel {
     public void setEndpointOptions(List<EndpointOptionModel> endpointOptions) {
         this.endpointOptions = endpointOptions;
     }
+
+    public String getShortJavaType() {
+        int pos = javaType.lastIndexOf(".");
+        if (pos != -1) {
+            return javaType.substring(pos + 1);
+        } else {
+            return javaType;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
index 978b166..a9b6734 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/ComponentOptionModel.java
@@ -72,4 +72,14 @@ public class ComponentOptionModel {
     public void setDescription(String description) {
         this.description = description;
     }
+
+    public String getShortJavaType() {
+        int pos = javaType.lastIndexOf(".");
+        if (pos != -1) {
+            return javaType.substring(pos + 1);
+        } else {
+            return javaType;
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
index bec4bd5..5ae2a27 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/EndpointOptionModel.java
@@ -126,4 +126,14 @@ public class EndpointOptionModel {
     public void setDescription(String description) {
         this.description = description;
     }
+
+    public String getShortJavaType() {
+        int pos = javaType.lastIndexOf(".");
+        if (pos != -1) {
+            return javaType.substring(pos + 1);
+        } else {
+            return javaType;
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/resources/component-header.mvel
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-header.mvel
b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-header.mvel
index e191135..965401a 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-header.mvel
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-header.mvel
@@ -6,6 +6,12 @@ The syntax:
 
     @{syntax}
 
+@if{alternativeSyntax != ""}
+An alternative syntax can be used:
+
+    @{alternativeSyntax}
+@end{}
+
 Maven users would need to add dependency:
 
 ```xml
@@ -16,5 +22,3 @@ Maven users would need to add dependency:
     </dependency>
 ```
 
-Some more bla bla
-

http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel
b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel
index 0ad31a6..a367431 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel
@@ -1,8 +1,31 @@
 ### Component options
 
+@if{componentOptions.isEmpty()}
+The @{title} component has no options.
+@else{}
 The @{title} component supports @{componentOptions.size()} options which are listed below.
 
-| Key | Description |
-| --- | ----------- |
-@foreach{row : componentOptions}| @{row.name} | @{row.description} |
+| Name | Java Type | Description |
+| ---- | --------- | ----------- |
+@foreach{row : componentOptions}| @{row.name} | @{row.javaType} | @{row.description} |
+@end{}
+
+#### Configuring component options
+
+The @{title} component can be configured using Java code as shown:
+
+```Java
+   @{shortJavaType} @{scheme} = camelContext.getComponent("@{scheme}", @{shortJavaType}.class);
+   @{scheme}.setFoo(...);
+   @{scheme}.setBar(...);
+```
+
+And in XML you can configure the @{title} component as a <bean> as shown:
+
+```XML
+   <bean id="@{scheme}" class="@{javaType}">
+     <property name="foo" value="..."/>
+     <property name="bar" value="..."/>
+   </bean>
+```
 @end{}

http://git-wip-us.apache.org/repos/asf/camel/blob/062aeaff/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
index 98f7be4..fd74440 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel
@@ -2,7 +2,7 @@
 
 The @{title} component supports @{endpointOptions.size()} endpoint options which are listed
below:
 
-| Key | Group | Required | Default | Description |
-| --- | ----- | -------- | ------- | ----------- |
-@foreach{row : endpointOptions}| @{row.name} | @{row.group} | @{row.required} | @{row.defaultValue}
| @{row.description} |
+| Name | Group | Required | Default | Java Type | Description |
+| ---- | ----- | -------- | ------- | --------- | ----------- |
+@foreach{row : endpointOptions}| @{row.name} | @{row.group} | @{row.required} | @{row.defaultValue}
| @{row.javaType} | @{row.description} |
 @end{}


Mime
View raw message