cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r674548 - in /cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/resource/ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/fr...
Date Mon, 07 Jul 2008 16:36:59 GMT
Author: dkulp
Date: Mon Jul  7 09:36:51 2008
New Revision: 674548

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

........
  r674547 | dkulp | 2008-07-07 12:34:05 -0400 (Mon, 07 Jul 2008) | 7 lines
  
  [CXF-1683, CXF-1684, CXF-1685, CXF-1686] Apply a bunch of patches from Dave Leatherdale
  * Support "zip" URL's in resolvers
  * Fix relative paths being resolved incorrectly
  * Fix empty parameters being a problem with maven plugin
  * Add default options for maven plugin
  * add <bindingFiles> element to specify binding files for maven plugin so extraArgs
need not be used for that and paths can be properly resolved for them.
........

Added:
    cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java
      - copied unchanged from r674547, cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java
Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
    cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
    cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
    cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
    cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul  7 09:36:51 2008
@@ -1 +1 @@
-/cxf/trunk:673548,674485
+/cxf/trunk:673548,674485,674547

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

Modified: cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
(original)
+++ cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
Mon Jul  7 09:36:51 2008
@@ -38,7 +38,6 @@
 
     public InputSource resolve(String curUri, String baseUri) {
         try {
-            lastestImportUri = curUri;
             currentResolver.resolve(baseUri, curUri, getClass());
             if (currentResolver.isResolved()) {
                 if (currentResolver.getURI() != null && currentResolver.getURI().isAbsolute())
{
@@ -60,6 +59,10 @@
             }
         } catch (IOException e) {
             // move on...
+        } finally {
+            lastestImportUri = curUri;
+            // the uri may have been updated since we were called
+            // so only store it away when everything else is done
         }
         return null;
         // return new InputSource(schemaLocation);

Modified: cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
(original)
+++ cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
Mon Jul  7 09:36:51 2008
@@ -64,10 +64,10 @@
         this.calling = (calling != null) ? calling : getClass();
         if (uriStr.startsWith("classpath:")) {
             tryClasspath(uriStr);
-        } else if (baseUriStr != null && baseUriStr.startsWith("jar:")) {
-            tryJar(baseUriStr, uriStr);
-        } else if (uriStr.startsWith("jar:")) {
-            tryJar(uriStr);
+        } else if (baseUriStr != null && (baseUriStr.startsWith("jar:") || baseUriStr.startsWith("zip:")))
{
+            tryArchive(baseUriStr, uriStr);
+        } else if (uriStr.startsWith("jar:") || uriStr.startsWith("zip:")) {
+            tryArchive(uriStr);
         } else {
             tryFileSystem(baseUriStr, uriStr);
         }
@@ -83,10 +83,10 @@
 
         if (uriStr.startsWith("classpath:")) {
             tryClasspath(uriStr);
-        } else if (baseUriStr != null && baseUriStr.startsWith("jar:")) {
-            tryJar(baseUriStr, uriStr);
-        } else if (uriStr.startsWith("jar:")) {
-            tryJar(uriStr);
+        } else if (baseUriStr != null && (baseUriStr.startsWith("jar:") || baseUriStr.startsWith("zip:")))
{
+            tryArchive(baseUriStr, uriStr);
+        } else if (uriStr.startsWith("jar:") || uriStr.startsWith("zip:")) {
+            tryArchive(uriStr);
         } else {
             tryFileSystem(baseUriStr, uriStr);
         }
@@ -193,18 +193,18 @@
         }
     }
     
