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/06/01 15:22:50 UTC

svn commit: r410861 - in /webservices/axis2/trunk/java/modules: adb-codegen/src/org/apache/axis2/schema/template/ codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/template/j...

Author: ajith
Date: Thu Jun  1 06:22:49 2006
New Revision: 410861

URL: http://svn.apache.org/viewvc?rev=410861&view=rev
Log:
1. Broke the data binding template into seperate files. Instead of one file now there are five files and these files are moved to the relevant modules to make things modular.
2. Modified the properties to include the names of the multiple templates instead of a single template. 
3. Modified the XSLTIncludeResolver.java to pump in the correct template depending on the selected data binding framework.

Added:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxmeDatabindingTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl
      - copied, changed from r410496, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
    webservices/axis2/trunk/java/modules/jibx/jibx.iml
    webservices/axis2/trunk/java/modules/jibx/src/org/apache/axis2/jibx/template/
    webservices/axis2/trunk/java/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
    webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/
    webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl
Removed:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    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/util/ConfigPropertyFileLoader.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java

Added: 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=410861&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl Thu Jun  1 06:22:49 2006
@@ -0,0 +1,78 @@
+<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>
+
+            <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){
+                            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;
+                        }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;
+                        }
+                    }
+
+                    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);
+                }
+
+                return null;
+            }
+
+        </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=410861&r1=410860&r2=410861&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties Thu Jun  1 06:22:49 2006
@@ -24,9 +24,14 @@
 codegen.databinding.extensions=org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.JaxMeExtension,org.apache.axis2.wsdl.codegen.extension.JiBXExtension,org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
 # the default data binding framework name
 codegen.databinding.frameworks.default=adb
-# the databinding template - this should include all the necessary xslt templates for
-# creating the databindsupporters
-codegen.databinding.supporter.template=/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
+# the databinding templates -
+codegen.databinding.adb.supporter.template=/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
+codegen.databinding.xmlbeans.supporter.template=/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl
+codegen.databinding.jaxme.supporter.template=/org/apache/axis2/wsdl/template/java/JaxmeDatabindingTemplate.xsl
+codegen.databinding.jibx.supporter.template=/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
+#there is no template for jaxbri ??
+#codegen.databinding.jaxbri.supporter.template=/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
+codegen.databinding.none.supporter.template=/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl
 
 codegen.databinding.testobject.template=/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl
 #####################################################################################################################

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=410861&r1=410860&r2=410861&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 Jun  1 06:22:49 2006
@@ -152,7 +152,7 @@
     public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
         this.codeGenConfiguration = configuration;
         this.axisService = codeGenConfiguration.getAxisService();
