cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r674887 - in /cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin: Option.java WSDL2JavaMojo.java WsdlOption.java WsdlOptionLoader.java
Date Tue, 08 Jul 2008 17:16:23 GMT
Author: dkulp
Date: Tue Jul  8 10:16:23 2008
New Revision: 674887

URL: http://svn.apache.org/viewvc?rev=674887&view=rev
Log:
[CXF-1692]Patch from Dave Leatherdale applied (with fixes to make tests pass).  Thanks!

Modified:
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java?rev=674887&r1=674886&r2=674887&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/Option.java
Tue Jul  8 10:16:23 2008
@@ -25,12 +25,32 @@
 
 public class Option {
 
+    /**
+     * As maven will set null for an empty parameter we need
+     * this horrid inital value to tell if it has been 
+     * configured or not yet.
+     */
+    private static final String DEFAULT_WSDL_LOCATION = "@£$%^&*()DEFAULTWSDLLOCATION";
     protected List<String> packagenames;
     protected List<String> extraargs = new ArrayList<String>();
     protected File outputDir;
+    List<String> namespaceExcludes;
+    Boolean defaultExcludesNamespace;
+    Boolean defaultNamespacePackageMapping;
     File dependencies[];
     File redundantDirs[];
     String bindingFiles[] = new String[0];
+    String wsdlLocation = DEFAULT_WSDL_LOCATION;
+    String frontEnd;
+    String dataBinding;
+    String wsdlVersion;
+    String catalog;
+    boolean extendedSoapHeaders;
+    boolean validateWsdl;
+    String serviceName;
+    boolean autoNameResolution;
+    boolean noAddressBinding;
+
 
     public Option() {
         super();
@@ -53,6 +73,13 @@
         this.packagenames = pn;
     }
 
+    public List<String> getNamespaceExcludes() {
+        return namespaceExcludes;
+    }
+
+    public void setNamespaceExcludes(List<String> namespaceExcludes) {
+        this.namespaceExcludes = namespaceExcludes;
+    }
     public void setDependencies(File files[]) {
         dependencies = files;
     }
@@ -89,6 +116,128 @@
         bindingFiles = tmp;
         bindingFiles[bindingFiles.length - 1] = file.toURI().toString();
     }
-    
 
+    public void setWsdlLocation(String s) {
+        wsdlLocation = s;
+    }
+
+    public String getWsdlLocation() {
+        return isSetWsdlLocation() ? wsdlLocation : null;
+    }
+
+    public boolean isSetWsdlLocation() {
+        return !DEFAULT_WSDL_LOCATION.equals(wsdlLocation);
+    }
+
+    public String getFrontEnd() {
+        return frontEnd;
+    }
+
+    public void setFrontEnd(String frontEnd) {
+        this.frontEnd = frontEnd;
+    }
+
+    public String getDataBinding() {
+        return dataBinding;
+    }
+
+    public void setDataBinding(String dataBinding) {
+        this.dataBinding = dataBinding;
+    }
+
+    public String getWsdlVersion() {
+        return wsdlVersion;
+    }
+
+    public void setWsdlVersion(String wsdlVersion) {
+        this.wsdlVersion = wsdlVersion;
+    }
+
+    public String getCatalog() {
+        return catalog;
+    }
+
+    public void setCatalog(String catalog) {
+        this.catalog = catalog;
+    }
+
+    public boolean isExtendedSoapHeaders() {
+        return extendedSoapHeaders;
+    }
+
+    public void setExtendedSoapHeaders(boolean extendedSoapHeaders) {
+        this.extendedSoapHeaders = extendedSoapHeaders;
+    }
+
+    public boolean isValidateWsdl() {
+        return validateWsdl;
+    }
+
+    public void setValidateWsdl(boolean validateWsdl) {
+        this.validateWsdl = validateWsdl;
+    }
+
+    public Boolean getDefaultExcludesNamespace() {
+        return defaultExcludesNamespace;
+    }
+
+    public void setDefaultExcludesNamespace(Boolean defaultExcludesNamespace) {
+        this.defaultExcludesNamespace = defaultExcludesNamespace;
+    }
+
+    public Boolean getDefaultNamespacePackageMapping() {
+        return defaultNamespacePackageMapping;
+    }
+
+    public void setDefaultNamespacePackageMapping(Boolean defaultNamespacePackageMapping)
{
+        this.defaultNamespacePackageMapping = defaultNamespacePackageMapping;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public boolean isAutoNameResolution() {
+        return autoNameResolution;
+    }
+
+    public void setAutoNameResolution(boolean autoNameResolution) {
+        this.autoNameResolution = autoNameResolution;
+    }
+
+    public boolean isNoAddressBinding() {
+        return noAddressBinding;
+    }
+
+    public void setNoAddressBinding(boolean noAddressBinding) {
+        this.noAddressBinding = noAddressBinding;
+    }
+
+    public void copyOptions(Option destination) {
+        destination.setAutoNameResolution(isAutoNameResolution());
+        destination.setBindingFiles(getBindingFiles());
+        destination.setCatalog(getCatalog());
+        destination.setDataBinding(getDataBinding());
+        destination.setDefaultExcludesNamespace(getDefaultExcludesNamespace());
+        destination.setDefaultNamespacePackageMapping(getDefaultNamespacePackageMapping());
+        destination.setDeleteDirs(getDeleteDirs());
+        destination.setDependencies(getDependencies());
+        destination.setExtendedSoapHeaders(isExtendedSoapHeaders());
+        destination.setExtraargs(getExtraargs());
+        destination.setFrontEnd(getFrontEnd());
+        destination.setNamespaceExcludes(namespaceExcludes);
+        destination.setNoAddressBinding(isNoAddressBinding());
+        destination.setOutputDir(getOutputDir());
+        destination.setPackagenames(getPackagenames());
+        destination.setServiceName(getServiceName());
+        destination.setValidateWsdl(isValidateWsdl());
+        if (isSetWsdlLocation()) {
+            destination.setWsdlLocation(getWsdlLocation());
+        }
+        destination.setWsdlVersion(getWsdlVersion());
+    }
 }

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=674887&r1=674886&r2=674887&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Tue Jul  8 10:16:23 2008
@@ -323,49 +323,7 @@
         if (doWork) {
             doneFile.delete();
 
-            List<String> list = new ArrayList<String>();
-            if (wsdlOption.getPackagenames() != null) {
-                Iterator it = wsdlOption.getPackagenames().iterator();
-                while (it.hasNext()) {
-                    list.add("-p");
-                    list.add(it.next().toString());
-                }
-            }
-            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()) {
-                    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());
+            List<String> list = generateCommandLine(wsdlOption, outputDirFile, basedir,
wsdlURI);
 
             getLog().debug("Calling wsdl2java with args: " + list);
             try {
@@ -378,6 +336,100 @@
         }
     }
 
