You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2006/07/24 15:30:25 UTC

svn commit: r425048 - in /webservices/axis2/trunk/java/modules: adb-codegen/src/org/apache/axis2/schema/ adb-codegen/src/org/apache/axis2/schema/template/ adb/src/org/apache/axis2/databinding/

Author: ajith
Date: Mon Jul 24 06:30:24 2006
New Revision: 425048

URL: http://svn.apache.org/viewvc?rev=425048&view=rev
Log:
1.Updated the helpergen code to generate plain beans
 I. Updated the ADBBeanTemplate.xsl to generate plain beans
 II. Updated the ADBDatabindingTemplate.xsl to suit the changes
 III. Added a new Datasource for the helper stuff (ADBHelperDataSource.java(
2. Modified the SchemaCompiler.java to call the right compile method inside

Added:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBHelperDataSource.java
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=425048&r1=425047&r2=425048&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 Jul 24 06:30:24 2006
@@ -278,11 +278,11 @@
                 Object o = tempIterator.next();
                 if (o instanceof XmlSchemaImport) {
                     XmlSchema schema1 = ((XmlSchemaImport) o).getSchema();
-                    if (schema1 != null) compile(schema1);
+                    if (schema1 != null) compile(schema1,isPartofGroup);
                 }
                 if (o instanceof XmlSchemaInclude) {
                     XmlSchema schema1 = ((XmlSchemaInclude) o).getSchema();
-                    if (schema1 != null) compile(schema1);
+                    if (schema1 != null) compile(schema1,isPartofGroup);
                 }
             }
         }

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=425048&r1=425047&r2=425048&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 Jul 24 06:30:24 2006
@@ -1293,6 +1293,7 @@
            <!-- end of main template -->
           </xsl:template>
 
+
 <!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-->
 <!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-->
 <!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-->
@@ -1316,6 +1317,8 @@
         <xsl:variable name="nsprefix" select="@nsprefix"/>
         <xsl:variable name="extension" select="@extension"/>
          <xsl:variable name="mapperClass" select="@mapperClass"/>
+         <xsl:variable name="package" select="@package"/>
+        <xsl:variable name="helpername"><xsl:value-of select="$name"/>Helper</xsl:variable>
     <!-- write the class header. this should be done only when unwrapped -->
 
         <xsl:if test="not(not(@unwrapped) or (@skip-write))">
@@ -1326,7 +1329,7 @@
             * by the Apache Axis2 version: #axisVersion# #today#
             */
 
-            package <xsl:value-of select="@package"/>;
+            package <xsl:value-of select="$package"/>;
             /**
             *  <xsl:value-of select="$name"/> bean class
             */
@@ -1337,7 +1340,7 @@
 	<xsl:when test="not(@helper)">
 
 	public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> 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="@originalName"/>
@@ -1521,26 +1524,35 @@
              <!-- end of xsl:if for not(@inherited) -->
             </xsl:if>
 
-
-
         </xsl:for-each>
 
