You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2006/07/06 15:57:22 UTC

svn commit: r419555 [1/2] - in /webservices/axis2/trunk/java: etc/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb/src/org/apache/axis2/databinding/ modules/codegen/src/org/apache/a...

Author: ajith
Date: Thu Jul  6 06:57:21 2006
New Revision: 419555

URL: http://svn.apache.org/viewvc?rev=419555&view=rev
Log:
1. Updated the XMLSchema dependancy to SNAPSHOT
2. Added preliminary unwrapping support. Uunwrapping cannot be switched from options yet and supports only ADB for the time.
  I. Modified the SchemaCompiler.java to populate the XMLSchema metadata sections according to the generated classes
  II. Modified the ExtensionUtility.java to populate the type map according to the unwrapping status.
  III. Updated the templates.
3. Fixed a few issues in the WSDL11ToAxisServiceBuilder.java regarding the wrapping algorithm
4. Added comments and other documentation in necessary places

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/TypeTesterUtil.java
Modified:
    webservices/axis2/trunk/java/etc/project.properties
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLUtil.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java

Modified: webservices/axis2/trunk/java/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/etc/project.properties?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/etc/project.properties (original)
+++ webservices/axis2/trunk/java/etc/project.properties Thu Jul  6 06:57:21 2006
@@ -131,7 +131,7 @@
 xbean.version=2.1.0
 xerces.version=2.7.1
 xml_apis.version=1.3.02
-XmlSchema.version=1.0.2
+XmlSchema.version=SNAPSHOT
 xmlsec.version=1.3.0
 xmlunit.version=1.0
 log4j.version=1.2.13

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java Thu Jul  6 06:57:21 2006
@@ -5,6 +5,18 @@
 import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
 import org.apache.axis2.wsdl.util.Constants;
+import org.apache.axis2.wsdl.WSDLUtil;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisMessage;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchema;
 
 import javax.xml.namespace.QName;
 import java.util.Map;
@@ -29,12 +41,19 @@
  */
 
 /**
- * This is the utility for the extension to call
+ * This is the utility for the extension to call by reflection.
  */
 public class ExtensionUtility {
 
-    public static void invoke(CodeGenConfiguration configuration) throws Exception{
+    public static void invoke(CodeGenConfiguration configuration) throws Exception {
         List schemaList = configuration.getAxisService().getSchema();
+
+        //hashmap that keeps the targetnamespace and the xmlSchema object
+        //this is a convenience to locate the relevant schema quickly
+        //by looking at the target namespace
+        Map schemaMap = new HashMap();
+        populateSchemaMap(schemaMap, schemaList);
+
         if (schemaList == null || schemaList.isEmpty()) {
             //there are no types to be code generated
             //However if the type mapper is left empty it will be a problem for the other
@@ -46,12 +65,12 @@
         CompilerOptions options = new CompilerOptions();
 
         //set the default options
-        populateDefaultOptions(options,configuration);
+        populateDefaultOptions(options, configuration);
 
         //set the user parameters. the user parameters get the preference over
         //the default ones. But the user better know what he's doing if he
         //used module specific parameters
-        populateUserparameters(options,configuration);
+        populateUserparameters(options, configuration);
 
         SchemaCompiler schemaCompiler = new SchemaCompiler(options);
         // run the schema compiler
@@ -60,11 +79,11 @@
         //create the type mapper
         //First try to take the one that is already there
         TypeMapper mapper = configuration.getTypeMapper();
-        if (mapper==null){
-            mapper =new JavaTypeMapper();
+        if (mapper == null) {
+            mapper = new JavaTypeMapper();
         }
-        
-        if (options.isWriteOutput()){
+
+        if (options.isWriteOutput()) {
             //get the processed element map and transfer it to the type mapper
             Map processedMap = schemaCompiler.getProcessedElementMap();
             Iterator processedkeys = processedMap.keySet().iterator();
@@ -74,7 +93,7 @@
                 mapper.addTypeMappingName(qNameKey, processedMap.get(qNameKey).toString());
             }
 
-        }else{
+        } else {
             //get the processed model map and transfer it to the type mapper
             //since the options mentiond that its not writable, it should have
             //populated the model map
@@ -101,41 +120,174 @@
 
         }
 
+        //process the unwrapped parameters
+        if (!configuration.isParametersWrapped()) {
+            //figure out the unwrapped operations
+            AxisService axisService = configuration.getAxisService();
+
+            for (Iterator operations = axisService.getOperations();
+                 operations.hasNext();) {
+                AxisOperation op = (AxisOperation) operations.next();
+                if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
+                    walkSchema(op.getMessage(
+                            WSDLConstants.MESSAGE_LABEL_IN_VALUE),
+                            configuration,
+                            mapper,
+                            schemaMap,
+                            op.getName().getLocalPart());
+                }
+
+
+            }
+        }
+
         //set the type mapper to the config
         configuration.setTypeMapper(mapper);
 
     }
 
     /**
+     * Populate the schema objects into the
      *
+     * @param schemaMap
+     * @param schemaList
+     */
+    private static void populateSchemaMap(Map schemaMap, List schemaList) {
+        for (int i = 0; i < schemaList.size(); i++) {
+            XmlSchema xmlSchema = (XmlSchema) schemaList.get(i);
+            schemaMap.put(xmlSchema.getTargetNamespace(), xmlSchema);
+        }
+    }
+
+    /**
+     * @param message
+     * @param configuration
+     * @param mapper
+     */
+    private static void walkSchema(AxisMessage message,
+                                   CodeGenConfiguration configuration,
+                                   TypeMapper mapper,
+                                   Map schemaMap,
+                                   String opName) {
+
+        if (message.getParameter(Constants.UNWRAPPED_KEY) != null) {
+            XmlSchemaType schemaType = message.getSchemaElement().getSchemaType();
+            //create a type mapper
+            if (schemaType instanceof XmlSchemaComplexType) {
+                XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
+                XmlSchemaParticle particle = cmplxType.getParticle();
+                if (particle instanceof XmlSchemaSequence) {
+                    XmlSchemaObjectCollection items =
+                            ((XmlSchemaSequence) particle).getItems();
+                    for (Iterator i = items.getIterator(); i.hasNext();) {
+                        Object item = i.next();
+                        // get each and every element in the sequence and
+                        // traverse through them
+                        if (item instanceof XmlSchemaElement) {
+                            //populate the map with the partname - class name
+                            //attached to the schema element
+                            XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) item;
+                            XmlSchemaType eltSchemaType = xmlSchemaElement.getSchemaType();
+                            if (eltSchemaType != null) {
+                                //there is a schema type object.We can utilize that
+                                populateClassName(eltSchemaType,mapper,opName,xmlSchemaElement.getName());
+                            } else if (xmlSchemaElement.getSchemaTypeName() != null) {
+                                //there is no schema type object but there is a
+                                //schema type QName.  Use that Qname to look up the
+                                //schematype in other schema objects
+                                eltSchemaType = findSchemaType(schemaMap,
+                                        xmlSchemaElement.getSchemaTypeName());
+                                if (eltSchemaType!=null){
+                                    populateClassName(eltSchemaType,mapper,opName,xmlSchemaElement.getName());
+                                }
+
+
+                            }
+                        }
+
+                    }
+
+                }
+            }
+        }
+    }
+
+    /**
+     * Util method to populate the class name into the typeMap
+     * @param eltSchemaType
+     */
+    private static void populateClassName(XmlSchemaType eltSchemaType,
+                                          TypeMapper typeMap,
+                                          String opName,
+                                          String partName) {
+
+        Map metaInfoMap = eltSchemaType.getMetaInfoMap();
+
+        if (metaInfoMap != null) {
+            String className = (String) metaInfoMap.
+                    get(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY);
+
+            QName partQName = WSDLUtil.getPartQName(opName,
+                    WSDLConstants.INPUT_PART_QNAME_SUFFIX,
+                    partName);
+            typeMap.addTypeMappingName(partQName,className);
+            if (Boolean.TRUE.equals(
+                    metaInfoMap.get(SchemaConstants.
+                    SchemaCompilerInfoHolder.CLASSNAME_PRIMITVE_KEY))){
+
+                //this type is primitive - add that to the type mapper status
+                //for now lets add a boolean
+                typeMap.addTypeMappingStatus(partQName,Boolean.TRUE);
+            }
+
+        }
+    }
+
+    /**
+     * Look for a given schema type given the schema type Qname
+     * @param schemaMap
+     * @param namespaceURI
+     * @return null if the schema is not found
+     */
+    private static XmlSchemaType findSchemaType(Map schemaMap, QName schemaTypeName) {
+        //find the schema
+        XmlSchema schema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI());
+        if (schema!=null){
+             return schema.getTypeByName(schemaTypeName);
+        }
+        return null;
+    }
+
+    /**
+     * populate parameters from the user
      * @param options
      */
-    private static void populateUserparameters(CompilerOptions options,CodeGenConfiguration configuration){
+    private static void populateUserparameters(CompilerOptions options, CodeGenConfiguration configuration) {
         Map propertyMap = configuration.getProperties();
-        if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.WRAP_SCHEMA_CLASSES)){
+        if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.WRAP_SCHEMA_CLASSES)) {
             if (Boolean.valueOf(
                     propertyMap.get(SchemaConstants.SchemaCompilerArguments.WRAP_SCHEMA_CLASSES).toString()).
                     booleanValue()) {
                 options.setWrapClasses(true);
-            }else{
+            } else {
                 options.setWrapClasses(false);
             }
         }
 