-        resolver = new XSLTIncludeResolver(this.codeGenConfiguration.getProperties());
+        resolver = new XSLTIncludeResolver(codeGenConfiguration);
     }
 
     public void setMapper(TypeMapper mapper) {

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxmeDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxmeDatabindingTemplate.xsl?rev=410861&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxmeDatabindingTemplate.xsl (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JaxmeDatabindingTemplate.xsl Thu Jun  1 06:22:49 2006
@@ -0,0 +1,78 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+
+    <!-- #################################################################################  -->
+    <!-- ############################   jaxme template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='jaxme']">
+
+        <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>
+
+        private org.apache.axiom.om.OMElement toOM(Object param) {
+            try {
+                javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(param.getClass().getInterfaces()[0].getPackage()
+                                                                                            .getName());
+                org.apache.axiom.om.impl.builder.SAXOMBuilder builder = new org.apache.axiom.om.impl.builder.SAXOMBuilder();
+                javax.xml.bind.Marshaller marshaller = ctx.createMarshaller();
+                marshaller.marshal(param, builder);
+                return builder.getRootElement();
+            } catch (javax.xml.bind.JAXBException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+            org.apache.axiom.soap.SOAPFactory factory, Object param, boolean optimizeContent) {
+            org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
+            if (param != null){
+                envelope.getBody().addChild(toOM(param));
+            }
+
+            return envelope;
+        }
+
+        public java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+        java.lang.Class type,
+         java.util.Map extraNamespaces){
+            try{
+                javax.xml.transform.Source source =
+                        new javanet.staxutils.StAXSource(param.getXMLStreamReader());
+                javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(
+                        type.getPackage().getName());
+                javax.xml.bind.Unmarshaller u = ctx.createUnmarshaller();
+                return u.unmarshal(source);
+            } catch(java.lang.Exception e) {
+                throw new RuntimeException("Data binding error",e);
+            }
+        }
+    <!-- Generate the base 64 optimize methods only if the base64 items are present -->
+   <xsl:if test="$base64">
+   private void optimizeContent(org.apache.axiom.om.OMElement element, javax.xml.namespace.QName[] qNames){
+        for (int i = 0; i &lt; qNames.length; i++) {
+            markElementsAsOptimized(qNames[i],element);
+        }
+    }
+
+    private void markElementsAsOptimized(javax.xml.namespace.QName qName,org.apache.axiom.om.OMElement rootElt){
+        if (rootElt.getQName().equals(qName)){
+            //get the text node and mark it
+            org.apache.axiom.om.OMNode node = rootElt.getFirstOMChild();
+            if (node.getType()==org.apache.axiom.om.OMNode.TEXT_NODE){
+                ((org.apache.axiom.om.OMText)node).setOptimize(true);
+            }
+
+        }
+        java.util.Iterator childElements = rootElt.getChildElements();
+        while (childElements.hasNext()) {
+            markElementsAsOptimized(qName,(org.apache.axiom.om.OMElement)childElements.next());
+        }
+    }
+    </xsl:if>
+    </xsl:template>
+</xsl:stylesheet>

Copied: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl (from r410496, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl?p2=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl&p1=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl&r1=410496&r2=410861&rev=410861&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/NoneDatabindingTemplate.xsl Thu Jun  1 06:22:49 2006
@@ -1,364 +1,34 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="text"/>
 
-    <!-- #################################################################################  -->
-    <!-- ############################   xmlbeans template   ##############################  -->
-    <xsl:template match="databinders[@dbtype='xmlbeans']">
-
-        <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!=''">
-                private  org.apache.axiom.om.OMElement  toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent){
-                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.newXMLStreamReader())) ;
-                 org.apache.axiom.om.OMElement documentElement = builder.getDocumentElement();
-
-		<xsl:if test="$base64">
-		if (optimizeContent) {
-                         optimizeContent(documentElement,qNameArray);
-		}
-                </xsl:if>
-
-                  ((org.apache.axiom.om.impl.OMNodeEx)documentElement).setParent(null);
-                  return documentElement;
-                }
-
-                private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param, boolean optimizeContent){
-                    org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
-                    if (param != null){
-                        envelope.getBody().addChild(toOM(param, optimizeContent));
-                    }
-                    return envelope;
-                }
-            </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();
-        }
-
-        public org.apache.xmlbeans.XmlObject 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)){
-                if (extraNamespaces!=null){
-                 return <xsl:value-of select="@type"/>.Factory.parse(
-                       param.getXMLStreamReaderWithoutCaching(),
-                       new org.apache.xmlbeans.XmlOptions().setLoadAdditionalNamespaces(extraNamespaces));
-                }else{
-                 return <xsl:value-of select="@type"/>.Factory.parse(
-                       param.getXMLStreamReaderWithoutCaching());
-                }
-                }
-            </xsl:if>
-        </xsl:for-each>
-        }catch(java.lang.Exception e){
-        throw new RuntimeException("Data binding error",e);
-        }
-        return null;
-        }
-
-    <!-- Generate the base 64 optimize methods only if the base64 items are present -->    
-   <xsl:if test="$base64">
-		
-   private void optimizeContent(org.apache.axiom.om.OMElement element, javax.xml.namespace.QName[] qNames){
-        for (int i = 0; i &lt; qNames.length; i++) {
-            markElementsAsOptimized(qNames[i],element);
-        }
-    }
-
-    private void markElementsAsOptimized(javax.xml.namespace.QName qName,org.apache.axiom.om.OMElement rootElt){
-        if (rootElt.getQName().equals(qName)){
-            //get the text node and mark it
-            org.apache.axiom.om.OMNode node = rootElt.getFirstOMChild();
-            if (node.getType()==org.apache.axiom.om.OMNode.TEXT_NODE){
-                ((org.apache.axiom.om.OMText)node).setOptimize(true);
-            }
 
-        }
-        java.util.Iterator childElements = rootElt.getChildElements();
-        while (childElements.hasNext()) {
-            markElementsAsOptimized(qName,(org.apache.axiom.om.OMElement)childElements.next());
-        }
-    }
-    </xsl:if>
-    </xsl:template>
     <!-- #################################################################################  -->
