cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r831039 - in /cxf/trunk: maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ tools/common/src/main/java/org/apache/cxf/tools/common/ tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/ tools/javato/ws/s...
Date Thu, 29 Oct 2009 17:28:41 GMT
Author: dkulp
Date: Thu Oct 29 17:28:40 2009
New Revision: 831039

URL: http://svn.apache.org/viewvc?rev=831039&view=rev
Log:
[CXF-1027, CXF-2445] Fix multi args for -beans and add multi args
support for -xjc

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/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java
    cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
    cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java
    cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.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=831039&r1=831038&r2=831039&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
Thu Oct 29 17:28:40 2009
@@ -38,12 +38,18 @@
     protected List<String> packagenames;
 
     /**
-     * Extra arguments to pass to the command-line code generator. For compatibility as well
as to 
+     * Extra arguments to pass to the command-line code generator. For compatibility as well
as to
      * specify any extra flags not addressed by other parameters
      */
     protected List<String> extraargs = new ArrayList<String>();
 
     /**
+     * Extra arguments to pass to the XJC compiler command-line code generator.
+     * For compatibility as well as to specify any extra flags not addressed by other parameters
+     */
+    protected List<String> xjcargs = new ArrayList<String>();
+
+    /**
      * Directory where generated java classes will be created. Defaults to plugin 'sourceRoot'
parameter
      */
     protected File outputDir;
@@ -160,6 +166,15 @@
         this.extraargs.addAll(ea);
     }
 
+    public List<String> getXJCargs() {
+        return xjcargs;
+    }
+
+    public void setXJCargs(List<String> ea) {
+        this.xjcargs.clear();
+        this.xjcargs.addAll(ea);
+    }
+
     public List<String> getPackagenames() {
         return packagenames;
     }
@@ -339,6 +354,7 @@
         destination.setDependencies(getDependencies());
         destination.setExtendedSoapHeaders(isExtendedSoapHeaders());
         destination.setExtraargs(getExtraargs());
+        destination.setXJCargs(getXJCargs());
         destination.setFrontEnd(getFrontEnd());
         destination.setNamespaceExcludes(namespaceExcludes);
         destination.setNoAddressBinding(isNoAddressBinding());

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=831039&r1=831038&r2=831039&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
Thu Oct 29 17:28:40 2009
@@ -554,6 +554,16 @@
         if (wsdlOption.isNoAddressBinding()) {
             list.add("-noAddressBinding");
         }
+        if (wsdlOption.getXJCargs() != null) {
+            
+            for (String value : wsdlOption.getXJCargs()) {
+                if (value == null) {
+                    value = ""; // Maven makes empty tags into null
+                                // instead of empty strings.
+                }
+                list.add("-xjc" + value);
+            }
+        }
         if (wsdlOption.getExtraargs() != null) {
             Iterator<String> it = wsdlOption.getExtraargs().iterator();
             while (it.hasNext()) {

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=831039&r1=831038&r2=831039&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
Thu Oct 29 17:28:40 2009
@@ -69,6 +69,7 @@
         builder.append("WSDL: ").append(wsdl).append('\n');
         builder.append("OutputDir: ").append(outputDir).append('\n');
         builder.append("Extraargs: ").append(extraargs).append('\n');
+        builder.append("XJCargs: ").append(xjcargs).append('\n');
         builder.append("Packagenames: ").append(packagenames).append('\n');
         builder.append('\n');
         return builder.toString();

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java
Thu Oct 29 17:28:40 2009
@@ -50,8 +50,6 @@
     private boolean verbose;
     private String usage;
     private final ErrorVisitor errors = new ErrorVisitor();
-    private String beanConfigResource;
-    
     
     public AbstractCXFToolContainer(String nm, ToolSpec toolspec) throws Exception {
         super(toolspec);
@@ -114,12 +112,7 @@
      * @throws ToolException for impossible options.
      */
     public void checkParams(ErrorVisitor err) throws ToolException {
-        CommandDocument doc = getCommandDocument();
-
-        if (doc.hasParameter(ToolConstants.CFG_BEAN_CONFIG)) {
-            String beanPath = doc.getParameter(ToolConstants.CFG_BEAN_CONFIG);          

-            setBeanConfigResource(beanPath);
-        }
+        //nothing to do here
     }
 
     public boolean isVerboseOn() {
@@ -289,17 +282,4 @@
         return map;
     }
 
-    /**
-     * @return Returns the beanConfigResource.
-     */
-    public String getBeanConfigResource() {
-        return beanConfigResource;
-    }
-
-    /**
-     * @param beanConfigResource The beanConfigResource to set.
-     */
-    public void setBeanConfigResource(String beanConfigResource) {
-        this.beanConfigResource = beanConfigResource;
-    }
 }

Modified: cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
(original)
+++ cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
Thu Oct 29 17:28:40 2009
@@ -156,6 +156,11 @@
             } else if (beanFilesParameter instanceof List) {
                 // is there a better way to avoid the warning?
                 beanDefinitions.addAll((List<String>)beanFilesParameter);
+            } else {
+                String list[] = (String[]) beanFilesParameter;
+                for (String b : list) {
+                    beanDefinitions.add(b);
+                }
             }
         }
         applicationContext = getApplicationContext(getBus(), beanDefinitions);