-        if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.WRITE_SCHEMA_CLASSES)){
+        if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.WRITE_SCHEMA_CLASSES)) {
             if (Boolean.valueOf(
                     propertyMap.get(SchemaConstants.SchemaCompilerArguments.WRITE_SCHEMA_CLASSES).toString()).
                     booleanValue()) {
                 options.setWriteOutput(true);
-            }else{
+            } else {
                 options.setWriteOutput(false);
             }
         }
 
         // add the custom package name
-        if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.PACKAGE)){
-            String packageName = (String)propertyMap.get(SchemaConstants.SchemaCompilerArguments.PACKAGE);
-            if (packageName!=null || !"".equals(packageName)){
+        if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.PACKAGE)) {
+            String packageName = (String) propertyMap.get(SchemaConstants.SchemaCompilerArguments.PACKAGE);
+            if (packageName != null || !"".equals(packageName)) {
                 options.setPackageName(packageName);
             }
 
@@ -144,33 +296,33 @@
 
 
     /**
-     *
+     * populate the default options - called before the applying of user parameters
      * @param options
      */
-    private static void populateDefaultOptions(CompilerOptions options,CodeGenConfiguration configuration) {
+    private static void populateDefaultOptions(CompilerOptions options, CodeGenConfiguration configuration) {
         //create the output directory
-        File outputDir =  configuration.isFlattenFiles()?
-                          configuration.getOutputLocation():
-                          new File(configuration.getOutputLocation(),"src");
-        
-        if(!outputDir.exists()) {
+        File outputDir = configuration.isFlattenFiles() ?
+                configuration.getOutputLocation() :
+                new File(configuration.getOutputLocation(), "src");
+
+        if (!outputDir.exists()) {
             outputDir.mkdirs();
         }
 
         /// these options need to be taken from the command line
         options.setOutputLocation(outputDir);
-        options.setNs2PackageMap(configuration.getUri2PackageNameMap()==null?
-                new HashMap():
+        options.setNs2PackageMap(configuration.getUri2PackageNameMap() == null ?
+                new HashMap() :
                 configuration.getUri2PackageNameMap());
 
         //default setting is to set the wrap status depending on whether it's
         //the server side or the client side
-        if (configuration.isServerSide()){
+        if (configuration.isServerSide()) {
             //for the serverside we generate unwrapped  by default
             options.setWrapClasses(false);
             //for the serverside we write the output by default
             options.setWriteOutput(true);
-        }else{
+        } else {
             // for the client let the users preference be the word here
             options.setWrapClasses(configuration.isPackClasses());
             //for the client side the default setting is not to write the

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Thu Jul  6 06:57:21 2006
@@ -188,13 +188,13 @@
      */
     public void compile(List schemalist) throws SchemaCompilationException {
 
-        
+
         try {
-             //clear the loaded and available maps
+            //clear the loaded and available maps
             loadedSchemaMap.clear();
             availableSchemaMap.clear();
 
-             XmlSchema schema;
+            XmlSchema schema;
             // first round - populate the avaialble map
             for (int i = 0; i < schemalist.size(); i++) {
                 schema = (XmlSchema) schemalist.get(i);
@@ -358,6 +358,9 @@
 
 
         String writtenClassName = writer.write(xsElt, processedTypemap, metainf);
+        //register the class name
+        xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                writtenClassName);
         processedElementMap.put(xsElt.getQName(), writtenClassName);
     }
 
@@ -415,11 +418,24 @@
             //later
 
             if (!isOuter) {
-
                 if (schemaType.getName()!=null){
                     // this element already has a name. Which means we can directly
                     // register it
-                    innerElementMap.put(xsElt.getQName(), findClassName(schemaType.getQName(), isArray(xsElt)));
+                    String className = findClassName(schemaType.getQName(),
+                            isArray(xsElt));
+
+                    innerElementMap.put(xsElt.getQName(), className);
+
+                    //store in the schema map
+                    schemaType.addMetaInfo(
+                            SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                            className);
+
+                    if (baseSchemaTypeMap.containsValue(className)){
+                        schemaType.addMetaInfo(
+                                SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_PRIMITVE_KEY,
+                                Boolean.TRUE);
+                    }
                     //since this is a inner element we should add it to the inner element map
                 }else{
                     //this is an anon type. This should have been already processed and registered at
@@ -436,21 +452,28 @@
                                 null);
                         //remove the reference from the anon list since we named the type
                         processedAnonymousComplexTypesMap.remove(xsElt);
+                        String className = findClassName(schemaType.getQName(), isArray(xsElt));
                         innerElementMap.put(
                                 xsElt.getQName(),
-                                findClassName(schemaType.getQName(), isArray(xsElt)));
+                                className);
+
+                        //store in the schema map
+                        xsElt.addMetaInfo(
+                                SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                                className);
                     }
                 }
             }else{
                 this.processedElementList.add(xsElt.getQName());
             }
-
+            //referenced name
         }else if (xsElt.getRefName()!=null){
 
             //process the referenced type. It could be thought that the referenced element replaces this
             //element
+            XmlSchema currentParentSchema = resolveParentSchema(xsElt.getRefName(),parentSchema);
+            XmlSchemaElement referencedElement = currentParentSchema.getElementByName(xsElt.getRefName());
 
-            XmlSchemaElement referencedElement = parentSchema.getElementByName(xsElt.getRefName());
             //if the element is referenced, then it should be one of the outer (global) ones
             processElement(referencedElement, parentSchema);
 
@@ -462,10 +485,13 @@
                 String className = findClassName(referencedElement.getSchemaTypeName(), isArray(xsElt));
                 //if this element is referenced, there's no QName for this element
                 this.processedElementRefMap.put(referenceEltQName, className);
+
+                referencedElement.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                        className);
             }else{
                 //this referenced element has an anon type and that anon type has been already
                 //processed. But in this case we need it to be a seperate class since this
-                // complextype has to be added as an attribute in a class.
+                //complextype has to be added as an attribute in a class.
                 //generate a name for this type
                 QName generatedTypeName = generateTypeQName(referenceEltQName, parentSchema);
                 XmlSchemaType referenceSchemaType = referencedElement.getSchemaType();
@@ -486,7 +512,7 @@
                     ));
                 }
             }