-    <!-- ############################   jaxme template   ##############################  -->
-    <xsl:template match="databinders[@dbtype='jaxme']">
-
-        <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>
-
-        private org.apache.axiom.om.OMElement toOM(Object param) {
-            try {
-                javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(param.getClass().getInterfaces()[0].getPackage()
-                                                                                            .getName());
-                org.apache.axiom.om.impl.builder.SAXOMBuilder builder = new org.apache.axiom.om.impl.builder.SAXOMBuilder();
-                javax.xml.bind.Marshaller marshaller = ctx.createMarshaller();
-                marshaller.marshal(param, builder);
-                return builder.getRootElement();
-            } catch (javax.xml.bind.JAXBException e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
-            org.apache.axiom.soap.SOAPFactory factory, Object param, boolean optimizeContent) {
-            org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
-            if (param != null){
-                envelope.getBody().addChild(toOM(param));
-            }
-
-            return envelope;
-        }
-
-        public java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+    <!-- ############################   none template!!!   ##############################  -->
+    <xsl:template match="databinders[@dbtype='none']">
+        private  org.apache.axiom.om.OMElement fromOM(
+        org.apache.axiom.om.OMElement param,
         java.lang.Class type,
-         java.util.Map extraNamespaces){
-            try{
-                javax.xml.transform.Source source =
-                        new javanet.staxutils.StAXSource(param.getXMLStreamReader());
-                javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(
-                        type.getPackage().getName());
-                javax.xml.bind.Unmarshaller u = ctx.createUnmarshaller();
-                return u.unmarshal(source);
-            } catch(java.lang.Exception e) {
-                throw new RuntimeException("Data binding error",e);
-            }
+        java.util.Map extraNamespaces){
+        return param;
         }
-    <!-- Generate the base 64 optimize methods only if the base64 items are present -->    
-   <xsl:if test="$base64">
-   private void optimizeContent(org.apache.axiom.om.OMElement element, javax.xml.namespace.QName[] qNames){
-        for (int i = 0; i &lt; qNames.length; i++) {
-            markElementsAsOptimized(qNames[i],element);
-        }
-    }
-
-    private void markElementsAsOptimized(javax.xml.namespace.QName qName,org.apache.axiom.om.OMElement rootElt){
-        if (rootElt.getQName().equals(qName)){
-            //get the text node and mark it
-            org.apache.axiom.om.OMNode node = rootElt.getFirstOMChild();
-            if (node.getType()==org.apache.axiom.om.OMNode.TEXT_NODE){
-                ((org.apache.axiom.om.OMText)node).setOptimize(true);
-            }
 
+        private  org.apache.axiom.om.OMElement  toOM(org.apache.axiom.om.OMElement param){
+        return param;
         }
-        java.util.Iterator childElements = rootElt.getChildElements();
-        while (childElements.hasNext()) {
-            markElementsAsOptimized(qName,(org.apache.axiom.om.OMElement)childElements.next());
-        }
-    }
-    </xsl:if>
-    </xsl:template>
-    <!-- #################################################################################  -->
-       <!-- ############################   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>
-
-            <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){
-                            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;
-                        }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;
-                        }
-                    }
-
-                    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 org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, org.apache.axiom.om.OMElement param, boolean optimizeContent){
+        org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
+        envelope.getBody().addChild(param);
+        return envelope;
+        }
 
