camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhira...@apache.org
Subject git commit: Added support for specifiying global/common aliases for API proxies in camel-api-component-maven-plugin, minor generated pom cleanup
Date Wed, 18 Jun 2014 23:27:41 GMT
Repository: camel
Updated Branches:
  refs/heads/master 5bf8ba893 -> 2d2716464


Added support for specifiying global/common aliases for API proxies in camel-api-component-maven-plugin,
minor generated pom cleanup


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

Branch: refs/heads/master
Commit: 2d27164647200782e7b07fd5d6440e96d3d501ca
Parents: 5bf8ba8
Author: Dhiraj Bokde <dhirajsb@yahoo.com>
Authored: Wed Jun 18 16:27:23 2014 -0700
Committer: Dhiraj Bokde <dhirajsb@yahoo.com>
Committed: Wed Jun 18 16:27:23 2014 -0700

----------------------------------------------------------------------
 .../__artifactId__-component/pom.xml              |  1 -
 .../camel/maven/ApiComponentGeneratorMojo.java    | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2d271646/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 add5147..6d67150 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
@@ -151,7 +151,6 @@
       <plugin>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-api-component-maven-plugin</artifactId>
-        <version>${camel-version}</version>
         <executions>
           <execution>
             <id>generate-from-file-api</id>

http://git-wip-us.apache.org/repos/asf/camel/blob/2d271646/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
index 74dc1ae..2d49313 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java
@@ -17,6 +17,9 @@
 package org.apache.camel.maven;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -36,12 +39,27 @@ public class ApiComponentGeneratorMojo extends AbstractSourceGeneratorMojo
{
     @Parameter(required = true)
     protected ApiProxy[] apis;
 
+    @Parameter
+    private List<ApiMethodAlias> aliases = Collections.emptyList();
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         if (apis == null || apis.length == 0) {
             throw new MojoExecutionException("One or more API proxies are required");
         }
 
+        // if set, merge common aliases with every API proxy's aliases
+        if (!aliases.isEmpty()) {
+            for (ApiProxy api : apis) {
+                List<ApiMethodAlias> apiAliases = api.getAliases();
+                if (apiAliases.isEmpty()) {
+                    apiAliases = new ArrayList<ApiMethodAlias>();
+                    apiAliases.addAll(aliases);
+                }
+                api.setAliases(apiAliases);
+            }
+        }
+
         // generate ApiCollection
         mergeTemplate(getApiContext(), getApiCollectionFile(), "/api-collection.vm");
 


Mime
View raw message