-
+            // schema type name is present but not the schema type object
         }else if (xsElt.getSchemaTypeName()!=null){
             //There can be instances where the SchemaType is null but the schemaTypeName is not!
             //this specifically happens with xsd:anyType.
@@ -535,7 +561,7 @@
      * @return
      */
     private XmlSchema resolveParentSchema(QName schemaTypeName,XmlSchema currentSchema)
-      throws SchemaCompilationException{
+            throws SchemaCompilationException{
         String targetNamespace = schemaTypeName.getNamespaceURI();
         Object loadedSchema = loadedSchemaMap.get(targetNamespace);
         if (loadedSchema!=null){
@@ -651,7 +677,8 @@
             }
         } else if (schemaType instanceof XmlSchemaSimpleType) {
             //process simple type
-            processSimpleSchemaType((XmlSchemaSimpleType) schemaType);
+            processSimpleSchemaType((XmlSchemaSimpleType) schemaType,
+                    xsElt);
         }
     }
 
@@ -684,6 +711,10 @@
         String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(complexType.getQName());
         processedTypemap.put(complexType.getQName(), fullyQualifiedClassName);
 
+        //register that in the schema metainfo bag
+        complexType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                fullyQualifiedClassName);
+
         BeanWriterMetaInfoHolder metaInfHolder = processComplexType(complexType,parentSchema);
 
         //write the class. This type mapping would have been populated right now
@@ -787,7 +818,7 @@
                     }
                 } else if (type instanceof XmlSchemaSimpleType) {
                     //process simple type
-                    processSimpleSchemaType((XmlSchemaSimpleType)type);
+                    processSimpleSchemaType((XmlSchemaSimpleType)type,null);
                 }
             }
 
@@ -1117,7 +1148,8 @@
      *
      * @param simpleType
      */
-    private void processSimpleSchemaType(XmlSchemaSimpleType simpleType) throws SchemaCompilationException{
+    private void processSimpleSchemaType(XmlSchemaSimpleType simpleType,
+                                         XmlSchemaElement xsElt) throws SchemaCompilationException{
         // handle the restriction
         XmlSchemaSimpleTypeContent content = simpleType.getContent();
         if (content != null) {
@@ -1132,10 +1164,17 @@
                     this.simpleTypesMap.put(simpleType.getQName(), className);
                     //set the old schema type QName and the new schema type QName
                     this.changedTypeMap.put(simpleType.getQName(), baseTypeName);
+                    //add the class name to the meta info map
+                    simpleType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                            className);
+
+                    //add an additional flag saying that this is a primitive type
+                    simpleType.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_PRIMITVE_KEY,
+                            Boolean.TRUE);
                 } else {
                     //recurse
                     if (restriction.getBaseType() != null) {
-                        processSimpleSchemaType(restriction.getBaseType());
+                        processSimpleSchemaType(restriction.getBaseType(),xsElt);
                     }
                 }
             }else if (content instanceof XmlSchemaSimpleTypeUnion) {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java Thu Jul  6 06:57:21 2006
@@ -106,4 +106,9 @@
         public static final String PACKAGE = "p";
 
     }
+
+    public static class SchemaCompilerInfoHolder{
+        public static final String CLASSNAME_KEY = "CLASS_NAME";
+        public static final String CLASSNAME_PRIMITVE_KEY = "CLASS_NAME_PRIMITIVE";
+    }
 }

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl Thu Jul  6 06:57:21 2006
@@ -1,73 +1,110 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="text"/>
-<!-- #################################################################################  -->
-       <!-- ############################   ADB template   ##############################  -->
-       <xsl:template match="databinders[@dbtype='adb']">
-
-            <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
-            <xsl:if test="$base64">
-                private static javax.xml.namespace.QName[] qNameArray = {
-                <xsl:for-each select="base64Elements/name">
-                    <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
-                </xsl:for-each>
-                };
-            </xsl:if>
+    <!-- #################################################################################  -->
+    <!-- ############################   ADB template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='adb']">
+
+        <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
+        <xsl:if test="$base64">
+            private static javax.xml.namespace.QName[] qNameArray = {
+            <xsl:for-each select="base64Elements/name">
+                <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
+            </xsl:for-each>
+            };
+        </xsl:if>
+        <!--  generate toOM for only non parts - this is WRONG!!!! -->
+        <xsl:for-each select="param[@type!='' and not(@primitive)]">
+            private  org.apache.axiom.om.OMElement  toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent){
+            return param.getOMElement(param.MY_QNAME,
+            org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+            }
+        </xsl:for-each>
 
-            <xsl:for-each select="param">
-                <xsl:if test="@type!=''">
-                    private  org.apache.axiom.om.OMElement  toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent){
-                        if (param instanceof org.apache.axis2.databinding.ADBBean){
-                     return param.getOMElement(param.MY_QNAME,
-                                 org.apache.axiom.om.OMAbstractFactory.getOMFactory());
-                        }else{
-                           <!-- treat this as a plain bean. use the reflective bean converter -->
-                           //todo finish this onece the bean serializer has the necessary methods
-                            return null;
-                        }
+        <xsl:for-each select="opnames/name">
+            <xsl:variable name="opname"><xsl:value-of select="."/></xsl:variable>
+            <xsl:variable name="opnsuri"><xsl:value-of select="@opnsuri"/></xsl:variable>
+            <xsl:choose>
+                <xsl:when test="count(../../param[@type!='' and @direction='in' and @opname=$opname])=1">
+                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"/> param, boolean optimizeContent){
+                    //note - optimize content is not used here !
+                    org.apache.axis2.databinding.ADBSOAPModelBuilder builder =
+                    new org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(<xsl:value-of select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"/>.MY_QNAME),
+                    factory);
+                    return builder.getEnvelope();
                     }
