ws-commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r390997 - in /webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom: OMElementImpl.java OMSerializerUtil.java OMTextImpl.java
Date Mon, 03 Apr 2006 10:40:57 GMT
Author: chinthaka
Date: Mon Apr  3 03:40:50 2006
New Revision: 390997

URL: http://svn.apache.org/viewcvs?rev=390997&view=rev
Log:
Performance improvements
- reduced the calls to omOutput.getXMLStreamWriter()
- reduce method calls in setNextOMSibling and setPreviousSibling.

Modified:
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMSerializerUtil.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=390997&r1=390996&r2=390997&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
Mon Apr  3 03:40:50 2006
@@ -240,13 +240,13 @@
 
         if (firstChild == null) {
             firstChild = child;
-            child.setPreviousOMSibling(null);
+            child.previousSibling = null;
         } else {
-            child.setPreviousOMSibling(lastChild);
-            ((OMNodeEx) lastChild).setNextOMSibling(child);
+            child.previousSibling = (OMNodeImpl) lastChild;
+             ((OMNodeImpl) lastChild).nextSibling = child;
         }
 
-        child.setNextOMSibling(null);
+        child.nextSibling = null;
         lastChild = child;
 
     }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMSerializerUtil.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMSerializerUtil.java?rev=390997&r1=390996&r2=390997&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMSerializerUtil.java
(original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMSerializerUtil.java
Mon Apr  3 03:40:50 2006
@@ -123,9 +123,9 @@
                     element, OMOutputImpl
                     omOutput)
             throws XMLStreamException {
-        String nameSpaceName = null;
-        String writer_prefix = null;
-        String prefix = null;
+        String nameSpaceName;
+        String writer_prefix;
+        String prefix;
         XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (element.getNamespace() != null) {
             nameSpaceName = element.getNamespace().getName();

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=390997&r1=390996&r2=390997&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
Mon Apr  3 03:40:50 2006
@@ -30,9 +30,9 @@
 import org.apache.axiom.om.util.Base64;
 import org.apache.axiom.om.util.UUIDGenerator;
 
+import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
-import javax.xml.namespace.QName;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -214,8 +214,7 @@
      * @param omOutput
      * @throws XMLStreamException
      */
-    private void writeOutput(OMOutputImpl omOutput) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+    private void writeOutput(XMLStreamWriter writer) throws XMLStreamException {
         int type = getType();
         if (type == TEXT_NODE || type == SPACE_NODE) {
             writer.writeCharacters(this.getText());
@@ -393,9 +392,12 @@
     }
 
     private void serializeLocal(OMOutputImpl omOutput) throws XMLStreamException {
+        XMLStreamWriter xmlStreamWriter = omOutput.getXmlStreamWriter();
+
         if (!this.isBinary) {
-            writeOutput(omOutput);
+            writeOutput(xmlStreamWriter);
         } else {
+
             if (omOutput.isOptimized()) {
                 if (contentID == null) {
                     contentID = omOutput.getNextContentId();
@@ -404,11 +406,11 @@
                 this.attribute = new OMAttributeImpl("href",
                         new OMNamespaceImpl("", "", this.factory), "cid:" + getContentID(),
                         this.factory);
-                this.serializeStartpart(omOutput);
+                this.serializeStartpart(xmlStreamWriter);
                 omOutput.writeOptimized(this);
-                omOutput.getXmlStreamWriter().writeEndElement();
+                xmlStreamWriter.writeEndElement();
             } else {
-                omOutput.getXmlStreamWriter().writeCharacters(this.getText());
+                xmlStreamWriter.writeCharacters(this.getText());
             }
         }
     }
@@ -416,12 +418,11 @@
     /*
      * Methods to copy from OMSerialize utils
      */
-    private void serializeStartpart(OMOutputImpl omOutput)
+    private void serializeStartpart(XMLStreamWriter writer)
             throws XMLStreamException {
         String nameSpaceName;
         String writer_prefix;
         String prefix;
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (this.xopNS != null) {
             nameSpaceName = this.xopNS.getName();
             writer_prefix = writer.getPrefix(nameSpaceName);
@@ -452,21 +453,19 @@
             writer.writeStartElement(this.getLocalName());
         }
         // add the elements attribute "href"
-        serializeAttribute(this.attribute, omOutput);
+        serializeAttribute(this.attribute, writer);
         // add the namespace
-        serializeNamespace(this.xopNS, omOutput);
+        serializeNamespace(this.xopNS, writer);
     }
 
     /**
      * Method serializeAttribute.
      *
      * @param attr
-     * @param omOutput
      * @throws XMLStreamException
      */
-    static void serializeAttribute(OMAttribute attr, OMOutputImpl omOutput)
+    static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)
             throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         // first check whether the attribute is associated with a namespace
         OMNamespace ns = attr.getNamespace();
         String prefix;
@@ -494,9 +493,8 @@
      * @param omOutput
      * @throws XMLStreamException
      */
-    static void serializeNamespace(OMNamespace namespace, OMOutputImpl omOutput)
+    static void serializeNamespace(OMNamespace namespace, XMLStreamWriter writer)
             throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (namespace != null) {
             String uri = namespace.getName();
             String ns_prefix = namespace.getPrefix();



Mime
View raw message