You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dh...@apache.org on 2014/06/10 21:51:56 UTC

[28/35] git commit: Fixed endpoint configuration, added component default ctor

Fixed endpoint configuration, added component default ctor


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

Branch: refs/heads/master
Commit: d35d71fc6480deb73395c22cc327b739795fedb6
Parents: b79eb69
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Wed Jun 4 19:05:45 2014 -0700
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Tue Jun 10 12:48:34 2014 -0700

----------------------------------------------------------------------
 .../__artifactId__-component/pom.xml                |  8 ++++++++
 .../src/main/java/__name__Component.java            | 16 +++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d35d71fc/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 af32397..2490084 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
@@ -70,6 +70,14 @@
       <scope>test</scope>
     </dependency>
 
+    <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>spi-annotations</artifactId>
+      <version>${camel-version}</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- testing -->
     <dependency>
       <groupId>org.apache.camel</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/d35d71fc/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 7226fef..d249203 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
@@ -41,12 +41,12 @@ public class ${name}Component extends UriEndpointComponent {
 
     private final ${name}ApiCollection collection = ${name}ApiCollection.getCollection();
 
-    public ${name}Component(Class<? extends Endpoint> endpointClass) {
-        super(endpointClass);
+    public ${name}Component() {
+        super(${name}Endpoint.class);
     }
 
-    public ${name}Component(CamelContext context, Class<? extends Endpoint> endpointClass) {
-        super(context, endpointClass);
+    public ${name}Component(CamelContext context) {
+        super(context, ${name}Endpoint.class);
     }
 
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
@@ -81,12 +81,18 @@ public class ${name}Component extends UriEndpointComponent {
 
         // set endpoint property inBody
         setProperties(endpoint, parameters);
+
+        // configure endpoint properties and initialize state
+        endpoint.configureProperties(parameters);
+
         return endpoint;
     }
 
     private ${name}Configuration createEndpointConfiguration(${name}ApiName name) throws Exception {
         final Map<String, Object> componentProperties = new HashMap<String, Object>();
-        IntrospectionSupport.getProperties(configuration, componentProperties, null, false);
+        if (configuration != null) {
+            IntrospectionSupport.getProperties(configuration, componentProperties, null, false);
+        }
 
         // create endpoint configuration with component properties
         final ${name}Configuration endpointConfiguration = collection.getEndpointConfiguration(name);