+                </xsl:when>
+                <xsl:when test="count(../../param[@type!='' and @direction='in' and @opname=$opname]) &gt; 1">
+                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
+                    <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]"><xsl:value-of select="@type"/> param<xsl:value-of select="position()"/>,</xsl:for-each>
+                    boolean optimizeContent){
+                    org.apache.axiom.om.OMElement elt;
+                    //make the OMfactory and generate the wrapper element
+                    org.apache.axiom.om.OMFactory fac = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
+                    org.apache.axiom.om.OMElement wrapperElt =
+                    fac.createOMElement("<xsl:value-of select="$opname"/>","<xsl:value-of select="$opnsuri"/>",null);
+                    <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]">
+                        elt = fac.createOMElement("<xsl:value-of select="@partname"/>","",null);
+                        // add the value here
+                        <xsl:choose>
+                            <xsl:when test="@primitive">
+                                elt.setText(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(param<xsl:value-of select="position()"/>));
+                            </xsl:when>
+                            <xsl:otherwise>
+                                elt.addChild(param.getOMElement(param.MY_QNAME,
+                                org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        wrapperElt.appendChild(elt);
+                    </xsl:for-each>
+
+                    org.apache.axis2.databinding.ADBSOAPModelBuilder builder =
+                    new org.apache.axis2.databinding.ADBSOAPModelBuilder(wrapperElt.getXMLStreamReader(),
+                    factory);
+                    return builder.getEnvelope();
 
-                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param, boolean optimizeContent){
-                        if (param instanceof org.apache.axis2.databinding.ADBBean){
-                            org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new
-                                    org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(<xsl:value-of select="@type"/>.MY_QNAME),
-                                                                                     factory);
-                            return builder.getEnvelope();
-                        }else{
-                           <!-- treat this as a plain bean. use the reflective bean converter -->
-                           //todo finish this onece the bean serializer has the necessary methods
-                            return null;
-                        }
                     }
-                </xsl:if>
-            </xsl:for-each>
-
-           /**
-           *  get the default envelope
-           */
-           private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
-                return factory.getDefaultEnvelope();
-           }
-
-
-            private  java.lang.Object fromOM(
-            org.apache.axiom.om.OMElement param,
-            java.lang.Class type,
-            java.util.Map extraNamespaces){
-
-                try {
-                       <xsl:for-each select="param">
-                              <xsl:if test="@type!=''">
-                      if (<xsl:value-of select="@type"/>.class.equals(type)){
-                           return <xsl:value-of select="@type"/>.Factory.parse(param.getXMLStreamReaderWithoutCaching());
-                      }
-                              </xsl:if>
-                     </xsl:for-each>
-                } catch (Exception e) {
-                     throw new RuntimeException(e);
+                </xsl:when>
+               <xsl:otherwise>
+                    /**
+                    *  get the default envelope
+                    */
+                    private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
+                    return factory.getDefaultEnvelope();
+                    }
+                </xsl:otherwise>
+            </xsl:choose>
+             <xsl:choose>
+			      <xsl:when test="count(../../param[@type!='' and @direction='out' and @opname=$opname])=1">
+                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/> param, boolean optimizeContent){
+                    //note - optimize content is not used here !
+                    org.apache.axis2.databinding.ADBSOAPModelBuilder builder =
+                    new org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(<xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME),
+                    factory);
+                    return builder.getEnvelope();
+                    }
+                </xsl:when>
+	   </xsl:choose>
+        </xsl:for-each>
+
+        private  java.lang.Object fromOM(
+        org.apache.axiom.om.OMElement param,
+        java.lang.Class type,
+        java.util.Map extraNamespaces){
+
+        try {
+        <xsl:for-each select="param[not(@primitive)]">
+            <xsl:if test="@type!=''">
+                if (<xsl:value-of select="@type"/>.class.equals(type)){
+                return <xsl:value-of select="@type"/>.Factory.parse(param.getXMLStreamReaderWithoutCaching());
                 }
+            </xsl:if>
+        </xsl:for-each>
+        } catch (Exception e) {
+        throw new RuntimeException(e);
+        }
 
-                return null;
-            }
+        return null;
+        }
 
-        </xsl:template>
- </xsl:stylesheet>
\ No newline at end of file
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java Thu Jul  6 06:57:21 2006
@@ -1,19 +1,19 @@
-/*
-* 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.
-*/
-
+/*
+* 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.
+*/
+
 package org.apache.axis2.databinding;
 
 import org.apache.axiom.soap.SOAPConstants;