-            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);
-                }
-
-                return null;
-            }
-
-        </xsl:template>
-    <!-- #################################################################################  -->
-    <!-- ############################   JiBX template   ##############################  -->
-    <xsl:template match="databinders[@dbtype='jibx']">
-
-        <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:variable name="firstType"><xsl:value-of select="param[1]/@type"/></xsl:variable>
-        
-        <xsl:for-each select="param">
-            <xsl:if test="@type!=''">
-            
-                <xsl:if test="position()=1">
-                    private static final org.jibx.runtime.IBindingFactory bindingFactory;
-                    static {
-                        org.jibx.runtime.IBindingFactory factory = null;
-                        try {
-                            factory = org.jibx.runtime.BindingDirectory.getFactory(<xsl:value-of select="@type"/>.class);
-                        } catch (Exception e) { /** intentionally empty - report error on usage attempt */ }
-                        bindingFactory = factory;
-                    };
-                </xsl:if>
-                
-                private org.apache.axiom.om.OMElement toOM(<xsl:value-of select="@type"/> param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
-                    if (param instanceof org.jibx.runtime.IMarshallable){
-                        if (bindingFactory == null) {
-                            throw new RuntimeException("Could not find JiBX binding information for <xsl:value-of select='$firstType'/>, JiBX binding unusable");
-                        }
-                        org.jibx.runtime.IMarshallable marshallable =
-                            (org.jibx.runtime.IMarshallable)param;
-                        int index = marshallable.JiBX_getIndex();
-                        org.apache.axis2.jibx.JiBXDataSource source =
-                            new org.apache.axis2.jibx.JiBXDataSource(marshallable, bindingFactory);
-                        org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace(bindingFactory.getElementNamespaces()[index], null);
-                        return factory.createOMElement(source, bindingFactory.getElementNames()[index], namespace);
-                    } else {
-                        throw new RuntimeException("No JiBX &lt;mapping> defined for class <xsl:value-of select='@type'/>");
-                    }
-                }
-  
-                private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param, boolean optimizeContent) {
-                    org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
-                    if (param != null){
-                        envelope.getBody().addChild(toOM(param, factory, optimizeContent));
-                    }
-                    return envelope;
-                }
-                
-            </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 {
-                if (bindingFactory == null) {
-                    throw new RuntimeException("Could not find JiBX binding information for com.sosnoski.seismic.jibxsoap.Query, JiBX binding unusable");
-                }
-                org.jibx.runtime.impl.UnmarshallingContext ctx =
-                    (org.jibx.runtime.impl.UnmarshallingContext)bindingFactory.createUnmarshallingContext();
-                org.jibx.runtime.IXMLReader reader = new org.jibx.runtime.impl.StAXReaderWrapper(param.getXMLStreamReaderWithoutCaching(), "SOAP-message", true);
-                ctx.setDocument(reader);
-                return ctx.unmarshalElement(type);
-            } catch (Exception e) {
-                 throw new RuntimeException(e);
-            }
+        private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
+        return factory.getDefaultEnvelope();
         }
 
     </xsl:template>
-    
-       <!-- #################################################################################  -->
-       <!-- ############################   none template!!!   ##############################  -->
-       <xsl:template match="databinders[@dbtype='none']">
-           private  org.apache.axiom.om.OMElement fromOM(
-                 org.apache.axiom.om.OMElement param,
-                 java.lang.Class type,
-                 java.util.Map extraNamespaces){
-              return param;
-           }
-
-           private  org.apache.axiom.om.OMElement  toOM(org.apache.axiom.om.OMElement param){
-               return param;
-           }
-
-           private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, org.apache.axiom.om.OMElement param, boolean optimizeContent){
-                org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
-                envelope.getBody().addChild(param);
-                return envelope;
-           }
-
-           /**
-           *  get the default envelope
-           */
-           private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
-                return factory.getDefaultEnvelope();
-           }
-
-       </xsl:template>
 
