You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2016/03/18 01:06:26 UTC

svn commit: r1735526 - in /axis/axis2/java/core/trunk/modules: adb-codegen/test/org/apache/axis2/schema/ codegen/src/org/apache/axis2/wsdl/ codegen/src/org/apache/axis2/wsdl/codegen/ codegen/test/org/apache/axis2/wsdl/codegen/ codegen/test/org/apache/a...

Author: veithen
Date: Fri Mar 18 00:06:25 2016
New Revision: 1735526

URL: http://svn.apache.org/viewvc?rev=1735526&view=rev
Log:
Disentangle codegen configuration from command line parsing. The concept of command line option is only meaningful for CLIs, not for Ant tasks, Maven plugins and Eclpse plugins.

Modified:
    axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/ExtensionUtilityTest.java
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
    axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java
    axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java
    axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java
    axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/temp/CodeGenerationUtilityTest.java
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/AntCodegenTask.java
    axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java
    axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
    axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java
    axis/axis2/java/core/trunk/modules/xmlbeans/test/org/apache/axis2/xmlbeans/WSDL2JavaSuccessTestBase.java

Modified: axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/ExtensionUtilityTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/ExtensionUtilityTest.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/ExtensionUtilityTest.java (original)
+++ axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/ExtensionUtilityTest.java Fri Mar 18 00:06:25 2016
@@ -23,12 +23,10 @@ package org.apache.axis2.schema;
 
 import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
-import java.util.HashMap;
 
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -44,7 +42,7 @@ public class ExtensionUtilityTest extend
         loadSampleSchemaFile(schemas);
         AxisService service=new AxisService();
         service.addSchema(schemas);
-        CodeGenConfiguration configuration=new CodeGenConfiguration(new HashMap<String, CommandLineOption>());
+        CodeGenConfiguration configuration=new CodeGenConfiguration();
         configuration.addAxisService(service);
         ExtensionUtility.invoke(configuration);
         TypeMapper mapper=configuration.getTypeMapper();

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Fri Mar 18 00:06:25 2016
@@ -28,7 +28,9 @@ import java.util.Map;
 import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.util.CommandLineOptionConstants;
 import org.apache.axis2.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
+import org.apache.axis2.wsdl.codegen.CodegenConfigLoader;
 import org.apache.axis2.wsdl.codegen.jaxws.JAXWSCodeGenerationEngine;
 import org.apache.axis2.wsdl.i18n.CodegenMessages;
 import org.apache.axis2.wsdl.util.WSDL2JavaOptionsValidator;
@@ -47,7 +49,9 @@ public class WSDL2Code {
          return;
       }
         if (isOptionsValid(commandLineOptionParser)){
-            new CodeGenerationEngine(commandLineOptionParser).generate();
+            CodeGenConfiguration config = new CodeGenConfiguration();
+            CodegenConfigLoader.loadConfig(config, commandLineOptionParser.getAllOptions());
+            new CodeGenerationEngine(config).generate();
         } else {
             printUsage();
         }

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Fri Mar 18 00:06:25 2016
@@ -19,19 +19,32 @@
 
 package org.apache.axis2.wsdl.codegen;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.util.CommandLineOption;
+import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder;
+import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
 import org.apache.axis2.util.CommandLineOptionConstants;
 import org.apache.axis2.util.URLProcessor;
+import org.apache.axis2.wsdl.WSDLUtil;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
+import org.apache.axis2.wsdl.i18n.CodegenMessages;
 import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
 import org.apache.ws.commons.schema.XmlSchema;
 
 import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
 import java.io.File;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -377,8 +390,7 @@ public class CodeGenConfiguration implem
      *
      * @param optionMap
      */
