camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: Fixed component-api archetype
Date Sat, 18 Jul 2015 09:20:33 GMT
Repository: camel
Updated Branches:
  refs/heads/master 46d61b8c5 -> 88551b2dd


Fixed component-api archetype


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

Branch: refs/heads/master
Commit: 88551b2ddbe4bc35178f1320a2f13de1ddee1b3a
Parents: 46d61b8
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Jul 18 11:17:22 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Jul 18 11:27:22 2015 +0200

----------------------------------------------------------------------
 .../__artifactId__-component/pom.xml            | 30 ++++++++++++++++++++
 .../src/main/java/__name__Component.java        | 15 ++++++++--
 .../src/main/java/__name__Endpoint.java         | 20 ++++++++++++-
 3 files changed, 61 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/88551b2d/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
b/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
index a0c7265..1ee1d01 100644
--- a/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
+++ b/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/pom.xml
@@ -51,6 +51,13 @@
       <version>${version}</version>
     </dependency>
 
+    <!-- support camel documentation -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${camel-version}</version>
+    </dependency>
+
     <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
     <dependency>
       <groupId>org.apache.camel</groupId>
@@ -223,6 +230,29 @@
         </executions>
       </plugin>
 
+      <!-- generate components meta-data and validate component includes documentation
etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${camel-version}</version>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+          </execution>
+        </executions>
+      </plugin>
+
       <!-- add generated source and test source to build -->
       <plugin>
         <groupId>org.codehaus.mojo</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/88551b2d/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Component.java
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Component.java
b/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Component.java
index 05fd2d0..2c55945 100644
--- a/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Component.java
+++ b/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Component.java
@@ -18,7 +18,6 @@ package ${package};
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.util.component.AbstractApiComponent;
 
 import ${package}.internal.${name}ApiCollection;
@@ -27,7 +26,6 @@ import ${package}.internal.${name}ApiName;
 /**
  * Represents the component that manages {@link ${name}Endpoint}.
  */
-@UriEndpoint(scheme = "${scheme}", consumerClass = ${name}Consumer.class, consumerPrefix
= "consumer")
 public class ${name}Component extends AbstractApiComponent<${name}ApiName, ${name}Configuration,
${name}ApiCollection> {
 
     public ${name}Component() {
@@ -46,6 +44,17 @@ public class ${name}Component extends AbstractApiComponent<${name}ApiName,
${nam
     @Override
     protected Endpoint createEndpoint(String uri, String methodName, ${name}ApiName apiName,
                                       ${name}Configuration endpointConfiguration) {
-        return new ${name}Endpoint(uri, this, apiName, methodName, endpointConfiguration);
+        ${name}Endpoint endpoint = new ${name}Endpoint(uri, this, apiName, methodName, endpointConfiguration);
+        endpoint.setName(methodName);
+        return endpoint;
     }
+
+    /**
+     * To use the shared configuration
+     */
+    @Override
+    public void setConfiguration(${name}Configuration configuration) {
+        super.setConfiguration(configuration);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/88551b2d/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Endpoint.java
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Endpoint.java
b/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Endpoint.java
index a804e7b..7f10526 100644
--- a/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Endpoint.java
+++ b/tooling/archetypes/camel-archetype-api-component/src/main/resources/archetype-resources/__artifactId__-component/src/main/java/__name__Endpoint.java
@@ -21,7 +21,9 @@ import java.util.Map;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.component.AbstractApiEndpoint;
 import org.apache.camel.util.component.ApiMethod;
 import org.apache.camel.util.component.ApiMethodPropertiesHelper;
@@ -36,9 +38,12 @@ import ${package}.internal.${name}PropertiesHelper;
 /**
  * Represents a ${name} endpoint.
  */
-@UriEndpoint(scheme = "${scheme}", consumerClass = ${name}Consumer.class, consumerPrefix
= "consumer")
+@UriEndpoint(scheme = "${scheme}", title = "${name}", syntax="${scheme}:name", consumerClass
= ${name}Consumer.class, label = "${name}")
 public class ${name}Endpoint extends AbstractApiEndpoint<${name}ApiName, ${name}Configuration>
{
 
+    @UriPath @Metadata(required = "true")
+    private String name;
+
     // TODO create and manage API proxy
     private Object apiProxy;
 
@@ -91,4 +96,17 @@ public class ${name}Endpoint extends AbstractApiEndpoint<${name}ApiName,
${name}
     public Object getApiProxy(ApiMethod method, Map<String, Object> args) {
         return apiProxy;
     }
+
+    /**
+     * Some description of this option, and what it does
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+
 }


Mime
View raw message