cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1214601 - in /cxf/trunk: maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/ma...
Date Thu, 15 Dec 2011 02:32:44 GMT
Author: bimargulies
Date: Thu Dec 15 02:32:43 2011
New Revision: 1214601

URL: http://svn.apache.org/viewvc?rev=1214601&view=rev
Log:
Much debugging of js mojo. It has even worked a little.

Modified:
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
    cxf/trunk/systests/wsdl_maven/codegen/pom.xml

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java?rev=1214601&r1=1214600&r2=1214601&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
Thu Dec 15 02:32:43 2011
@@ -138,7 +138,7 @@ public abstract class AbstractCodegenMoh
     /**
      * Sets the JVM arguments (i.e. <code>-Xms128m -Xmx128m</code>) if fork is
set to <code>true</code>.
      * 
-     * @parameter
+     * @parameter expression="${cxf.codegen.jvmArgs}"
      * @since 2.4
      */
     private String additionalJvmArgs;
@@ -325,7 +325,7 @@ public abstract class AbstractCodegenMoh
             outputDirFile.mkdirs();
             URI basedir = project.getBasedir().toURI();
             URI wsdlURI = getWsdlURI(wsdlOption, basedir);
-            File doneFile = getDoneFile(basedir, wsdlURI, "java");
+            File doneFile = getDoneFile(basedir, wsdlURI, "js");
 
             if (!shouldRun(wsdlOption, doneFile, wsdlURI)) {
                 continue;
@@ -396,12 +396,12 @@ public abstract class AbstractCodegenMoh
     protected abstract File getGeneratedSourceRoot();
 
     protected abstract File getGeneratedTestRoot();
-
+    
     protected void runForked(Set<URI> classPath, 
                              String mainClassName, 
                              String[] args) throws MojoExecutionException {
-        getLog().info("Running wsdl2java in fork mode...");
-        getLog().debug("Running wsdl2java in fork mode with args " + Arrays.asList(args));
+        getLog().info("Running code generation in fork mode...");
+        getLog().debug("Running code generation in fork mode with args " + Arrays.asList(args));
 
         Commandline cmd = new Commandline();
         cmd.getShell().setQuotedArgumentsEnabled(false); // for JVM args

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java?rev=1214601&r1=1214600&r2=1214601&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
Thu Dec 15 02:32:43 2011
@@ -60,6 +60,9 @@ public class WSDL2JavaMojo extends Abstr
     File sourceRoot;
     
     /**
+     * Options that specify WSDLs to process and/or control the processing of wsdls. 
+     * If you have enabled wsdl scanning, these elements attach options to particular wsdls.
+     * If you have not enabled wsdl scanning, these options call out the wsdls to process.

      * @parameter
      */
     WsdlOption wsdlOptions[];

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java?rev=1214601&r1=1214600&r2=1214601&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/Option.java
Thu Dec 15 02:32:43 2011
@@ -19,6 +19,7 @@
 package org.apache.cxf.maven_plugin.wsdl2js;
 
 import java.io.File;
+import java.util.Arrays;
 
 public class Option {
 
@@ -158,7 +159,7 @@ public class Option {
     /**
      * @return Validating the WSDL?
      */
-    public boolean isValidate() {
+    public Boolean isValidate() {
         return validate;
     }
 
@@ -166,7 +167,7 @@ public class Option {
      * Control WSDL validation.
      * @param validate true to validate.
      */
-    public void setValidate(boolean validate) {
+    public void setValidate(Boolean validate) {
         this.validate = validate;
     }
 
@@ -194,4 +195,13 @@ public class Option {
         this.dependencies = dependencies;
     }
 
+    @Override
+    public String toString() {
+        return String
+            .format("Option [packagePrefixes=%s, catalog=%s, output=%s, "
+                    + " validate=%s, wsdlVersion=%s, dependencies=%s]",
+                    Arrays.toString(packagePrefixes), catalog, output, validate, wsdlVersion,
+                    Arrays.toString(dependencies));
+    }
+
 }

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java?rev=1214601&r1=1214600&r2=1214601&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
Thu Dec 15 02:32:43 2011
@@ -51,14 +51,6 @@ import org.apache.maven.project.MavenPro
 public class WSDL2JavaScriptMojo extends AbstractCodegenMoho {
 
     /**
-     * WSDL files to process. Each wsdl file is specified as an option element, with possible
options.
-     * 
-     * @parameter
-     * @required
-     */
-    WsdlOption[] wsdls;
-
-    /**
      * @parameter expression="${cxf.testJavascriptRoot}"
      */
     File testSourceRoot;
@@ -77,9 +69,12 @@ public class WSDL2JavaScriptMojo extends
      * 
      * @parameter
      */
-    Option defaultOptions;
+    Option defaultOptions = new Option();
     
     /**
+     * Options that specify WSDLs to process and/or control the processing of wsdls. 
+     * If you have enabled wsdl scanning, these elements attach options to particular wsdls.
+     * If you have not enabled wsdl scanning, these options call out the wsdls to process.

      * @parameter
      */
     WsdlOption wsdlOptions[];
@@ -199,9 +194,14 @@ public class WSDL2JavaScriptMojo extends
     }
 
     protected void mergeOptions(List<GenericWsdlOption> effectiveWsdlOptions) {
-        for (GenericWsdlOption wo : wsdls) {
+        File outputDirFile = getGeneratedTestRoot() == null 
+            ? getGeneratedSourceRoot() : getGeneratedTestRoot();
+        for (GenericWsdlOption wo : effectiveWsdlOptions) {
             WsdlOption option = (WsdlOption)wo;
             option.merge(defaultOptions);
+            if (option.getOutput() == null) {
+                option.setOutput(outputDirFile);
+            }
         }
     }
 
@@ -211,8 +211,10 @@ public class WSDL2JavaScriptMojo extends
         List<GenericWsdlOption> effectiveWsdlOptions = new ArrayList<GenericWsdlOption>();
         List<GenericWsdlOption> temp;
         
-        for (WsdlOption wo : wsdlOptions) {
-            effectiveWsdlOptions.add(wo);
+        if (wsdlOptions != null) {
+            for (WsdlOption wo : wsdlOptions) {
+                effectiveWsdlOptions.add(wo);
+            }
         }
         
         if (wsdlRoot != null && wsdlRoot.exists() && !disableDirectoryScan)
{
@@ -263,8 +265,7 @@ public class WSDL2JavaScriptMojo extends
         Set<Artifact> dependencies = CastUtils.cast(project.getDependencyArtifacts());
         for (Artifact artifact : dependencies) {
             WsdlOption option = new WsdlOption();
-            WsdlUtilities.fillWsdlOptionFromArtifact(new WsdlOption(), artifact, outputDir);
-            if (option != null) {
+            if (WsdlUtilities.fillWsdlOptionFromArtifact(option, artifact, outputDir)) {
                 if (defaultOptions != null) {
                     option.merge(defaultOptions);
                 }

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java?rev=1214601&r1=1214600&r2=1214601&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WsdlOption.java
Thu Dec 15 02:32:43 2011
@@ -111,5 +111,11 @@ public class WsdlOption extends Option i
          */
         options.add(wsdl);
         return options;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("WsdlOption [wsdl=%s, artifact=%s, %s]", wsdl, artifact,
+                             super.toString());
     } 
 }

Modified: cxf/trunk/systests/wsdl_maven/codegen/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/wsdl_maven/codegen/pom.xml?rev=1214601&r1=1214600&r2=1214601&view=diff
==============================================================================
--- cxf/trunk/systests/wsdl_maven/codegen/pom.xml (original)
+++ cxf/trunk/systests/wsdl_maven/codegen/pom.xml Thu Dec 15 02:32:43 2011
@@ -36,7 +36,6 @@
                 <artifactId>cxf-codegen-plugin</artifactId>
                 <version>${project.version}</version>
                 <executions>
-                    <execution>
                         <!-- Codegen with default settings.
                              This test shows some of the defaults that work without configuration.
 
                              In this case the wsdl dependency to the service "cxf-systests-java2ws"
@@ -45,7 +44,8 @@
                              this binding will be applied.
                              The binding file contains an empty wsdlLocation. This means
that
                              the binding will be applied to the wsdl currently processed.
 -->
-                        <id>generate-sources</id>
+                    <execution>
+                        <id>generate-java-sources</id>
                         <phase>generate-sources</phase>
                         <goals>
                             <goal>wsdl2java</goal>
@@ -58,6 +58,24 @@
                             </defaultOptions>
                         </configuration>
                     </execution>
+                    <execution>
+                        <!-- Codegen with default settings.
+                             This test shows some of the defaults that work without configuration.
 
+                             In this case the wsdl dependency to the service "cxf-systests-java2ws"
+                             will be processed.
+                             As we have a file named defaultBinding.xml in the classpath
+                             this binding will be applied.
+                             The binding file contains an empty wsdlLocation. This means
that
+                             the binding will be applied to the wsdl currently processed.
 -->
+                        <id>generate-js-sources</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>wsdl2js</goal>
+                        </goals>
+                        <configuration>
+                            <fork>${cxf.codegenplugin.forkmode}</fork>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
         </plugins>



Mime
View raw message