@@ -29,6 +29,7 @@
  * Builds a SOAPEnvelope around an ADB pull parser
  */
 public class ADBSOAPModelBuilder extends StAXSOAPModelBuilder {
+    
     public ADBSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory) {
         super(new Envelope(parser).
                 getPullParser(

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Thu Jul  6 06:57:21 2006
@@ -85,7 +85,7 @@
 
 
     /**
-     * Determines whether the parameters are wrappedor unwrapped
+     * Determines whether the parameters are wrapped or unwrapped
      * true by default
      */
     private boolean parametersWrapped = true;

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Thu Jul  6 06:57:21 2006
@@ -49,6 +49,7 @@
 import org.apache.axis2.wsdl.util.Constants;
 import org.apache.axis2.wsdl.util.XSLTIncludeResolver;
 import org.apache.axis2.wsdl.util.MessagePartInformationHolder;
+import org.apache.axis2.wsdl.util.TypeTesterUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -57,6 +58,7 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.Text;
+//import com.ibm.wsdl.util.xml.DOM2Writer;
 
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
@@ -176,28 +178,27 @@
         infoHolder = new HashMap();
     }
 
+    /**
+     * Sets the relevant codegen configuration
+     * @see Emitter#setCodeGenConfiguration(org.apache.axis2.wsdl.codegen.CodeGenConfiguration)
+     * @param configuration
+     */
     public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
         this.codeGenConfiguration = configuration;
         this.axisService = codeGenConfiguration.getAxisService();
         resolver = new XSLTIncludeResolver(codeGenConfiguration);
     }
 
+    /**
+     * Sets the type mapper
+     * @see Emitter#setMapper(org.apache.axis2.wsdl.databinding.TypeMapper)
+     * @param mapper
+     */
     public void setMapper(TypeMapper mapper) {
         this.mapper = mapper;
     }
 
 
-    /**
-     * @see org.apache.axis2.wsdl.codegen.emitter.Emitter#emitStub()
-     */
-    public void emitStub() throws CodeGenerationException {
-
-        try {
-            emitStubFromService();
-        } catch (Exception e) {
-            throw new CodeGenerationException(e);
-        }
-    }
 
     /**
      * Update mapper for the stub
@@ -206,6 +207,11 @@
         updateMapperClassnames(getFullyQualifiedStubName());
     }
 
+    /**
+     * Returns the fully qualified Stub name
+     * reused in many methods
+     * @return
+     */
     protected String getFullyQualifiedStubName() {
         String packageName = codeGenConfiguration.getPackageName();
         String localPart = makeJavaClassName(axisService.getName());
@@ -213,7 +219,7 @@
     }
 
     /**
-     *
+     * rests the fault name maps
      */
     protected void resetFaultNames() {
         fullyQualifiedFaultClassNameMap.clear();
@@ -262,54 +268,58 @@
 
     /**
      * Emits the stubcode with bindings.
-     *
+     * @see org.apache.axis2.wsdl.codegen.emitter.Emitter#emitStub()
      * @throws Exception
      */
-    protected void emitStubFromService() throws Exception {
-
-        // see the comment at updateMapperClassnames for details and reasons for
-        // calling this method
-        if (mapper.isObjectMappingPresent()) {
-            updateMapperForStub();
-        } else {
-            copyToFaultMap();
-        }
+    public void emitStub() throws CodeGenerationException {
+        try{
+            // see the comment at updateMapperClassnames for details and reasons for
+            // calling this method
+            if (mapper.isObjectMappingPresent()) {
+                updateMapperForStub();
+            } else {
+                copyToFaultMap();
+            }
 
-        //generate and populate the fault names before hand. We need that for
-        //the smooth opration of the thing
-        //first reset the fault names and recreate it
-        resetFaultNames();
-        generateAndPopulateFaultNames();
-        updateFaultPackageForStub();
-
-        // write the inteface
-        // feed the binding information also
-        // note that we do not create this interface if the user switched on the wrap classes mode
-        if (!codeGenConfiguration.isPackClasses()) {
-            writeInterface(false);
-        }
-
-        // write the call back handlers
-        writeCallBackHandlers();
-
-        // write interface implementations
-        writeInterfaceImplementation();
-
-        // write the test classes
-        writeTestClasses();
-
-        // write an ant build file
-        // Note that ant build is generated only once
-        // and that has to happen here only if the
-        // client side code is required
-        if (!codeGenConfiguration.isGenerateAll()) {
-            //our logic for the build xml is that it will
-            //only be written when not flattened
-            if (!codeGenConfiguration.isFlattenFiles()) {
-                writeAntBuild();
+            //generate and populate the fault names before hand. We need that for
+            //the smooth opration of the thing
+            //first reset the fault names and recreate it
+            resetFaultNames();
+            generateAndPopulateFaultNames();
+            updateFaultPackageForStub();
+
+            // write the inteface
+            // feed the binding information also
+            // note that we do not create this interface if the user switched on the wrap classes mode
+            if (!codeGenConfiguration.isPackClasses()) {
+                writeInterface(false);
+            }
+
+            // write the call back handlers
+            writeCallBackHandlers();
+
+            // write interface implementations
+            writeInterfaceImplementation();
+
+            // write the test classes
+            writeTestClasses();
+
+            // write an ant build file
+            // Note that ant build is generated only once
+            // and that has to happen here only if the
+            // client side code is required
+            if (!codeGenConfiguration.isGenerateAll()) {
+                //our logic for the build xml is that it will
+                //only be written when not flattened
+                if (!codeGenConfiguration.isFlattenFiles()) {
+                    writeAntBuild();
+                }
             }
+        }catch(CodeGenerationException ce){
+            throw ce;
+        }catch(Exception e){
+            throw new CodeGenerationException(e);
         }
-
     }
 
     /**
@@ -372,6 +382,10 @@
         }
     }
 
+    /**
+     * Creates the XML Model for the test case
+     * @return
+     */
     protected Document createDOMDocumentForTestCase() {
         String coreClassName = makeJavaClassName(axisService.getName());
         Document doc = getEmptyDocument();
@@ -485,9 +499,19 @@
 
 
         doc.appendChild(rootElement);
+
+        //////////////////////////////////////////////////////////
+        //System.out.println(DOM2Writer.nodeToString(rootElement));
+        ////////////////////////////////////////////////////////////
         return doc;
     }
 
+    /**
+     * A util method that returns a unique list of faults
+     *
+     * @param doc
+     * @return
+     */
     protected Element getUniqueListofFaults(Document doc) {
         Element rootElement = doc.createElement("fault-list");
         Element faultElement;
@@ -674,18 +698,6 @@
     }
 
 
-    /**
-     * Emit the skeltons
-     *
-     * @throws CodeGenerationException
-     */
-    public void emitSkeleton() throws CodeGenerationException {
-        try {
-            emitSkeletonService();
-        } catch (Exception e) {
-            throw new CodeGenerationException(e);
-        }
-    }
 
     /**
      * Update mapper for message receiver
@@ -713,43 +725,52 @@
     }
 
     /**
+     * Emits the skeleton
      * @throws Exception
      */
-    protected void emitSkeletonService() throws Exception {
-        // see the comment at updateMapperClassnames for details and reasons for
-        // calling this method
-        if (mapper.isObjectMappingPresent()) {
-            updateMapperForMessageReceiver();
-        } else {
-            copyToFaultMap();
-        }
+    public void emitSkeleton() throws CodeGenerationException {
 
-        //handle faults
-        generateAndPopulateFaultNames();
-        updateFaultPackageForSkeleton();
+        try{
+            // see the comment at updateMapperClassnames for details and reasons for
+            // calling this method
+            if (mapper.isObjectMappingPresent()) {
+                updateMapperForMessageReceiver();
+            } else {
+                copyToFaultMap();
+            }
 
-        if (codeGenConfiguration.isServerSideInterface()) {
-            //write skeletonInterface
-            writeSkeletonInterface();
-        }
-        // write skeleton
-        writeSkeleton();
+            //handle faults
+            generateAndPopulateFaultNames();
+            updateFaultPackageForSkeleton();
 
-        // write a MessageReceiver for this particular service.
-        writeMessageReceiver();
+            if (codeGenConfiguration.isServerSideInterface()) {
+                //write skeletonInterface
+                writeSkeletonInterface();
+            }
+            // write skeleton
+            writeSkeleton();
 
-        // write interface implementations
-        writeServiceXml();
+            // write a MessageReceiver for this particular service.
+            writeMessageReceiver();
 
-        //write the ant build
-        //we skip this for the flattened case
-        if (!codeGenConfiguration.isFlattenFiles()) {
-            writeAntBuild();
-        }
+            // write interface implementations
+            writeServiceXml();
 
-        //for the server side codegen
-        //we need to serialize the WSDL's
-        writeWSDLFiles();
+            //write the ant build
+            //we skip this for the flattened case
+            if (!codeGenConfiguration.isFlattenFiles()) {
+                writeAntBuild();
+            }
+
+            //for the server side codegen
+            //we need to serialize the WSDL's
+            writeWSDLFiles();
+
+        }catch(CodeGenerationException cgExp){
+            throw cgExp;
+        }catch(Exception e){
+            throw new CodeGenerationException(e);
+        }
     }
 
     /**
@@ -808,6 +829,9 @@
 
     }
 
+    /**
+     * Utility method to copy the faults to the correct map
+     */
     protected void copyToFaultMap() {
         Map classNameMap = mapper.getAllMappedNames();
         Iterator keys = classNameMap.keySet().iterator();
@@ -819,7 +843,7 @@
     }
 
     /**
-     *
+     *  Change the fault classnames to go with the package and stub
      */
     protected void updateFaultPackageForStub() {
         Iterator faultClassNameKeys = fullyQualifiedFaultClassNameMap.keySet().iterator();
@@ -836,7 +860,9 @@
     }
 
     /**
-     *
+     *  Change the fault classnames to go with the package & class of the
+     *  skeleton
+     *  the faults are always generated as inner types
      */
     protected void updateFaultPackageForSkeleton() {
         Iterator faultClassNameKeys = fullyQualifiedFaultClassNameMap.keySet().iterator();
@@ -853,6 +879,7 @@
     }
 
     /**
+     * Writes the message receiver
      * @throws Exception
      */
     protected void writeMessageReceiver() throws Exception {
@@ -881,6 +908,12 @@
         }
     }
 
+    /**
+     * Creates the XML model for the message receiver
+     * @param mep
+     * @param isServerSideInterface
+     * @return
+     */
     protected Document createDocumentForMessageReceiver(String mep, boolean isServerSideInterface) {
 
         Document doc = getEmptyDocument();
@@ -926,11 +959,15 @@
 
         doc.appendChild(rootElement);
 
+        //////////////////////////////////////////////////////////
+        //System.out.println(DOM2Writer.nodeToString(rootElement));
+        ////////////////////////////////////////////////////////////
+
         return doc;
     }
 
     /**
-     * create a dom doc for databinders
+     * create a dom element for databinders
      *
      * @param doc
      */
@@ -938,9 +975,8 @@
 
         // First Iterate through the operations and find the relevant fromOM and toOM methods to be generated
         Map parameterMap = new HashMap();
-        Iterator operationsIterator = axisService.getOperations();
 
-        while (operationsIterator.hasNext()) {
+        for (Iterator operationsIterator = axisService.getOperations();operationsIterator.hasNext();) {
             AxisOperation axisOperation = (AxisOperation) operationsIterator.next();
             // Add the parameters to a map with their type as the key
             // this step is needed to remove repetitions
@@ -950,8 +986,11 @@
             if (WSDLUtil.isInputPresentForMEP(MEP)) {
                 Element[] inputParamElement = getInputParamElement(doc, axisOperation);
                 for (int i = 0; i < inputParamElement.length; i++) {
-                   parameterMap.put(inputParamElement[i].getAttribute("type"),
-                           inputParamElement[i]);
+                    //add an attribute to the parameter saying that this is an
+                    //input
+                    addAttribute(doc,"direction","in",inputParamElement[i]);
+                    parameterMap.put(inputParamElement[i].getAttribute("type"),
+                            inputParamElement[i]);
 
                 }
             }
@@ -959,12 +998,17 @@
             if (WSDLUtil.isOutputPresentForMEP(MEP)) {
                 Element outputParamElement = getOutputParamElement(doc, axisOperation);
                 if (outputParamElement != null) {
+                    //set the direction as out
+                    addAttribute(doc,"direction","out",outputParamElement);
                     parameterMap.put(outputParamElement.getAttribute("type"), outputParamElement);
                 }
             }
+
             //process faults
             Element[] faultParamElements = getFaultParamElements(doc, axisOperation);
             for (int i = 0; i < faultParamElements.length; i++) {
+                //set the direction as out - all faults are out messages ?
+                addAttribute(doc,"direction","out",faultParamElements[i]);
                 parameterMap.put(
                         faultParamElements[i].getAttribute("type"),
                         faultParamElements[i]);
@@ -1002,6 +1046,9 @@
         // if the base64 name list is missing then this whole step is skipped
         rootElement.appendChild(getBase64Elements(doc));
 
+        //add the method names
+        rootElement.appendChild(getOpNames(doc));
+
         // Now run through the parameters and add them to the root element
         Collection parameters = parameterMap.values();
 
@@ -1009,13 +1056,36 @@
             rootElement.appendChild((Element) iterator.next());
         }
 
+
+        ///////////////////////////////////////////////
+        //System.out.println(DOM2Writer.nodeToString(rootElement));
+        ////////////////////////////////////////////////
+
         return rootElement;
     }
 
+    /**
+     * Gets an element representing the operation names
+     * @param doc
+     * @return Returns Element.
+     */
+    protected Element getOpNames(Document doc) {
+        Element root = doc.createElement("opnames");
+        Element elt;
+
+        for (Iterator operationsIterator = axisService.getOperations();operationsIterator.hasNext();) {
+            AxisOperation axisOperation = (AxisOperation) operationsIterator.next();
+            elt = doc.createElement("name");
+            elt.appendChild(doc.createTextNode(axisOperation.getName().getLocalPart()));
+            addAttribute(doc,"opnsuri",axisOperation.getName().getNamespaceURI(),elt);
+            root.appendChild(elt);
+        }
+
+        return root;
+    }
 
     /**
      * Gets the base64 types. If not available this will be empty!!!
-     *
      * @param doc
      * @return Returns Element.
      */
@@ -1078,9 +1148,18 @@
         while (keys.hasNext()) {
             Object key = keys.next();
             String className = (String) classNameMap.get(key);
-            classNameMap.put(key, fullyQulifiedIncludingClassNamePrefix + "." + className);
-            instantiatableMessageClassNames.put(key,
-                    fullyQulifiedIncludingClassNamePrefix + "$" + className);
+
+            //this is a generated class name - update the name
+            if (!TypeTesterUtil.hasPackage(className) && !TypeTesterUtil.isPrimitive(className)){
+                classNameMap.put(key, fullyQulifiedIncludingClassNamePrefix + "." + className);
+                instantiatableMessageClassNames.put(key,
+                        fullyQulifiedIncludingClassNamePrefix + "$" + className);
+            }else{
+                //this is a fully qualified class name - just leave it as it is
+                classNameMap.put(key, className);
+                instantiatableMessageClassNames.put(key,
+                        className);
+            }
         }
     }
 
@@ -1116,6 +1195,15 @@
 
     }
 
+    /**
+     * A resusable method to return the service element for creating the
+     * service xml
+     *
+     * @param serviceName
+     * @param className
+     * @param doc
+     * @return
+     */
     protected Node getServiceElement(String serviceName, String className, Document doc) {
         Element rootElement = doc.createElement("interface");
 
@@ -1157,7 +1245,6 @@
 
     /**
      * Write the skeletonInterface
-     *
      * @throws Exception
      */
     protected void writeSkeletonInterface() throws Exception {
@@ -1172,7 +1259,11 @@
         writeClass(skeletonModel, skeletonInterfaceWriter);
     }
 
-
+    /**
+     * Creates the XMLModel for the skeleton
+     * @param isSkeletonInterface
+     * @return
+     */
     protected Document createDOMDocumentForSkeleton(boolean isSkeletonInterface) {
         Document doc = getEmptyDocument();
         Element rootElement = doc.createElement("interface");
@@ -1197,6 +1288,10 @@
 
     }
 
+    /**
+     * Creates the XML model for the skeleton interface
+     * @return
+     */
     protected Document createDOMDocumentForSkeletonInterface() {
         Document doc = getEmptyDocument();
         Element rootElement = doc.createElement("interface");
@@ -1218,6 +1313,13 @@
 
     }
 
+    /**
+     * Loads the operations
+     * @param doc
+     * @param rootElement
+     * @param mep
+     * @return
+     */
     protected boolean loadOperations(Document doc, Element rootElement, String mep) {
         Element methodElement;
         String portTypeName = makeJavaClassName(axisService.getName());
@@ -1400,11 +1502,11 @@
 //                transformer.setOutputProperty("omit-xml-declaration", "yes");
 //                transformer.setOutputProperty(OutputKeys.INDENT, "yes");
 //                transformer.transform(source, new StreamResult(swrite));
-//                
+//
 //                log.debug(swrite.toString());
-                
+
             } catch (Exception e) {
-                
+
                 e.printStackTrace();
             }
         }
@@ -1467,13 +1569,13 @@
      * @param operation
      */
     private void addOutputAndFaultActions(Document doc, Element methodElement, AxisOperation operation){
-        String outputAction = operation.getOutputAction(); 
+        String outputAction = operation.getOutputAction();
         if(outputAction != null){
             Element outputActionElt = doc.createElement(org.apache.axis2.Constants.OUTPUT_ACTION_MAPPING);
             outputActionElt.setAttribute(AddressingConstants.WSA_ACTION, outputAction);
             methodElement.appendChild(outputActionElt);
         }
-        
+
         String[] faultActionNames = operation.getFaultActionNames();
         if(faultActionNames != null){
             for(int i=0;i<faultActionNames.length; i++){
@@ -1484,7 +1586,7 @@
             }
         }
     }
-    
+
     /**
      * populate the header parameters
      *
@@ -1624,9 +1726,9 @@
                 addAttribute(doc, "type", (typeMapping == null)
                         ? ""
                         : typeMapping, paramElement);
+
                 String attribValue = (String) instantiatableMessageClassNames.
                         get(msg.getElementQName());
-
                 addAttribute(doc, "instantiatableType",
                         attribValue == null ? "" : attribValue,
                         paramElement);
@@ -1666,6 +1768,8 @@
         AxisMessage inputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
         List paramElementList  = new ArrayList();
         if (inputMessage != null) {
+            // this message has been unwrapped - find the correct references of the
+            // the message by looking at the unwrapped details object
             if (inputMessage.getParameter(Constants.UNWRAPPED_KEY) != null) {
                 //we have this unwrapped earlier. get the info holder
                 //and then look at the parameters
@@ -1675,23 +1779,28 @@
                         (MessagePartInformationHolder)detailsParameter.getValue();
                 List partsList = infoHolder.getPartsList();
 
+
                 for (int i = 0; i < partsList.size(); i++) {
                     QName qName = (QName) partsList.get(i);
                     paramElementList.add(generateParamComponent(doc,
                             this.mapper.getParameterName(
                                     qName),
                             this.mapper.getTypeMappingName(
-                                    qName))
+                                    qName),
+                            operation.getName(),
+                            qName.getLocalPart(),
+                            (this.mapper.getTypeMappingStatus(qName)!=null))
                     );
                 }
             } else {
-
+                // This is a wrapped component - just add the type mapping
                 paramElementList.add(generateParamComponent(doc,
                         this.mapper.getParameterName(
                                 inputMessage.getElementQName()),
                         this.mapper.getTypeMappingName(
-                                inputMessage.getElementQName())
-                        )
+                                inputMessage.getElementQName()),
+                        operation.getName()
+                )
                 );
 
             }
@@ -1699,20 +1808,57 @@
         }
 
         return (Element[])paramElementList.toArray(
-                                    new Element[paramElementList.size()]);
+                new Element[paramElementList.size()]);
+    }
+
+     /**
+     * A convenient method for the generating the parameter
+     * element
+     * @param doc
+     * @param paramName
+     * @param paramType
+     * @param
+     * @return
+     */
+    protected Element generateParamComponent(Document doc,
+                                             String paramName,
+                                             String paramType,
+                                             QName operationName) {
+        return generateParamComponent(doc,paramName,paramType,operationName,null,false);
+
     }
 
     /**
-     * A convenient method for the
+     * A convenient method for the generating the parameter
+     * element
+     * @param doc
+     * @param paramName
+     * @param paramType
+     * @return
+     */
+    protected Element generateParamComponent(Document doc,
+                                             String paramName,
+                                             String paramType) {
+        return generateParamComponent(doc,paramName,paramType,null,null,false);
+
+    }
+    /**
+     * A convenient method for the generating the parameter
+     * element
      *
      * @param doc
      * @param paramElement
      * @param paramName
      * @param paramType
+     * @param opName
+     * @param paramName
      */
     protected Element generateParamComponent(Document doc,
                                              String paramName,
-                                             String paramType) {
+                                             String paramType,
+                                             QName opName,
+                                             String partName,
+                                             boolean isPrimitive) {
         Element paramElement = doc.createElement("param");
         addAttribute(doc, "name",
                 paramName, paramElement);
@@ -1729,6 +1875,19 @@
         // add this as a body parameter
         addAttribute(doc, "location", "body", paramElement);
 
+        //if the opName and partName are present , add them
+        if (opName!=null){
+            addAttribute(doc,"opname",opName.getLocalPart(),paramElement);
+
+        }
+        if (partName!= null){
+            addAttribute(doc,"partname",partName,paramElement);
+        }
+
+        if (isPrimitive){
+            addAttribute(doc,"primitive","yes",paramElement);
+        }
+
         return paramElement;
     }
 
@@ -1764,6 +1923,7 @@
 
         // add this as a body parameter
         addAttribute(doc, "location", "body", param);
+        addAttribute(doc, "opname", operation.getName().getLocalPart(), param);
 
         return param;
     }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Thu Jul  6 06:57:21 2006
@@ -60,9 +60,6 @@
                 operations.hasNext();){
                 AxisOperation op = (AxisOperation)operations.next();
 
-                //todo check whether we need to unwrap this message depending on
-                //the binding state.
-
                 if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())){
                     walkSchema(op.getMessage(
                             WSDLConstants.MESSAGE_LABEL_IN_VALUE),
@@ -104,7 +101,26 @@
                     // traverse through them
                     if (item instanceof XmlSchemaElement){
                         //add the element name to the part name list
-                        partNameList.add(((XmlSchemaElement)item).getQName());
+                        String partName = ((XmlSchemaElement) item).getName();
+
+                        //  part names are not unique across messages. Hence
+                        //  we need some way of making the part name a unique
+                        //  one (due to the fact that the type mapper
+                        //  is a global list of types).
+                        //  The seemingly best way to do that is to
+                        //  specify a namespace for the part QName reference which
+                        //  is stored in the  list. This part qname is
+                        //  temporary and should not be used with it's
+                        //  namespace URI (which happened to be the operation name)
+                        //  with _input attached to it
+
+
+                        partNameList.add(
+                                WSDLUtil.getPartQName(opName.getLocalPart(),
+                                        WSDLConstants.INPUT_PART_QNAME_SUFFIX,
+                                        partName));
+
+
                     }else{
                         // if the particle contains anything other than
                         // a XMLSchemaElement then we are not in a position
@@ -128,9 +144,9 @@
                     infoHolder.setPartsList(partNameList);
 
                     //attach it to the parameters
-                     message.addParameter(
-                             getParameter(Constants.UNWRAPPED_DETAILS,
-                             infoHolder));
+                    message.addParameter(
+                            getParameter(Constants.UNWRAPPED_DETAILS,
+                                    infoHolder));
 
                 } catch (AxisFault axisFault) {
                     throw new CodeGenerationException(axisFault);
@@ -163,4 +179,7 @@
 
         return myParameter;
     }
+
+
+
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java Thu Jul  6 06:57:21 2006
@@ -101,4 +101,23 @@
      * @param defaultMapping
      */
     public void setDefaultMappingName(String defaultMapping);
+
+
+    /**
+     * Allows the storage of a status object with a mapping to
+     * the qname. This may be used to store certain status information
+     * that will be used by different type mappers. A given type mapper
+     * may choose not to implement this!
+     * @param qname
+     * @param status
+     */
+    public void addTypeMappingStatus(QName qName,Object status);
+
+    /**
+     * Returns the relevant status object given the qName of the xml element
+     * @see #addTypeMappingStatus(javax.xml.namespace.QName, Object)
+     * @param qName
+     * @return the status object
+     */
+    public Object getTypeMappingStatus(QName qName);
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java Thu Jul  6 06:57:21 2006
@@ -41,6 +41,9 @@
     //hashmap that contains the type mapping objects
     protected HashMap qName2ObjectMap = new HashMap();
 
+    //hashmap for keeping the status objects.
+    protected HashMap qName2StatusMap = new HashMap();
+
     //counter variable to generate unique parameter ID's
     protected int counter = 0;
 
@@ -142,5 +145,23 @@
      */
     public void setDefaultMappingName(String defaultMapping) {
         this.defaultClassName = defaultMapping;
+    }
+
+    /**
+     * @see TypeMapper#addTypeMappingStatus(javax.xml.namespace.QName, Object)
+     * @param qName
+     * @param status
+     */
+    public void addTypeMappingStatus(QName qName, Object status) {
+        this.qName2StatusMap.put(qName, status);
+    }
+
+    /**
+     * @see TypeMapper#getTypeMappingStatus(javax.xml.namespace.QName) 
+     * @param qName
+     * @return
+     */
+    public Object getTypeMappingStatus(QName qName) {
+        return this.qName2StatusMap.get(qName);
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Thu Jul  6 06:57:21 2006
@@ -254,21 +254,26 @@
                                 <!-- style being doclit or rpc does not matter -->
                                 <xsl:when test="$style='rpc' or $style='document'">
                                     //Style is Doc.
-                                    <!-- Let's assume there is only one parameters here -->
-                                    <xsl:for-each select="input/param[@location='body']">
-                                        <xsl:choose>
-                                            <xsl:when test="@type!=''">
-                                                 env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
-                                                <xsl:value-of select="@name"/>,
+                                    <xsl:choose>
+                                        <xsl:when test="count(input/param[@location='body' and @type!=''])=1">
+                                           env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
+                                                <xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>,
+                                                optimizeContent(new javax.xml.namespace.QName("<xsl:value-of select="$method-ns"/>",
+                                                "<xsl:value-of select="$method-name"/>")));
+                                        </xsl:when>
+                                        <xsl:when test="count(input/param[@location='body' and @type!='']) &gt; 1">
+                                           env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
+                                                 <xsl:for-each select="input/param[@location='body' and @type!='']">
+                                                   <xsl:value-of select="@name"/>,
+                                                 </xsl:for-each>
                                                 optimizeContent(new javax.xml.namespace.QName("<xsl:value-of select="$method-ns"/>",
                                                 "<xsl:value-of select="$method-name"/>")));
-                                            </xsl:when>
-                                            <xsl:otherwise>
-                                                 env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()));
-                                            </xsl:otherwise>
-                                        </xsl:choose>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                              env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()));
+                                        </xsl:otherwise>
+                                    </xsl:choose>
 