-    public CodeGenConfiguration(Map<String,CommandLineOption> optionMap) {
-        CodegenConfigLoader.loadConfig(this, optionMap);
+    public CodeGenConfiguration() {
         this.axisServices = new ArrayList<AxisService>();
         this.outputFileNamesList = new ArrayList<String>();
     }
@@ -640,4 +652,126 @@ public class CodeGenConfiguration implem
     public void setUseOperationName(boolean useOperationName) {
         isUseOperationName = useOperationName;
     }
+
+    public void loadWsdl(String wsdlUri) throws CodeGenerationException {
+        try {
+            // the redirected urls gives problems in code generation some times with jaxbri
+            // eg. https://www.paypal.com/wsdl/PayPalSvc.wsdl
+            // if there is a redirect url better to find it and use.
+            if (wsdlUri.startsWith("http")) {
+                URL url = new URL(wsdlUri);
+                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+                connection.setInstanceFollowRedirects(false);
+                connection.getResponseCode();
+                String newLocation = connection.getHeaderField("Location");
+                if (newLocation != null){
+                    wsdlUri = newLocation;
+                }
+            }
+
+            if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
+                    equals(getWSDLVersion())) {
+
+                WSDL20ToAxisServiceBuilder builder;
+
+                // jibx currently does not support multiservice
+                if ((getServiceName() != null) || (getDatabindingType().equals("jibx"))) {
+                    builder = new WSDL20ToAxisServiceBuilder(
+                            wsdlUri,
+                            getServiceName(),
+                            getPortName(),
+                            isAllPorts());
+                    builder.setCodegen(true);
+                    addAxisService(builder.populateService());
+                } else {
+                    builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, getPortName());
+                    builder.setCodegen(true);
+                    builder.setAllPorts(isAllPorts());
+                    setAxisServices(
+                            ((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices());
+                }
+
+            } else {
+                //It'll be WSDL 1.1
+                Definition wsdl4jDef = readInTheWSDLFile(wsdlUri);
+
+                // we save the original wsdl definition to write it to the resource folder later
+                // this is required only if it has imports
+                Map imports = wsdl4jDef.getImports();
+                if ((imports != null) && (imports.size() > 0)) {
+                    setWsdlDefinition(readInTheWSDLFile(wsdlUri));
+                } else {
+                    setWsdlDefinition(wsdl4jDef);
+                }
+
+                // we generate the code for one service and one port if the
+                // user has specified them.
+                // otherwise generate the code for every service.
+                // TODO: find out a permanant solution for this.
+                QName serviceQname = null;
+
+                if (getServiceName() != null) {
+                    serviceQname = new QName(wsdl4jDef.getTargetNamespace(),
+                                             getServiceName());
+                }
+
+                WSDL11ToAxisServiceBuilder builder;
+                // jibx currently does not support multiservice
+                if ((serviceQname != null) || (getDatabindingType().equals("jibx"))) {
+                    builder = new WSDL11ToAxisServiceBuilder(
+                            wsdl4jDef,
+                            serviceQname,
+                            getPortName(),
+                            isAllPorts());
+                    builder.setCodegen(true);
+                    addAxisService(builder.populateService());
+                } else {
+                    builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef, getPortName());
+                    builder.setCodegen(true);
+                    builder.setAllPorts(isAllPorts());
+                    setAxisServices(
+                            ((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices());
+                }
+            }
+            setBaseURI(getBaseURI(wsdlUri));
+        } catch (AxisFault axisFault) {
+            throw new CodeGenerationException(
+                    CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault);
+        } catch (WSDLException e) {
+            throw new CodeGenerationException(
+                    CodegenMessages.getMessage("engine.wsdlParsingException"), e);
+        } catch (Exception e) {
+            throw new CodeGenerationException(                            
+                    CodegenMessages.getMessage("engine.wsdlParsingException"), e);
+        }
+    }
+
+    /**
+     * calculates the base URI Needs improvement but works fine for now ;)
+     *
+     * @param currentURI
+     */
+    private String getBaseURI(String currentURI) throws URISyntaxException, IOException {
+        File file = new File(currentURI);
+        if (file.exists()) {
+            return file.getCanonicalFile().getParentFile().toURI().toString();
+        }
+        String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/"));
+        return uriFragment + (uriFragment.endsWith("/") ? "" : "/");
+    }
+
+    /**
+     * Read the WSDL file
+     *
+     * @param uri
+     * @throws WSDLException
+     */
+    private Definition readInTheWSDLFile(final String uri) throws WSDLException {
+
+        WSDLReader reader = WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+        reader.setFeature("javax.wsdl.importDocuments", true);
+
+        return reader.readWSDL(uri);
+        
+    }
 }

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Fri Mar 18 00:06:25 2016
@@ -19,16 +19,6 @@
 
 package org.apache.axis2.wsdl.codegen;
 
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder;
-import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
-import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder;
-import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
-import org.apache.axis2.util.CommandLineOption;
-import org.apache.axis2.util.CommandLineOptionConstants;
-import org.apache.axis2.util.CommandLineOptionParser;
-import org.apache.axis2.wsdl.WSDLUtil;
 import org.apache.axis2.wsdl.codegen.emitter.Emitter;
 import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
@@ -37,20 +27,9 @@ import org.apache.axis2.wsdl.util.Config
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.Output;
-import javax.wsdl.Input;
-import javax.wsdl.extensions.AttributeExtensible;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
 import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -77,116 +56,6 @@ public class CodeGenerationEngine {
     }
 
     /**
-     * @param parser
-     * @throws CodeGenerationException
-     */
-    public CodeGenerationEngine(CommandLineOptionParser parser) throws CodeGenerationException {
-        Map allOptions = parser.getAllOptions();
-        String wsdlUri;
-        try {
-
-            CommandLineOption option =
-                    (CommandLineOption)allOptions.
-                            get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION);
-            wsdlUri = option.getOptionValue();
-
-            // the redirected urls gives problems in code generation some times with jaxbri
-            // eg. https://www.paypal.com/wsdl/PayPalSvc.wsdl
-            // if there is a redirect url better to find it and use.
-            if (wsdlUri.startsWith("http")) {
-                URL url = new URL(wsdlUri);
-                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-                connection.setInstanceFollowRedirects(false);
-                connection.getResponseCode();
-                String newLocation = connection.getHeaderField("Location");
-                if (newLocation != null){
-                    wsdlUri = newLocation;
-                }
-            }
-
-            configuration = new CodeGenConfiguration(allOptions);
-
-
-            if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
-                    equals(configuration.getWSDLVersion())) {
-
-                WSDL20ToAxisServiceBuilder builder;
-
-                // jibx currently does not support multiservice
-                if ((configuration.getServiceName() != null) || (configuration.getDatabindingType().equals("jibx"))) {
-                    builder = new WSDL20ToAxisServiceBuilder(
-                            wsdlUri,
-                            configuration.getServiceName(),
-                            configuration.getPortName(),
-                            configuration.isAllPorts());
-                    builder.setCodegen(true);
-                    configuration.addAxisService(builder.populateService());
-                } else {
-                    builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, configuration.getPortName());
-                    builder.setCodegen(true);
-                    builder.setAllPorts(configuration.isAllPorts());
-                    configuration.setAxisServices(
-                            ((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices());
-                }
-
-            } else {
-                //It'll be WSDL 1.1
-                Definition wsdl4jDef = readInTheWSDLFile(wsdlUri);
-
-                // we save the original wsdl definition to write it to the resource folder later
-                // this is required only if it has imports
-                Map imports = wsdl4jDef.getImports();
-                if ((imports != null) && (imports.size() > 0)) {
-                    configuration.setWsdlDefinition(readInTheWSDLFile(wsdlUri));
-                } else {
-                    configuration.setWsdlDefinition(wsdl4jDef);
-                }
-
-                // we generate the code for one service and one port if the
-                // user has specified them.
-                // otherwise generate the code for every service.
-                // TODO: find out a permanant solution for this.
-                QName serviceQname = null;
-
-                if (configuration.getServiceName() != null) {
-                    serviceQname = new QName(wsdl4jDef.getTargetNamespace(),
-                                             configuration.getServiceName());
-                }
-
-                WSDL11ToAxisServiceBuilder builder;
-                // jibx currently does not support multiservice
-                if ((serviceQname != null) || (configuration.getDatabindingType().equals("jibx"))) {
-                    builder = new WSDL11ToAxisServiceBuilder(
-                            wsdl4jDef,
-                            serviceQname,
-                            configuration.getPortName(),
-                            configuration.isAllPorts());
-                    builder.setCodegen(true);
-                    configuration.addAxisService(builder.populateService());
-                } else {
-                    builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef, configuration.getPortName());
-                    builder.setCodegen(true);
-                    builder.setAllPorts(configuration.isAllPorts());
-                    configuration.setAxisServices(
-                            ((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices());
-                }
-            }
-            configuration.setBaseURI(getBaseURI(wsdlUri));
-        } catch (AxisFault axisFault) {
-            throw new CodeGenerationException(
-                    CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault);
-        } catch (WSDLException e) {
-            throw new CodeGenerationException(
-                    CodegenMessages.getMessage("engine.wsdlParsingException"), e);
-        } catch (Exception e) {
-            throw new CodeGenerationException(                            
-                    CodegenMessages.getMessage("engine.wsdlParsingException"), e);
-        }
-
-        loadExtensions();
-    }
-
-    /**
      * Loads the relevant preExtensions
      *
      * @throws CodeGenerationException
@@ -297,23 +166,6 @@ public class CodeGenerationEngine {
 
     }
 
-
-    /**
-     * Read the WSDL file
-     *
-     * @param uri
-     * @throws WSDLException
-     */
-    public Definition readInTheWSDLFile(final String uri) throws WSDLException {
-
-    	WSDLReader reader = WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
-        reader.setFeature("javax.wsdl.importDocuments", true);
-
-        return reader.readWSDL(uri);
-        
-    }
-
-
     /**
      * gets a object from the class
      *
@@ -353,20 +205,6 @@ public class CodeGenerationEngine {
     }
 
     /**
-     * calculates the base URI Needs improvement but works fine for now ;)
-     *
-     * @param currentURI
-     */
-    private String getBaseURI(String currentURI) throws URISyntaxException, IOException {
-        File file = new File(currentURI);
-        if (file.exists()) {
-            return file.getCanonicalFile().getParentFile().toURI().toString();
-        }
-        String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/"));
-        return uriFragment + (uriFragment.endsWith("/") ? "" : "/");
-    }
-
-    /**
      * calculates the URI
      * needs improvement
      *

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Fri Mar 18 00:06:25 2016
@@ -31,9 +31,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
-class CodegenConfigLoader implements CommandLineOptionConstants {
-
-    public static void loadConfig(CodeGenConfiguration config, Map<String,CommandLineOption> optionMap) {
+public class CodegenConfigLoader implements CommandLineOptionConstants {
+    public static void loadConfig(CodeGenConfiguration config, Map<String,CommandLineOption> optionMap) throws CodeGenerationException {
         String outputLocation = "."; //default output directory is the current working directory
         CommandLineOption commandLineOption = loadOption(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
                                                          WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG,
@@ -326,7 +325,7 @@ class CodegenConfigLoader implements Com
             }
         }
 
-
+        config.loadWsdl(optionMap.get(WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION).getOptionValue());
     }
 
     private static CommandLineOption loadOption(String shortOption, String longOption,

Modified: axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java Fri Mar 18 00:06:25 2016
@@ -21,13 +21,10 @@
 package org.apache.axis2.wsdl.codegen;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.wsdl.codegen.XMLSchemaTest;
-import org.apache.axis2.util.CommandLineOption;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.junit.Test;
 
@@ -55,8 +52,7 @@ public class CodeGenConfigurationTest ex
     
     @Test
     public void testGetSchemaListForAllServices(){
-        Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>();
-        CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap);
+        CodeGenConfiguration configuration = new CodeGenConfiguration();
         configuration.addAxisService(service);
         List<XmlSchema> list=configuration.getSchemaListForAllServices();
         assertEquals(schemas.get(0), list.get(0));

Modified: axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java Fri Mar 18 00:06:25 2016
@@ -21,8 +21,6 @@
 package org.apache.axis2.wsdl.codegen.extension;
 
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -35,7 +33,6 @@ import org.apache.axis2.context.ServiceC
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.XMLSchemaTest;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -144,8 +141,7 @@ public class JAXWSWapperExtensionTest ex
         axisOperation.addMessage(axisMessage, "test_message");
         service.addOperation(axisOperation);
         JAXWSWapperExtension extension = new JAXWSWapperExtension();
-        Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>();
-        CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap);
+        CodeGenConfiguration configuration = new CodeGenConfiguration();
         configuration.setOutputLanguage("jax-ws");
         configuration.setParametersWrapped(false);
         configuration.addAxisService(service);
@@ -156,8 +152,7 @@ public class JAXWSWapperExtensionTest ex
     @Test
     public void  testWalkSchema() throws Exception{
         JAXWSWapperExtension extension = new JAXWSWapperExtension();
-        Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>();
-        CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap);
+        CodeGenConfiguration configuration = new CodeGenConfiguration();
         configuration.setOutputLanguage("jax-ws");
         configuration.setParametersWrapped(false);
         configuration.addAxisService(service);        

Modified: axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java Fri Mar 18 00:06:25 2016
@@ -21,7 +21,6 @@
 package org.apache.axis2.wsdl.codegen.extension;
 
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
 import org.apache.axis2.wsdl.codegen.XMLSchemaTest;
@@ -29,8 +28,6 @@ import org.apache.ws.commons.schema.XmlS
 import org.junit.Test;
 
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
 
 public class WSDLValidatorExtensionTest extends XMLSchemaTest {
 
@@ -43,10 +40,9 @@ public class WSDLValidatorExtensionTest
             try {
                 AxisService service = new AxisService();
                 ArrayList<XmlSchema> list = new ArrayList<XmlSchema>();
-                Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>();
                 list.add(schema);
                 service.addSchema(list);
-                CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap);
+                CodeGenConfiguration configuration = new CodeGenConfiguration();
                 configuration.addAxisService(service);
                 WSDLValidatorExtension extension = new WSDLValidatorExtension();
 

Modified: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/temp/CodeGenerationUtilityTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/temp/CodeGenerationUtilityTest.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/temp/CodeGenerationUtilityTest.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/temp/CodeGenerationUtilityTest.java Fri Mar 18 00:06:25 2016
@@ -21,13 +21,11 @@ package org.temp;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.jaxbri.CodeGenerationUtility;
-import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -38,9 +36,8 @@ public class CodeGenerationUtilityTest e
     @Test
     public void testProcessSchemas() throws Exception {
         ArrayList<XmlSchema> list = new ArrayList<XmlSchema>();
-        Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>();
         loadSampleSchemaFile(list);
-        CodeGenConfiguration codeGenConfiguration = new CodeGenConfiguration(optionMap);
+        CodeGenConfiguration codeGenConfiguration = new CodeGenConfiguration();
         codeGenConfiguration.setBaseURI("localhost/test");
         codeGenConfiguration.setOutputLocation(new File("target"));
         TypeMapper mapper = CodeGenerationUtility.processSchemas(list, null, codeGenConfiguration);

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/AntCodegenTask.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/AntCodegenTask.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/AntCodegenTask.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/AntCodegenTask.java Fri Mar 18 00:06:25 2016
@@ -23,7 +23,9 @@ import org.apache.axis2.util.CommandLine
 import org.apache.axis2.util.CommandLineOptionConstants;
 import org.apache.axis2.util.CommandLineOptionParser;
 import org.apache.axis2.util.URLProcessor;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
+import org.apache.axis2.wsdl.codegen.CodegenConfigLoader;
 import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
 import org.apache.tools.ant.AntClassLoader;
 import org.apache.tools.ant.BuildException;
@@ -413,7 +415,9 @@ public class AntCodegenTask extends Task
             Map commandLineOptions = this.fillOptionMap();
             CommandLineOptionParser parser =
                     new CommandLineOptionParser(commandLineOptions);
-            new CodeGenerationEngine(parser).generate();
+            CodeGenConfiguration config = new CodeGenConfiguration();
+            CodegenConfigLoader.loadConfig(config, parser.getAllOptions());
+            new CodeGenerationEngine(config).generate();
         } catch (Throwable e) {
             throw new BuildException(e);
         }

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java Fri Mar 18 00:06:25 2016
@@ -39,6 +39,7 @@ import org.apache.axis2.tool.core.JarFil
 import org.apache.axis2.tool.core.SrcCompiler;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
+import org.apache.axis2.wsdl.codegen.CodegenConfigLoader;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.impl.Log4JLogger;
@@ -267,7 +268,8 @@ public class CodeGenWizard extends Wizar
 
                  //Fix for the CodeGenConfiguration Contructor Change
                  //CodeGenConfiguration codegenConfig = new CodeGenConfiguration(service, optionsMap);
-                 CodeGenConfiguration codegenConfig = new CodeGenConfiguration(optionsMap);
+                 CodeGenConfiguration codegenConfig = new CodeGenConfiguration();
+                 CodegenConfigLoader.loadConfig(codegenConfig, optionsMap);
                  codegenConfig.addAxisService(service);
                  
                  //set the wsdl definision for codegen config for skeleton generarion.

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java Fri Mar 18 00:06:25 2016
@@ -32,6 +32,7 @@ import org.apache.axis2.util.URLProcesso
 import org.apache.axis2.wsdl.WSDLUtil;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
+import org.apache.axis2.wsdl.codegen.CodegenConfigLoader;
 
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
@@ -383,7 +384,8 @@ public class CodegenBean {
             if (!"xmlbeans".equals(getDatabindingName())) {
                 Thread.currentThread().setContextClassLoader(Class.class.getClassLoader());
             }
-            CodeGenConfiguration codegenConfig = new CodeGenConfiguration(fillOptionMap());
+            CodeGenConfiguration codegenConfig = new CodeGenConfiguration();
+            CodegenConfigLoader.loadConfig(codegenConfig, fillOptionMap());
             codegenConfig.addAxisService(getAxisService(WSDLFileName));
             codegenConfig.setWsdlDefinition(wsdlDefinition);
             //set the baseURI
@@ -391,7 +393,8 @@ public class CodegenBean {
             new CodeGenerationEngine(codegenConfig).generate();
         } catch (Throwable e) {
             try {
-                CodeGenConfiguration codegenConfig = new CodeGenConfiguration(fillOptionMap());
+                CodeGenConfiguration codegenConfig = new CodeGenConfiguration();
+                CodegenConfigLoader.loadConfig(codegenConfig, fillOptionMap());
                 codegenConfig.addAxisService(getAxisService(WSDLFileName));
                 codegenConfig.setWsdlDefinition(wsdlDefinition);
                 //set the baseURI

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-wsdl2code-maven-plugin/src/main/java/org/apache/axis2/maven2/wsdl2code/AbstractWSDL2CodeMojo.java Fri Mar 18 00:06:25 2016
@@ -22,8 +22,10 @@ package org.apache.axis2.maven2.wsdl2cod
 import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.util.CommandLineOptionConstants;
 import org.apache.axis2.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.wsdl.codegen.CodegenConfigLoader;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -630,7 +632,9 @@ public abstract class AbstractWSDL2CodeM
         CommandLineOptionParser parser =
                 new CommandLineOptionParser(commandLineOptions);
         try {
-            new CodeGenerationEngine(parser).generate();
+            CodeGenConfiguration config = new CodeGenConfiguration();
+            CodegenConfigLoader.loadConfig(config, parser.getAllOptions());
+            new CodeGenerationEngine(config).generate();
         } catch (CodeGenerationException e) {
             Throwable t = e;
             while (t.getCause() != null) {

Modified: axis/axis2/java/core/trunk/modules/xmlbeans/test/org/apache/axis2/xmlbeans/WSDL2JavaSuccessTestBase.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/xmlbeans/test/org/apache/axis2/xmlbeans/WSDL2JavaSuccessTestBase.java?rev=1735526&r1=1735525&r2=1735526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/xmlbeans/test/org/apache/axis2/xmlbeans/WSDL2JavaSuccessTestBase.java (original)
+++ axis/axis2/java/core/trunk/modules/xmlbeans/test/org/apache/axis2/xmlbeans/WSDL2JavaSuccessTestBase.java Fri Mar 18 00:06:25 2016
@@ -23,8 +23,10 @@ import junit.framework.TestCase;
 import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.util.CommandLineOptionConstants;
 import org.apache.axis2.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.wsdl.codegen.CodegenConfigLoader;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Target;
 import org.apache.tools.ant.taskdefs.Javac;
@@ -169,7 +171,9 @@ public abstract class WSDL2JavaSuccessTe
         Map optionMap = fillOptionMap(wsdlFile, outputLocation);
         CommandLineOptionParser parser =
                 new CommandLineOptionParser(optionMap);
-        new CodeGenerationEngine(parser).generate();
+        CodeGenConfiguration config = new CodeGenConfiguration();
+        CodegenConfigLoader.loadConfig(config, parser.getAllOptions());
+        new CodeGenerationEngine(config).generate();
     }
 
     /** @param outputLocation  */