cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r608272 - in /incubator/cxf/branches/2.0.x-fixes: ./ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
Date Wed, 02 Jan 2008 22:47:33 GMT
Author: dkulp
Date: Wed Jan  2 14:47:32 2008
New Revision: 608272

URL: http://svn.apache.org/viewvc?rev=608272&view=rev
Log:
Merged revisions 607390 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r607390 | mmao | 2007-12-29 02:18:46 -0500 (Sat, 29 Dec 2007) | 5 lines
  
  CXF-1246 
    Support run wsdl2java in the style of 
       mvn org.apache.cxf:cxf-codegen-plugin:2.1-incubator-SNAPSHOT:wsdl2java 
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
    incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=608272&r1=608271&r2=608272&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Wed Jan  2 14:47:32 2008
@@ -87,6 +87,16 @@
      */
     boolean useCompileClasspath;
 
+    private List<WsdlOption> getWsdlOptionsFromDir(final File root) throws MojoExecutionException
{
+        List<WsdlOption> options = new ArrayList<WsdlOption>();
+        for (WsdlOption o : new WsdlOptionLoader().load(root)) {
+            if (!options.contains(o)) {
+                options.add(o);
+            }
+        }
+        return options;
+    }
+
     public void execute() throws MojoExecutionException {
         String outputDir = testSourceRoot == null ? sourceRoot : testSourceRoot;
         File outputDirFile = new File(outputDir);
@@ -95,22 +105,25 @@
         File classesDir = new File(classesDirectory);
         classesDir.mkdirs();
 
-
-        if (wsdlRoot != null) {
-            List<WsdlOption> options = new ArrayList<WsdlOption>();
-            if (wsdlOptions != null) {
-                options.addAll(Arrays.asList(wsdlOptions));
+        List<WsdlOption> options = new ArrayList<WsdlOption>();
+        if (wsdlRoot == null) {
+            File sourceWsdlRoot = new File(project.getBasedir(), "/src/main/resources/wsdl");
+            if (sourceWsdlRoot.exists()) {
+                options.addAll(getWsdlOptionsFromDir(sourceWsdlRoot));
             }
-            
-            for (WsdlOption o : new WsdlOptionLoader().load(wsdlRoot)) {
-                if (!options.contains(o)) {
-                    options.add(o);
-                }
+
+            File testWsdlRoot = new File(project.getBasedir(), "/src/test/resources/wsdl");
+            if (testWsdlRoot.exists()) {
+                options.addAll(getWsdlOptionsFromDir(testWsdlRoot));
             }
-            wsdlOptions = options.toArray(new WsdlOption[options.size()]);
         }
 
-        if (wsdlOptions == null) {
+        if (wsdlOptions != null) {
+            options.addAll(Arrays.asList(wsdlOptions));
+        }
+        wsdlOptions = options.toArray(new WsdlOption[options.size()]);
+
+        if (wsdlOptions.length == 0) {
             getLog().info("Nothing to generate");
             return;
         }

Modified: incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java?rev=608272&r1=608271&r2=608272&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
Wed Jan  2 14:47:32 2008
@@ -38,14 +38,16 @@
     private static final String WSDL_BINDINGS = "-binding-?\\d*.xml$";
 
     public List<WsdlOption> load(String wsdlRoot) throws MojoExecutionException {
-        File wsdlBasedir;
-        if (wsdlRoot == null) {
+        return load(new File(wsdlRoot));
+    }
+
+    public List<WsdlOption> load(File wsdlBasedir) throws MojoExecutionException {
+        if (wsdlBasedir == null) {
             return new ArrayList<WsdlOption>();
         }
-        wsdlBasedir = new File(wsdlRoot);
 
         if (!wsdlBasedir.exists()) {
-            throw new MojoExecutionException(wsdlRoot + " not exists");
+            throw new MojoExecutionException(wsdlBasedir + " not exists");
         }
 
         return findJobs(wsdlBasedir, getWsdlFiles(wsdlBasedir));



Mime
View raw message