-     <!-- ######################################################################################### -->
-     <!-- get OMElement methods that allows direct writing -->
+   }   	
+	</xsl:when>
+	<xsl:otherwise>
+	<!--  Start of helper generation part of the template-->
+public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> class <xsl:value-of select="$helpername"/> {
+
+     <!-- get OMElement methods that allows direct writing. generated inside the helper class-->
+     <xsl:variable name="fullyQualifiedName"><xsl:value-of select="$package"/>.<xsl:value-of select="$name"/></xsl:variable>
+     <xsl:variable name="fullyQualifiedHelperName"><xsl:value-of select="$package"/>.<xsl:value-of select="$helpername"/></xsl:variable>
      /**
      *
      * @param parentQName
      * @param factory
      * @return
      */
-    public org.apache.axiom.om.OMElement getOMElement(
+    public static org.apache.axiom.om.OMElement getOMElement(
+            final <xsl:value-of select="$fullyQualifiedName"/> bean,
             final javax.xml.namespace.QName parentQName,
             final org.apache.axiom.om.OMFactory factory){
 
         org.apache.axiom.om.OMDataSource dataSource =
-                       new org.apache.axis2.databinding.ADBDataSource(this,parentQName){
+                       new org.apache.axis2.databinding.ADBHelperDataSource(bean,parentQName,"<xsl:value-of select="$fullyQualifiedHelperName"/>"){
                            public void serialize(
                                   javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
+
+            <xsl:value-of select="$fullyQualifiedName"/> typedBean =
+                               (<xsl:value-of select="$fullyQualifiedName"/>)bean;
             <xsl:choose>
             <xsl:when test="@type or @anon">
                 <!-- For a type write the passed in QName first-->
@@ -1556,7 +1568,7 @@
                 <!--First serialize the attributes!-->
                 <xsl:for-each select="property[@attribute]">
                     <xsl:variable name="propertyName"><xsl:value-of select="@name"/></xsl:variable>
-                    <xsl:variable name="varName">local<xsl:value-of select="@javaname"/></xsl:variable>
+                    <xsl:variable name="varName">typedBean.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-->
@@ -1584,7 +1596,7 @@
                 <!-- Now serialize the elements-->
                 <xsl:for-each select="property[not(@attribute)]">
                     <xsl:variable name="propertyName"><xsl:value-of select="@name"/></xsl:variable>
-                    <xsl:variable name="varName">local<xsl:value-of select="@javaname"/></xsl:variable>
+                    <xsl:variable name="varName">typedBean.local<xsl:value-of select="@javaname"/></xsl:variable>
                     <xsl:variable name="min"><xsl:value-of select="@minOccurs"/></xsl:variable>
                     <xsl:variable name="namespace"><xsl:value-of select="@nsuri"/></xsl:variable>
                     <xsl:variable name="settingTracker">local<xsl:value-of select="@javaname"/>Tracker</xsl:variable>
@@ -1601,8 +1613,9 @@
                                       writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","true",xmlWriter);
                                        xmlWriter.writeEndElement();
                                     }else{
-                                     <xsl:value-of select="$varName"/>.getOMElement(
-                                       new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
+                                          <xsl:value-of select="@type"/>Helper.getOMElement(
+                                            <xsl:value-of select="$varName"/>,
+                                          new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
                                         factory).serialize(xmlWriter);
                                     }
                                 </xsl:when>
@@ -1610,9 +1623,12 @@
                                     if (<xsl:value-of select="$varName"/>==null){
                                          throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
                                     }
-                                   <xsl:value-of select="$varName"/>.getOMElement(
-                                       new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
-                                       factory).serialize(xmlWriter);
+
+                                            <xsl:value-of select="@type"/>Helper.getOMElement(
+                                            <xsl:value-of select="$varName"/>,
+                                            new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
+                                            factory).serialize(xmlWriter);
+
                                 </xsl:otherwise>
                             </xsl:choose>
                         </xsl:when>
@@ -1631,10 +1647,10 @@
                             </xsl:choose>
 
                             for (int i = 0;i &lt; <xsl:value-of select="$varName"/>.length;i++){
-                             <xsl:value-of select="$varName"/>[i].getOMElement(
-                                       new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
-                                       factory).serialize(xmlWriter);
-
+                                    <xsl:value-of select="@type"/>Helper.getOMElement(
+                                    <xsl:value-of select="$varName"/>[i],
+                                    new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
+                                    factory).serialize(xmlWriter);
                             }
                             <!--we've opened a bracket for the nulls - fix it here-->
                             <xsl:if test="@nillable">}</xsl:if>
@@ -1743,9 +1759,10 @@
             <xsl:otherwise>
                 <!-- if the element is associated with a type, then its gonna be only one -->
                 //We can safely assume an element has only one type associated with it
-                <xsl:variable name="varName">local<xsl:value-of select="property/@javaname"/></xsl:variable>
-                <xsl:variable name="nillable"><xsl:value-of select="property/@nillable"/></xsl:variable>
-                <xsl:variable name="primitive"><xsl:value-of select="property/@primitive"/></xsl:variable>
+                <xsl:variable name="varName">typedBean.local<xsl:value-of select="property/@javaname"/></xsl:variable>
+                <xsl:variable name="nillable" select="property/@nillable"/>
+                <xsl:variable name="primitive" select="property/@primitive"/>
+                <xsl:variable name="type" select="property/@type"/>
 
                 <xsl:choose>
                     <!-- This better be only one!!-->
@@ -1760,8 +1777,9 @@
 
                                         xmlWriter.writeEndElement();
                                        }else{
-                                         <xsl:value-of select="$varName"/>.getOMElement(
-                                         MY_QNAME,
+                                         <xsl:value-of select="$type"/>Helper.getOMElement(
+                                         <xsl:value-of select="$varName"/>,
+                                         <xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME,
                                          factory).serialize(xmlWriter);
                                        }
                             </xsl:when>
@@ -1769,8 +1787,9 @@
                                  if (<xsl:value-of select="$varName"/>==null){
                                    throw new RuntimeException("Property cannot be null!");
                                  }
-                                 <xsl:value-of select="$varName"/>.getOMElement(
-                                         MY_QNAME,
+                                <xsl:value-of select="$type"/>Helper.getOMElement(
+                                         <xsl:value-of select="$varName"/>,
+                                         <xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME,
                                          factory).serialize(xmlWriter);
                             </xsl:otherwise>
                         </xsl:choose>
@@ -1851,26 +1870,14 @@
             <xsl:otherwise>
                //ignore the QName passed in - we send only OUR QName!
                return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
-               MY_QNAME,factory,dataSource);
+               <xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME,factory,dataSource);
             </xsl:otherwise>
        </xsl:choose>
     }
-    
-    
-    
-    public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
-     	return <xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>Helper.getPullParser(this, qName);
-     }
-    
-    
-    }
-      	
-	</xsl:when>
-	<xsl:otherwise>
-	
-public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> class <xsl:value-of select="$name"/>Helper <xsl:if test="@extension"> extends <xsl:value-of select="@extension"/></xsl:if> {
 
-	private static java.lang.String getElementTextProperly(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
+
+
+    private static java.lang.String getElementTextProperly(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
             java.lang.String value = reader.getElementText();
             while (!reader.isEndElement())
                 reader.next();
@@ -1884,8 +1891,8 @@
         * Postcondition: If this object is an element, the reader is positioned at its end element
         *                If this object is a complex type, the reader is positioned at the end element of its outer element
         */
-        public static <xsl:value-of select="$name"/> parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
-            <xsl:value-of select="$name"/> object = new <xsl:value-of select="$name"/>();
+        public static <xsl:value-of select="$fullyQualifiedName"/> parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
+            <xsl:value-of select="$fullyQualifiedName"/> object = new <xsl:value-of select="$fullyQualifiedName"/>();
             int event;
             try {
                 <!-- Advance to our start element, or if we are a complex type, to our first property start element or the outer end element if no properties -->
@@ -2233,8 +2240,10 @@
             return object;
         }
 	
-	        public static javax.xml.stream.XMLStreamReader getPullParser(<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/> bean, javax.xml.namespace.QName qName){
+	 public static javax.xml.stream.XMLStreamReader getPullParser(java.lang.Object beanObject, javax.xml.namespace.QName qName){
 
+        <xsl:value-of select="@package"/>.<xsl:value-of select="@name"/> bean =
+         (<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>)beanObject;
 
         <xsl:choose>
             <xsl:when test="@type or @anon">
@@ -2453,7 +2462,7 @@
 
             package <xsl:value-of select="@package"/>;
             /**
-            *  <xsl:value-of select="$name"/> bean class
+            *  <xsl:value-of select="$name"/> class
             */
         </xsl:if>
         public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> class <xsl:value-of select="$name"/>{
@@ -2468,7 +2477,7 @@
                   "<xsl:value-of select="@shortname"/>".equals(typeName)){
                    <xsl:choose>
                        <xsl:when test="$helperMode">
-                           return  <xsl:value-of select="@classname"/>Helper.parse(reader); 
+                           return  <xsl:value-of select="@classname"/>Helper.parse(reader);
                        </xsl:when>
                         <xsl:otherwise>
                             return  <xsl:value-of select="@classname"/>.Factory.parse(reader);
@@ -2478,7 +2487,7 @@
                   }
 
               </xsl:for-each>
-             return null;
+             throw new java.lang.RuntimeException("Unsupported type " + namespaceURI + " " + typeName);
           }
 
         }

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=425048&r1=425047&r2=425048&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 Jul 24 06:30:24 2006
@@ -9,8 +9,19 @@
         <!--  generate toOM for only non parts and non primitives!!! -->
         <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(<xsl:value-of select="@type"/>.MY_QNAME,
-            org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+            <xsl:choose>
+                    <xsl:when test="$helpermode">
+                            return <xsl:value-of select="@type"/>Helper.getOMElement(
+                                        param,
+                                        <xsl:value-of select="@type"/>.MY_QNAME,
+                                        org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+                    </xsl:when>
+                    <xsl:otherwise>
+                     return param.getOMElement(<xsl:value-of select="@type"/>.MY_QNAME,
+                                  org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+                    </xsl:otherwise>
+            </xsl:choose>
+
             }
         </xsl:for-each>
 
@@ -41,7 +52,17 @@
 
 
                        org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
-                       emptyEnvelope.getBody().addChild(wrappedType.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+                          <xsl:choose>
+                            <xsl:when test="$helpermode">
+                                emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
+                                wrappedType,
+                                <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+                            </xsl:when>
+                            <xsl:otherwise>
+                                emptyEnvelope.getBody().addChild(wrappedType.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+                            </xsl:otherwise>
+                        </xsl:choose>
+
                        return emptyEnvelope;
                        }
 
@@ -52,7 +73,16 @@
 						<!-- Assumption - the parameter is always an ADB element-->
 				    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="$inputElementType"/> param, boolean optimizeContent){
                     org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
-                     emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+                         <xsl:choose>
+                            <xsl:when test="$helpermode">
+                                emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
+                                param,
+                                <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+                            </xsl:when>
+                            <xsl:otherwise>
+                                emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+                            </xsl:otherwise>
+                    </xsl:choose>
                      return emptyEnvelope;
                     }
 
@@ -71,7 +101,18 @@
                     <!-- Assumption - The ADBBean here is always an element based bean -->
                     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){
                       org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
-                     emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
+                       <xsl:choose>
+                            <xsl:when test="$helpermode">
+                                emptyEnvelope.getBody().addChild(
+                                <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>Helper.getOMElement(
+                                param,
+                                <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
+                            </xsl:when>
+                            <xsl:otherwise>
+                                emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
+                            </xsl:otherwise>
+                    </xsl:choose>
+
                      return emptyEnvelope;
                     }
                 </xsl:when>

Added: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBHelperDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBHelperDataSource.java?rev=425048&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBHelperDataSource.java (added)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBHelperDataSource.java Mon Jul 24 06:30:24 2006
@@ -0,0 +1,102 @@
+package org.apache.axis2.databinding;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.util.StAXUtils;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamReader;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+/*
+ * 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 abstract class ADBHelperDataSource implements OMDataSource {
+
+    protected QName parentQName;
+    protected Object bean;
+    protected String helperClassName;
+
+    /**
+     * Constructor taking in an ADBBean
+     * @param bean
+     */
+    protected ADBHelperDataSource(Object bean,QName parentQName,String helperClassName) {
+        this.bean = bean;
+        this.parentQName = parentQName;
+        this.helperClassName = helperClassName;
+    }
+
+
+    /**
+     * @see OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)
+     * @param output
+     * @param format
+     * @throws javax.xml.stream.XMLStreamException
+     */
+    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+       serialize(StAXUtils.createXMLStreamWriter(output));
+    }
+
+    /**
+     * @see OMDataSource#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat)
+     * @param writer
+     * @param format
+     * @throws XMLStreamException
+     */
+    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
+        serialize(StAXUtils.createXMLStreamWriter(writer));
+    }
+
+    /**
+     * This needs to be generated inside the ADB bean
+     * @see OMDataSource#serialize(javax.xml.stream.XMLStreamWriter)
+     * @param xmlWriter
+     * @throws XMLStreamException
+     */
+    public abstract void serialize(XMLStreamWriter xmlWriter)
+            throws XMLStreamException;
+
+
+    /**
+     * @see org.apache.axiom.om.OMDataSource#getReader()
+     * @return
+     * @throws XMLStreamException
+     */
+    public XMLStreamReader getReader() throws XMLStreamException {
+        // since only ADBBeans related to elements can be serialized
+        try {
+            Class helperClass = Class.forName(helperClassName);
+            Method method = helperClass.getMethod("getPullParser",new Class[]{Object.class,
+                                               QName.class});
+            return (XMLStreamReader)method.invoke(null,new Object[]{bean,parentQName});
+        } catch (ClassNotFoundException e) {
+            throw new XMLStreamException(e);
+        } catch (NoSuchMethodException e) {
+           throw new XMLStreamException(e);
+        } catch (IllegalAccessException e) {
+             throw new XMLStreamException(e);
+        } catch (InvocationTargetException e) {
+            throw new XMLStreamException(e);
+        }
+
+    }
+
+}



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