Modified: cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java
(original)
+++ cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessor.java
Thu Oct 29 17:28:40 2009
@@ -192,6 +192,11 @@
             } else if (beanFilesParameter instanceof List) {
                 // is there a better way to avoid the warning?
                 beanDefinitions.addAll((List<String>)beanFilesParameter);
+            } else {
+                String list[] = (String[]) beanFilesParameter;
+                for (String b : list) {
+                    beanDefinitions.add(b);
+                }
             }
         }
         applicationContext = getApplicationContext(getBus(), beanDefinitions);

Modified: cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Thu Oct 29 17:28:40 2009
@@ -85,6 +85,7 @@
         Set<String> set = new HashSet<String>();
         set.add(ToolConstants.CFG_PACKAGENAME);
         set.add(ToolConstants.CFG_NEXCLUDE);
+        set.add(ToolConstants.CFG_XJC_ARGS);
         return set;
     }
 

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Thu Oct 29 17:28:40 2009
@@ -268,12 +268,18 @@
         }
         
         if (context.get(ToolConstants.CFG_XJC_ARGS) != null) {
-            String xjcArgs = (String)context.get(ToolConstants.CFG_XJC_ARGS);
-            StringTokenizer tokenizer = new StringTokenizer(xjcArgs, ",", false);
-            while (tokenizer.hasMoreTokens()) {
-                String arg = tokenizer.nextToken();
-                args.add(arg);
-                LOG.log(Level.FINE, "xjc arg:" + arg);
+            Object o = context.get(ToolConstants.CFG_XJC_ARGS);
+            if (o instanceof String) {
+                o = new String[] {(String)o};
+            }
+            String[] xjcArgss = (String[])o;
+            for (String xjcArgs : xjcArgss) {
+                StringTokenizer tokenizer = new StringTokenizer(xjcArgs, ",", false);
+                while (tokenizer.hasMoreTokens()) {
+                    String arg = tokenizer.nextToken();
+                    args.add(arg);
+                    LOG.log(Level.FINE, "xjc arg:" + arg);
+                }
             }
         }
 

Modified: cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
Thu Oct 29 17:28:40 2009
@@ -69,6 +69,7 @@
     public Set<String> getArrayKeys() {
         Set<String> set = new HashSet<String>();
         set.add(ToolConstants.CFG_JSPACKAGEPREFIX);
+        set.add(ToolConstants.CFG_BEAN_CONFIG);
         return set;
     }
 

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
Thu Oct 29 17:28:40 2009
@@ -33,7 +33,7 @@
 
     <usage>
         <optionGroup id="options">
-            <option id="frontend" maxOccurs="unbounded">
+            <option id="frontend" maxOccurs="1">
                 <annotation>
                     Specifies the front end. (defaults to JAXWS)
                 </annotation>
@@ -44,7 +44,7 @@
                 </associatedArgument>
             </option>
 
-            <option id="databinding" maxOccurs="unbounded">
+            <option id="databinding" maxOccurs="1">
                 <annotation>
                     Specifies the data binding. (defaults to JAXB)
                 </annotation>
@@ -55,7 +55,7 @@
                 </associatedArgument>
             </option>
 
-            <option id="wsdlversion" maxOccurs="unbounded">
+            <option id="wsdlversion" maxOccurs="1">
                 <annotation>
                     Specifies the WSDL version. (default is WSDL1.1)
                 </annotation>
@@ -271,7 +271,7 @@
                 <switch>wsdlLocation</switch>
             </option>
 
-            <option id="xjc" maxOccurs="1">
+            <option id="xjc" maxOccurs="unbounded">
                 <annotation>
                     Specifies a comma separated list of arguments that are passed directly
to XJC when the
                     JAXB data binding  is used. This option causes XJC to load additional
plugins that 

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=831039&r1=831038&r2=831039&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Thu Oct 29 17:28:40 2009
@@ -1071,5 +1071,20 @@
         assertTrue(file.exists());
         String str = FileUtils.getStringFromFile(file);
         assertTrue(str.contains("http://child/xsd"));
-    }   
+    }
+    
+    @Test
+    public void testMultiXjcArgs() throws Exception {
+        String[] args = new String[] {"-d", output.getCanonicalPath(),
+                                      "-xjc-Xlocator",
+                                      "-xjc-Xsync-methods",
+                                      getLocation("/wsdl2java_wsdl/hello_world.wsdl")};
+        WSDLToJava.main(args);
+        File file = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/types/SayHi.java");
+        
+        assertTrue(file.exists());
+        String str = FileUtils.getStringFromFile(file);
+        assertTrue(str.contains("@XmlLocation"));
+        assertTrue(str.contains("synchronized"));
+    }
 }



Mime
View raw message