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/21 04:38:02 UTC

git commit: Added support for specifying includeMethods parameter in plugin to filter Javadoc methods

Repository: camel
Updated Branches:
  refs/heads/master 12945b849 -> 68cb6a4af


Added support for specifying includeMethods parameter in plugin to filter Javadoc methods


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

Branch: refs/heads/master
Commit: 68cb6a4afac02c7228ca8ba2d3d3283c47d575ee
Parents: 12945b8
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Fri Jun 20 19:37:22 2014 -0700
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Fri Jun 20 19:37:22 2014 -0700

----------------------------------------------------------------------
 .../camel/maven/AbstractApiMethodBaseMojo.java  | 24 ------------
 .../maven/AbstractApiMethodGeneratorMojo.java   |  8 ----
 .../camel/maven/AbstractGeneratorMojo.java      | 40 --------------------
 .../maven/AbstractSourceGeneratorMojo.java      | 16 --------
 .../camel/maven/ApiComponentGeneratorMojo.java  | 30 ++++++++-------
 .../org/apache/camel/maven/FromJavadoc.java     | 10 +++++
 .../maven/JavadocApiMethodGeneratorMojo.java    |  9 ++++-
 .../JavadocApiMethodGeneratorMojoTest.java      |  1 +
 8 files changed, 34 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodBaseMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodBaseMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodBaseMojo.java
index 07b2bff..c5e6f1b 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodBaseMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodBaseMojo.java
@@ -31,28 +31,4 @@ public abstract class AbstractApiMethodBaseMojo extends AbstractSourceGeneratorM
 
     @Parameter(property = PREFIX + "excludeConfigTypes")
     protected String excludeConfigTypes;
-
-    public Substitution[] getSubstitutions() {
-        return substitutions;
-    }
-
-    public void setSubstitutions(Substitution[] substitutions) {
-        this.substitutions = substitutions;
-    }
-
-    public String getExcludeConfigNames() {
-        return excludeConfigNames;
-    }
-
-    public void setExcludeConfigNames(String excludeConfigNames) {
-        this.excludeConfigNames = excludeConfigNames;
-    }
-
-    public String getExcludeConfigTypes() {
-        return excludeConfigTypes;
-    }
-
-    public void setExcludeConfigTypes(String excludeConfigTypes) {
-        this.excludeConfigTypes = excludeConfigTypes;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
index ec17364..c7131c0 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java
@@ -45,14 +45,6 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
     private Pattern propertyNamePattern;
     private Pattern propertyTypePattern;
 
-    public String getProxyClass() {
-        return proxyClass;
-    }
-
-    public void setProxyClass(String proxyClass) {
-        this.proxyClass = proxyClass;
-    }
-
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
 

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractGeneratorMojo.java
index a308da0..abb5802 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractGeneratorMojo.java
@@ -168,44 +168,4 @@ public abstract class AbstractGeneratorMojo extends AbstractMojo {
         }
         return canonicalName;
     }