-    private void tryJar(String baseStr, String uriStr) throws IOException {
+    private void tryArchive(String baseStr, String uriStr) throws IOException {
         int i = baseStr.indexOf('!');
         if (i == -1) {
             tryFileSystem(baseStr, uriStr);
         }
 
-        String jarBase = baseStr.substring(0, i + 1);
-        String jarEntry = baseStr.substring(i + 1);
+        String archiveBase = baseStr.substring(0, i + 1);
+        String archiveEntry = baseStr.substring(i + 1);
         try {
-            URI u = new URI(jarEntry).resolve(uriStr);
+            URI u = new URI(archiveEntry).resolve(uriStr);
 
-            tryJar(jarBase + u.toString());
+            tryArchive(archiveBase + u.toString());
 
             if (is != null) {
                 if (u.isAbsolute()) {
@@ -219,7 +219,7 @@
         tryFileSystem("", uriStr);
     }
     
-    private void tryJar(String uriStr) throws IOException {
+    private void tryArchive(String uriStr) throws IOException {
         int i = uriStr.indexOf('!');
         if (i == -1) {
             return;
@@ -252,7 +252,7 @@
             } catch (URISyntaxException e) {
                 // processing the jar:file:/ type value
                 String urlStr = url.toString();
-                if (urlStr.startsWith("jar:")) {
+                if (urlStr.startsWith("jar:") || urlStr.startsWith("zip:")) {
                     int pos = urlStr.indexOf('!');
                     if (pos != -1) {
                         try {

Modified: 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/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
(original)
+++ cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Mon Jul  7 09:36:51 2008
@@ -70,6 +70,11 @@
      */
     MavenProject project;
 
+    /**
+     * Default options to be used when a wsdl has not had it's options explicitly specified.
+     * @parameter
+     */
+    Option defaultOptions;
 
     /**
      * @parameter
@@ -116,7 +121,7 @@
                                                    final File output)
         throws MojoExecutionException {
         List<WsdlOption> options = new ArrayList<WsdlOption>();
-        for (WsdlOption o : new WsdlOptionLoader().load(root, includes, excludes)) {
+        for (WsdlOption o : new WsdlOptionLoader().load(root, includes, excludes, defaultOptions))
{
             if (o.getOutputDir() == null) {
                 o.setOutputDir(output);
             }
@@ -326,17 +331,40 @@
                     list.add(it.next().toString());
                 }
             }
-            // -d specify the dir for generated source code
-            //list.add("-verbose");
+            if (getLog().isDebugEnabled()) {
+                list.add("-verbose");            
+            }
+            // -d specify the dir for generated source code            
             list.add("-d");
             list.add(outputDirFile.toString());
 
+            for (String binding : wsdlOption.getBindingFiles()) {
+                File bindingFile = new File(binding);
+                URI bindingURI;
+                if (bindingFile.exists()) {
+                    bindingURI = bindingFile.toURI();
+                } else {
+                    bindingURI = basedir.resolve(binding);
+                }
+                list.add("-b");
+                list.add(bindingURI.toString());
+            }
+            
             if (wsdlOption.getExtraargs() != null) {
                 Iterator it = wsdlOption.getExtraargs().iterator();
                 while (it.hasNext()) {
-                    list.add(it.next().toString());
+                    Object value = it.next();
+                    if (value == null) {
+                        value = ""; // Maven make empty tags into null
+                                    // instead of empty strings.
+                    }
+                    list.add(value.toString());
                 }
             }
+            if (wsdlOption.isSetWsdlLocation()) {
+                list.add("-wsdlLocation");
+                list.add(wsdlOption.getWsdlLocation() == null ? "" : wsdlOption.getWsdlLocation());
+            }
             list.add(wsdlURI.toString());
 
             getLog().debug("Calling wsdl2java with args: " + list);

Modified: cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
(original)
+++ cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
Mon Jul  7 09:36:51 2008
@@ -19,34 +19,12 @@
 
 package org.apache.cxf.maven_plugin;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
 
-public class WsdlOption {
+public class WsdlOption extends Option {
     String wsdl;
-    List<String> packagenames;
-    List<String> extraargs = new ArrayList<String>();
-    File outputDir;
-    File dependencies[];
-    File redundantDirs[];
-
-    public List<String> getExtraargs() {
-        return extraargs;
-    }
-
-    public void setExtraargs(List<String> ea) {
-        this.extraargs = ea;
-    }
-
-    public List<String> getPackagenames() {
-        return packagenames;
-    }
-
-    public void setPackagenames(List<String> pn) {
-        this.packagenames = pn;
-    }
-
+    String wsdlLocation;
+    boolean wsdlLocationSet;
+    
     public String getWsdl() {
         return wsdl;
     }
@@ -54,24 +32,17 @@
     public void setWsdl(String w) {
         wsdl = w;
     }
-    public void setDependencies(File files[]) {
-        dependencies = files;
-    }
-    public File[] getDependencies() {
-        return dependencies;
-    }    
-    public void setDeleteDirs(File files[]) {
-        redundantDirs = files;
+    
+    public void setWsdlLocation(String s) {
+        wsdlLocationSet = true;
+        wsdlLocation = s;
     }
-    public File[] getDeleteDirs() {
-        return redundantDirs;
+    public String getWsdlLocation() {
+        return wsdlLocation;
     }
     
-    public File getOutputDir() {
-        return outputDir;
-    }
-    public void setOutputDir(File f) {
-        outputDir = f;
+    public boolean isSetWsdlLocation() {
+        return wsdlLocationSet;
     }
     
     public int hashCode() {

Modified: 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/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
(original)
+++ cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
Mon Jul  7 09:36:51 2008
@@ -57,10 +57,13 @@
     }
     
     public List<WsdlOption> load(String wsdlRoot) throws MojoExecutionException {
-        return load(new File(wsdlRoot), new String[] {"*.wsdl"}, null);
+        return load(new File(wsdlRoot), new String[] {"*.wsdl"}, null, null);
     }
 
-    public List<WsdlOption> load(File wsdlBasedir, String includes[], String excludes[])
+    public List<WsdlOption> load(File wsdlBasedir,
+                                 String includes[],
+                                 String excludes[],
+                                 Option defaultOptions)
         throws MojoExecutionException {
         
         if (wsdlBasedir == null) {
@@ -68,10 +71,10 @@
         }
 
         if (!wsdlBasedir.exists()) {
-            throw new MojoExecutionException(wsdlBasedir + " not exists");
+            throw new MojoExecutionException(wsdlBasedir + " does not exist");
         }
 
-        return findJobs(wsdlBasedir, getWsdlFiles(wsdlBasedir, includes, excludes));
+        return findJobs(wsdlBasedir, getWsdlFiles(wsdlBasedir, includes, excludes), defaultOptions);
     }
 
     private List<File> getWsdlFiles(File dir, String includes[], String excludes[])
@@ -106,7 +109,7 @@
         return FileUtils.getFiles(dir, pattern);
     }
 
-    protected List<WsdlOption> findJobs(File dir, List<File> wsdlFiles) {
+    protected List<WsdlOption> findJobs(File dir, List<File> wsdlFiles, Option
defaultOptions) {
         List<WsdlOption> jobs = new ArrayList<WsdlOption>();
 
         for (File wsdl : wsdlFiles) {
@@ -119,23 +122,17 @@
             File options = getOptions(dir, wsdlName + WSDL_OPTIONS);
             List<File> bindings = getBindingFiles(dir, wsdlName + WSDL_BINDINGS);
 
-            jobs.add(generateWsdlOption(wsdl, bindings, options));
+            jobs.add(generateWsdlOption(wsdl, bindings, options, defaultOptions));
         }
         return jobs;
     }
 
     protected WsdlOption generateWsdlOption(final File wsdl, 
                                             final List<File> bindingFiles, 
-                                            final File options) {
+                                            final File options,
+                                            final Option defaultOptions) {
         WsdlOption wsdlOption = new WsdlOption();
 
-        if (bindingFiles != null) {
-            for (File binding : bindingFiles) {
-                wsdlOption.getExtraargs().add("-b");
-                wsdlOption.getExtraargs().add(binding.toString());
-            }
-        }
-
         if (options != null && options.exists()) {
             try {
                 List<String> lines = FileUtils.readLines(options);
@@ -145,8 +142,22 @@
             } catch (Exception e) {
                 e.printStackTrace();
             }
+        } else if (defaultOptions != null) {
+            // no options specified use the defaults
+            wsdlOption.setPackagenames(defaultOptions.getPackagenames());
+            wsdlOption.setExtraargs(defaultOptions.getExtraargs());
+            wsdlOption.setOutputDir(defaultOptions.getOutputDir());
+            wsdlOption.setDeleteDirs(defaultOptions.getDeleteDirs());
+            wsdlOption.setDependencies(defaultOptions.getDependencies());
+            wsdlOption.setBindingFiles(defaultOptions.getBindingFiles());
+        }
+        
+        if (bindingFiles != null) {
+            for (File binding : bindingFiles) {
+                wsdlOption.addBindingFile(binding);
+            }
         }
-        wsdlOption.setWsdl(wsdl.toString());
+        wsdlOption.setWsdl(wsdl.toURI().toString());
         
         return wsdlOption;
     }

Modified: cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Mon Jul  7 09:36:51 2008
@@ -465,7 +465,7 @@
             }
 
         } else {
-            Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile);
+            Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile, reader.getName());
             throw new ToolException(msg);
         }
     }

Modified: cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties?rev=674548&r1=674547&r2=674548&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
Mon Jul  7 09:36:51 2008
@@ -19,7 +19,7 @@
 #
 #
 STAX_PARSER_ERROR = StAX parser error, check your external binding file(s)
-UNKNOWN_BINDING_FILE= Unknown external binding files: {0}
+UNKNOWN_BINDING_FILE= Unknown external binding file: {0}  Found unknown QName {1}
 CAN_NOT_FIND_BINDING_WSDL = Can not read the specified wsdl {0} that external binding file
{1} points to
 BINDING_LOC_ERROR = Attribute wsdlLocation/schemaLocation value {0} in jaxws binding element
is not an URI
 ERROR_TARGETNODE_WITH_XPATH = XPath query {0} is identifying either multiple or no target
nodes.



Mime
View raw message