axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r359761 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/ adb/src/org/apache/axis2/databinding/utils/ xml/src/org/apache/axis2/om/impl/llom/ xml/src/org/apache/axis2/om/impl/llom/serialize/
Date Thu, 29 Dec 2005 09:36:27 GMT
Author: chinthaka
Date: Thu Dec 29 01:36:08 2005
New Revision: 359761

URL: http://svn.apache.org/viewcvs?rev=359761&view=rev
Log:
Applying Dims' changes with minor fixes.

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java?rev=359761&r1=359760&r2=359761&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/ADBSOAPModelBuilder.java
Thu Dec 29 01:36:08 2005
@@ -1,14 +1,14 @@
 package org.apache.axis2.databinding;
 
-import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import org.apache.axis2.om.impl.OMNodeEx;
 import org.apache.axis2.om.OMException;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.om.impl.OMNodeEx;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 /**
  * Builds a SOAPEnvelope around an ADB pull parser
@@ -33,7 +33,12 @@
         ((OMNodeEx)body).setComplete(false);
     }
 
+    long count = -1;
     public int next() throws OMException {
+        count++;
+        if(count == 0)
+            return 0;
+        
         int ret = super.next();
         try {
             // Peek to see if the parser has any more and set the done flag.

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java?rev=359761&r1=359760&r2=359761&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ADBPullParser.java
Thu Dec 29 01:36:08 2005
@@ -619,7 +619,11 @@
     }
 
     public int getEventType() {
-        throw new UnsupportedOperationException("Yet to be implemented !!");
+        try {
+            return next();
+        } catch (XMLStreamException e) {
+            throw new RuntimeException("FIXME");
+        }
     }
 
     public char[] getTextCharacters() {

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=359761&r1=359760&r2=359761&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
Thu Dec 29 01:36:08 2005
@@ -53,7 +53,7 @@
 public class OMElementImpl extends OMNodeImpl
         implements OMElement, OMConstants, OMContainerEx {
 
-    private Log logger = LogFactory.getLog(getClass());
+    private Log logger;
     /**
      * Field ns
      */
@@ -96,6 +96,7 @@
         }
         this.builder = builder;
         firstChild = null;
+        getLogger();
     }
 
 
@@ -124,6 +125,7 @@
         if (ns != null) {
             setNamespace(ns);
         }
+        getLogger();
     }
 
     /**
@@ -199,7 +201,7 @@
      * the OMNodes.
      * This QName can contain any combination of prefix, localname and URI
      *
-     * @throws org.apache.axis2.om.OMException
+     * @throws OMException
      *
      * @throws OMException
      */
