You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/09/15 21:07:03 UTC

svn commit: r289289 [107/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/a...

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Thu Sep 15 11:52:11 2005
@@ -1,258 +1,258 @@
-/*
-* Copyright 2001-2004 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package org.apache.axis2.wsdl.codegen;
-
-import org.apache.axis2.wsdl.databinding.TypeMapper;
-import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
-import org.apache.wsdl.WSDLDescription;
-
-import java.io.File;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author chathura@opensource.lk
- */
-public class CodeGenConfiguration implements CommandLineOptionConstants {
-
-    private WSDLDescription wom;
-    private CommandLineOptionParser parser;
-    private File outputLocation;
-    private String outputLanguage = ConfigPropertyFileLoader.getDefaultLanguage();
-    private int databindingType = XSLTConstants.DataBindingTypes.XML_BEANS; //default is XML beans
-    private boolean advancedCodeGenEnabled = false;
-
-
-    private boolean asyncOn = true;
-    private boolean syncOn = true;
-    private boolean serverSide = false;
-    private boolean generateDeployementDescriptor = true;
-    private boolean writeTestCase = false;
-    private boolean writeMessageReceiver = true;
-    private String packageName = XSLTConstants.DEFAULT_PACKAGE_NAME;
-
-    /* Code generation style means whether to use the binding or the interface for code generation.
-    * the default is automatic where the code generator looks for the binding and if the binding is
-    * absent, switches to the interface. The user however, can switch to the interface or the binding
-    * modes explicitly by specifying this parameter
-    */
-    private  int codeGenerationStyle = XSLTConstants.CodegenStyle.AUTOMATIC;
-
-    /*
-    * A hashmap of properties that may be populated on the way. extensions can populate it
-    *
-    */
-    private Map configurationProperties = new HashMap();
-
-    public void put(Object key, Object value){
-        configurationProperties.put(key,value);
-    }
-
-    public Object get(Object key){
-       return configurationProperties.get(key);
-    }
-
-    public Map getProperties(){
-        return configurationProperties;
-    }
-    private TypeMapper typeMapper;
-
-
-    public int getCodeGenerationStyle() {
-        return codeGenerationStyle;
-    }
-
-    public void setCodeGenerationStyle(int codeGenerationStyle) {
-        this.codeGenerationStyle = codeGenerationStyle;
-    }
-
-    public TypeMapper getTypeMapper() {
-        return typeMapper;
-    }
-
-    public void setTypeMapper(TypeMapper typeMapper) {
-        this.typeMapper = typeMapper;
-    }
-
-    public int getDatabindingType() {
-        return databindingType;
-    }
-
-    public void setDatabindingType(int databindingType) {
-        this.databindingType = databindingType;
-    }
-
-    public void setDatabindingType(String databindingType) {
-        if (Databinding.XML_BEANS.equalsIgnoreCase(databindingType)) {
-            this.databindingType = XSLTConstants.DataBindingTypes.XML_BEANS;
-        }else if(Databinding.JAXB.equalsIgnoreCase(databindingType)){
-            this.databindingType = XSLTConstants.DataBindingTypes.JAXB;
-        }else{
-            throw new UnsupportedOperationException();
-        }
-    }
-
-    /**
-     * @param wom
-     * @param parser
-     */
-    public CodeGenConfiguration(WSDLDescription wom,
-                                CommandLineOptionParser parser) {
-        this(wom, parser.getAllOptions());
-        this.parser = parser;
-    }
-
-    public CodeGenConfiguration(WSDLDescription wom, Map optionMap) {
-        this.wom = wom;
-
-        CommandLineOption clo =
-                ((CommandLineOption)optionMap.get(OUTPUT_LOCATION_OPTION));
-        if (clo == null) {
-            throw new RuntimeException("Cannot codegenerate! WSDL file is missing!");
-        }
-        String outputLocation = clo.getOptionValue();
-        this.outputLocation = new File(outputLocation);
-
-        serverSide = (optionMap.get(SERVER_SIDE_CODE_OPTION) != null);
-        generateDeployementDescriptor = (optionMap.get(
-                GENERATE_SERVICE_DESCRIPTION_OPTION) !=
-                null);
-        writeTestCase = (optionMap.get(GENERATE_TEST_CASE_OPTION) != null);
-
-        boolean asyncFlagPresent = (optionMap.get(CODEGEN_ASYNC_ONLY_OPTION) !=
-                null);
-        boolean syncFlagPresent = (optionMap.get(CODEGEN_SYNC_ONLY_OPTION) !=
-                null);
-        if (asyncFlagPresent) {
-            this.asyncOn = true;
-            this.syncOn = false;
-        }
-        if (syncFlagPresent) {
-            this.asyncOn = false;
-            this.syncOn = true;
-        }
-
-        CommandLineOption packageOption = (CommandLineOption) optionMap.get(
-                PACKAGE_OPTION);
-        if (packageOption != null) {
-            this.packageName = packageOption.getOptionValue();
-        }
-
-        CommandLineOption langOption = (CommandLineOption) optionMap.get(
-                STUB_LANGUAGE_OPTION);
-        //The language here
-        if (langOption != null) {
-            outputLanguage = langOption.getOptionValue();
-        }
-
-// Unused code commented out by gdaniels...
-        CommandLineOption dataBindingOption = (CommandLineOption) optionMap.get(
-                DATA_BINDING_TYPE_OPTION);
-        if(dataBindingOption != null){
-            setDatabindingType(dataBindingOption.getOptionValue());
-        }
-    }
-
-
-//    private void loadLanguge(String langName) {
-//        if (LanguageNames.JAVA.equalsIgnoreCase(langName)) {
-//            this.outputLanguage = XSLTConstants.LanguageTypes.JAVA;
-//        } else if (LanguageNames.C_SHARP.equalsIgnoreCase(langName)) {
-//            this.outputLanguage = XSLTConstants.LanguageTypes.C_SHARP;
-//        } else if (LanguageNames.C_PLUS_PLUS.equalsIgnoreCase(langName)) {
-//            this.outputLanguage = XSLTConstants.LanguageTypes.C_PLUS_PLUS;
-//        } else if (LanguageNames.VB_DOT_NET.equalsIgnoreCase(langName)) {
-//            this.outputLanguage = XSLTConstants.LanguageTypes.VB_DOT_NET;
-//        }
-//    }
-
-    /**
-     * @return Returns the parser.
-     */
-    public CommandLineOptionParser getParser() {
-        return parser;
-    }
-
-    /**
-     * @return Returns the wom.
-     */
-    public WSDLDescription getWom() {
-        return wom;
-    }
-
-
-    /**
-     * @return Returns the outputLocation.
-     */
-    public File getOutputLocation() {
-        return outputLocation;
-    }
-
-    public String getOutputLanguage() {
-        return outputLanguage;
-    }
-
-    public boolean isAdvancedCodeGenEnabled() {
-        return advancedCodeGenEnabled;
-    }
-
-
-    /**
-     * @return Returns the packageName.
-     */
-    public String getPackageName() {
-        return packageName;
-    }
-
-    /**
-     * @param packageName The packageName to set.
-     */
-    public void setPackageName(String packageName) {
-        this.packageName = packageName;
-    }
-
-
-    public boolean isAsyncOn() {
-        return asyncOn;
-    }
-
-
-    public boolean isSyncOn() {
-        return syncOn;
-    }
-
-    public boolean isServerSide() {
-        return serverSide;
-    }
-
-    public boolean isGenerateDeployementDescriptor() {
-        return generateDeployementDescriptor;
-    }
-
-    public boolean isWriteTestCase() {
-        return writeTestCase;
-    }
-
-
-    public boolean isWriteMessageReceiver() {
-        return writeMessageReceiver;
-    }
-
-    public void setWriteMessageReceiver(boolean writeMessageReceiver) {
-        this.writeMessageReceiver = writeMessageReceiver;
-    }
+/*
+* Copyright 2001-2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.wsdl.codegen;
+
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
+import org.apache.wsdl.WSDLDescription;
+
+import java.io.File;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public class CodeGenConfiguration implements CommandLineOptionConstants {
+
+    private WSDLDescription wom;
+    private CommandLineOptionParser parser;
+    private File outputLocation;
+    private String outputLanguage = ConfigPropertyFileLoader.getDefaultLanguage();
+    private int databindingType = XSLTConstants.DataBindingTypes.XML_BEANS; //default is XML beans
+    private boolean advancedCodeGenEnabled = false;
+
+
+    private boolean asyncOn = true;
+    private boolean syncOn = true;
+    private boolean serverSide = false;
+    private boolean generateDeployementDescriptor = true;
+    private boolean writeTestCase = false;
+    private boolean writeMessageReceiver = true;
+    private String packageName = XSLTConstants.DEFAULT_PACKAGE_NAME;
+
+    /* Code generation style means whether to use the binding or the interface for code generation.
+    * the default is automatic where the code generator looks for the binding and if the binding is
+    * absent, switches to the interface. The user however, can switch to the interface or the binding
+    * modes explicitly by specifying this parameter
+    */
+    private  int codeGenerationStyle = XSLTConstants.CodegenStyle.AUTOMATIC;
+
+    /*
+    * A hashmap of properties that may be populated on the way. extensions can populate it
+    *
+    */
+    private Map configurationProperties = new HashMap();
+
+    public void put(Object key, Object value){
+        configurationProperties.put(key,value);
+    }
+
+    public Object get(Object key){
+       return configurationProperties.get(key);
+    }
+
+    public Map getProperties(){
+        return configurationProperties;
+    }
+    private TypeMapper typeMapper;
+
+
+    public int getCodeGenerationStyle() {
+        return codeGenerationStyle;
+    }
+
+    public void setCodeGenerationStyle(int codeGenerationStyle) {
+        this.codeGenerationStyle = codeGenerationStyle;
+    }
+
+    public TypeMapper getTypeMapper() {
+        return typeMapper;
+    }
+
+    public void setTypeMapper(TypeMapper typeMapper) {
+        this.typeMapper = typeMapper;
+    }
+
+    public int getDatabindingType() {
+        return databindingType;
+    }
+
+    public void setDatabindingType(int databindingType) {
+        this.databindingType = databindingType;
+    }
+
+    public void setDatabindingType(String databindingType) {
+        if (Databinding.XML_BEANS.equalsIgnoreCase(databindingType)) {
+            this.databindingType = XSLTConstants.DataBindingTypes.XML_BEANS;
+        }else if(Databinding.JAXB.equalsIgnoreCase(databindingType)){
+            this.databindingType = XSLTConstants.DataBindingTypes.JAXB;
+        }else{
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    /**
+     * @param wom
+     * @param parser
+     */
+    public CodeGenConfiguration(WSDLDescription wom,
+                                CommandLineOptionParser parser) {
+        this(wom, parser.getAllOptions());
+        this.parser = parser;
+    }
+
+    public CodeGenConfiguration(WSDLDescription wom, Map optionMap) {
+        this.wom = wom;
+
+        CommandLineOption clo =
+                ((CommandLineOption)optionMap.get(OUTPUT_LOCATION_OPTION));
+        if (clo == null) {
+            throw new RuntimeException("Cannot codegenerate! WSDL file is missing!");
+        }
+        String outputLocation = clo.getOptionValue();
+        this.outputLocation = new File(outputLocation);
+
+        serverSide = (optionMap.get(SERVER_SIDE_CODE_OPTION) != null);
+        generateDeployementDescriptor = (optionMap.get(
+                GENERATE_SERVICE_DESCRIPTION_OPTION) !=
+                null);
+        writeTestCase = (optionMap.get(GENERATE_TEST_CASE_OPTION) != null);
+
+        boolean asyncFlagPresent = (optionMap.get(CODEGEN_ASYNC_ONLY_OPTION) !=
+                null);
+        boolean syncFlagPresent = (optionMap.get(CODEGEN_SYNC_ONLY_OPTION) !=
+                null);
+        if (asyncFlagPresent) {
+            this.asyncOn = true;
+            this.syncOn = false;
+        }
+        if (syncFlagPresent) {
+            this.asyncOn = false;
+            this.syncOn = true;
+        }
+
+        CommandLineOption packageOption = (CommandLineOption) optionMap.get(
+                PACKAGE_OPTION);
+        if (packageOption != null) {
+            this.packageName = packageOption.getOptionValue();
+        }
+
+        CommandLineOption langOption = (CommandLineOption) optionMap.get(
+                STUB_LANGUAGE_OPTION);
+        //The language here
+        if (langOption != null) {
+            outputLanguage = langOption.getOptionValue();
+        }
+
+// Unused code commented out by gdaniels...
+        CommandLineOption dataBindingOption = (CommandLineOption) optionMap.get(
+                DATA_BINDING_TYPE_OPTION);
+        if(dataBindingOption != null){
+            setDatabindingType(dataBindingOption.getOptionValue());
+        }
+    }
+
+
+//    private void loadLanguge(String langName) {
+//        if (LanguageNames.JAVA.equalsIgnoreCase(langName)) {
+//            this.outputLanguage = XSLTConstants.LanguageTypes.JAVA;
+//        } else if (LanguageNames.C_SHARP.equalsIgnoreCase(langName)) {
+//            this.outputLanguage = XSLTConstants.LanguageTypes.C_SHARP;
+//        } else if (LanguageNames.C_PLUS_PLUS.equalsIgnoreCase(langName)) {
+//            this.outputLanguage = XSLTConstants.LanguageTypes.C_PLUS_PLUS;
+//        } else if (LanguageNames.VB_DOT_NET.equalsIgnoreCase(langName)) {
+//            this.outputLanguage = XSLTConstants.LanguageTypes.VB_DOT_NET;
+//        }
+//    }
+
+    /**
+     * @return Returns the parser.
+     */
+    public CommandLineOptionParser getParser() {
+        return parser;
+    }
+
+    /**
+     * @return Returns the wom.
+     */
+    public WSDLDescription getWom() {
+        return wom;
+    }
+
+
+    /**
+     * @return Returns the outputLocation.
+     */
+    public File getOutputLocation() {
+        return outputLocation;
+    }
+
+    public String getOutputLanguage() {
+        return outputLanguage;
+    }
+
+    public boolean isAdvancedCodeGenEnabled() {
+        return advancedCodeGenEnabled;
+    }
+
+
+    /**
+     * @return Returns the packageName.
+     */
+    public String getPackageName() {
+        return packageName;
+    }
+
+    /**
+     * @param packageName The packageName to set.
+     */
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+
+    public boolean isAsyncOn() {
+        return asyncOn;
+    }
+
+
+    public boolean isSyncOn() {
+        return syncOn;
+    }
+
+    public boolean isServerSide() {
+        return serverSide;
+    }
+
+    public boolean isGenerateDeployementDescriptor() {
+        return generateDeployementDescriptor;
+    }
+
+    public boolean isWriteTestCase() {
+        return writeTestCase;
+    }
+
+
+    public boolean isWriteMessageReceiver() {
+        return writeMessageReceiver;
+    }
+
+    public void setWriteMessageReceiver(boolean writeMessageReceiver) {
+        this.writeMessageReceiver = writeMessageReceiver;
+    }
 }

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Thu Sep 15 11:52:11 2005
@@ -1,145 +1,145 @@
-/*
-* Copyright 2001-2004 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package org.apache.axis2.wsdl.codegen;
-
-import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
-import org.apache.axis2.wsdl.codegen.emitter.CSharpEmitter;
-import org.apache.axis2.wsdl.codegen.emitter.Emitter;
-import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter;
-import org.apache.axis2.wsdl.codegen.extension.*;
-import org.apache.axis2.wsdl.databinding.TypeMapper;
-import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
-import org.apache.wsdl.WSDLDescription;
-
-import javax.wsdl.WSDLException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author chathura@opensource.lk
- */
-public class CodeGenerationEngine {
-    private List moduleEndpoints = new ArrayList();
-
-
-    private CodeGenConfiguration configuration;
-
-    public CodeGenerationEngine(CodeGenConfiguration config) throws CodeGenerationException{
-        this.configuration = config;
-        loadExtensions();
-    }
-
-    public CodeGenerationEngine(CommandLineOptionParser parser) throws CodeGenerationException {
-        WSDLDescription wom;
-        try {
-            wom = this.getWOM(parser);
-        } catch (WSDLException e) {
-            throw new CodeGenerationException("Error parsing WSDL", e);
-        } catch (IOException e1) {
-            throw new CodeGenerationException("Invalid WSDL Location ", e1);
-        }
-
-        this.configuration = new CodeGenConfiguration(wom, parser);
-        loadExtensions();
-    }
-
-    private void loadExtensions() throws CodeGenerationException{
-
-        String[] extensions = ConfigPropertyFileLoader.getExtensionClassNames();
-        for (int i = 0; i < extensions.length; i++) {
-            //load the Extension class
-            addExtension((CodeGenExtension)getObjectFromClassName(extensions[i]));
-
-        }
-
-    }
-
-    private void addExtension(CodeGenExtension ext){
-        ext.init(this.configuration);
-        this.moduleEndpoints.add(ext);
-    }
-    public void generate() throws CodeGenerationException {
-        try {
-            for (int i = 0; i < this.moduleEndpoints.size(); i++) {
-                ((CodeGenExtension) this.moduleEndpoints.get(i)).engage();
-            }
-
-            Emitter emitter;
-            TypeMapper mapper = configuration.getTypeMapper();
-
-            Map emitterMap = ConfigPropertyFileLoader.getLanguageEmitterMap();
-            String className = emitterMap.get(this.configuration.getOutputLanguage()).toString();
-            if (className!=null){
-                
-                emitter = (Emitter)getObjectFromClassName(className);
-                emitter.setCodeGenConfiguration(this.configuration);
-                emitter.setMapper(mapper);
-
-            }else{
-                throw new Exception("Emitter class not found!");
-            }
-
-
-            if (this.configuration.isServerSide()){
-                emitter.emitSkeleton();
-            }else{
-                emitter.emitStub();
-            }
-
-        } catch (ClassCastException e) {
-            throw new CodeGenerationException("Non emitter class found!",e);
-
-        } catch (Exception e) {
-            throw new CodeGenerationException(e);
-        }
-
-
-    }
-
-
-    private WSDLDescription getWOM(CommandLineOptionParser parser) throws WSDLException,
-            IOException {
-        String uri = ((CommandLineOption) parser.getAllOptions().get(
-                CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION)).getOptionValue();
-        return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(uri)
-                .getDescription();
-    }
-
-
-    /**
-     * gets a object from the class
-     * @param className
-     * @return
-     */
-    private Object getObjectFromClassName(String className) throws CodeGenerationException{
-        try {
-            Class extensionClass = this.getClass().getClassLoader().loadClass(className);
-            return extensionClass.newInstance();
-        } catch (ClassNotFoundException e) {
-            throw new CodeGenerationException("Extension class loading problem",e);
-        } catch (InstantiationException e) {
-            throw new CodeGenerationException("Extension class instantiation problem",e);
-        } catch (IllegalAccessException e) {
-            throw new CodeGenerationException("Illegal extension!",e);
-        } catch (Exception e) {
-            throw new CodeGenerationException(e);
-        }
-
-    }
-}
+/*
+* Copyright 2001-2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.wsdl.codegen;
+
+import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis2.wsdl.codegen.emitter.CSharpEmitter;
+import org.apache.axis2.wsdl.codegen.emitter.Emitter;
+import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter;
+import org.apache.axis2.wsdl.codegen.extension.*;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
+import org.apache.wsdl.WSDLDescription;
+
+import javax.wsdl.WSDLException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public class CodeGenerationEngine {
+    private List moduleEndpoints = new ArrayList();
+
+
+    private CodeGenConfiguration configuration;
+
+    public CodeGenerationEngine(CodeGenConfiguration config) throws CodeGenerationException{
+        this.configuration = config;
+        loadExtensions();
+    }
+
+    public CodeGenerationEngine(CommandLineOptionParser parser) throws CodeGenerationException {
+        WSDLDescription wom;
+        try {
+            wom = this.getWOM(parser);
+        } catch (WSDLException e) {
+            throw new CodeGenerationException("Error parsing WSDL", e);
+        } catch (IOException e1) {
+            throw new CodeGenerationException("Invalid WSDL Location ", e1);
+        }
+
+        this.configuration = new CodeGenConfiguration(wom, parser);
+        loadExtensions();
+    }
+
+    private void loadExtensions() throws CodeGenerationException{
+
+        String[] extensions = ConfigPropertyFileLoader.getExtensionClassNames();
+        for (int i = 0; i < extensions.length; i++) {
+            //load the Extension class
+            addExtension((CodeGenExtension)getObjectFromClassName(extensions[i]));
+
+        }
+
+    }
+
+    private void addExtension(CodeGenExtension ext){
+        ext.init(this.configuration);
+        this.moduleEndpoints.add(ext);
+    }
+    public void generate() throws CodeGenerationException {
+        try {
+            for (int i = 0; i < this.moduleEndpoints.size(); i++) {
+                ((CodeGenExtension) this.moduleEndpoints.get(i)).engage();
+            }
+
+            Emitter emitter;
+            TypeMapper mapper = configuration.getTypeMapper();
+
+            Map emitterMap = ConfigPropertyFileLoader.getLanguageEmitterMap();
+            String className = emitterMap.get(this.configuration.getOutputLanguage()).toString();
+            if (className!=null){
+                
+                emitter = (Emitter)getObjectFromClassName(className);
+                emitter.setCodeGenConfiguration(this.configuration);
+                emitter.setMapper(mapper);
+
+            }else{
+                throw new Exception("Emitter class not found!");
+            }
+
+
+            if (this.configuration.isServerSide()){
+                emitter.emitSkeleton();
+            }else{
+                emitter.emitStub();
+            }
+
+        } catch (ClassCastException e) {
+            throw new CodeGenerationException("Non emitter class found!",e);
+
+        } catch (Exception e) {
+            throw new CodeGenerationException(e);
+        }
+
+
+    }
+
+
+    private WSDLDescription getWOM(CommandLineOptionParser parser) throws WSDLException,
+            IOException {
+        String uri = ((CommandLineOption) parser.getAllOptions().get(
+                CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION)).getOptionValue();
+        return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(uri)
+                .getDescription();
+    }
+
+
+    /**
+     * gets a object from the class
+     * @param className
+     * @return
+     */
+    private Object getObjectFromClassName(String className) throws CodeGenerationException{
+        try {
+            Class extensionClass = this.getClass().getClassLoader().loadClass(className);
+            return extensionClass.newInstance();
+        } catch (ClassNotFoundException e) {
+            throw new CodeGenerationException("Extension class loading problem",e);
+        } catch (InstantiationException e) {
+            throw new CodeGenerationException("Extension class instantiation problem",e);
+        } catch (IllegalAccessException e) {
+            throw new CodeGenerationException("Illegal extension!",e);
+        } catch (Exception e) {
+            throw new CodeGenerationException(e);
+        }
+
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationException.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationException.java Thu Sep 15 11:52:11 2005
@@ -1,35 +1,35 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.wsdl.codegen;
-
-/**
- * @author chathura@opensource.lk
- */
-public class CodeGenerationException extends Exception {
-
-    public CodeGenerationException(String message) {
-        super(message);
-    }
-
-    public CodeGenerationException(String message, Throwable throwable) {
-        super(message, throwable);
-    }
-
-    public CodeGenerationException(Throwable throwable) {
-        super(throwable);
-    }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public class CodeGenerationException extends Exception {
+
+    public CodeGenerationException(String message) {
+        super(message);
+    }
+
+    public CodeGenerationException(String message, Throwable throwable) {
+        super(message, throwable);
+    }
+
+    public CodeGenerationException(Throwable throwable) {
+        super(throwable);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CodeGenerationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java Thu Sep 15 11:52:11 2005
@@ -1,105 +1,105 @@
-/*
-* Copyright 2001-2004 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package org.apache.axis2.wsdl.codegen;
-
-import java.util.ArrayList;
-
-/**
- * @author chathura@opensource.lk
- */
-public class CommandLineOption implements CommandLineOptionConstants {
-
-    private String type;
-    private ArrayList optionValues;
-    private boolean invalid = false;
-
-    public CommandLineOption(String type, String[] values) {
-        updateType(type);
-        ArrayList arrayList = new ArrayList(values.length);
-        for (int i = 0; i < values.length; i++) {
-            arrayList.add(values[i]);
-        }
-        this.optionValues = arrayList;
-    }
-
-    private void updateType(String type) {
-        if (type.startsWith("-")) type = type.replaceFirst("-", "");
-        type = type.toLowerCase();
-        this.type = type;
-    }
-
-    /**
-     * @param type
-     */
-    public CommandLineOption(String type, ArrayList values) {
-        updateType(type);
-        this.validate(this.type);
-
-        if (null != values) {
-            this.optionValues = values;
-        }
-    }
-
-
-    /**
-     * @return Returns the type.
-     * @see <code>CommandLineOptionConstans</code>
-     */
-    public String getType() {
-        return type;
-    }
-
-
-    /**
-     * @return Returns the optionValues.
-     */
-    public String getOptionValue() {
-        if (optionValues != null)
-            return (String) optionValues.get(0);
-        else
-            return null;
-    }
-
-    /**
-     * @return Returns the invalid.
-     */
-    public boolean isInvalid() {
-        return invalid;
-    }
-
-
-    /**
-     * @return Returns the optionValues.
-     */
-    public ArrayList getOptionValues() {
-        return optionValues;
-    }
-
-    private void validate(String optionType) {
-        invalid = !((WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(optionType) ||
-                (OUTPUT_LOCATION_OPTION).equalsIgnoreCase(optionType) ||
-                (SERVER_SIDE_CODE_OPTION).equalsIgnoreCase(optionType) ||
-                (CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
-                (CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
-                (PACKAGE_OPTION).equalsIgnoreCase(optionType) ||
-                (GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(
-                        optionType) ||
-                (GENERATE_TEST_CASE_OPTION).equalsIgnoreCase(optionType) ||
-                (STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType) ||
-                (DATA_BINDING_TYPE_OPTION).equalsIgnoreCase(optionType));
-    }
+/*
+* Copyright 2001-2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.wsdl.codegen;
+
+import java.util.ArrayList;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public class CommandLineOption implements CommandLineOptionConstants {
+
+    private String type;
+    private ArrayList optionValues;
+    private boolean invalid = false;
+
+    public CommandLineOption(String type, String[] values) {
+        updateType(type);
+        ArrayList arrayList = new ArrayList(values.length);
+        for (int i = 0; i < values.length; i++) {
+            arrayList.add(values[i]);
+        }
+        this.optionValues = arrayList;
+    }
+
+    private void updateType(String type) {
+        if (type.startsWith("-")) type = type.replaceFirst("-", "");
+        type = type.toLowerCase();
+        this.type = type;
+    }
+
+    /**
+     * @param type
+     */
+    public CommandLineOption(String type, ArrayList values) {
+        updateType(type);
+        this.validate(this.type);
+
+        if (null != values) {
+            this.optionValues = values;
+        }
+    }
+
+
+    /**
+     * @return Returns the type.
+     * @see <code>CommandLineOptionConstans</code>
+     */
+    public String getType() {
+        return type;
+    }
+
+
+    /**
+     * @return Returns the optionValues.
+     */
+    public String getOptionValue() {
+        if (optionValues != null)
+            return (String) optionValues.get(0);
+        else
+            return null;
+    }
+
+    /**
+     * @return Returns the invalid.
+     */
+    public boolean isInvalid() {
+        return invalid;
+    }
+
+
+    /**
+     * @return Returns the optionValues.
+     */
+    public ArrayList getOptionValues() {
+        return optionValues;
+    }
+
+    private void validate(String optionType) {
+        invalid = !((WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(optionType) ||
+                (OUTPUT_LOCATION_OPTION).equalsIgnoreCase(optionType) ||
+                (SERVER_SIDE_CODE_OPTION).equalsIgnoreCase(optionType) ||
+                (CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
+                (CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
+                (PACKAGE_OPTION).equalsIgnoreCase(optionType) ||
+                (GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(
+                        optionType) ||
+                (GENERATE_TEST_CASE_OPTION).equalsIgnoreCase(optionType) ||
+                (STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType) ||
+                (DATA_BINDING_TYPE_OPTION).equalsIgnoreCase(optionType));
+    }
 }

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java Thu Sep 15 11:52:11 2005
@@ -1,52 +1,52 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.wsdl.codegen;
-
-/**
- * @author chathura@opensource.lk
- */
-public interface CommandLineOptionConstants {
-
-    public static final String SOLE_INPUT = "SOLE_INPUT";
-
-    public static final String WSDL_LOCATION_URI_OPTION = "uri";
-    public static final String OUTPUT_LOCATION_OPTION = "o";
-    public static final String SERVER_SIDE_CODE_OPTION = "ss";
-    public static final String GENERATE_SERVICE_DESCRIPTION_OPTION = "sd";
-    public static final String CODEGEN_ASYNC_ONLY_OPTION = "a";
-    public static final String CODEGEN_SYNC_ONLY_OPTION = "s";
-    public static final String PACKAGE_OPTION = "p";
-    public static final String STUB_LANGUAGE_OPTION = "l";
-    public static final String GENERATE_TEST_CASE_OPTION = "t";
-    public static final String DATA_BINDING_TYPE_OPTION = "d";
-
-
-    public static final String INVALID_OPTION = "INVALID_OPTION";
-
-    public interface LanguageNames {
-        public static final String JAVA = "java";
-        public static final String C_SHARP = "cs";
-        public static final String VB_DOT_NET = "vb";
-        public static final String C_PLUS_PLUS = "cpp";
-
-    }
-    
-    public interface Databinding {
-    	public static final String XML_BEANS = "xmlbeans";
-    	public static final String JAXB = "jaxb";
-    }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public interface CommandLineOptionConstants {
+
+    public static final String SOLE_INPUT = "SOLE_INPUT";
+
+    public static final String WSDL_LOCATION_URI_OPTION = "uri";
+    public static final String OUTPUT_LOCATION_OPTION = "o";
+    public static final String SERVER_SIDE_CODE_OPTION = "ss";
+    public static final String GENERATE_SERVICE_DESCRIPTION_OPTION = "sd";
+    public static final String CODEGEN_ASYNC_ONLY_OPTION = "a";
+    public static final String CODEGEN_SYNC_ONLY_OPTION = "s";
+    public static final String PACKAGE_OPTION = "p";
+    public static final String STUB_LANGUAGE_OPTION = "l";
+    public static final String GENERATE_TEST_CASE_OPTION = "t";
+    public static final String DATA_BINDING_TYPE_OPTION = "d";
+
+
+    public static final String INVALID_OPTION = "INVALID_OPTION";
+
+    public interface LanguageNames {
+        public static final String JAVA = "java";
+        public static final String C_SHARP = "cs";
+        public static final String VB_DOT_NET = "vb";
+        public static final String C_PLUS_PLUS = "cpp";
+
+    }
+    
+    public interface Databinding {
+    	public static final String XML_BEANS = "xmlbeans";
+    	public static final String JAXB = "jaxb";
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionParser.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionParser.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionParser.java Thu Sep 15 11:52:11 2005
@@ -1,124 +1,124 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.wsdl.codegen;
-
-import java.util.*;
-
-/**
- * @author chathura@opensource.lk
- */
-public class CommandLineOptionParser implements CommandLineOptionConstants {
-
-    private Map commandLineOptions;
-
-    public CommandLineOptionParser(Map commandLineOptions) {
-        this.commandLineOptions = commandLineOptions;
-    }
-
-    public CommandLineOptionParser(String[] args) {
-        this.commandLineOptions = this.parse(args);
-
-    }
-
-    /**
-     * Return a list with <code>CommandLineOption</code> objects
-     *
-     * @param args
-     * @return CommandLineOption List
-     */
-    private Map parse(String[] args) {
-        Map commandLineOptions = new HashMap();
-
-        if (0 == args.length)
-            return commandLineOptions;
-
-        //State 0 means started
-        //State 1 means earlier one was a new -option
-        //State 2 means earlier one was a sub param of a -option
-
-        int state = 0;
-        ArrayList optionBundle = null;
-        String optionType = null;
-        CommandLineOption commandLineOption;
-
-        for (int i = 0; i < args.length; i++) {
-
-            if (args[i].substring(0, 1).equals("-")) {
-                if (0 == state) {
-                    // fresh one
-                    state = 1;
-                    optionType = args[i];
-                } else if (2 == state || 1 == state) {
-                    // new one but old one should be saved
-                    commandLineOption =
-                            new CommandLineOption(optionType, optionBundle);
-                    commandLineOptions.put(commandLineOption.getType(),
-                            commandLineOption);
-                    state = 1;
-                    optionType = args[i];
-                    optionBundle = null;
-
-                }
-            } else {
-                if (0 == state) {
-                    commandLineOption =
-                            new CommandLineOption(
-                                    CommandLineOptionConstants.SOLE_INPUT,
-                                    args);
-                    commandLineOptions.put(commandLineOption.getType(),
-                            commandLineOption);
-                    return commandLineOptions;
-
-                } else if (1 == state) {
-                    optionBundle = new ArrayList();
-                    optionBundle.add(args[i]);
-                    state = 2;
-
-                } else if (2 == state) {
-                    optionBundle.add(args[i]);
-                }
-
-            }
-
-
-        }
-
-        commandLineOption = new CommandLineOption(optionType, optionBundle);
-        commandLineOptions.put(commandLineOption.getType(), commandLineOption);
-        return commandLineOptions;
-    }
-
-    public Map getAllOptions() {
-        return this.commandLineOptions;
-    }
-
-    public List getInvalidOptions() {
-        List faultList = new ArrayList();
-        Iterator iterator = this.commandLineOptions.values().iterator();
-        while (iterator.hasNext()) {
-            CommandLineOption commandLineOption = ((CommandLineOption) (iterator
-                    .next()));
-            if (commandLineOption.isInvalid()) {
-                faultList.add(commandLineOption);
-            }
-        }
-
-        return faultList;
-    }
-
-
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen;
+
+import java.util.*;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public class CommandLineOptionParser implements CommandLineOptionConstants {
+
+    private Map commandLineOptions;
+
+    public CommandLineOptionParser(Map commandLineOptions) {
+        this.commandLineOptions = commandLineOptions;
+    }
+
+    public CommandLineOptionParser(String[] args) {
+        this.commandLineOptions = this.parse(args);
+
+    }
+
+    /**
+     * Return a list with <code>CommandLineOption</code> objects
+     *
+     * @param args
+     * @return CommandLineOption List
+     */
+    private Map parse(String[] args) {
+        Map commandLineOptions = new HashMap();
+
+        if (0 == args.length)
+            return commandLineOptions;
+
+        //State 0 means started
+        //State 1 means earlier one was a new -option
+        //State 2 means earlier one was a sub param of a -option
+
+        int state = 0;
+        ArrayList optionBundle = null;
+        String optionType = null;
+        CommandLineOption commandLineOption;
+
+        for (int i = 0; i < args.length; i++) {
+
+            if (args[i].substring(0, 1).equals("-")) {
+                if (0 == state) {
+                    // fresh one
+                    state = 1;
+                    optionType = args[i];
+                } else if (2 == state || 1 == state) {
+                    // new one but old one should be saved
+                    commandLineOption =
+                            new CommandLineOption(optionType, optionBundle);
+                    commandLineOptions.put(commandLineOption.getType(),
+                            commandLineOption);
+                    state = 1;
+                    optionType = args[i];
+                    optionBundle = null;
+
+                }
+            } else {
+                if (0 == state) {
+                    commandLineOption =
+                            new CommandLineOption(
+                                    CommandLineOptionConstants.SOLE_INPUT,
+                                    args);
+                    commandLineOptions.put(commandLineOption.getType(),
+                            commandLineOption);
+                    return commandLineOptions;
+
+                } else if (1 == state) {
+                    optionBundle = new ArrayList();
+                    optionBundle.add(args[i]);
+                    state = 2;
+
+                } else if (2 == state) {
+                    optionBundle.add(args[i]);
+                }
+
+            }
+
+
+        }
+
+        commandLineOption = new CommandLineOption(optionType, optionBundle);
+        commandLineOptions.put(commandLineOption.getType(), commandLineOption);
+        return commandLineOptions;
+    }
+
+    public Map getAllOptions() {
+        return this.commandLineOptions;
+    }
+
+    public List getInvalidOptions() {
+        List faultList = new ArrayList();
+        Iterator iterator = this.commandLineOptions.values().iterator();
+        while (iterator.hasNext()) {
+            CommandLineOption commandLineOption = ((CommandLineOption) (iterator
+                    .next()));
+            if (commandLineOption.isInvalid()) {
+                faultList.add(commandLineOption);
+            }
+        }
+
+        return faultList;
+    }
+
+
 }

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/CommandLineOptionParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/Constants.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/Constants.java Thu Sep 15 11:52:11 2005
@@ -1,24 +1,24 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.wsdl.codegen;
-
-/**
- * @author chathura@opensource.lk
- */
-public class Constants {
-    public static int TEST_PORT = 5555;
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public class Constants {
+    public static int TEST_PORT = 5555;
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/Constants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java Thu Sep 15 11:52:11 2005
@@ -1,54 +1,54 @@
-package org.apache.axis2.wsdl.codegen;
-
-import javax.xml.namespace.QName;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*   Constants for the XSLT related items
-*/
-
-public interface XSLTConstants {
-    String DEFAULT_PACKAGE_NAME = "codegen";
-    QName BASE_64_CONTENT_QNAME= new QName("http://www.w3.org/2001/XMLSchema","base64Binary");
-    QName XMIME_CONTENT_TYPE_QNAME = new QName("http://www.w3.org/2004/06/xmlmime","contentType");
-    String BASE_64_PROPERTY_KEY = "base64map";
-    /**
-     * Language constants
-     */
-    public interface LanguageTypes {
-
-        public static final int JAVA = 1;
-        public static final int C_SHARP = 2;
-        public static final int C_PLUS_PLUS = 3;
-        public static final int VB_DOT_NET = 4;
-    }
-
-    public interface DataBindingTypes {
-
-        public static final int NONE = 0;
-        public static final int XML_BEANS = 1;
-        public static final int JAXB = 2;
-
-    }
-
-    public interface CodegenStyle{
-        public static final int AUTOMATIC = 0;
-        public static final int INTERFACE = 1;
-        public static final int BINDING = 2;
-    }
-    
-
-}
+package org.apache.axis2.wsdl.codegen;
+
+import javax.xml.namespace.QName;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*   Constants for the XSLT related items
+*/
+
+public interface XSLTConstants {
+    String DEFAULT_PACKAGE_NAME = "codegen";
+    QName BASE_64_CONTENT_QNAME= new QName("http://www.w3.org/2001/XMLSchema","base64Binary");
+    QName XMIME_CONTENT_TYPE_QNAME = new QName("http://www.w3.org/2004/06/xmlmime","contentType");
+    String BASE_64_PROPERTY_KEY = "base64map";
+    /**
+     * Language constants
+     */
+    public interface LanguageTypes {
+
+        public static final int JAVA = 1;
+        public static final int C_SHARP = 2;
+        public static final int C_PLUS_PLUS = 3;
+        public static final int VB_DOT_NET = 4;
+    }
+
+    public interface DataBindingTypes {
+
+        public static final int NONE = 0;
+        public static final int XML_BEANS = 1;
+        public static final int JAXB = 2;
+
+    }
+
+    public interface CodegenStyle{
+        public static final int AUTOMATIC = 0;
+        public static final int INTERFACE = 1;
+        public static final int BINDING = 2;
+    }
+    
+
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/CSharpEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/CSharpEmitter.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/CSharpEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/CSharpEmitter.java Thu Sep 15 11:52:11 2005
@@ -1,44 +1,44 @@
-package org.apache.axis2.wsdl.codegen.emitter;
-
-import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
-import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
-import org.apache.axis2.wsdl.databinding.TypeMapper;
-
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * 
- */
-
-public class CSharpEmitter extends MultiLanguageClientEmitter {
-
-    public CSharpEmitter(){
-    }
-
-    public CSharpEmitter(CodeGenConfiguration configuration) {
-        this.configuration = configuration;
-        this.mapper = new DefaultTypeMapper();
-
-    }
-
-    public CSharpEmitter(CodeGenConfiguration configuration,
-                         TypeMapper mapper) {
-        this.configuration = configuration;
-        this.mapper = mapper;
-
-    }
-
-
-}
+package org.apache.axis2.wsdl.codegen.emitter;
+
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * 
+ */
+
+public class CSharpEmitter extends MultiLanguageClientEmitter {
+
+    public CSharpEmitter(){
+    }
+
+    public CSharpEmitter(CodeGenConfiguration configuration) {
+        this.configuration = configuration;
+        this.mapper = new DefaultTypeMapper();
+
+    }
+
+    public CSharpEmitter(CodeGenConfiguration configuration,
+                         TypeMapper mapper) {
+        this.configuration = configuration;
+        this.mapper = mapper;
+
+    }
+
+
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/CSharpEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/Emitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/Emitter.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/Emitter.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/Emitter.java Thu Sep 15 11:52:11 2005
@@ -1,37 +1,37 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.wsdl.codegen.emitter;
-
-import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
-import org.apache.axis2.wsdl.codegen.CodeGenerationException;
-import org.apache.axis2.wsdl.databinding.TypeMapper;
-
-/**
- * @author chathura@opensource.lk
- */
-public interface Emitter {
-
-    public void setCodeGenConfiguration(CodeGenConfiguration configuration);
-    
-    public void setMapper(TypeMapper mapper) ;
-
-    public void emitStub() throws CodeGenerationException;
-
-    public void emitSkeleton() throws CodeGenerationException;
-
-
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen.emitter;
+
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+
+/**
+ * @author chathura@opensource.lk
+ */
+public interface Emitter {
+
+    public void setCodeGenConfiguration(CodeGenConfiguration configuration);
+    
+    public void setMapper(TypeMapper mapper) ;
+
+    public void emitStub() throws CodeGenerationException;
+
+    public void emitSkeleton() throws CodeGenerationException;
+
+
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/Emitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/JavaEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/JavaEmitter.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/JavaEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/JavaEmitter.java Thu Sep 15 11:52:11 2005
@@ -1,48 +1,48 @@
-package org.apache.axis2.wsdl.codegen.emitter;
-
-import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
-import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
-import org.apache.axis2.wsdl.databinding.TypeMapper;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Java emiiter implementation
-*/
-
-public class JavaEmitter extends MultiLanguageClientEmitter {
-
-    public JavaEmitter() {
-    }
-
-    /**
-     * @param configuration
-     */
-    public JavaEmitter(CodeGenConfiguration configuration) {
-        this.configuration = configuration;
-        this.mapper = new DefaultTypeMapper();
-
-    }
-
-    /**
-     * @param configuration
-     * @param mapper
-     */
-    public JavaEmitter(CodeGenConfiguration configuration, TypeMapper mapper) {
-        this.configuration = configuration;
-        this.mapper = mapper;
-    }
-
-}
+package org.apache.axis2.wsdl.codegen.emitter;
+
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Java emiiter implementation
+*/
+
+public class JavaEmitter extends MultiLanguageClientEmitter {
+
+    public JavaEmitter() {
+    }
+
+    /**
+     * @param configuration
+     */
+    public JavaEmitter(CodeGenConfiguration configuration) {
+        this.configuration = configuration;
+        this.mapper = new DefaultTypeMapper();
+
+    }
+
+    /**
+     * @param configuration
+     * @param mapper
+     */
+    public JavaEmitter(CodeGenConfiguration configuration, TypeMapper mapper) {
+        this.configuration = configuration;
+        this.mapper = mapper;
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/JavaEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native