-     </xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java?rev=410861&r1=410860&r2=410861&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java Thu Jun  1 06:22:49 2006
@@ -3,12 +3,13 @@
 import org.apache.axis2.wsdl.i18n.CodegenMessages;
 
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.FileNotFoundException;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 
@@ -19,7 +20,7 @@
 
 
 
-    private static String dbSupporterTemplateName;
+    private static Map dbSupporterTemplateNameMap;
     private static String testObjectTemplateName;
     private static String[] extensionClassNames;
     private static String[] thirdPartySchemaNames;
@@ -41,7 +42,8 @@
     private static final String DATA_BINDING_FRAMEWORK_NAME_KEY = "codegen.databinding.frameworks";
     private static final String DATA_BINDING_FRAMEWORK_DEFAULT_NAME_KEY = "codegen.databinding.frameworks.default";
     private static final String DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY = "codegen.databinding.extensions";
-    private static final String DATA_BINDING_TEMPLATE_NAME_KEY = "codegen.databinding.supporter.template";
+    private static final String DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX = "codegen.databinding.";
+    private static final String DATA_BINDING_TEMPLATE_NAME_KEY_SUFFIX = "template";
     private static final String DATA_BINDING_TEST_OBJECT_TEMPLATE_NAME_KEY = "codegen.databinding.testobject.template";
 
 
@@ -76,7 +78,7 @@
     }
 
     private static void reset(){
-        dbSupporterTemplateName = null;
+        dbSupporterTemplateNameMap = new HashMap();
         testObjectTemplateName = null;
         extensionClassNames = null;
         thirdPartySchemaNames = null;
@@ -94,7 +96,7 @@
             //look for the system property "org.apache.axis2.codegen.config" to for a property
             //entry refering to the config properties
             String property = System.getProperty("org.apache.axis2.codegen.config");
-            InputStream stream = null;
+            InputStream stream;
 
             if (property!=null){
                 stream = getStream(property);
@@ -156,8 +158,20 @@
                 thirdPartySchemaNames = tempString.split(SEPARATOR_CHAR);
 
             }
-            //the db supporter template name
-            dbSupporterTemplateName = props.getProperty(DATA_BINDING_TEMPLATE_NAME_KEY);
+
+            //populate the db supporter template names.
+            dbSupporterTemplateNameMap = new HashMap();
+            String key;
+            for (Iterator allProperties = props.keySet().iterator();
+                 allProperties.hasNext();){
+                key = (String)allProperties.next();
+                if (key.startsWith(DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX) &&
+                        key.endsWith(DATA_BINDING_TEMPLATE_NAME_KEY_SUFFIX)){
+                    dbSupporterTemplateNameMap.put(key,
+                            props.getProperty(key));
+                }
+
+            }
 
             testObjectTemplateName = props.getProperty(DATA_BINDING_TEST_OBJECT_TEMPLATE_NAME_KEY);
 
@@ -228,12 +242,12 @@
     }
 
     /**
-     * Gets the databinder template name. This is the template that has the
+     * Gets the databinder template names. This is the template that has the
      * logic for creating the databind supporters.
      * @return Returns String.
      */