+    private List<String> generateCommandLine(WsdlOption wsdlOption, File outputDirFile,
URI basedir,
+                                             URI wsdlURI) {
+        List<String> list = new ArrayList<String>();
+        if (wsdlOption.getPackagenames() != null) {
+            Iterator it = wsdlOption.getPackagenames().iterator();
+            while (it.hasNext()) {
+                list.add("-p");
+                list.add(it.next().toString());
+            }
+        }
+        if (wsdlOption.getNamespaceExcludes() != null) {
+            Iterator it = wsdlOption.getNamespaceExcludes().iterator();
+            while (it.hasNext()) {
+                list.add("-nexclude");
+                list.add(it.next().toString());
+            }
+        }
+        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.getFrontEnd() != null) {
+            list.add("-fe");
+            list.add(wsdlOption.getFrontEnd());
+        }
+        if (wsdlOption.getDataBinding() != null) {
+            list.add("-db");
+            list.add(wsdlOption.getDataBinding());
+        }
+        if (wsdlOption.getWsdlVersion() != null) {
+            list.add("-wv");
+            list.add(wsdlOption.getWsdlVersion());
+        }
+        if (wsdlOption.getCatalog() != null) {
+            list.add("-catalog");
+            list.add(wsdlOption.getCatalog());
+        }
+        if (wsdlOption.isExtendedSoapHeaders()) {
+            list.add("-exsh");
+        }
+        if (wsdlOption.isValidateWsdl()) {
+            list.add("-validate");
+        }
+        if (wsdlOption.getDefaultExcludesNamespace() != null) {
+            list.add("-dex");
+            list.add(wsdlOption.getDefaultExcludesNamespace().toString());
+        }
+        if (wsdlOption.getDefaultNamespacePackageMapping() != null) {
+            list.add("-dns");
+            list.add(wsdlOption.getDefaultNamespacePackageMapping().toString());
+        }
+        if (wsdlOption.getServiceName()  != null) {
+            list.add("-sn");
+            list.add(wsdlOption.getServiceName());
+        }
+        if (wsdlOption.isAutoNameResolution()) {
+            list.add("-autoNameResolution");
+        }
+        if (wsdlOption.isNoAddressBinding()) {
+            list.add("-noAddressBinding");
+        }
+        if (wsdlOption.getExtraargs() != null) {
+            Iterator it = wsdlOption.getExtraargs().iterator();
+            while (it.hasNext()) {
+                Object value = it.next();
+                if (value == null) {
+                    value = ""; // Maven makes 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());
+        return list;
+    }
+
     private boolean deleteDir(File f) {
         if (f.isDirectory()) {
             File files[] = f.listFiles();

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java?rev=674887&r1=674886&r2=674887&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOption.java
Tue Jul  8 10:16:23 2008
@@ -22,9 +22,6 @@
 
 public class WsdlOption extends Option {
     String wsdl;
-    String wsdlLocation;
-    boolean wsdlLocationSet;
-    
     public String getWsdl() {
         return wsdl;
     }
@@ -33,18 +30,6 @@
         wsdl = w;
     }
     
-    public void setWsdlLocation(String s) {
-        wsdlLocationSet = true;
-        wsdlLocation = s;
-    }
-    public String getWsdlLocation() {
-        return wsdlLocation;
-    }
-    
-    public boolean isSetWsdlLocation() {
-        return wsdlLocationSet;
-    }
-    
     public int hashCode() {
         if (wsdl != null) {
             return wsdl.hashCode();

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java?rev=674887&r1=674886&r2=674887&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlOptionLoader.java
Tue Jul  8 10:16:23 2008
@@ -144,12 +144,7 @@
             }
         } 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());
+            defaultOptions.copyOptions(wsdlOption);
         }
         
         if (bindingFiles != null) {



Mime
View raw message