You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gz...@apache.org on 2014/06/22 13:37:24 UTC

git commit: [Minor] Fix CS errors in camel-api-component-maven-plugin

Repository: camel
Updated Branches:
  refs/heads/master c984cba26 -> d83274f4f


[Minor] Fix CS errors in camel-api-component-maven-plugin

Signed-off-by: Gregor Zurowski <gr...@zurowski.org>

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

Branch: refs/heads/master
Commit: d83274f4ff6a199c7fe8baaed607bfe9a3185dfd
Parents: c984cba
Author: Gregor Zurowski <gr...@zurowski.org>
Authored: Sun Jun 22 07:33:41 2014 -0400
Committer: Gregor Zurowski <gr...@zurowski.org>
Committed: Sun Jun 22 07:36:10 2014 -0400

----------------------------------------------------------------------
 .../maven/AbstractApiMethodGeneratorMojo.java   | 16 ++++-----
 .../camel/maven/AbstractGeneratorMojo.java      | 16 ++++-----
 .../camel/maven/ApiComponentGeneratorMojo.java  | 36 ++++++++++----------
 .../camel/maven/DocumentGeneratorMojo.java      |  4 +--
 .../maven/JavadocApiMethodGeneratorMojo.java    | 14 ++++----
 .../camel/maven/AbstractGeneratorMojoTest.java  |  4 +--
 .../maven/ApiComponentGeneratorMojoTest.java    |  2 +-
 .../JavadocApiMethodGeneratorMojoTest.java      |  2 +-
 8 files changed, 47 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/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 c7131c0..32a9b0e 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
