axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r373431 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/utils/ codegen/src/org/apache/axis2/wsdl/ codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org...
Date Mon, 30 Jan 2006 04:40:35 GMT
Author: ajith
Date: Sun Jan 29 20:39:37 2006
New Revision: 373431

URL: http://svn.apache.org/viewcvs?rev=373431&view=rev
Log:
Halfway through implementing the Java2WSDL tool
1. Moved the java2wsdl classes into the builder package
2. Modified the option validation to allow the option parser to be reused
3. added the constants for the commandline Options

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/Java2WSDL.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/Java2WSDLCodegenEngine.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Java2WSDLOptionsValidator.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionsValidator.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
      - copied, changed from r373081, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionValidator.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WOMBuilder.java
      - copied, changed from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WOM.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java
      - copied, changed from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WSDL.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaGenerator.java
      - copied, changed from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/TypeTable.java
      - copied, changed from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/TypeTable.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/
      - copied from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ChainedParamReader.java
      - copied, changed from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ChainedParamReader.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ClassReader.java
      - copied, changed from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ClassReader.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/MethodTable.java
      - copied, changed from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/MethodTable.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamNameExtractor.java
      - copied, changed from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamNameExtractor.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamReader.java
      - copied, changed from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamReader.java
Removed:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionValidator.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/
Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOption.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionParser.java
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
    webservices/axis2/trunk/java/modules/integration/maven.xml
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/ant/AntCodegenTask.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java Sun Jan 29 20:39:37 2006
@@ -175,21 +175,21 @@
         return o.toString();
     }
 
-     public static String convertToString(Short o) {
+    public static String convertToString(Short o) {
         return o.toString();
     }
 
     public static String convertToString(UnsignedByte o) {
-           return o.toString();
-       }
+        return o.toString();
+    }
 