-                                    </xsl:for-each>	
                                     <xsl:choose>
                                         <!-- If there are headers then build the envelope -->
                                         <xsl:when test="count(input/param[@location='header'])>0">
@@ -422,16 +427,25 @@
                             <xsl:choose>
                                 <xsl:when test="$style='document' or $style='rpc'">
                                     //Style is Doc.
-                                    <xsl:for-each select="input/param[@location='body']">
-                                        <xsl:choose>
-                                            <xsl:when test="@type!=''">
-                                                 env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), <xsl:value-of select="@name"/>, optimizeContent(new javax.xml.namespace.QName("<xsl:value-of select="$method-ns"/>", "<xsl:value-of select="$method-name"/>")));
-                                            </xsl:when>
-                                            <xsl:otherwise>
-                                                 env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()));
-                                            </xsl:otherwise>
-                                        </xsl:choose>
-                                    </xsl:for-each>
+                                    <xsl:choose>
+                                        <xsl:when test="count(input/param[@location='body' and @type!=''])=1">
+                                           env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
+                                                <xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>,
+                                                optimizeContent(new javax.xml.namespace.QName("<xsl:value-of select="$method-ns"/>",
+                                                "<xsl:value-of select="$method-name"/>")));
+                                        </xsl:when>
+                                        <xsl:when test="count(input/param[@location='body' and @type!='']) &gt; 1">
+                                           env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
+                                                 <xsl:for-each select="input/param[@location='body' and @type!='']">
+                                                   <xsl:value-of select="@name"/>,
+                                                 </xsl:for-each>
+                                                optimizeContent(new javax.xml.namespace.QName("<xsl:value-of select="$method-ns"/>",
+                                                "<xsl:value-of select="$method-name"/>")));
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                              env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()));
+                                        </xsl:otherwise>
+                                    </xsl:choose>
                                     <xsl:choose>
                                         <!-- If there are headers then build the envelope  -->
                                         <xsl:when test="count(input/param[@location='header'])>0">

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Thu Jul  6 06:57:21 2006
@@ -82,11 +82,12 @@
                     <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@location='body'])"/></xsl:variable>
                     <xsl:choose>
                         <xsl:when test="$paramCount &gt; 0">skel.<xsl:value-of select="@name"/>(
-                            <xsl:for-each select="input/param[@location='body']">
-                                <xsl:if test="@type!=''">(<xsl:value-of select="@type"/>)fromOM(
+                            <xsl:for-each select="input/param[@location='body' and @type!='']">
+                                 (<xsl:value-of select="@type"/>)fromOM(
                                     msgContext.getEnvelope().getBody().getFirstElement(),
                                     <xsl:value-of select="@type"/>.class,
-                                    getEnvelopeNamespaces(msgContext.getEnvelope()))<xsl:if test="position() &gt; 1">,</xsl:if></xsl:if>
+                                    getEnvelopeNamespaces(msgContext.getEnvelope()))<xsl:if test="position() &gt; 1">,</xsl:if>
+                                
                             </xsl:for-each>);
                         </xsl:when>
                         <!--No input parameters-->

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java Thu Jul  6 06:57:21 2006
@@ -24,8 +24,8 @@
     String EXTERNAL_TEMPLATE_PROPERTY_KEY = "externalTemplate";
     String XSLT_INCLUDE_DATABIND_SUPPORTER_HREF_KEY = "databindsupporter";
     String XSLT_INCLUDE_TEST_OBJECT_HREF_KEY = "testObject";