@@ -36,6 +36,8 @@ import org.apache.velocity.VelocityContext;
  */
 public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBaseMojo {
 
+    private static final Map<Class<?>, String> PRIMITIVE_VALUES;
+
     @Parameter(required = true, property = PREFIX + "proxyClass")
     protected String proxyClass;
 
@@ -145,15 +147,15 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
         context.put("componentPackage", componentPackage);
 
         // generate parameter names and types for configuration, sorted by parameter name
-        Map<String,ApiMethodParser.Argument> parameters = new TreeMap<String, ApiMethodParser.Argument>();
+        Map<String, ApiMethodParser.Argument> parameters = new TreeMap<String, ApiMethodParser.Argument>();
         for (ApiMethodParser.ApiMethodModel model : models) {
             for (ApiMethodParser.Argument argument : model.getArguments()) {
                 final String name = argument.getName();
                 Class<?> type = argument.getType();
                 final String typeName = type.getCanonicalName();
-                if (!parameters.containsKey(name) &&
-                        (propertyNamePattern == null || !propertyNamePattern.matcher(name).matches()) &&
-                        (propertyTypePattern == null || !propertyTypePattern.matcher(typeName).matches())) {
+                if (!parameters.containsKey(name)
+                        && (propertyNamePattern == null || !propertyNamePattern.matcher(name).matches())
+                        && (propertyTypePattern == null || !propertyTypePattern.matcher(typeName).matches())) {
                     parameters.put(name, argument);
                 }
             }
@@ -232,8 +234,6 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
         }
     }
 
-    private static final Map<Class<?>, String> PRIMITIVE_VALUES;
-
     static {
         PRIMITIVE_VALUES = new HashMap<Class<?>, String>();
         PRIMITIVE_VALUES.put(Boolean.TYPE, "Boolean.FALSE");
@@ -300,8 +300,8 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa
                         parameterizedType.append(
                             getCanonicalName(getProjectClassLoader().loadClass("java.lang." + argType)));
                     } catch (ClassNotFoundException e1) {
-                        log.warn("Ignoring type parameters " + typeArgs + "> for argument " + argument.getName() +
-                            ", unable to load parameteric type argument " + argType, e1);
+                        log.warn("Ignoring type parameters " + typeArgs + "> for argument " + argument.getName()
+                                 + ", unable to load parameteric type argument " + argType, e1);
                         ignore = true;
                     }
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/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 abb5802..30e67dd 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
@@ -50,6 +50,11 @@ public abstract class AbstractGeneratorMojo extends AbstractMojo {
     protected static final String OUT_PACKAGE = PREFIX + "component.internal";
     protected static final String COMPONENT_PACKAGE = PREFIX + "component";
 
+    private static VelocityEngine engine;
+    private static ClassLoader projectClassLoader;
+
+    private static boolean sharedProjectState;
+
     // used for velocity logging, to avoid creating velocity.log
     protected final Logger log = Logger.getLogger(this.getClass());
 
@@ -68,10 +73,9 @@ public abstract class AbstractGeneratorMojo extends AbstractMojo {
     @Parameter(required = true, defaultValue = "${project}", readonly = true)
     protected MavenProject project;
 
-    private static VelocityEngine engine;
-    private static ClassLoader projectClassLoader;
-
-    private static boolean sharedProjectState;
+    protected AbstractGeneratorMojo() {
+        clearSharedProjectState();
+    }
 
     public static void setSharedProjectState(boolean sharedProjectState) {
         AbstractGeneratorMojo.sharedProjectState = sharedProjectState;
@@ -83,10 +87,6 @@ public abstract class AbstractGeneratorMojo extends AbstractMojo {
         }
     }
 
-    protected AbstractGeneratorMojo() {
-        clearSharedProjectState();
-    }
-
     protected static VelocityEngine getEngine() {
         if (engine == null) {
             // initialize velocity to load resources from class loader and use Log4J

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/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 d86799d..4f6a4b4 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
@@ -88,8 +88,8 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
                         }
                     }
                     if (!found) {
-                        throw new MojoExecutionException("Missing one of fromSignatureFile or fromJavadoc for " +
-                            proxyClass);
+                        throw new MojoExecutionException("Missing one of fromSignatureFile or fromJavadoc for "
+                                + proxyClass);
                     }
                 }
 
@@ -131,12 +131,12 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
         mojo.generatedTestDir = generatedTestDir;
 
         // set AbstractAPIMethodBaseMojo properties
-        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;
+        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.proxyClass = apiProxy.getProxyClass();
@@ -157,16 +157,16 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo {
             final FromJavadoc apiFromJavadoc = api.getFromJavadoc();
             if (apiFromJavadoc != null) {
                 final JavadocApiMethodGeneratorMojo javadocMojo = new JavadocApiMethodGeneratorMojo();
-                javadocMojo.excludePackages = apiFromJavadoc.getExcludePackages() != null ?
-                    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 ?
-                    apiFromJavadoc.getIncludeStaticMethods() : fromJavadoc.getIncludeStaticMethods();
+                javadocMojo.excludePackages = apiFromJavadoc.getExcludePackages() != null
+                        ? 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
+                        ? apiFromJavadoc.getIncludeStaticMethods() : fromJavadoc.getIncludeStaticMethods();
 
                 apiMethodGenerator = javadocMojo;
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
index b2e3077..cdd1e1a 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
@@ -280,8 +280,8 @@ public class DocumentGeneratorMojo extends AbstractGeneratorMojo implements Mave
 
     private void updateReportOutputDirectory(File reportOutputDirectory) {
         // append destDir if needed
-        if (this.destDir != null && reportOutputDirectory != null &&
-            !reportOutputDirectory.getAbsolutePath().endsWith(destDir)) {
+        if (this.destDir != null && reportOutputDirectory != null
+                && !reportOutputDirectory.getAbsolutePath().endsWith(destDir)) {
             this.reportOutputDirectory = new File(reportOutputDirectory, destDir);
         } else {
             this.reportOutputDirectory = reportOutputDirectory;

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/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 f734d68..c03fdd9 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
@@ -86,8 +86,8 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
 
         // for proxy class and super classes not matching excluded packages or classes
         for (Class aClass = getProxyType();
-             aClass != null && !packagePatterns.matcher(aClass.getPackage().getName()).matches() &&
-                     (classPatterns == null || !classPatterns.matcher(aClass.getSimpleName()).matches());
+             aClass != null && !packagePatterns.matcher(aClass.getPackage().getName()).matches()
+                     && (classPatterns == null || !classPatterns.matcher(aClass.getSimpleName()).matches());
              aClass = aClass.getSuperclass()) {
 
             log.debug("Processing " + aClass.getName());
@@ -116,9 +116,9 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
                 // get public method signature
                 final Map<String, String> methodMap = htmlParser.getMethodText();
                 for (String method : htmlParser.getMethods()) {
-                    if (!result.containsKey(method) &&
-                            (includeMethodPatterns == null || includeMethodPatterns.matcher(method).find()) &&
-                            (excludeMethodPatterns == null || !excludeMethodPatterns.matcher(method).find())) {
+                    if (!result.containsKey(method)
+                            && (includeMethodPatterns == null || includeMethodPatterns.matcher(method).find())
+                            && (excludeMethodPatterns == null || !excludeMethodPatterns.matcher(method).find())) {
 
                         final int leftBracket = method.indexOf('(');
                         final String name = method.substring(0, leftBracket);
@@ -151,8 +151,8 @@ public class JavadocApiMethodGeneratorMojo extends AbstractApiMethodGeneratorMoj
         }
 
         if (result.isEmpty()) {
-            throw new MojoExecutionException("No public non-static methods found, " +
-                    "make sure Javadoc is available as project test dependency");
+            throw new MojoExecutionException("No public non-static methods found, "
+                    + "make sure Javadoc is available as project test dependency");
         }
         return new ArrayList<String>(result.values());
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java b/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
index 68f5bff..f374385 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
@@ -32,8 +32,8 @@ import static org.junit.Assert.assertTrue;
 public abstract class AbstractGeneratorMojoTest {
     protected static final String OUT_DIR = "target/generated-test-sources/camel-component";
 
-    private static final String COMPONENT_PACKAGE = "org.apache.camel.component.test";
-    private static final String OUT_PACKAGE = COMPONENT_PACKAGE + ".internal";
+    protected static final String COMPONENT_PACKAGE = "org.apache.camel.component.test";
+    protected static final String OUT_PACKAGE = COMPONENT_PACKAGE + ".internal";
 
     protected static final String PACKAGE_PATH = OUT_PACKAGE.replaceAll("\\.", "/") + "/";
     protected static final String COMPONENT_PACKAGE_PATH = COMPONENT_PACKAGE.replaceAll("\\.", "/") + "/";

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java b/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
index a7ac4a5..b58d6d6 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
@@ -62,7 +62,7 @@ public class ApiComponentGeneratorMojoTest extends AbstractGeneratorMojoTest {
         mojo.apis[1].setProxyClass(VelocityContext.class.getName());
         mojo.apis[1].setAliases(aliases);
         Substitution substitution = new Substitution(".*", "key", "java.lang.Object", "applicationKey", false);
-        mojo.apis[1].setSubstitutions(new Substitution[]{ substitution });
+        mojo.apis[1].setSubstitutions(new Substitution[] {substitution});
         final FromJavadoc fromJavadoc = new FromJavadoc();
         fromJavadoc.setExcludePackages(JavadocApiMethodGeneratorMojo.DEFAULT_EXCLUDE_PACKAGES);
         fromJavadoc.setExcludeMethods("clone|Current|internal|icache");

http://git-wip-us.apache.org/repos/asf/camel/blob/d83274f4/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 7ce3422..cbf11dc 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
@@ -45,7 +45,7 @@ public class JavadocApiMethodGeneratorMojoTest extends AbstractGeneratorMojoTest
         // use VelocityEngine javadoc
         mojo.proxyClass = VelocityContext.class.getCanonicalName();
         Substitution substitution = new Substitution(".*", "key", "java.lang.Object", "applicationKey", false);
-        mojo.substitutions = new Substitution[]{ substitution };
+        mojo.substitutions = new Substitution[] {substitution};
         mojo.excludePackages = JavadocApiMethodGeneratorMojo.DEFAULT_EXCLUDE_PACKAGES;
         mojo.includeMethods = ".+";
         mojo.excludeMethods = "clone|Current|internal|icache";