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:41 UTC

[13/35] git commit: Converted generated ApiCollection class to singleton

Converted generated ApiCollection class to singleton


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

Branch: refs/heads/master
Commit: ee191eb061dddb6504889d42a1f14a7e5e2d2ad3
Parents: 32677ff
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Wed May 28 14:21:05 2014 -0700
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Tue Jun 10 12:48:31 2014 -0700

----------------------------------------------------------------------
 .../src/main/resources/api-collection.vm               | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ee191eb0/tooling/maven/camel-component-util-maven-plugin/src/main/resources/api-collection.vm
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/src/main/resources/api-collection.vm b/tooling/maven/camel-component-util-maven-plugin/src/main/resources/api-collection.vm
index 26382db..a82c2c5 100644
--- a/tooling/maven/camel-component-util-maven-plugin/src/main/resources/api-collection.vm
+++ b/tooling/maven/camel-component-util-maven-plugin/src/main/resources/api-collection.vm
@@ -30,9 +30,11 @@ import org.apache.camel.util.component.ApiMethodHelper;
 /**
  * Camel {@link ApiCollection} for $componentName
  */
-public class $collectionName extends ApiCollection {
+public final class $collectionName extends ApiCollection {
 
-    public ${collectionName}() {
+    private static $collectionName collection;
+
+    private ${collectionName}() {
         final Map<String, String> aliases = new HashMap<String, String>();
 #foreach( $api in $apis )
         aliases.clear();
@@ -43,4 +45,11 @@ public class $collectionName extends ApiCollection {
         apis.put("$api.ApiName", new ApiMethodHelper<$apiMethod>(${apiMethod}.class, aliases));
 #end
     }
+
+    public static final synchronized $collectionName getCollection() {
+        if (collection == null) {
+            collection = new $collectionName();
+        }
+        return collection;
+    }
 }