@@ -254,14 +256,14 @@
     /**
      * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText
or OMELement for others.
      *
-     * @throws org.apache.axis2.om.OMException
+     * @throws OMException
      *
      * @throws OMException
      */
     public OMNode getNextOMSibling() throws OMException {
         while (!done) {
             int token = builder.next();
-            if(token == XMLStreamConstants.END_DOCUMENT) {
+            if (token == XMLStreamConstants.END_DOCUMENT) {
                 throw new OMException();
             }
         }
@@ -349,21 +351,21 @@
      * This can also be used to retrieve the prefix of a known namespace URI
      */
     private OMNamespace findDeclaredNamespace(String uri, String prefix) {
-        
-    	
-    	if(uri == null) {
-    		return null;
-    	}
-    	
-    	//If the prefix is available and uri is available and its the xml namespace
-    	if(prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) && uri.equals(OMConstants.XMLNS_URI))
{
-    		return new OMNamespaceImpl(uri, prefix);
-    	}
-    	
-    	if (namespaces == null) {
+
+
+        if (uri == null) {
             return null;
         }
-	        
+
+        //If the prefix is available and uri is available and its the xml namespace
+        if (prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) &&
uri.equals(OMConstants.XMLNS_URI)) {
+            return new OMNamespaceImpl(uri, prefix);
+        }
+
+        if (namespaces == null) {
+            return null;
+        }
+
         if (prefix == null || "".equals(prefix)) {
             Iterator namespaceListIterator = namespaces.values().iterator();
             while (namespaceListIterator.hasNext()) {
@@ -380,11 +382,11 @@
             if (namespace != null && uri.equalsIgnoreCase(namespace.getName())) {
                 return namespace;
             } else {
-            	return null;
+                return null;
             }
         }
-	}
-    
+    }
+
 
     /**
      * Method getAllDeclaredNamespaces
@@ -397,9 +399,11 @@
                 public void remove() {
                     throw new UnsupportedOperationException();
                 }
+
                 public boolean hasNext() {
                     return false;
                 }
+
                 public Object next() {
                     return null;
                 }
@@ -539,7 +543,7 @@
     /**
      * This will remove this information item and its children, from the model completely
      *
-     * @throws org.apache.axis2.om.OMException
+     * @throws OMException
      *
      * @throws OMException
      */
@@ -571,7 +575,7 @@
     /**
      * getXMLStreamReader
      *
-     * @see org.apache.axis2.om.OMElement#getXMLStreamReader()
+     * @see OMElement#getXMLStreamReader()
      */
     public XMLStreamReader getXMLStreamReader() {
         return getXMLStreamReader(true);
@@ -580,7 +584,7 @@
     /**
      * getXMLStreamReaderWithoutCaching
      *
-     * @see org.apache.axis2.om.OMElement#getXMLStreamReaderWithoutCaching()
+     * @see OMElement#getXMLStreamReaderWithoutCaching()
      */
     public XMLStreamReader getXMLStreamReaderWithoutCaching() {
         return getXMLStreamReader(false);
@@ -699,16 +703,18 @@
             //has nothing to do if the element is already built!
             if (this.done) {
                 OMSerializerUtil.serializeStartpart(this, omOutput);
-                //serializeAndConsume children
-                Iterator children = this.getChildren();
-                while (children.hasNext()) {
-                    //A call to the  Serialize or the serializeAndConsume wont make a difference
here
-                    ((OMNodeEx) children.next()).serializeAndConsume(omOutput);
+                OMNodeImpl child = (OMNodeImpl) firstChild;
+                while(child != null && ((!(child instanceof OMElement)) || child.isComplete()))
{
+                    child.serializeAndConsume(omOutput);
+                    child = child.nextSibling;
+                }
+                if(child != null) {
+                    OMElement element = (OMElement) child;
+                    element.getBuilder().setCache(false);
+                    OMSerializerUtil.serializeByPullStream(element, omOutput, cache);
                 }
                 OMSerializerUtil.serializeEndpart(omOutput);
             } else {
-                //take the XMLStream reader and feed it to the stream serilizer.
-                //todo is this right ?????
                 OMSerializerUtil.serializeByPullStream(this, omOutput, cache);
             }
 
@@ -732,15 +738,6 @@
     }
 
     /**
-     * Method getNextNamespacePrefix
-     *
-     * @return prefix
-     */
-    private String getNextNamespacePrefix() {
-        return "ns" + ++noPrefixNamespaceCounter;
-    }
-
-    /**
      * Get first element
      *
      * @return element
@@ -860,5 +857,16 @@
         OMElement clonedElement = new StAXOMBuilder(this.getXMLStreamReader(true)).getDocumentElement();
         clonedElement.build();
         return clonedElement;
+    }
+
+    public Log getLogger() {
+        if (logger == null) {
+            if (parent != null && parent instanceof OMElementImpl) {
+                logger = ((OMElementImpl) parent).getLogger();
+            }else {
+                logger = LogFactory.getLog(getClass());
+            }
+        }
+        return logger;
     }
 }

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java?rev=359761&r1=359760&r2=359761&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
Thu Dec 29 01:36:08 2005
@@ -875,7 +875,9 @@
                 updateLastNode();
                 break;
             case SWITCHED:
-                currentEvent = parser.next();
+                if(parser.hasNext()) {
+                    currentEvent = parser.next();
+                }
                 updateCompleteStatus();
                 break;
             default :

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java?rev=359761&r1=359760&r2=359761&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java
Thu Dec 29 01:36:08 2005
@@ -143,8 +143,13 @@
 
         // add the namespaces
         int count = reader.getNamespaceCount();
+        String namespacePrefix;
         for (int i = 0; i < count; i++) {
-            serializeNamespace(reader.getNamespacePrefix(i),
+            namespacePrefix = reader.getNamespacePrefix(i);
+            if(namespacePrefix != null && namespacePrefix.length()==0)
+                continue;
+            
+            serializeNamespace(namespacePrefix,
                     reader.getNamespaceURI(i), writer);
         }
     }



Mime
View raw message