-
-    public String getOutPackage() {
-        return outPackage;
-    }
-
-    public void setOutPackage(String outPackage) {
-        this.outPackage = outPackage;
-    }
-
-    public String getScheme() {
-        return scheme;
-    }
-
-    public void setScheme(String scheme) {
-        this.scheme = scheme;
-    }
-
-    public String getComponentName() {
-        return componentName;
-    }
-
-    public void setComponentName(String componentName) {
-        this.componentName = componentName;
-    }
-
-    public String getComponentPackage() {
-        return componentPackage;
-    }
-
-    public void setComponentPackage(String componentPackage) {
-        this.componentPackage = componentPackage;
-    }
-
-    public MavenProject getProject() {
-        return project;
-    }
-
-    public void setProject(MavenProject project) {
-        this.project = project;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSourceGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSourceGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSourceGeneratorMojo.java
index cc0e85c..add0616 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSourceGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSourceGeneratorMojo.java
@@ -30,20 +30,4 @@ public abstract class AbstractSourceGeneratorMojo extends AbstractGeneratorMojo
 
     @Parameter(defaultValue = "${project.build.directory}/generated-test-sources/camel-component")
     protected File generatedTestDir;
-
-    public File getGeneratedSrcDir() {
-        return generatedSrcDir;
-    }
-
-    public void setGeneratedSrcDir(File generatedSrcDir) {
-        this.generatedSrcDir = generatedSrcDir;
-    }
-
-    public File getGeneratedTestDir() {
-        return generatedTestDir;
-    }
-
-    public void setGeneratedTestDir(File generatedTestDir) {
-        this.generatedTestDir = generatedTestDir;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/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 dabdcd5..d86799d 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
@@ -120,26 +120,26 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
     private void configureMethodGenerator(AbstractApiMethodGeneratorMojo mojo, ApiProxy apiProxy) {
 
         // set AbstractGeneratorMojo properties
-        mojo.setComponentName(componentName);
-        mojo.setScheme(scheme);
-        mojo.setOutPackage(outPackage);
-        mojo.setComponentPackage(componentPackage);
-        mojo.setProject(project);
+        mojo.componentName = componentName;
+        mojo.scheme = scheme;
+        mojo.outPackage = outPackage;
+        mojo.componentPackage = componentPackage;
+        mojo.project = project;
 
         // set AbstractSourceGeneratorMojo properties
-        mojo.setGeneratedSrcDir(generatedSrcDir);
-        mojo.setGeneratedTestDir(generatedTestDir);
+        mojo.generatedSrcDir = generatedSrcDir;
+        mojo.generatedTestDir = generatedTestDir;
 
         // set AbstractAPIMethodBaseMojo properties
-        mojo.setSubstitutions(apiProxy.getSubstitutions().length != 0 ?
-            apiProxy.getSubstitutions() : substitutions);
-        mojo.setExcludeConfigNames(apiProxy.getExcludeConfigNames() != null ?
-            apiProxy.getExcludeConfigNames() : excludeConfigNames);
-        mojo.setExcludeConfigTypes(apiProxy.getExcludeConfigTypes() != null ?
-            apiProxy.getExcludeConfigTypes() : excludeConfigTypes);
+        mojo.substitutions = apiProxy.getSubstitutions().length != 0 ?
+            apiProxy.getSubstitutions() : substitutions;
+        mojo.excludeConfigNames = apiProxy.getExcludeConfigNames() != null ?
+            apiProxy.getExcludeConfigNames() : excludeConfigNames;
+        mojo.excludeConfigTypes = apiProxy.getExcludeConfigTypes() != null ?
+            apiProxy.getExcludeConfigTypes() : excludeConfigTypes;
 
         // set AbstractAPIMethodGeneratorMojo properties
-        mojo.setProxyClass(apiProxy.getProxyClass());
+        mojo.proxyClass = apiProxy.getProxyClass();
     }
 
     private AbstractApiMethodGeneratorMojo getApiMethodGenerator(ApiProxy api) {
@@ -161,6 +161,8 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
                     apiFromJavadoc.getExcludePackages() : fromJavadoc.getExcludePackages();
                 javadocMojo.excludeClasses = apiFromJavadoc.getExcludeClasses() != null ?
                     apiFromJavadoc.getExcludeClasses() : fromJavadoc.getExcludeClasses();
+                javadocMojo.includeMethods = apiFromJavadoc.getIncludeMethods() != null ?
+                    apiFromJavadoc.getIncludeMethods() : fromJavadoc.getIncludeMethods();
                 javadocMojo.excludeMethods = apiFromJavadoc.getExcludeMethods() != null ?
                     apiFromJavadoc.getExcludeMethods() : fromJavadoc.getExcludeMethods();
                 javadocMojo.includeStaticMethods = apiFromJavadoc.getIncludeStaticMethods() != null ?

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/FromJavadoc.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/FromJavadoc.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/FromJavadoc.java
index f23a301..49962fc 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/FromJavadoc.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/FromJavadoc.java
@@ -25,6 +25,8 @@ public class FromJavadoc {
 
     protected String excludeClasses;
 
+    protected String includeMethods;
+
     protected String excludeMethods;
 
     protected Boolean includeStaticMethods;
@@ -45,6 +47,14 @@ public class FromJavadoc {
         this.excludeClasses = excludeClasses;
     }
 
+    public String getIncludeMethods() {
+        return includeMethods;
+    }
+
+    public void setIncludeMethods(String includeMethods) {
+        this.includeMethods = includeMethods;
+    }
+
     public String getExcludeMethods() {
         return excludeMethods;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
index a8a9beb..f734d68 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojo.java
@@ -65,6 +65,9 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
     @Parameter(property = PREFIX + "excludeClasses")
     protected String excludeClasses;
 
+    @Parameter(property = PREFIX + "includeMethods")
+    protected String includeMethods;
+
     @Parameter(property = PREFIX + "excludeMethods")
     protected String excludeMethods;
 
@@ -78,7 +81,8 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
 
         final Pattern packagePatterns = Pattern.compile(excludePackages);
         final Pattern classPatterns = (excludeClasses != null) ? Pattern.compile(excludeClasses) : null;
-        final Pattern methodPatterns = (excludeMethods != null) ? Pattern.compile(excludeMethods) : null;
+        final Pattern includeMethodPatterns = (includeMethods != null) ? Pattern.compile(includeMethods) : null;
+        final Pattern excludeMethodPatterns = (excludeMethods != null) ? Pattern.compile(excludeMethods) : null;
 
         // for proxy class and super classes not matching excluded packages or classes
         for (Class aClass = getProxyType();
@@ -113,7 +117,8 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
                 final Map<String, String> methodMap = htmlParser.getMethodText();
                 for (String method : htmlParser.getMethods()) {
                     if (!result.containsKey(method) &&
-                            (methodPatterns == null || !methodPatterns.matcher(method).find())) {
+                            (includeMethodPatterns == null || includeMethodPatterns.matcher(method).find()) &&
+                            (excludeMethodPatterns == null || !excludeMethodPatterns.matcher(method).find())) {
 
                         final int leftBracket = method.indexOf('(');
                         final String name = method.substring(0, leftBracket);

http://git-wip-us.apache.org/repos/asf/camel/blob/68cb6a4a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java b/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
index c9e9f1c..7ce3422 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
@@ -47,6 +47,7 @@ public class JavadocApiMethodGeneratorMojoTest extends AbstractGeneratorMojoTest
         Substitution substitution = new Substitution(".*", "key", "java.lang.Object", "applicationKey", false);
         mojo.substitutions = new Substitution[]{ substitution };
         mojo.excludePackages = JavadocApiMethodGeneratorMojo.DEFAULT_EXCLUDE_PACKAGES;
+        mojo.includeMethods = ".+";
         mojo.excludeMethods = "clone|Current|internal|icache";
 
         mojo.execute();