axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r321105 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2: databinding/schema/ databinding/schema/template/ wsdl/codegen/ wsdl/codegen/extension/ wsdl/codegen/writer/ wsdl/template/java/
Date Fri, 14 Oct 2005 13:17:12 GMT
Author: ajith
Date: Fri Oct 14 06:16:46 2005
New Revision: 321105

URL: http://svn.apache.org/viewcvs?rev=321105&view=rev
Log:
1. Modified the schema compiler (yet again :)) to generate classes for the outermost elements.
2. Added the new constant 'adb' to represent our databinding
3. added a supporter template. This however is not working at all

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/JavaBeanWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/TypeMap.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
    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/CommandLineOptionConstants.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/DatabindingSupportClassWriter.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/JavaBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/JavaBeanWriter.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/JavaBeanWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/JavaBeanWriter.java
Fri Oct 14 06:16:46 2005
@@ -64,7 +64,7 @@
         try {
             //determine the package for this type.
             QName qName = complexType.getQName();
-            return process(qName, metainf, typeMap);
+            return process(qName, metainf, typeMap, false);
 
         }catch (SchemaCompilationException e) {
             throw e;
@@ -75,7 +75,7 @@
 
     }
 
-    private String process(QName qName, BeanWriterMetaInfoHolder metainf, Map typeMap) throws
Exception {
+    private String process(QName qName, BeanWriterMetaInfoHolder metainf, Map typeMap, boolean
isElement) throws Exception {
         String packageName = URLProcessor.getNameSpaceFromURL(qName.getNamespaceURI());
         String className = qName.getLocalPart();
 
@@ -92,6 +92,10 @@
         XSLTUtils.addAttribute(model,"package",packageName,rootElt);
         XSLTUtils.addAttribute(model,"nsuri",qName.getNamespaceURI(),rootElt);
         XSLTUtils.addAttribute(model,"nsprefix",qName.getPrefix(),rootElt);
+        if (!isElement){
+            XSLTUtils.addAttribute(model,"type","yes",rootElt);
+        }
+
         if (metainf.isExtension()){
             XSLTUtils.addAttribute(model,"extension",metainf.getExtensionClassName(),rootElt);
         }
@@ -144,7 +148,7 @@
         try {
             //determine the package for this type.
             QName qName = element.getQName();
-             return process(qName, metainf, typeMap);
+             return process(qName, metainf, typeMap, true);
         } catch (Exception e) {
             throw new SchemaCompilationException(e);
         }
@@ -153,9 +157,12 @@
     }
 
 
-    /** A bit of code from the code generator. We are better off using the template
+
+
+    /**
+     *  A bit of code from the old code generator. We are better off using the template
      * engines and such stuff that's already there. But the class writers are hard to be
-     * reused so some code needs to be repeated
+     * reused so some code needs to be repeated (atleast a bit)
      *
      */
     private  void loadTemplate() throws SchemaCompilationException {

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
Fri Oct 14 06:16:46 2005
@@ -2,6 +2,7 @@
 
 import org.apache.ws.commons.schema.*;
 import org.apache.axis2.util.URLProcessor;
+import org.apache.axis2.om.OMElement;
 
 import javax.xml.namespace.QName;
 import java.util.*;
@@ -26,7 +27,12 @@
 
     private CompilerOptions options;
     private HashMap processedTypemap;
+    //The processedElementmap and the processedElementList have a subtle difference
+    //The writing to the processedElementList happens when an outer element is processed.
+    //
     private HashMap processedElementmap;
+    private ArrayList processedElementList;
+
     private JavaBeanWriter writer;
 
     private Map baseSchemaTypeMap = TypeMap.getTypeMap();
@@ -51,6 +57,7 @@
 
             this.processedTypemap = new HashMap();
             this.processedElementmap = new HashMap();
+            this.processedElementList = new ArrayList();
 
             this.writer = new JavaBeanWriter(this.options.getOutputLocation());
 
@@ -88,64 +95,113 @@
 
         //select all the elements. We generate the code for types
         //only if the elements refer them!!!
+
         XmlSchemaObjectTable elements = schema.getElements();
-        Iterator  xmlSchemaElementIterator = elements.getValues();
-        while (xmlSchemaElementIterator.hasNext()) {
-            processElement((XmlSchemaElement)xmlSchemaElementIterator.next());
+        Iterator  xmlSchemaElement1Iterator = elements.getValues();
+        while (xmlSchemaElement1Iterator.hasNext()) {
+            //this is the set of outer elements so we need to generate classes
+            processElement((XmlSchemaElement)xmlSchemaElement1Iterator.next(),true);
+        }
+
+        //Now re iterate through the elements and write them
+        Iterator xmlSchemaElement2Iterator = elements.getValues();
+        while (xmlSchemaElement2Iterator.hasNext()) {
+            //this is the set of outer elements so we need to generate classes
+            writeElement((XmlSchemaElement)xmlSchemaElement2Iterator.next());
+        }
+
+    }
+
+    private void writeElement(XmlSchemaElement schemaElement) throws SchemaCompilationException{
+        if (this.processedElementmap.containsKey(schemaElement.getQName())){
+            return;
         }
 
+        XmlSchemaType schemaType = schemaElement.getSchemaType();
+
+        if (schemaType!=null){
+            //at this time it is not wise to directly write the class for the element
+            //so we push the complete element to an arraylist and let the process
+            //pass through
+            BeanWriterMetaInfoHolder metainf = new BeanWriterMetaInfoHolder();
+            QName qName = schemaType.getQName();
+            //find the class name
+            String className = findClassName(schemaType);
+            metainf.addElementInfo(schemaElement.getQName(),
+                    qName,
+                    className);
+            String writtenClassName = writer.write(schemaElement,processedTypemap,metainf);
+            processedElementmap.put(schemaElement.getQName(),writtenClassName);
+        }
 
 
     }
 
+
+
     /**
      *
      * @param xsElt
      */
-    private void processElement(XmlSchemaElement xsElt) throws SchemaCompilationException{
+    private void processElement(XmlSchemaElement xsElt,boolean isOuter) throws SchemaCompilationException{
         //The processing element logic seems to be quite simple. Look at the relevant schema
type
         //for each and every element and process that accordingly.
         //this means that any unused type definitions would not be generated!
-
-        XmlSchemaType schemaType = xsElt.getSchemaType();
-
-        if (processedElementmap.containsKey(xsElt.getQName())){
+        if (processedElementList.contains(xsElt.getQName())){
             return;
         }
-        QName qName = null;
+        System.out.println("xsElt = " + xsElt);
+        System.out.println("xsElt.getQName() = " + xsElt.getQName());
+
+        XmlSchemaType schemaType = xsElt.getSchemaType();
 
         if (schemaType!=null){
             processSchema(schemaType);
-            qName = schemaType.getQName();
-        }else{
-            //perhaps this has an anoynimous complex type! Handle it here
-        }
-
 
-        //if the schema type is a basic one then we are done by just
-        //there can be only one schema type (????)
+            //at this time it is not wise to directly write the class for the element
+            //so we push the complete element to an arraylist and let the process
+            //pass through
+
+            if (!isOuter){
+                String className = findClassName(schemaType);
+                this.processedElementmap.put(xsElt.getQName(),className);
+            }
+            this.processedElementList.add(xsElt.getQName());
 
-        String className = "";
-        if (processedTypemap.containsKey(qName)){
-            className =  processedTypemap.get(qName).toString();
-        }else if (baseSchemaTypeMap.containsKey(qName)){
-            className =  baseSchemaTypeMap.get(qName).toString();
         }else{
-           //this is a schema type we do not know. Or perhaps there's no schema type at all
-           //the right class to represent this is the java.lang.Object
-            className = Object.class.getName();
+            //perhaps this has an anonymous complex type! Handle it here
+            //BTW how do we handle an anonymous complex type
         }
 
-        processedElementmap.put(xsElt.getQName(),className);
-
+    }
 
+    private String findClassName(XmlSchemaType schemaType) {
+        //find the class name
+        QName qName = schemaType.getQName();
+        String className;
+        if (processedTypemap.containsKey(qName)) {
+            className = (String)processedTypemap.get(qName);
+        }else if(baseSchemaTypeMap.containsKey(qName)){
+            className =(String)baseSchemaTypeMap.get(qName);
+        }else{
+            // We seem to have failed in finding a class name for the
+            //contained schema type. We better set the default then
+            className = OMElement.class.getName();
+        }
+        return className;
     }
 
+    /**
+     * Process a schema element
+     * @param schemaType
+     * @throws SchemaCompilationException
+     */
     private void processSchema(XmlSchemaType schemaType) throws SchemaCompilationException
{
         if (schemaType instanceof XmlSchemaComplexType){
             //write classes for complex types
             processComplexSchemaType((XmlSchemaComplexType)schemaType);
         }else if (schemaType instanceof XmlSchemaSimpleType){
+            //process simple type
             processSimpleSchemaType((XmlSchemaSimpleType)schemaType);
         }
     }
@@ -179,6 +235,12 @@
 
     }
 
+    /**
+     *
+     * @param particle
+     * @param metainfHolder
+     * @throws SchemaCompilationException
+     */
     private void processParticle(XmlSchemaParticle particle, //particle being processed
                                  BeanWriterMetaInfoHolder metainfHolder // metainf holder
     ) throws SchemaCompilationException {
@@ -188,12 +250,18 @@
         }else if (particle instanceof XmlSchemaAll){
             XmlSchemaObjectCollection items = ((XmlSchemaAll)particle).getItems();
             process(items, metainfHolder,false);
-
         }else if (particle instanceof XmlSchemaChoice){
             //handle the choice!
         }
     }
 
+    /**
+     *
+     * @param items
+     * @param metainfHolder
+     * @param order
+     * @throws SchemaCompilationException
+     */
     private void process(XmlSchemaObjectCollection items,
                          BeanWriterMetaInfoHolder metainfHolder,
                          boolean order) throws SchemaCompilationException {
@@ -205,7 +273,7 @@
             if (item instanceof XmlSchemaElement){
                 //recursively process the element
                 XmlSchemaElement xsElt = (XmlSchemaElement) item;
-                processElement(xsElt);
+                processElement(xsElt,false); //we know for sure this is not an outer type
                 processedElements.add(xsElt);
             }else if (item instanceof XmlSchemaComplexContent){
                 // process the extension
@@ -241,11 +309,11 @@
      */
     private void processSimpleSchemaType(XmlSchemaSimpleType simpleType){
         //nothing to here yet.
-        
+
     }
 
 
-    /*     Utility methods       */
+/*     Utility methods       */
     private String getJavaClassNameFromComplexTypeQName(QName name){
         String className = name.getLocalPart();
         String packageName = URLProcessor.getNameSpaceFromURL(name.getNamespaceURI());

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/TypeMap.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/TypeMap.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/TypeMap.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/TypeMap.java
Fri Oct 14 06:16:46 2005
@@ -1,5 +1,7 @@
 package org.apache.axis2.databinding.schema;
 
+import org.apache.axis2.om.OMElement;
+
 import javax.xml.namespace.QName;
 import java.util.Map;
 import java.util.HashMap;
@@ -39,8 +41,8 @@
         addTypemapping(SchemaConstants.XSD_LONG, long.class.getName());
         addTypemapping(SchemaConstants.XSD_SHORT, short.class.getName());
         addTypemapping(SchemaConstants.XSD_BYTE, byte.class.getName());
-        addTypemapping(SchemaConstants.XSD_ANY, Object.class.getName());
-        addTypemapping(SchemaConstants.XSD_ANYTYPE, Object.class.getName());
+        addTypemapping(SchemaConstants.XSD_ANY, OMElement.class.getName());
+        addTypemapping(SchemaConstants.XSD_ANYTYPE, OMElement.class.getName());
 
     }
     private static void addTypemapping(QName name,String str) {

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
Fri Oct 14 06:16:46 2005
@@ -10,11 +10,22 @@
 
     public class <xsl:value-of select="$name"/> <xsl:if test="@extension"> extends
<xsl:value-of select="@extension"/></xsl:if>
         implements org.apache.axis2.databinding.ADBBean{
+        <xsl:choose>
+            <xsl:when test="@type">/* This type was generated from the piece of schema
that had
+                    name = <xsl:value-of select="$name"/>
+                    Namespace URI = <xsl:value-of select="@nsuri"/>
+                    Namespace Prefix = <xsl:value-of select="@nsprefix"/>
+                */
+            </xsl:when>
+            <xsl:otherwise>
+                public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
+                                                     "<xsl:value-of select="@nsuri"/>",
+                                                     "<xsl:value-of select="$name"/>",
+                                                     "<xsl:value-of select="@nsprefix"/>");
 
-      private static final javax.xml.namespace.QName qName = new javax.xml.namespace.QName(
-                                      "<xsl:value-of select="@nsuri"/>",
-                                      "<xsl:value-of select="$name"/>",
-                                      "<xsl:value-of select="@nsprefix"/>");
+            </xsl:otherwise>
+        </xsl:choose>
+      <xsl:if test="@type"></xsl:if>
 
      <xsl:for-each select="property">
          <xsl:variable name="propertyType"><xsl:value-of select="@type"></xsl:value-of></xsl:variable>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=321105&r1=321104&r2=321105&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
Fri Oct 14 06:16:46 2005
@@ -98,9 +98,12 @@
             this.databindingType = XSLTConstants.DataBindingTypes.XML_BEANS;
         } else if (Databinding.JAXB.equalsIgnoreCase(databindingType)) {
             this.databindingType = XSLTConstants.DataBindingTypes.JAXB;
-        } else if (Databinding.NONE.equalsIgnoreCase(databindingType)) {
+        } else if (Databinding.ADB.equalsIgnoreCase(databindingType)) {
+            this.databindingType = XSLTConstants.DataBindingTypes.ADB;
+        }else if (Databinding.NONE.equalsIgnoreCase(databindingType)) {
             this.databindingType = XSLTConstants.DataBindingTypes.NONE;
         } else {
+             //set to none by default
              this.databindingType = XSLTConstants.DataBindingTypes.NONE;
         }
     }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
Fri Oct 14 06:16:46 2005
@@ -45,6 +45,7 @@
     public interface Databinding {
     	public static final String XML_BEANS = "xmlbeans";
     	public static final String JAXB = "jaxb";
+    	public static final String ADB = "adb";
         public static final String NONE = "none";
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/XSLTConstants.java
Fri Oct 14 06:16:46 2005
@@ -39,6 +39,7 @@
         public static final int NONE = 0;
         public static final int XML_BEANS = 1;
         public static final int JAXB = 2;
+        public static final int ADB = 3;
 
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
Fri Oct 14 06:16:46 2005
@@ -17,6 +17,7 @@
 package org.apache.axis2.wsdl.codegen.extension;
 
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.XSLTConstants;
 import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
 import org.apache.axis2.wsdl.databinding.JavaTypeMapper;
 import org.apache.axis2.databinding.schema.SchemaCompiler;
@@ -46,7 +47,12 @@
     }
 
     public void engage() {
+            //test the databinding type. If not just fall through
+        if (configuration.getDatabindingType() != XSLTConstants.DataBindingTypes.ADB) {
+            return;
+        }
         try {
+
             WSDLTypes typesList = configuration.getWom().getTypes();
             if (typesList == null) {
                 //there are no types to be code generated

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/DatabindingSupportClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/DatabindingSupportClassWriter.java?rev=321105&r1=321104&r2=321105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/DatabindingSupportClassWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/DatabindingSupportClassWriter.java
Fri Oct 14 06:16:46 2005
@@ -50,7 +50,7 @@
         String templateName = null;
         Iterator keys = languageSpecificPropertyMap.keySet().iterator();
         String databindString;
-        
+
         //set the correct databinding type string
         switch(this.databindingFramework)  {
             case XSLTConstants.DataBindingTypes.XML_BEANS:
@@ -59,6 +59,9 @@
             case XSLTConstants.DataBindingTypes.JAXB:
                 databindString = "jaxb";
                 break;
+            case XSLTConstants.DataBindingTypes.ADB:
+                databindString = "adb";
+                break;       
             default:
                 databindString = "default";
         }

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl?rev=321105&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
(added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
Fri Oct 14 06:16:46 2005
@@ -0,0 +1,74 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/class">
+        package <xsl:value-of select="@package"/>;
+
+        /**
+        *  Auto generated supporter class for XML beans by the Axis code generator
+        */
+
+        public class <xsl:value-of select="@name"/> extends org.apache.axis2.clientapi.AbstractCallbackSupporter{
+        <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>
+
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+        public  static org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/>
param){
+               if (param instanceof  org.apache.axis2.databinding.ADBBean){
+                    return param.getPullParser(adbBeanQName);
+                }
+               return documentElement;
+        }
+            </xsl:if>
+        </xsl:for-each>
+
+        public static org.apache.xmlbeans.XmlObject fromOM(org.apache.axis2.om.OMElement
param,
+        java.lang.Class type){
+        try{
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+                if (<xsl:value-of select="@type"/>.class.equals(type)){
+
+                }
+            </xsl:if>
+        </xsl:for-each>
+        }catch(java.lang.Exception e){
+            throw new RuntimeException("Data binding error",e);
+        }
+            return null;
+        }
+
+        //Generates an empty object for testing
+        // Caution - need some manual editing to work properly
+        public static org.apache.xmlbeans.XmlObject getTestObject(java.lang.Class type){
+        try{
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+                if (<xsl:value-of select="@type"/>.class.equals(type)){
+                <xsl:value-of select="@type"/> emptyObject= new <xsl:value-of select="@type"/>;
+                ////////////////////////////////////////////////
+                // TODO
+                // Fill in the empty object with necessaey values. Empty XMLBeans objects
do not generate proper events
+                ////////////////////////////////////////////////
+                return emptyObject;
+                }
+            </xsl:if>
+        </xsl:for-each>
+        }catch(java.lang.Exception e){
+            throw new RuntimeException("Test object creation failure",e);
+        }
+            return null;
+        }
+        }
+    </xsl:template>
+
+    <xsl:template match="param">
+
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file



Mime
View raw message