-     public static String convertToString(UnsignedInt o) {
-           return o.toString();
-       }
+    public static String convertToString(UnsignedInt o) {
+        return o.toString();
+    }
 
     public static String convertToString(UnsignedLong o) {
-           return o.toString();
-       }
+        return o.toString();
+    }
 
     public static String convertToString(Object o) {
         return o.toString();

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/Java2WSDL.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/Java2WSDL.java?rev=373431&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/Java2WSDL.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/Java2WSDL.java Sun Jan 29 20:39:37 2006
@@ -0,0 +1,51 @@
+package org.apache.axis2.wsdl;
+
+import org.apache.axis2.wsdl.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.util.Java2WSDLOptionsValidator;
+import org.apache.axis2.wsdl.util.WSDL2JavaOptionsValidator;
+import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
+import org.apache.axis2.wsdl.codegen.Java2WSDLCodegenEngine;
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+/*
+ * 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 Java2WSDL {
+
+    public static void main(String[] args) {
+        CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
+                args);
+        //  validate the arguments
+        validateCommandLineOptions(commandLineOptionParser);
+        try {
+            new Java2WSDLCodegenEngine(commandLineOptionParser.getAllOptions()).generate();
+        } catch (CodeGenerationException e) {
+            System.out.println("An error occured during codegen");//todo i18n this
+        }
+    }
+
+    public static void printUsage(){
+        //todo fill this
+    }
+
+
+    private static void validateCommandLineOptions(
+               CommandLineOptionParser parser) {
+           if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()).size() > 0)
+               printUsage();
+
+       }
+
+}

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Sun Jan 29 20:39:37 2006
@@ -20,6 +20,7 @@
 import org.apache.axis2.wsdl.i18n.CodegenMessages;
 import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
 import org.apache.axis2.wsdl.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.util.WSDL2JavaOptionsValidator;
 
 public class WSDL2Code {
 
@@ -51,11 +52,11 @@
 
     private static void validateCommandLineOptions(
             CommandLineOptionParser parser) {
-        if (parser.getInvalidOptions().size() > 0)
+        if (parser.getInvalidOptions(new WSDL2JavaOptionsValidator()).size() > 0)
             printUsage();
         if (null ==
                 parser.getAllOptions().get(
-                        CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION))
+                        CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION))
             printUsage();
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Sun Jan 29 20:39:37 2006
@@ -37,7 +37,7 @@
 public class CodeGenerationEngine {
     private Log log = LogFactory.getLog(getClass());
 
-    private List moduleEndpoints = new ArrayList();
+    private List extensions = new ArrayList();
 
 
     private CodeGenConfiguration configuration;
@@ -52,7 +52,7 @@
         Map allOptions = parser.getAllOptions();
         try {
 
-            CommandLineOption option = (CommandLineOption)allOptions.get(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION);
+            CommandLineOption option = (CommandLineOption)allOptions.get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION);
             wom = this.getWOM(option.getOptionValue());
         } catch (WSDLException e) {
             throw new CodeGenerationException(CodegenMessages.getMessage("engine.wsdlParsingException"), e);
@@ -75,15 +75,15 @@
     private void addExtension(CodeGenExtension ext) {
         if(ext != null) {
             ext.init(configuration);
-            moduleEndpoints.add(ext);
+            extensions.add(ext);
         }
     }
 
 
     public void generate() throws CodeGenerationException {
         try {
-            for (int i = 0; i < moduleEndpoints.size(); i++) {
-                ((CodeGenExtension) moduleEndpoints.get(i)).engage();
+            for (int i = 0; i < extensions.size(); i++) {
+                ((CodeGenExtension) extensions.get(i)).engage();
             }
 
             Emitter emitter;
@@ -99,7 +99,7 @@
             }
 
             Map emitterMap = ConfigPropertyFileLoader.getLanguageEmitterMap();
-            String className = emitterMap.get(configuration.getOutputLanguage()).toString();
+            String className = (String)emitterMap.get(configuration.getOutputLanguage());
             if (className != null) {
                 emitter = (Emitter) getObjectFromClassName(className);
                 emitter.setCodeGenConfiguration(configuration);
@@ -109,13 +109,20 @@
             }
 
 
+
             if (configuration.isServerSide()) {
                 emitter.emitSkeleton();
-            }
+                //if the users want both client and server, it would be in the 
+                // generate all option
 
-            if (!configuration.isServerSide() || configuration.isWriteTestCase()) {
+                if (configuration.isGenerateAll()) {
+                    emitter.emitStub();
+                }
+            }else{
                 emitter.emitStub();
             }
+
+
 
         } catch (ClassCastException e) {
             throw new CodeGenerationException(CodegenMessages.getMessage("engine.wrongEmitter"), e);

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Sun Jan 29 20:39:37 2006
@@ -27,7 +27,7 @@
 
     public static void loadConfig(CodeGenConfiguration config, Map optionMap){
         String outputLocation = "."; //default output directory is the current working directory
-        CommandLineOption outputLocationOption = loadOption(OUTPUT_LOCATION_OPTION,OUTPUT_LOCATION_OPTION_LONG,optionMap);
+        CommandLineOption outputLocationOption = loadOption(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG,optionMap);
 
         if (outputLocationOption != null) {
             outputLocation = outputLocationOption.getOptionValue();
@@ -44,16 +44,16 @@
             outputLocationFile.mkdirs();
         }
 
-        config.setServerSide(loadOption(SERVER_SIDE_CODE_OPTION,SERVER_SIDE_CODE_OPTION_LONG,optionMap) != null);
-        config.setGenerateDeployementDescriptor(loadOption(GENERATE_SERVICE_DESCRIPTION_OPTION,
-                GENERATE_SERVICE_DESCRIPTION_OPTION_LONG,optionMap) !=
+        config.setServerSide(loadOption(WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG,optionMap) != null);
+        config.setGenerateDeployementDescriptor(loadOption(WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
+                WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION_LONG,optionMap) !=
                 null);
-        config.setWriteTestCase(loadOption(GENERATE_TEST_CASE_OPTION,GENERATE_TEST_CASE_OPTION,optionMap) != null);
+        config.setWriteTestCase(loadOption(WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION, WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,optionMap) != null);
 
         boolean asyncFlagPresent =
-                (loadOption(CODEGEN_ASYNC_ONLY_OPTION,CODEGEN_ASYNC_ONLY_OPTION_LONG,optionMap) !=  null);
+                (loadOption(WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION_LONG,optionMap) !=  null);
         boolean syncFlagPresent =
-                (loadOption(CODEGEN_SYNC_ONLY_OPTION,CODEGEN_SYNC_ONLY_OPTION_LONG,optionMap) !=   null);
+                (loadOption(WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION_LONG,optionMap) !=   null);
         if (asyncFlagPresent) {
             config.setAsyncOn(true);
             config.setSyncOn(false);
@@ -63,35 +63,35 @@
             config.setSyncOn(true);
         }
 
-        CommandLineOption packageOption = loadOption(PACKAGE_OPTION,PACKAGE_OPTION_LONG,optionMap);
+        CommandLineOption packageOption = loadOption(WSDL2JavaConstants.PACKAGE_OPTION, WSDL2JavaConstants.PACKAGE_OPTION_LONG,optionMap);
         if (packageOption != null) {
             config.setPackageName(packageOption.getOptionValue());
         }
 
-        CommandLineOption langOption = loadOption(STUB_LANGUAGE_OPTION,STUB_LANGUAGE_OPTION_LONG,optionMap);
+        CommandLineOption langOption = loadOption(WSDL2JavaConstants.STUB_LANGUAGE_OPTION, WSDL2JavaConstants.STUB_LANGUAGE_OPTION_LONG,optionMap);
         //The language here
         if (langOption != null) {
             config.setOutputLanguage(langOption.getOptionValue());
         }
 
-        CommandLineOption dataBindingOption = loadOption(DATA_BINDING_TYPE_OPTION,DATA_BINDING_TYPE_OPTION_LONG,optionMap);
+        CommandLineOption dataBindingOption = loadOption(WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION_LONG,optionMap);
         if (dataBindingOption != null) {
             config.setDatabindingType(dataBindingOption.getOptionValue());
         }
 
-        CommandLineOption unwrapClassesOption = loadOption(UNPACK_CLASSES_OPTION,UNPACK_CLASSES_OPTION_LONG,optionMap);
+        CommandLineOption unwrapClassesOption = loadOption(WSDL2JavaConstants.UNPACK_CLASSES_OPTION, WSDL2JavaConstants.UNPACK_CLASSES_OPTION_LONG,optionMap);
         if (unwrapClassesOption != null) {
             config.setPackClasses(false);
         }
 
-        CommandLineOption portNameOption = loadOption(PORT_NAME_OPTION,PORT_NAME_OPTION_LONG,optionMap);
+        CommandLineOption portNameOption = loadOption(WSDL2JavaConstants.PORT_NAME_OPTION, WSDL2JavaConstants.PORT_NAME_OPTION_LONG,optionMap);
         config.setPortName(portNameOption!=null?portNameOption.getOptionValue():null);
 
-        CommandLineOption serviceNameOption = loadOption(SERVICE_NAME_OPTION,SERVICE_NAME_OPTION_LONG,optionMap);
+        CommandLineOption serviceNameOption = loadOption(WSDL2JavaConstants.SERVICE_NAME_OPTION, WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG,optionMap);
         config.setServiceName(serviceNameOption!=null?serviceNameOption.getOptionValue():null);
 
 
-        CommandLineOption generateAllOption = loadOption(GENERATE_ALL_OPTION,GENERATE_ALL_OPTION_LONG,optionMap);
+        CommandLineOption generateAllOption = loadOption(WSDL2JavaConstants.GENERATE_ALL_OPTION, WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG,optionMap);
         if (generateAllOption != null) {
             config.setGenerateAll(true);
         }
@@ -102,9 +102,9 @@
         while (keyIterator.hasNext()) {
             Object key = keyIterator.next();
             CommandLineOption option = (CommandLineOption) optionMap.get(key);
-            if (key.toString().startsWith(EXTRA_OPTIONTYPE_PREFIX)) {
+            if (key.toString().startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)) {
                 //add this to the property map
-                config.getProperties().put(key.toString().replaceFirst(EXTRA_OPTIONTYPE_PREFIX, ""), option.getOptionValue());
+                config.getProperties().put(key.toString().replaceFirst(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX, ""), option.getOptionValue());
             }
         }
 

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/Java2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/Java2WSDLCodegenEngine.java?rev=373431&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/Java2WSDLCodegenEngine.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/Java2WSDLCodegenEngine.java Sun Jan 29 20:39:37 2006
@@ -0,0 +1,101 @@
+package org.apache.axis2.wsdl.codegen;
+
+import org.apache.axis2.wsdl.builder.Java2WSDLBuilder;
+import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
+import org.apache.axis2.wsdl.util.CommandLineOption;
+
+import java.util.Map;
+import java.io.File;
+/*
+ * 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 Java2WSDLCodegenEngine implements CommandLineOptionConstants {
+
+    private Java2WSDLBuilder java2WsdlBuilder;
+
+    public Java2WSDLCodegenEngine(Map optionsMap) throws CodeGenerationException {
+
+
+        //create a new  Java2WSDLBuilder and populate it
+        File outputFolder = null;
+
+        CommandLineOption option = loadOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION,
+                Java2WSDLConstants.OUTPUT_LOCATION_OPTION_LONG,optionsMap);
+        String outputFolderName =  option ==null?System.getProperty("user.dir"):option.getOptionValue();
+
+
+        outputFolder = new File(outputFolderName);
+        if(!outputFolder.isDirectory()){
+            throw new CodeGenerationException(""); //todo put the messages here - not a folder
+        }
+
+        option = loadOption(Java2WSDLConstants.CLASSNAME_OPTION,Java2WSDLConstants.CLASSNAME_OPTION_LONG,optionsMap);
+        String className =option==null?null:option.getOptionValue();
+        if (className==null || className.equals("")){
+             throw new CodeGenerationException(""); //todo put the messages here - a class is a must
+        }
+
+        option = loadOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION,
+                Java2WSDLConstants.OUTPUT_FILENAME_OPTION_LONG,optionsMap);
+        String outputFileName = option==null?null:option.getOptionValue();
+        //derive a file name from the class name
+        if (outputFileName==null){
+         outputFileName = getSimpleClassName(className);
+        }
+
+        //first create a file in the given location
+        File outputFile = new File(outputFolder,outputFileName);
+
+        //if the class path is present, create a URL class loader with those
+        //class path entries present. if not just take the
+
+
+    }
+
+    public void generate() throws CodeGenerationException {
+
+    }
+
+
+    private  CommandLineOption loadOption(String shortOption, String longOption,Map options) {
+        //short option gets precedence
+        CommandLineOption option = null;
+        if (longOption!=null){
+           option =(CommandLineOption)options.get(longOption);
+           if (option!=null) {
+               return option;
+           }
+        }
+        if (shortOption!= null){
+            option = (CommandLineOption)options.get(shortOption);
+        }
+
+        return option;
+    }
+
+     /**
+     * A method to strip the fully qualified className to a simple classname
+     * @param qualifiedName
+     * @return
+     */
+    private String getSimpleClassName(String qualifiedName) {
+        int index = qualifiedName.lastIndexOf(".");
+        if (index > 0) {
+            return qualifiedName.substring(index + 1, qualifiedName.length());
+        }
+        return qualifiedName;
+    }
+}

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Sun Jan 29 20:39:37 2006
@@ -670,10 +670,7 @@
                 throw new Exception(CodegenMessages.getMessage("emitter.unknownStyle", codegenStyle + ""));
             }
 
