axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r415495 - in /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema: SchemaCompiler.java template/ADBBeanTemplate.xsl template/ADBDatabindingTemplate.xsl
Date Tue, 20 Jun 2006 04:27:25 GMT
Author: ajith
Date: Mon Jun 19 21:27:24 2006
New Revision: 415495

URL: http://svn.apache.org/viewvc?rev=415495&view=rev
Log:
1. Modified the SchemaCompiler.java to avoid a possible bug.
2. Updated the ADBBeanTemplate.xsl to complete the Writing code.
3. Updated the ADBDatabindingTemplate.xsl to use the generated getOMElement rather than creating
a one using the pull parser.
  
Note - Although the tests pass we need to have a full set of test cases to test the new writing
capability.

Modified:
    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/template/ADBBeanTemplate.xsl
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl

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=415495&r1=415494&r2=415495&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
Mon Jun 19 21:27:24 2006
@@ -99,6 +99,9 @@
     private Map loadedSchemaMap = new HashMap();
 
     // A map keeping the available schemas
+    //the key is the targetnamespace and the value is the schema object
+    //this map will be populated when multiple schemas
+    //are fed to the schema compiler!
     private Map availableSchemaMap = new HashMap();
 
 
@@ -184,10 +187,15 @@
      * @see #compile(org.apache.ws.commons.schema.XmlSchema)
      */
     public void compile(List schemalist) throws SchemaCompilationException {
-        XmlSchema schema;
+
         
         try {
-            // first round - populate the map
+             //clear the loaded and available maps
+            loadedSchemaMap.clear();
+            availableSchemaMap.clear();
+
+             XmlSchema schema;
+            // first round - populate the avaialble map
             for (int i = 0; i < schemalist.size(); i++) {
                 schema = (XmlSchema) schemalist.get(i);
                 availableSchemaMap.put(
@@ -196,7 +204,7 @@
                 );
             }
 
-            // second round - call the schema
+            // second round - call the schema compiler one by one
             for (int i = 0; i < schemalist.size(); i++) {
                 compile((XmlSchema) schemalist.get(i));
             }

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?rev=415495&r1=415494&r2=415495&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
Mon Jun 19 21:27:24 2006
@@ -241,6 +241,7 @@
 
         </xsl:for-each>
 
+     <!-- #########################################################################################
-->
      <!-- get OMElement methods that allows direct writing -->
      /**
      *
@@ -268,19 +269,17 @@
                     <xsl:variable name="varName">local<xsl:value-of select="@javaname"/></xsl:variable>
                      <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
                     <xsl:choose>
+                        <!-- Note - It is assumed that any attributes are OMAttributes-->
                         <xsl:when test="@any and not(@array)">
-                            xmlWriter.writeAttribute("<xsl:value-of select="$namespace"/>",
-                                                     "<xsl:value-of select="$propertyName"/>",
-                                                     <xsl:value-of select="$varName"/>);
-                            <!-- todo change this to use the OMAttribute-->
-
+                            xmlWriter.writeAttribute(<xsl:value-of select="$varName"/>.getNamespace().getName(),
+                                                     <xsl:value-of select="$varName"/>.getLocalName(),
+                                                     <xsl:value-of select="$varName"/>.getAttributeValue());
                         </xsl:when>
                          <xsl:when test="@any and @array">
                              for (int i=0;i &lt;<xsl:value-of select="$varName"/>.length;i++){
-                              xmlWriter.writeAttribute("<xsl:value-of select="$namespace"/>",
-                                                     "<xsl:value-of select="$propertyName"/>",
-                                                     <xsl:value-of select="$varName"/>[i]);
-                              <!-- todo change this to use the OMAttribute-->
+                              xmlWriter.writeAttribute(<xsl:value-of select="$varName"/>[i].getNamespace().getName(),
+                                                     <xsl:value-of select="$varName"/>[i].getLocalName(),
+                                                     <xsl:value-of select="$varName"/>[i].getAttributeValue());
                              }
                          </xsl:when>
                         <!-- there can never be attribute arrays in the normal case-->
@@ -334,7 +333,7 @@
                                 <xsl:when test="@nillable">
                                     // this property is nillable
                                     if (<xsl:value-of select="$varName"/>!=null){
-                                    <!--this barcket needs to be closed!-->
+                                    <!--this bracket needs to be closed!-->
                                 </xsl:when>
                                 <xsl:otherwise>
                                     if (<xsl:value-of select="$varName"/>==null){
@@ -352,9 +351,8 @@
                         </xsl:when>
 
                         <xsl:when test="@default">
-
-                            // do something for the default!!!
-
+                            <!-- Note - Assumed to be OMElement-->
+                            <xsl:value-of select="$varName"/>.serialize(xmlWriter);
                         </xsl:when>
                         <!-- handle non ADB arrays - Not any however -->
                         <xsl:when test="@array and not(@any)">
@@ -388,14 +386,15 @@
                          <!-- handle non ADB arrays  - Any case  - any may not be
                          nillable -->
                         <xsl:when test="@array and @any">
+                            <!-- Note - Assumed to be OMElement-->
                             for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
-                              // how to handle this!!!
+                              <xsl:value-of select="$varName"/>[i].serialize(xmlWriter);
                             }
-                            <!--we've opened a bracket for the nulls - fix it here-->
                         </xsl:when>
                         <!-- handle any - non array case-->
                          <xsl:when test="@any">
-                           <!--  How do you handle the any???? probably the OMElement
?-->
+                            <!-- Note - Assumed to be OMElement-->
+                            <xsl:value-of select="$varName"/>.serialize(xmlWriter);
                         </xsl:when>
 
                         <!-- handle all other cases including the binary case -->
@@ -407,10 +406,9 @@
                     </xsl:choose>
                     <xsl:if test="$min=0 or $choice">}</xsl:if>
 
-                    <!-- write the end element for the type-->
-                    xmlWriter.writeEndElement();
-
                 </xsl:for-each>
+                   <!-- write the end element for the type-->
+               xmlWriter.writeEndElement();
             <!-- end of when for type & anon -->
             </xsl:when>
 
@@ -467,31 +465,20 @@
 
         };
 
-
-
-
-
-
-
-
         <xsl:choose>
             <xsl:when test="@type">
                return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
                parentQName,factory,dataSource);
             </xsl:when>
             <xsl:otherwise>
-               //ignore the QName passed in - we send only OUR QNames
+               //ignore the QName passed in - we send only OUR QName!
                return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
                MY_QNAME,factory,dataSource);
             </xsl:otherwise>
        </xsl:choose>
-
-
-
-
-
     }
 
+  <!-- #########################################################################################
-->
         /**
         * databinding method to get an XML representation of this object
         *
@@ -696,7 +683,7 @@
 
         }
 
-
+  <!-- #########################################################################################
-->
 
      /**
       *  Factory class that keeps the parse method

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=415495&r1=415494&r2=415495&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
Mon Jun 19 21:27:24 2006
@@ -17,13 +17,8 @@
                 <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){
-                            org.apache.axiom.om.impl.builder.StAXOMBuilder builder
-                                       = new org.apache.axiom.om.impl.builder.StAXOMBuilder
-                            (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),
-                               new org.apache.axis2.util.StreamWrapper(param.getPullParser(<xsl:value-of
select="@type"/>.MY_QNAME)));
-                            org.apache.axiom.om.OMElement documentElement = builder.getDocumentElement();
-                            ((org.apache.axiom.om.impl.OMNodeEx) documentElement).setParent(null);
// remove the parent link
-                            return documentElement;
+                     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



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


Mime
View raw message