-    public static String getDbSupporterTemplateName() {
-        return dbSupporterTemplateName;
+    public static Map getDbSupporterTemplatesMap() {
+        return dbSupporterTemplateNameMap;
     }
     /**
      * Gets the extension class names.

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java?rev=410861&r1=410860&r2=410861&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/XSLTIncludeResolver.java Thu Jun  1 06:22:49 2006
@@ -1,6 +1,7 @@
 package org.apache.axis2.wsdl.util;
 
 import org.apache.axis2.wsdl.i18n.CodegenMessages;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
@@ -9,6 +10,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.Map;
+import java.util.Iterator;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -27,24 +29,34 @@
 
 public class XSLTIncludeResolver implements URIResolver,XSLTConstants {
 
-    private Map externalPropertyMap;
+    private CodeGenConfiguration configuration;
 
     public XSLTIncludeResolver() {
     }
 
-    public XSLTIncludeResolver(Map externalPropertyMap) {
-        this.externalPropertyMap = externalPropertyMap;
+    public XSLTIncludeResolver(CodeGenConfiguration config) {
+        this.configuration = config;
     }
 
-    public void setExternalPropertyMap(Map externalPropertyMap) {
-        this.externalPropertyMap = externalPropertyMap;
-    }
+
 
     public Source resolve(String href, String base) throws TransformerException {
         String templateName;
+        Map externalPropertyMap = configuration.getProperties();
+
         InputStream supporterTemplateStream;
         if (XSLT_INCLUDE_DATABIND_SUPPORTER_HREF_KEY.equals(href)){
-            return getSourceFromTemplateName(ConfigPropertyFileLoader.getDbSupporterTemplateName());
+            //use the language name from the configuration to search the key
+            //our search only consists of looking for the data binding name
+            //in the key
+            Map dbSupporterMap = ConfigPropertyFileLoader.getDbSupporterTemplatesMap();
+            String key;
+            for (Iterator keys = dbSupporterMap.keySet().iterator();keys.hasNext();){
+                key = (String) keys.next();
+                if (key.indexOf(configuration.getDatabindingType())!=-1){
+                    return getSourceFromTemplateName((String)dbSupporterMap.get(key));
+                }
+            }
         }
 
         if (XSLT_INCLUDE_TEST_OBJECT_HREF_KEY.equals((href))){

Added: webservices/axis2/trunk/java/modules/jibx/jibx.iml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jibx/jibx.iml?rev=410861&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jibx/jibx.iml (added)
+++ webservices/axis2/trunk/java/modules/jibx/jibx.iml Thu Jun  1 06:22:49 2006
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+  <component name="ModuleRootManager" />
+  <component name="NewModuleRootManager">
+    <output url="file://$MODULE_DIR$/classes" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntryProperties />
+  </component>
+</module>
+

Added: webservices/axis2/trunk/java/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl?rev=410861&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl (added)
+++ webservices/axis2/trunk/java/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl Thu Jun  1 06:22:49 2006
@@ -0,0 +1,86 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+<!-- #################################################################################  -->
+    <!-- ############################   JiBX template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='jibx']">
+
+        <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:variable name="firstType"><xsl:value-of select="param[1]/@type"/></xsl:variable>
+
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+
+                <xsl:if test="position()=1">
+                    private static final org.jibx.runtime.IBindingFactory bindingFactory;
+                    static {
+                        org.jibx.runtime.IBindingFactory factory = null;
+                        try {
+                            factory = org.jibx.runtime.BindingDirectory.getFactory(<xsl:value-of select="@type"/>.class);
+                        } catch (Exception e) { /** intentionally empty - report error on usage attempt */ }
+                        bindingFactory = factory;
+                    };
+                </xsl:if>
+
+                private org.apache.axiom.om.OMElement toOM(<xsl:value-of select="@type"/> param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
+                    if (param instanceof org.jibx.runtime.IMarshallable){
+                        if (bindingFactory == null) {
+                            throw new RuntimeException("Could not find JiBX binding information for <xsl:value-of select='$firstType'/>, JiBX binding unusable");
+                        }
+                        org.jibx.runtime.IMarshallable marshallable =
+                            (org.jibx.runtime.IMarshallable)param;
+                        int index = marshallable.JiBX_getIndex();
+                        org.apache.axis2.jibx.JiBXDataSource source =
+                            new org.apache.axis2.jibx.JiBXDataSource(marshallable, bindingFactory);
+                        org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace(bindingFactory.getElementNamespaces()[index], null);
+                        return factory.createOMElement(source, bindingFactory.getElementNames()[index], namespace);
+                    } else {
+                        throw new RuntimeException("No JiBX &lt;mapping> defined for class <xsl:value-of select='@type'/>");
+                    }
+                }
+
+                private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param, boolean optimizeContent) {
+                    org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
+                    if (param != null){
+                        envelope.getBody().addChild(toOM(param, factory, optimizeContent));
+                    }
+                    return envelope;
+                }
+
+            </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 {
+                if (bindingFactory == null) {
+                    throw new RuntimeException("Could not find JiBX binding information for com.sosnoski.seismic.jibxsoap.Query, JiBX binding unusable");
+                }
+                org.jibx.runtime.impl.UnmarshallingContext ctx =
+                    (org.jibx.runtime.impl.UnmarshallingContext)bindingFactory.createUnmarshallingContext();
+                org.jibx.runtime.IXMLReader reader = new org.jibx.runtime.impl.StAXReaderWrapper(param.getXMLStreamReaderWithoutCaching(), "SOAP-message", true);
+                ctx.setDocument(reader);
+                return ctx.unmarshalElement(type);
+            } catch (Exception e) {
+                 throw new RuntimeException(e);
+            }
+        }
+
+    </xsl:template>
+    </xsl:stylesheet>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl?rev=410861&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl (added)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl Thu Jun  1 06:22:49 2006
@@ -0,0 +1,102 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+
+    <!-- #################################################################################  -->
+    <!-- ############################   xmlbeans template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='xmlbeans']">
+
+        <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!=''">
+                private  org.apache.axiom.om.OMElement  toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent){
+                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.newXMLStreamReader())) ;
+                 org.apache.axiom.om.OMElement documentElement = builder.getDocumentElement();
+
+		<xsl:if test="$base64">
+		if (optimizeContent) {
+                         optimizeContent(documentElement,qNameArray);
+		}
+                </xsl:if>
+
+                  ((org.apache.axiom.om.impl.OMNodeEx)documentElement).setParent(null);
+                  return documentElement;
+                }
+
+                private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="@type"/> param, boolean optimizeContent){
+                    org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
+                    if (param != null){
+                        envelope.getBody().addChild(toOM(param, optimizeContent));
+                    }
+                    return envelope;
+                }
+            </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();
+        }
+
+        public org.apache.xmlbeans.XmlObject 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)){
+                if (extraNamespaces!=null){
+                 return <xsl:value-of select="@type"/>.Factory.parse(
+                       param.getXMLStreamReaderWithoutCaching(),
+                       new org.apache.xmlbeans.XmlOptions().setLoadAdditionalNamespaces(extraNamespaces));
+                }else{
+                 return <xsl:value-of select="@type"/>.Factory.parse(
+                       param.getXMLStreamReaderWithoutCaching());
+                }
+                }
+            </xsl:if>
+        </xsl:for-each>
+        }catch(java.lang.Exception e){
+        throw new RuntimeException("Data binding error",e);
+        }
+        return null;
+        }
+
+    <!-- Generate the base 64 optimize methods only if the base64 items are present -->
+   <xsl:if test="$base64">
+
+   private void optimizeContent(org.apache.axiom.om.OMElement element, javax.xml.namespace.QName[] qNames){
+        for (int i = 0; i &lt; qNames.length; i++) {
+            markElementsAsOptimized(qNames[i],element);
+        }
+    }
+
+    private void markElementsAsOptimized(javax.xml.namespace.QName qName,org.apache.axiom.om.OMElement rootElt){
+        if (rootElt.getQName().equals(qName)){
+            //get the text node and mark it
+            org.apache.axiom.om.OMNode node = rootElt.getFirstOMChild();
+            if (node.getType()==org.apache.axiom.om.OMNode.TEXT_NODE){
+                ((org.apache.axiom.om.OMText)node).setOptimize(true);
+            }
+
+        }
+        java.util.Iterator childElements = rootElt.getChildElements();
+        while (childElements.hasNext()) {
+            markElementsAsOptimized(qName,(org.apache.axiom.om.OMElement)childElements.next());
+        }
+    }
+    </xsl:if>
+    </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file



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