-            // Call the emit stub method to generate the client side too
-            if (configuration.isGenerateAll()) {
-                emitStub();
-            }
+            
         } catch (Exception e) {
             throw new CodeGenerationException(e);
         }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOption.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOption.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOption.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOption.java Sun Jan 29 20:39:37 2006
@@ -39,7 +39,7 @@
 
         //for options that start with the extra prefix, don't do any change for the
         //case
-        if (!type.startsWith(EXTRA_OPTIONTYPE_PREFIX)){
+        if (!type.startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)){
             type = type.toLowerCase();
         }
         this.type = type;

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java Sun Jan 29 20:39:37 2006
@@ -18,43 +18,68 @@
 
 public interface CommandLineOptionConstants {
 
-    public static final String SOLE_INPUT = "SOLE_INPUT";
+    interface WSDL2JavaConstants{
+
+        //short option constants
+        String WSDL_LOCATION_URI_OPTION = "uri";
+        String OUTPUT_LOCATION_OPTION = "o";
+        String SERVER_SIDE_CODE_OPTION = "ss";
+        String GENERATE_SERVICE_DESCRIPTION_OPTION = "sd";
+        String CODEGEN_ASYNC_ONLY_OPTION = "a";
+        String CODEGEN_SYNC_ONLY_OPTION = "s";
+        String PACKAGE_OPTION = "p";
+        String STUB_LANGUAGE_OPTION = "l";
+        String GENERATE_TEST_CASE_OPTION = "t";
+        String DATA_BINDING_TYPE_OPTION = "d";
+        String UNPACK_CLASSES_OPTION = "u";
+        String GENERATE_ALL_OPTION = "g";
+        String PORT_NAME_OPTION = "pn";
+        String SERVICE_NAME_OPTION = "sn";
+        //long option constants
+        String OUTPUT_LOCATION_OPTION_LONG = "output";
+        String SERVER_SIDE_CODE_OPTION_LONG = "server-side";
+        String GENERATE_SERVICE_DESCRIPTION_OPTION_LONG = "service-description";
+        String CODEGEN_ASYNC_ONLY_OPTION_LONG = "async";
+        String CODEGEN_SYNC_ONLY_OPTION_LONG = "sync";
+        String PACKAGE_OPTION_LONG = "package";
+        String STUB_LANGUAGE_OPTION_LONG = "language";
+        String GENERATE_TEST_CASE_OPTION_LONG = "test-case";
+        String DATA_BINDING_TYPE_OPTION_LONG = "databinding-method";
+        String UNPACK_CLASSES_OPTION_LONG = "unpack-classes";
+        String GENERATE_ALL_OPTION_LONG = "generate-all";
+        String PORT_NAME_OPTION_LONG = "port-name";
+        String SERVICE_NAME_OPTION_LONG = "service-name";
+        String INVALID_OPTION = "INVALID_OPTION";
+        String EXTRA_OPTIONTYPE_PREFIX = "E";
+    }
+
+    interface Java2WSDLConstants{
+        String OUTPUT_LOCATION_OPTION = "o";
+        String OUTPUT_FILENAME_OPTION = "of";
+        String CLASSNAME_OPTION = "cn";
+        String CLASSPATH_OPTION = "cp";
+        String TARGET_NAMESPACE_OPTION = "tn";
+        String TARGET_NAMESPACE_PREFIX_OPTION = "tp";
+        String SCHEMA_TARGET_NAMESPACE_OPTION = "stn";
+        String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION = "stp";
+        String SERVICE_NAME_OPTION = "sn";
+
+        //long option constants
+        String OUTPUT_LOCATION_OPTION_LONG = "output";
+        String TARGET_NAMESPACE_OPTION_LONG = "targetNamespace";
+        String TARGET_NAMESPACE_PREFIX_OPTION_LONG = "targetNamespacePrefix";
+        String SERVICE_NAME_OPTION_LONG = "serviceName";
+        String CLASSNAME_OPTION_LONG = "className";
+        String CLASSPATH_OPTION_LONG = "classPath";
+        String OUTPUT_FILENAME_OPTION_LONG = "outputFilename";
+        String SCHEMA_TARGET_NAMESPACE_OPTION_LONG = "schemaTargetnamespace";
+        String SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG = "schemaTargetnamespacePrefix";
 
-    public static final String WSDL_LOCATION_URI_OPTION = "uri";
 
-     //short option constants
-    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 UNPACK_CLASSES_OPTION = "u";
-    public static final String GENERATE_ALL_OPTION = "g";
-    public static final String PORT_NAME_OPTION = "pn";
-    public static final String SERVICE_NAME_OPTION = "sn";
-
-     //long option constants
-    public static final String OUTPUT_LOCATION_OPTION_LONG = "output";
-    public static final String SERVER_SIDE_CODE_OPTION_LONG = "server-side";
-    public static final String GENERATE_SERVICE_DESCRIPTION_OPTION_LONG = "service-description";
-    public static final String CODEGEN_ASYNC_ONLY_OPTION_LONG = "async";
-    public static final String CODEGEN_SYNC_ONLY_OPTION_LONG = "sync";
-    public static final String PACKAGE_OPTION_LONG = "package";
-    public static final String STUB_LANGUAGE_OPTION_LONG = "language";
-    public static final String GENERATE_TEST_CASE_OPTION_LONG = "test-case";
-    public static final String DATA_BINDING_TYPE_OPTION_LONG = "databinding-method";
-    public static final String UNPACK_CLASSES_OPTION_LONG = "unpack-classes";
-    public static final String GENERATE_ALL_OPTION_LONG = "generate-all";
-    public static final String PORT_NAME_OPTION_LONG = "port-name";
-    public static final String SERVICE_NAME_OPTION_LONG = "service-name";
+    }
 
+    public static final String SOLE_INPUT = "SOLE_INPUT";
 
-    public static final String INVALID_OPTION = "INVALID_OPTION";
 
 
-     public static String EXTRA_OPTIONTYPE_PREFIX = "E";
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionParser.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionParser.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionParser.java Sun Jan 29 20:39:37 2006
@@ -24,6 +24,11 @@
 
 public class CommandLineOptionParser implements CommandLineOptionConstants {
 
+    //states
+    private static int STARTED = 0;
+    private static int NEW_OPTION = 1;
+    private static int SUB_PARAM_OF_OPTION = 2;
+
     private Map commandLineOptions;
 
     public CommandLineOptionParser(Map commandLineOptions) {
@@ -51,31 +56,31 @@
         //State 1 means earlier one was a new -option
         //State 2 means earlier one was a sub param of a -option
 
-        int state = 0;
+        int state = STARTED;
         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) {
+            if (args[i].startsWith("-")) {
+                if (STARTED == state) {
                     // fresh one
-                    state = 1;
+                    state = NEW_OPTION;
                     optionType = args[i];
-                } else if (2 == state || 1 == state) {
+                } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) {
                     // new one but old one should be saved
                     commandLineOption =
                             new CommandLineOption(optionType, optionBundle);
                     commandLineOptions.put(commandLineOption.getOptionType(),
                             commandLineOption);
-                    state = 1;
+                    state = NEW_OPTION;
                     optionType = args[i];
                     optionBundle = null;
 
                 }
             } else {
-                if (0 == state) {
+                if (STARTED == state) {
                     commandLineOption =
                             new CommandLineOption(
                                     CommandLineOptionConstants.SOLE_INPUT,
@@ -84,12 +89,12 @@
                             commandLineOption);
                     return commandLineOptions;
 
-                } else if (1 == state) {
+                } else if (NEW_OPTION == state) {
                     optionBundle = new ArrayList();
                     optionBundle.add(args[i]);
-                    state = 2;
+                    state = SUB_PARAM_OF_OPTION;
 
-                } else if (2 == state) {
+                } else if (SUB_PARAM_OF_OPTION == state) {
                     optionBundle.add(args[i]);
                 }
 
@@ -107,13 +112,13 @@
         return this.commandLineOptions;
     }
 
-    public List getInvalidOptions() {
+    public List getInvalidOptions(OptionsValidator validator) {
         List faultList = new ArrayList();
         Iterator iterator = this.commandLineOptions.values().iterator();
         while (iterator.hasNext()) {
             CommandLineOption commandLineOption = ((CommandLineOption) (iterator
                     .next()));
-            if (OptionValidator.isInvalid(commandLineOption)) {
+            if (validator.isInvalid(commandLineOption)) {
                 faultList.add(commandLineOption);
             }
         }

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Java2WSDLOptionsValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Java2WSDLOptionsValidator.java?rev=373431&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Java2WSDLOptionsValidator.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Java2WSDLOptionsValidator.java Sun Jan 29 20:39:37 2006
@@ -0,0 +1,51 @@
+package org.apache.axis2.wsdl.util;
+/*
+ * 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 Java2WSDLOptionsValidator implements OptionsValidator,CommandLineOptionConstants {
+
+    public boolean isInvalid(CommandLineOption option) {
+        boolean invalid;
+        String optionType = option.getOptionType();
+
+        if (optionType.startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)){
+            invalid = false;
+        } else{
+            invalid = !((Java2WSDLConstants.CLASSNAME_OPTION).equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.OUTPUT_LOCATION_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.CLASSNAME_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.CLASSPATH_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.TARGET_NAMESPACE_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.TARGET_NAMESPACE_PREFIX_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.SERVICE_NAME_OPTION.equalsIgnoreCase(optionType) ||
+
+                       Java2WSDLConstants.CLASSNAME_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.OUTPUT_LOCATION_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.CLASSNAME_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.CLASSPATH_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.TARGET_NAMESPACE_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.TARGET_NAMESPACE_PREFIX_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG.equalsIgnoreCase(optionType) ||
+                       Java2WSDLConstants.SERVICE_NAME_OPTION_LONG.equalsIgnoreCase(optionType));
+
+        }
+
+        return invalid;
+    }
+}

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionsValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionsValidator.java?rev=373431&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionsValidator.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionsValidator.java Sun Jan 29 20:39:37 2006
@@ -0,0 +1,24 @@
+package org.apache.axis2.wsdl.util;
+/*
+ * 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.
+ */
+
+/**
+ * An interface for the options validator. This acts as the input for the commandlineOptions parser
+ */
+public interface OptionsValidator {
+
+    public boolean isInvalid(CommandLineOption option);
+}

Copied: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (from r373081, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionValidator.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?p2=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java&p1=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionValidator.java&r1=373081&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/OptionValidator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Sun Jan 29 20:39:37 2006
@@ -16,45 +16,44 @@
  */
 
 
-class OptionValidator implements CommandLineOptionConstants{
+public class WSDL2JavaOptionsValidator implements CommandLineOptionConstants,OptionsValidator{
 
-    public static boolean isInvalid(CommandLineOption option) {
+    public boolean isInvalid(CommandLineOption option) {
 
         boolean invalid;
         String optionType = option.getOptionType();
 
-        if (optionType.startsWith(EXTRA_OPTIONTYPE_PREFIX)){
+        if (optionType.startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)){
             invalid = false;
         } else{
+            invalid = !((WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.OUTPUT_LOCATION_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.PACKAGE_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.UNPACK_CLASSES_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.GENERATE_ALL_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.PORT_NAME_OPTION).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.SERVICE_NAME_OPTION).equalsIgnoreCase(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) ||
-                    (UNPACK_CLASSES_OPTION).equalsIgnoreCase(optionType) ||
-                    (GENERATE_ALL_OPTION).equalsIgnoreCase(optionType) ||
-                    (PORT_NAME_OPTION).equalsIgnoreCase(optionType) ||
-                    (SERVICE_NAME_OPTION).equalsIgnoreCase(optionType) ||
-
-                    (OUTPUT_LOCATION_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (SERVER_SIDE_CODE_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (CODEGEN_ASYNC_ONLY_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (CODEGEN_SYNC_ONLY_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (PACKAGE_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (GENERATE_SERVICE_DESCRIPTION_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (GENERATE_TEST_CASE_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (STUB_LANGUAGE_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (DATA_BINDING_TYPE_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (UNPACK_CLASSES_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (PORT_NAME_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (SERVICE_NAME_OPTION_LONG).equalsIgnoreCase(optionType) ||
-                    (GENERATE_ALL_OPTION_LONG).equalsIgnoreCase(optionType)
+                    (WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.PACKAGE_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.STUB_LANGUAGE_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.UNPACK_CLASSES_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.PORT_NAME_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.SERVICE_NAME_OPTION_LONG).equalsIgnoreCase(optionType) ||
+                    (WSDL2JavaConstants.GENERATE_ALL_OPTION_LONG).equalsIgnoreCase(optionType)
             );
 
         }

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java Sun Jan 29 20:39:37 2006
@@ -347,9 +347,9 @@
     private Map fillOptionMap(String wsdlFileName,String outputLocation) {
         Map optionMap = new HashMap();
         optionMap.put(
-                CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
                         new String[]{wsdlFileName}));
 
         //use default sync option - No option is given
@@ -358,30 +358,30 @@
         //output location - code_gen_output
 
         optionMap.put(
-                CommandLineOptionConstants.OUTPUT_LOCATION_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.OUTPUT_LOCATION_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
                         new String[]{outputLocation}));
         //server side option is on
         optionMap.put(
-                CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
                         new String[0]));
         // descriptor option is on
         optionMap.put(
-                CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
-                new CommandLineOption(CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
+                new CommandLineOption(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
                         new String[0]));
          // db is xmlbeans option is on
         optionMap.put(
-                CommandLineOptionConstants.DATA_BINDING_TYPE_OPTION,
-                new CommandLineOption(CommandLineOptionConstants.DATA_BINDING_TYPE_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
+                new CommandLineOption(CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
                         new String[]{TestConstants.Databinding.XML_BEANS}));
 
          optionMap.put(
-                CommandLineOptionConstants.GENERATE_ALL_OPTION,
-                new CommandLineOption(CommandLineOptionConstants.GENERATE_ALL_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
+                new CommandLineOption(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
                         new String[0]));
         //todo Make this work
         //test case option is on

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java Sun Jan 29 20:39:37 2006
@@ -7,8 +7,8 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Handler;
 import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.wsdl.java2wsdl.SchemaGenerator;
-import org.apache.axis2.wsdl.java2wsdl.TypeTable;
+import org.apache.axis2.wsdl.builder.SchemaGenerator;
+import org.apache.axis2.wsdl.builder.TypeTable;
 import org.apache.wsdl.WSDLConstants;
 import org.codehaus.jam.JMethod;
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Sun Jan 29 20:39:37 2006
@@ -25,7 +25,7 @@
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.util.PolicyUtil;
-import org.apache.axis2.wsdl.java2wsdl.SchemaGenerator;
+import org.apache.axis2.wsdl.builder.SchemaGenerator;
 import org.apache.axis2.wsdl.writer.WOMWriter;
 import org.apache.axis2.wsdl.writer.WOMWriterFactory;
 import org.apache.commons.logging.Log;

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java Sun Jan 29 20:39:37 2006
@@ -1,7 +1,7 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.wsdl.builder.WSDLComponentFactory;
-import org.apache.axis2.wsdl.java2wsdl.SchemaGenerator;
+import org.apache.axis2.wsdl.builder.SchemaGenerator;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.wsdl.MessageReference;
 import org.apache.wsdl.WSDLBinding;

Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/maven.xml?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Sun Jan 29 20:39:37 2006
@@ -29,7 +29,7 @@
         <j:set var="axis2.home" value="${basedir}/target"/>
         <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
             <classpath refid="maven.dependency.classpath"/>
-            <arg line="-d xmlbeans -p samples.wsdl.perf -o target/perf -s -t -ss -sd -uri test/samples/wsdl/perf/perf.wsdl"/>
+            <arg line="-d xmlbeans -p samples.wsdl.perf -o target/perf -s -t -ss -sd -g -uri test/samples/wsdl/perf/perf.wsdl"/>
         </java>
         <ant:copy overwrite="yes" todir="target/perf/test/samples/perf">
             <ant:fileset dir="test/samples/wsdl/perf">
@@ -46,7 +46,7 @@
 
         <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
             <classpath refid="maven.dependency.classpath"/>
-            <arg line="-d adb -p samples.wsdl.perf2 -o target/perf2 -s -t -ss -sd -uri test/samples/wsdl/perf2/perf.wsdl"/>
+            <arg line="-d adb -p samples.wsdl.perf2 -o target/perf2 -s -t -ss -sd -g -uri test/samples/wsdl/perf2/perf.wsdl"/>
         </java>
         <ant:copy overwrite="yes" todir="target/perf2/test/samples/perf2">
             <ant:fileset dir="test/samples/wsdl/perf2">

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/ant/AntCodegenTask.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/ant/AntCodegenTask.java?rev=373431&r1=373430&r2=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/ant/AntCodegenTask.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/ant/AntCodegenTask.java Sun Jan 29 20:39:37 2006
@@ -82,80 +82,80 @@
         ////////////////////////////////////////////////////////////////
         //WSDL file name
         optionMap.put(
-                CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
                         getStringArray(WSDLFileName)));
         //output location
         optionMap.put(
-                CommandLineOptionConstants.OUTPUT_LOCATION_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.OUTPUT_LOCATION_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
                         getStringArray(output)));
         //////////////////////////////////////////////////////////////////
         // Databinding type
         optionMap.put(
-                CommandLineOptionConstants.DATA_BINDING_TYPE_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.DATA_BINDING_TYPE_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION,
                         getStringArray(databindingName)));
 
         // Async only option - forcing to generate async methods only
         if (asyncOnly) {
             optionMap.put(
-                    CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION,
+                    CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
                     new CommandLineOption(
-                            CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION,
+                            CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
                             new String[0]));
         }
         // Sync only option - forcing to generate Sync methods only
         if (syncOnly) {
             optionMap.put(
-                    CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION,
+                    CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
                     new CommandLineOption(
-                            CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION,
+                            CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
                             new String[0]));
         }
 
         //Package
         optionMap.put(
-                CommandLineOptionConstants.PACKAGE_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.PACKAGE_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
                         getStringArray(packageName)));
 
         //stub language
         optionMap.put(
-                CommandLineOptionConstants.STUB_LANGUAGE_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.STUB_LANGUAGE_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
                         getStringArray(language)));
 
 
         //server side and generate services.xml options
         if (serverSide) {
             optionMap.put(
-                    CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
+                    CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
                     new CommandLineOption(
-                            CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
+                            CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
                             new String[0]));
 
             //services XML generation - effective only when specified as the server side
             if (generateServiceXml) {
                 optionMap.put(
-                        CommandLineOptionConstants
+                        CommandLineOptionConstants.WSDL2JavaConstants
                                 .GENERATE_SERVICE_DESCRIPTION_OPTION,
                         new CommandLineOption(
-                                CommandLineOptionConstants
+                                CommandLineOptionConstants.WSDL2JavaConstants
                                         .GENERATE_SERVICE_DESCRIPTION_OPTION,
                                 new String[0]));
             }
             //generate all option - Only valid when generating serverside code
             if (generateAllClasses) {
                 optionMap.put(
-                        CommandLineOptionConstants.GENERATE_ALL_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
                         new CommandLineOption(
-                                CommandLineOptionConstants.GENERATE_ALL_OPTION,
+                                CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION,
                                 new String[0]));
             }
 
@@ -164,9 +164,9 @@
         //generate the test case
         if (testcase) {
             optionMap.put(
-                    CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION,
+                    CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
                     new CommandLineOption(
-                            CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION,
+                            CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION,
                             new String[0]));
         }
 
@@ -174,22 +174,22 @@
         //or gets generates as seperate classes
         if (unpackClasses) {
             optionMap.put(
-                    CommandLineOptionConstants.UNPACK_CLASSES_OPTION,
+                    CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION,
                     new CommandLineOption(
-                            CommandLineOptionConstants.UNPACK_CLASSES_OPTION,
+                            CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION,
                             new String[0]));
         }
 
         optionMap.put(
-                CommandLineOptionConstants.SERVICE_NAME_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.SERVICE_NAME_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION,
                         new String[]{serviceName}));
 
         optionMap.put(
-                CommandLineOptionConstants.PORT_NAME_OPTION,
+                CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION,
                 new CommandLineOption(
-                        CommandLineOptionConstants.PORT_NAME_OPTION,
+                        CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION,
                         new String[]{portName}));
         return optionMap;
     }

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WOMBuilder.java (from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WOM.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WOMBuilder.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WOMBuilder.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WOM.java&r1=373081&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WOM.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WOMBuilder.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl;
+package org.apache.axis2.wsdl.builder;
 
 import org.apache.axis2.wsdl.builder.WSDLComponentFactory;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -47,28 +47,34 @@
 *
 */
 
-public class Java2WOM {
+public class Java2WOMBuilder {
 
     private TypeTable table;
     private JMethod method [];
     private XmlSchema schema;
     private String serviceName;
-    private String targentNamespece;
-    private String targetNamespecheprefix;
+    private String targetNamespace;
+    private String targetNamespacePrefix;
 
-    public Java2WOM(TypeTable table, JMethod[] method, XmlSchema schema, String serviceName,
-                    String targentNamespece,
-                    String targetNamespecheprefix) {
+    public static final String DEFAULT_SOAP_NAMESPACE_PREFIX = "soap";
+    public static final String DEFAULT_SCHEMA_NAMESPACE_PREFIX = "xs";
+    public static final String BINDING_NAME_SUFFIX = "Binding";
+    public static final String PORT_TYPE_SUFFIX = "PortType";
+    public static final String PORT_NAME_SUFFIX = "Port";
+
+    public Java2WOMBuilder(TypeTable table, JMethod[] method, XmlSchema schema, String serviceName,
+                           String targetNamespace,
+                           String targetNamespacePrefix) {
         this.table = table;
         this.method = method;
         this.schema = schema;
         this.serviceName = serviceName;
 
-        if (targentNamespece != null && !targentNamespece.trim().equals("")) {
-            this.targentNamespece = targentNamespece;
+        if (targetNamespace != null && !targetNamespace.trim().equals("")) {
+            this.targetNamespace = targetNamespace;
         }
-        if (targetNamespecheprefix != null && !targetNamespecheprefix.trim().equals("")) {
-            this.targetNamespecheprefix = targetNamespecheprefix;
+        if (targetNamespacePrefix != null && !targetNamespacePrefix.trim().equals("")) {
+            this.targetNamespacePrefix = targetNamespacePrefix;
         }
 
     }
@@ -77,33 +83,35 @@
         DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
         StringWriter writer = new StringWriter();
-        schema.write(writer);
-        writer.flush();
+
+        writeSchema(writer);
+
         Document doc = domBuilder.parse(new ByteArrayInputStream(writer.toString().getBytes()));
         Element documentElement = doc.getDocumentElement();
         WSDLDescription womDescription;
         WSDLComponentFactory wsdlComponentFactory = new WSDLDescriptionImpl();
         womDescription = wsdlComponentFactory.createDescription();
-        HashMap namspaceMap = new HashMap();
-        namspaceMap.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
-        namspaceMap.put(targetNamespecheprefix, targentNamespece);
-        namspaceMap.put("ns1", "http://org.apache.axis2/xsd");
-        namspaceMap.put("xs", "http://www.w3.org/2001/XMLSchema");
+        HashMap namspaceMap = loadNamespaces();
         womDescription.setNamespaces(namspaceMap);
-        womDescription.setTargetNameSpace(targentNamespece);
+        womDescription.setTargetNameSpace(targetNamespace);
 
         //generating port type
         WSDLInterface portType = generatePortType(womDescription, wsdlComponentFactory, documentElement);
         womDescription.addInterface(portType);
 
-        QName bindingName = new QName(targentNamespece, serviceName + "Binding"
-                , targetNamespecheprefix);
-        //generating binding
+        QName bindingName = new QName(targetNamespace, serviceName + BINDING_NAME_SUFFIX
+                , targetNamespacePrefix);
+
+        //generating binding. Our bidings are strictly doc/lit, atleast for now
         WSDLBinding binding = generateBinding(wsdlComponentFactory,
                 portType,
                 bindingName,
-                "document", "literal", "http://schemas.xmlsoap.org/soap/http",
-                "http://www.org.apache.axis2");
+                //todo these need to be constants
+                "document",
+                "literal",
+                "http://schemas.xmlsoap.org/soap/http",
+                targetNamespace);
+
         womDescription.addBinding(binding);
 
         //generating service
@@ -112,7 +120,34 @@
         return womDescription;
     }
 
+    /**
+     * Loads the namespaces
+     * @return
+     */
+    private HashMap loadNamespaces() {
+        HashMap namspaceMap = new HashMap();
+        namspaceMap.put(DEFAULT_SOAP_NAMESPACE_PREFIX, "http://schemas.xmlsoap.org/wsdl/soap/");
+        namspaceMap.put(targetNamespacePrefix, targetNamespace);
+        namspaceMap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, "http://www.w3.org/2001/XMLSchema");
+        return namspaceMap;
+    }
+
+    /**
+     * write the schema
+     */
+
+    private void writeSchema(StringWriter writer) {
+        schema.write(writer);
+        writer.flush();
+    }
 
+    /**
+     * Generate the porttypes
+     * @param womDescription
+     * @param wsdlComponentFactory
+     * @param documentElement
+     * @return
+     */
     public WSDLInterface generatePortType(WSDLDescription womDescription,
                                           WSDLComponentFactory wsdlComponentFactory,
                                           Element documentElement) {
@@ -126,7 +161,7 @@
         womDescription.setTypes(wsdlTypes);
 
         WSDLInterface portType = womDescription.createInterface();
-        portType.setName(new QName(serviceName + "Port"));
+        portType.setName(new QName(serviceName + PORT_TYPE_SUFFIX));
 
         //adding message refs
         for (int i = 0; i < method.length; i++) {
@@ -154,6 +189,14 @@
         return portType;
     }
 
+    /**
+     * Generate the service
+     * @param wsdlComponentFactory
+     * @param womDescription
+     * @param binding
+     * @param ServiceName
+     * @return
+     */
     public WSDLService generateService(WSDLComponentFactory wsdlComponentFactory,
                                        WSDLDescription womDescription,
                                        WSDLBinding binding, String ServiceName) {
@@ -161,28 +204,39 @@
         service.setName(new QName(ServiceName));
         WSDLEndpoint endpoints = wsdlComponentFactory.createEndpoint();
         endpoints.setBinding(binding);
-        endpoints.setName(new QName(ServiceName + "PortType"));
+        endpoints.setName(new QName(ServiceName + PORT_NAME_SUFFIX));
         SOAPAddressImpl address = new SOAPAddressImpl();
-        address.setLocationURI("http://127.0.0.1:8080:/axis2/services/" + ServiceName);
+        address.setLocationURI("http://127.0.0.1:8080/axis2/services/" + ServiceName);  // ???
         endpoints.addExtensibilityElement(address);
         service.setEndpoint(endpoints);
         return service;
     }
 
 
+    /**
+     * Generate the bindings
+     * @param wsdlComponentFactory
+     * @param portType
+     * @param bindingName
+     * @param style
+     * @param use
+     * @param transportURI
+     * @param namespaceURI
+     * @return
+     */
     private WSDLBinding generateBinding(WSDLComponentFactory wsdlComponentFactory,
                                         WSDLInterface portType, QName bindingName,
                                         String style,
                                         String use,
-                                        String trsportURI,
-                                        String namespeceURI) {
+                                        String transportURI,
+                                        String namespaceURI) {
         WSDLBinding binding = wsdlComponentFactory.createBinding();
         binding.setBoundInterface(portType);
         binding.setName(bindingName);
 
         SOAPBindingImpl soapbindingImpl = new SOAPBindingImpl();
         soapbindingImpl.setStyle(style);
-        soapbindingImpl.setTransportURI(trsportURI);
+        soapbindingImpl.setTransportURI(transportURI);
         binding.addExtensibilityElement(soapbindingImpl);
 
         Iterator op_itr = portType.getOperations().keySet().iterator();
@@ -208,7 +262,7 @@
                 SOAPBodyImpl requestSoapbody = new SOAPBodyImpl();
                 requestSoapbody.setUse(use);
                 //todo need to fix this
-                requestSoapbody.setNamespaceURI(namespeceURI);
+                requestSoapbody.setNamespaceURI(namespaceURI);
                 bindingInMessage.addExtensibilityElement(requestSoapbody);
             }
 
@@ -220,7 +274,7 @@
                 bindingoperation.setOutput(bindingOutMessage);
                 SOAPBodyImpl resSoapbody = new SOAPBodyImpl();
                 resSoapbody.setUse(use);
-                resSoapbody.setNamespaceURI(namespeceURI);
+                resSoapbody.setNamespaceURI(namespaceURI);
                 bindingOutMessage.addExtensibilityElement(resSoapbody);
             }
         }

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java (from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WSDL.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WSDL.java&r1=373081&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/Java2WSDL.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java Sun Jan 29 20:39:37 2006
@@ -1,7 +1,8 @@
-package org.apache.axis2.wsdl.java2wsdl;
+package org.apache.axis2.wsdl.builder;
 
 import org.apache.axis2.wsdl.writer.WOMWriter;
 import org.apache.axis2.wsdl.writer.WOMWriterFactory;
+import org.apache.axis2.wsdl.builder.Java2WOMBuilder;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.wsdl.WSDLDescription;
 
@@ -23,30 +24,113 @@
 *
 */
 
-public class Java2WSDL {
+/**
+ * The WSDL builder to be used when WSDL's need to be generated from a Java class
+ */
+public class Java2WSDLBuilder {
 
     private OutputStream out;
     private String className;
     private ClassLoader classLoader;
+    private String wsdlPrefix = "wsdl";
 
-    public Java2WSDL(OutputStream out, String className, ClassLoader classLoader) {
+    private String serviceName  = null;
+
+    //these apply for the WSDL
+    private String targetNamespace = null;
+    private String targetNamespacePrefix = null;
+
+    private String  schemaTargetNamespace = null;
+    private String  schemaTargetNamespacePrefix = null;
+
+    public String getSchemaTargetNamespace() {
+        return schemaTargetNamespace;
+    }
+
+    public void setSchemaTargetNamespace(String schemaTargetNamespace) {
+        this.schemaTargetNamespace = schemaTargetNamespace;
+    }
+
+    public String getSchemaTargetNamespacePrefix() {
+        return schemaTargetNamespacePrefix;
+    }
+
+    public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) {
+        this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix;
+    }
+
+    public String getTargetNamespace() {
+        return targetNamespace;
+    }
+
+    public void setTargetNamespace(String targetNamespace) {
+        this.targetNamespace = targetNamespace;
+    }
+
+    public String getTargetNamespacePrefix() {
+        return targetNamespacePrefix;
+    }
+
+    public void setTargetNamespacePrefix(String targetNamespacePrefix) {
+        this.targetNamespacePrefix = targetNamespacePrefix;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+
+    public String getWsdlPrefix() {
+        return wsdlPrefix;
+    }
+
+    public void setWsdlPrefix(String wsdlPrefix) {
+        this.wsdlPrefix = wsdlPrefix;
+    }
+
+    /**
+     *
+     * @param out
+     * @param className
+     * @param classLoader
+     */
+    public Java2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) {
         this.out = out;
         this.className = className;
         this.classLoader = classLoader;
     }
 
 
+    /**
+     * Externally visible generator method
+     * @throws Exception
+     */
     public void generateWSDL() throws Exception {
-        SchemaGenerator sg = new SchemaGenerator(classLoader, className, null, null);
+        SchemaGenerator sg = new SchemaGenerator(classLoader, className, schemaTargetNamespace, schemaTargetNamespacePrefix);
         XmlSchema schema = sg.generateSchema();
-        WSDLDescription wommodel = new Java2WOM(
-                sg.getTypeTable(), sg.getMethods(), schema, simpleClassName(className), null, null).generateWOM();
+        WSDLDescription wommodel = new Java2WOMBuilder(
+                sg.getTypeTable(),
+                sg.getMethods(),
+                schema,
+                serviceName==null?simpleClassName(className):serviceName,
+                targetNamespace,
+                targetNamespacePrefix).generateWOM();
+        
         WOMWriter womWriter = WOMWriterFactory.createWriter(org.apache.wsdl.WSDLConstants.WSDL_1_1);
-        womWriter.setdefaultWSDLPrefix("wsdl");
+        womWriter.setdefaultWSDLPrefix(wsdlPrefix);
         womWriter.writeWOM(wommodel, out);
 
     }
 
+    /**
+     * A method to strip the fully qualified className to a simple classname
+     * @param qualifiedName
+     * @return
+     */
     private String simpleClassName(String qualifiedName) {
         int index = qualifiedName.lastIndexOf(".");
         if (index > 0) {

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaGenerator.java (from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaGenerator.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaGenerator.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java&r1=373081&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaGenerator.java Sun Jan 29 20:39:37 2006
@@ -1,6 +1,6 @@
-package org.apache.axis2.wsdl.java2wsdl;
+package org.apache.axis2.wsdl.builder;
 
-import org.apache.axis2.wsdl.java2wsdl.bytecode.MethodTable;
+import org.apache.axis2.wsdl.builder.bytecode.MethodTable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.schema.*;

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/TypeTable.java (from r373081, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/TypeTable.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/TypeTable.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/TypeTable.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/TypeTable.java&r1=373081&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/TypeTable.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/TypeTable.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl;
+package org.apache.axis2.wsdl.builder;
 
 import org.apache.axis2.om.OMElement;
 

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ChainedParamReader.java (from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ChainedParamReader.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ChainedParamReader.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ChainedParamReader.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ChainedParamReader.java&r1=373421&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ChainedParamReader.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ChainedParamReader.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl.bytecode;
+package org.apache.axis2.wsdl.builder.bytecode;
 
 import java.io.IOException;
 import java.lang.reflect.Constructor;

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ClassReader.java (from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ClassReader.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ClassReader.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ClassReader.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ClassReader.java&r1=373421&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ClassReader.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ClassReader.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl.bytecode;
+package org.apache.axis2.wsdl.builder.bytecode;
 
 import org.apache.axis2.i18n.Messages;
 

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/MethodTable.java (from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/MethodTable.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/MethodTable.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/MethodTable.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/MethodTable.java&r1=373421&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/MethodTable.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/MethodTable.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl.bytecode;
+package org.apache.axis2.wsdl.builder.bytecode;
 
 import java.lang.reflect.Method;
 import java.util.HashMap;

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamNameExtractor.java (from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamNameExtractor.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamNameExtractor.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamNameExtractor.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamNameExtractor.java&r1=373421&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamNameExtractor.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamNameExtractor.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl.bytecode;
+package org.apache.axis2.wsdl.builder.bytecode;
 
 import org.apache.axis2.i18n.Messages;
 import org.apache.commons.logging.Log;

Copied: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamReader.java (from r373421, webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamReader.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamReader.java?p2=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamReader.java&p1=webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamReader.java&r1=373421&r2=373431&rev=373431&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/bytecode/ParamReader.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/bytecode/ParamReader.java Sun Jan 29 20:39:37 2006
@@ -1,4 +1,4 @@
-package org.apache.axis2.wsdl.java2wsdl.bytecode;
+package org.apache.axis2.wsdl.builder.bytecode;
 
 import org.apache.axis2.i18n.Messages;
 



Mime
View raw message