-    String UNWRAPPED_KEY = "UNWrapped";
-    String UNWRAPPED_DETAILS = "UNWrapped_details";
+    String UNWRAPPED_KEY = "UnWrapped";
+    String UNWRAPPED_DETAILS = "UnWrapped_details";
 
 
     public interface CodegenStyle {

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/TypeTesterUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/TypeTesterUtil.java?rev=419555&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/TypeTesterUtil.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/TypeTesterUtil.java Thu Jul  6 06:57:21 2006
@@ -0,0 +1,48 @@
+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 TypeTesterUtil {
+
+    /**
+     * Check whether a given classname is primitives
+     * @param className
+     * @return
+     */
+    public static boolean isPrimitive(String className){
+
+        return  "int".equals(className) ||
+                "float".equals(className) ||
+                "boolean".equals(className) ||
+                "double".equals(className) ||
+                "byte".equals(className) ||
+                "short".equals(className) ||
+                "long".equals(className);
+
+
+    }
+
+    /**
+     * Tests whether the given classname has a package
+     * the current logic is simple where we look for a
+     * '.' inside the classname string
+     * @param className
+     * @return
+     */
+     public static boolean hasPackage(String className){
+        return  (className.indexOf('.')!= -1);
+    }
+}

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java Thu Jul  6 06:57:21 2006
@@ -83,6 +83,7 @@
 
     int WSDL_1_1 = 1;
     int WSDL_2_0 = 2;
+    String INPUT_PART_QNAME_SUFFIX = "_input";
 
 
     public static interface WSDL11Constants{

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLUtil.java?rev=419555&r1=419554&r2=419555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLUtil.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLUtil.java Thu Jul  6 06:57:21 2006
@@ -1,4 +1,6 @@
 package org.apache.axis2.wsdl;
+
+import javax.xml.namespace.QName;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -60,4 +62,27 @@
                 WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
                 WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP);
     }
+
+    /**
+     *  part names are not unique across messages. Hence
+     we need some way of making the part name a unique
+     one (due to the fact that the type mapper
+     is a global list of types).
+     The seemingly best way to do that is to
+     specify a namespace for the part QName reference which
+     is stored in the  list. This part qname is
+     temporary and should not be used with it's
+     namespace URI (which happened to be the operation name)
+     with _input (or a similar suffix) attached to it
+     * @param opName
+     * @param suffix
+     * @param partName
+     * @return
+     */
+    public static QName getPartQName(String opName,
+                                     String suffix,
+                                     String partName){
+        return new QName(opName+suffix,partName);
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org