+1 from me.

On 3/19/07, Amila Suriarachchi <[EMAIL PROTECTED]> wrote:
hi,
the getOMElement method in current generated ADB code is as follows,

 public org.apache.axiom.om.OMElement getOMElement(
               final javax.xml.namespace.QName parentQName,
               final org.apache.axiom.om.OMFactory factory){

        org.apache.axiom.om.OMDataSource dataSource =
getOMDataSource(parentQName, factory);

               return new
org.apache.axiom.om.impl.llom.OMSourcedElementImpl (
               parentQName,factory,dataSource);

       }

    public org.apache.axiom.om.OMDataSource
getOMDataSource(
            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){

         public void serialize(
javax.xml.stream.XMLStreamWriter xmlWriter) throws
javax.xml.stream.XMLStreamException {
            // serialize method implementation

        }

in here getOMElement method calls to getOMDataSource method. then within the
each getOMDataSource method always a new OMDataSource Object is created
(using an anonymous inner class) and the serialize method implements within
it.
In the serialize method (in anonymous class) it calls for getOMDataSource in
other adb classes again and again and as a result of this there are a lot of
OMDataSource classes created.

I think we can stop this by implementing the getOMElement and  serialize
method like this,

public org.apache.axiom.om.OMElement getOMElement(
            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, MY_QNAME)
{

                    public void
serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
                        OperationContent.this.serialize(MY_QNAME, factory,
xmlWriter);
                    }
                };
        return new
org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
                MY_QNAME, factory, dataSource);

    }

    public void serialize(final javax.xml.namespace.QName parentQName,
                          final org.apache.axiom.om.OMFactory factory,
                          javax.xml.stream.XMLStreamWriter
xmlWriter) throws javax.xml.stream.XMLStreamException {

        // serialize metho implementation
        localOperation1Content.serialize(MY_QNAME, factory,
xmlWriter);

    }

In here it creates only one OMDataSource object per ADB Object structure and
directly calls the serialize method.
the serialize method is a public method of the ADB bean class itself.

Is there any pirticular reason to use and OMDataSource in every bean? Would
this cause any other problems?
Can someone having a better OM knowledge look into this?

I ran all the adb-codegen testcase with this change and it worked fine.
Here with I have attached the patch

thanks
Amila.

--
Amila Suriarachchi,
WSO2 Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to