ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1729251 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/ aspects/om-aspects/src/main/java...
Date Mon, 08 Feb 2016 20:55:15 GMT
Author: veithen
Date: Mon Feb  8 20:55:14 2016
New Revision: 1729251

URL: http://svn.apache.org/viewvc?rev=1729251&view=rev
Log:
Turn the spaghetti code in SerializerImpl into a more or less straightforward XmlHandler chain.

Removed:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/Serializer.java
Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/SerializerImpl.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/SAXSerializer.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/XMLReaderImpl.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/AxiomSerializable.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCharacterDataNodeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocTypeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomEntityReferenceSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSerializableSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPMessageSupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/SerializerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/SerializerImpl.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/SerializerImpl.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/SerializerImpl.java
Mon Feb  8 20:55:14 2016
@@ -18,33 +18,25 @@
  */
 package org.apache.axiom.om.impl.common.serializer.push;
 
-import java.util.Iterator;
-
 import javax.activation.DataHandler;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.axiom.core.CoreAttribute;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
 import org.apache.axiom.om.DeferredParsingException;
-import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.impl.common.builder.StAXHelper;
 import org.apache.axiom.om.impl.common.util.OMDataSourceUtil;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.intf.TextContent;
 import org.apache.axiom.om.impl.stream.StreamException;
 import org.apache.axiom.om.impl.stream.XmlHandler;
 
-public abstract class SerializerImpl implements Serializer {
-    private final XmlHandler handler;
-    
+public abstract class SerializerImpl implements XmlHandler {
     /**
      * Constructor.
      * 
@@ -58,7 +50,7 @@ public abstract class SerializerImpl imp
      *            indicates if the namespace context determined by the ancestors of the root
node
      *            should be strictly preserved in the output
      */
-    public SerializerImpl(OMSerializable root, boolean namespaceRepairing, boolean preserveNamespaceContext)
{
+    public XmlHandler buildHandler(OMSerializable root, boolean namespaceRepairing, boolean
preserveNamespaceContext) {
         OMElement contextElement;
         if (root instanceof OMNode) {
             OMContainer parent = ((OMNode)root).getParent();
@@ -77,32 +69,9 @@ public abstract class SerializerImpl imp
         if (namespaceRepairing) {
             handler = new NamespaceHelper(this, handler, contextElement);
         }
-        this.handler = handler;
+        return handler;
     }
 
-    public final void serializeStartpart(OMElement element) throws StreamException {
-        OMNamespace ns = element.getNamespace();
-        if (ns == null) {
-            handler.startElement("", element.getLocalName(), "");
-        } else {
-            handler.startElement(ns.getNamespaceURI(), element.getLocalName(), ns.getPrefix());
-        }
-        for (Iterator<OMNamespace> it = element.getAllDeclaredNamespaces(); it.hasNext();
) {
-            ns = it.next();
-            handler.processNamespaceDeclaration(ns.getPrefix(), ns.getNamespaceURI());
-        }
-        for (Iterator<OMAttribute> it = element.getAllAttributes(); it.hasNext(); )
{
-            OMAttribute attr = it.next();
-            ns = attr.getNamespace();
-            if (ns == null) {
-                handler.processAttribute("", attr.getLocalName(), "", attr.getAttributeValue(),
attr.getAttributeType(), ((CoreAttribute)attr).coreGetSpecified());
-            } else {
-                handler.processAttribute(ns.getNamespaceURI(), attr.getLocalName(), ns.getPrefix(),
attr.getAttributeValue(), attr.getAttributeType(), ((CoreAttribute)attr).coreGetSpecified());
-            }
-        }
-        handler.attributesCompleted();
-    }
-    
     /**
      * Serialize the given data source.
      * 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/SAXSerializer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/SAXSerializer.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/SAXSerializer.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/SAXSerializer.java
Mon Feb  8 20:55:14 2016
@@ -27,7 +27,6 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
 import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.impl.common.serializer.push.SerializerImpl;
 import org.apache.axiom.om.impl.stream.StreamException;
 import org.apache.axiom.util.base64.Base64EncodingWriterOutputStream;
@@ -45,8 +44,7 @@ public class SAXSerializer extends Seria
     private int depth;
     private final SAXHelper helper = new SAXHelper();
     
-    public SAXSerializer(OMSerializable root, ContentHandler contentHandler, LexicalHandler
lexicalHandler) {
-        super(root, false, true);
+    public SAXSerializer(ContentHandler contentHandler, LexicalHandler lexicalHandler) {
         this.contentHandler = contentHandler;
         this.lexicalHandler = lexicalHandler;
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/XMLReaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/XMLReaderImpl.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/XMLReaderImpl.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/sax/XMLReaderImpl.java
Mon Feb  8 20:55:14 2016
@@ -46,7 +46,7 @@ public class XMLReaderImpl extends Abstr
     
     private void parse() throws SAXException {
         try {
-            root.internalSerialize(new SAXSerializer(root, contentHandler, lexicalHandler),
+            root.internalSerialize(new SAXSerializer(contentHandler, lexicalHandler).buildHandler(root,
false, true),
                     new OMOutputFormat(), cache);
         } catch (StreamException ex) {
             throw (SAXException)ex.getCause();

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/serializer/push/stax/StAXSerializer.java
Mon Feb  8 20:55:14 2016
@@ -28,6 +28,7 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.impl.common.serializer.push.SerializerImpl;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.axiom.util.stax.XMLStreamWriterUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -43,11 +44,14 @@ public class StAXSerializer extends Seri
     private final XMLStreamWriter writer;
     private DataHandlerWriter dataHandlerWriter;
     
-    public StAXSerializer(OMSerializable root, XMLStreamWriter writer) {
-        super(root, true, false);
+    public StAXSerializer(XMLStreamWriter writer) {
         this.writer = writer;
     }
 
+    public XmlHandler buildHandler(OMSerializable root) {
+        return buildHandler(root, true, false);
+    }
+    
     protected void serializePushOMDataSource(OMDataSource dataSource) throws StreamException
{
         try {
             dataSource.serialize(writer);

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/AxiomSerializable.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/AxiomSerializable.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/AxiomSerializable.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/AxiomSerializable.java
Mon Feb  8 20:55:14 2016
@@ -22,6 +22,7 @@ import org.apache.axiom.om.OMOutputForma
 import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public interface AxiomSerializable extends OMSerializable, AxiomInformationItem {
     OMXMLParserWrapper getBuilder();
@@ -36,5 +37,5 @@ public interface AxiomSerializable exten
      * @param cache indicates if caching should be enabled
      * @throws StreamException 
      */
-    void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws
StreamException;
+    void internalSerialize(XmlHandler handler, OMOutputFormat format, boolean cache) throws
StreamException;
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCDATASectionSupport.aj
Mon Feb  8 20:55:14 2016
@@ -21,15 +21,15 @@ package org.apache.axiom.om.impl.mixin;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.intf.AxiomCDATASection;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomCDATASectionSupport {
     public final int AxiomCDATASection.getType() {
         return OMNode.CDATA_SECTION_NODE;
     }
 
-    public final void AxiomCDATASection.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache) throws StreamException {
-        serializer.processCDATASection(coreGetCharacterData().toString());
+    public final void AxiomCDATASection.internalSerialize(XmlHandler handler, OMOutputFormat
format, boolean cache) throws StreamException {
+        handler.processCDATASection(coreGetCharacterData().toString());
     }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCharacterDataNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCharacterDataNodeSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCharacterDataNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCharacterDataNodeSupport.aj
Mon Feb  8 20:55:14 2016
@@ -21,15 +21,15 @@ package org.apache.axiom.om.impl.mixin;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.intf.AxiomCharacterDataNode;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomCharacterDataNodeSupport {
     public final int AxiomCharacterDataNode.getType() {
         return coreIsIgnorable() ? OMNode.SPACE_NODE : OMNode.TEXT_NODE;
     }
 
-    public final void AxiomCharacterDataNode.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache) throws StreamException {
-        serializer.processCharacterData(coreGetCharacterData(), coreIsIgnorable());
+    public final void AxiomCharacterDataNode.internalSerialize(XmlHandler handler, OMOutputFormat
format, boolean cache) throws StreamException {
+        handler.processCharacterData(coreGetCharacterData(), coreIsIgnorable());
     }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomCommentSupport.aj
Mon Feb  8 20:55:14 2016
@@ -22,8 +22,8 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.intf.AxiomComment;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomCommentSupport {
     public final int AxiomComment.getType() {
@@ -38,8 +38,8 @@ public aspect AxiomCommentSupport {
         coreSetCharacterData(text, AxiomSemantics.INSTANCE);
     }
     
-    public final void AxiomComment.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache) throws StreamException {
-        serializer.processComment(coreGetCharacterData().toString());
+    public final void AxiomComment.internalSerialize(XmlHandler handler, OMOutputFormat format,
boolean cache) throws StreamException {
+        handler.processComment(coreGetCharacterData().toString());
     }
     
     public final void AxiomComment.buildWithAttachments() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
Mon Feb  8 20:55:14 2016
@@ -60,8 +60,8 @@ import org.apache.axiom.om.impl.common.s
 import org.apache.axiom.om.impl.intf.AxiomChildNode;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.OMFactoryEx;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.axiom.om.util.OMXMLStreamReaderValidator;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
@@ -295,7 +295,7 @@ public aspect AxiomContainerSupport {
         MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, true);
         try {
             try {
-                internalSerialize(new StAXSerializer(this, writer), format, true);
+                internalSerialize(new StAXSerializer(writer).buildHandler(this), format,
true);
             } catch (StreamException ex) {
                 throw AxiomExceptionTranslator.toXMLStreamException(ex);
             }
@@ -310,7 +310,7 @@ public aspect AxiomContainerSupport {
         writer.setOutputFormat(format);
         try {
             try {
-                internalSerialize(new StAXSerializer(this, writer), format, true);
+                internalSerialize(new StAXSerializer(writer).buildHandler(this), format,
true);
             } catch (StreamException ex) {
                 throw AxiomExceptionTranslator.toXMLStreamException(ex);
             }
@@ -324,7 +324,7 @@ public aspect AxiomContainerSupport {
         MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, false);
         try {
             try {
-                internalSerialize(new StAXSerializer(this, writer), format, false);
+                internalSerialize(new StAXSerializer(writer).buildHandler(this), format,
false);
             } catch (StreamException ex) {
                 throw AxiomExceptionTranslator.toXMLStreamException(ex);
             }
@@ -340,7 +340,7 @@ public aspect AxiomContainerSupport {
         writer.setOutputFormat(format);
         try {
             try {
-                internalSerialize(new StAXSerializer(this, writer), format, false);
+                internalSerialize(new StAXSerializer(writer).buildHandler(this), format,
false);
             } catch (StreamException ex) {
                 throw AxiomExceptionTranslator.toXMLStreamException(ex);
             }
@@ -349,7 +349,7 @@ public aspect AxiomContainerSupport {
         }
     }
 
-    final void AxiomContainer.serializeChildren(Serializer serializer, OMOutputFormat format,
boolean cache) throws StreamException {
+    final void AxiomContainer.serializeChildren(XmlHandler handler, OMOutputFormat format,
boolean cache) throws StreamException {
         if (getState() == AxiomContainer.DISCARDED) {
             Builder builder = (Builder)getBuilder();
             if (builder != null) {
@@ -360,14 +360,14 @@ public aspect AxiomContainerSupport {
         if (cache) {
             AxiomChildNode child = (AxiomChildNode)getFirstOMChild();
             while (child != null) {
-                child.internalSerialize(serializer, format, true);
+                child.internalSerialize(handler, format, true);
                 child = (AxiomChildNode)child.getNextOMSibling();
             }
         } else {
             // First, recursively serialize all child nodes that have already been created
             AxiomChildNode child = (AxiomChildNode)coreGetFirstChildIfAvailable();
             while (child != null) {
-                child.internalSerialize(serializer, format, cache);
+                child.internalSerialize(handler, format, cache);
                 child = (AxiomChildNode)child.coreGetNextSiblingIfAvailable();
             }
             // Next, if the container is incomplete, disable caching (temporarily)
@@ -375,7 +375,7 @@ public aspect AxiomContainerSupport {
             // events from the underlying XMLStreamReader.
             if (!isComplete() && getBuilder() != null) {
                 Builder builder = (Builder)getBuilder();
-                StAXHelper helper = new StAXHelper(builder.disableCaching(), serializer);
+                StAXHelper helper = new StAXHelper(builder.disableCaching(), handler);
                 int depth = 0;
                 loop: while (true) {
                     switch (helper.lookahead()) {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocTypeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocTypeSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocTypeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocTypeSupport.aj
Mon Feb  8 20:55:14 2016
@@ -20,8 +20,8 @@ package org.apache.axiom.om.impl.mixin;
 
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.intf.AxiomDocType;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomDocTypeSupport {
     public final int AxiomDocType.getType() {
@@ -32,8 +32,8 @@ public aspect AxiomDocTypeSupport {
         return coreGetRootName();
     }
 
-    public final void AxiomDocType.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache) throws StreamException {
-        serializer.processDocumentTypeDeclaration(coreGetRootName(), coreGetPublicId(), coreGetSystemId(),
coreGetInternalSubset());
+    public final void AxiomDocType.internalSerialize(XmlHandler handler, OMOutputFormat format,
boolean cache) throws StreamException {
+        handler.processDocumentTypeDeclaration(coreGetRootName(), coreGetPublicId(), coreGetSystemId(),
coreGetInternalSubset());
     }
     
     public final void AxiomDocType.buildWithAttachments() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
Mon Feb  8 20:55:14 2016
@@ -25,8 +25,8 @@ import org.apache.axiom.om.OMOutputForma
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomDocumentSupport {
     public final OMElement AxiomDocument.getOMDocumentElement() {
@@ -45,12 +45,12 @@ public aspect AxiomDocumentSupport {
         }
     }
 
-    public final void AxiomDocument.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache) throws StreamException {
-        internalSerialize(serializer, format, cache, !format.isIgnoreXMLDeclaration());
+    public final void AxiomDocument.internalSerialize(XmlHandler handler, OMOutputFormat
format, boolean cache) throws StreamException {
+        internalSerialize(handler, format, cache, !format.isIgnoreXMLDeclaration());
     }
 
     // Overridden in AxiomSOAPMessageSupport
-    public void AxiomDocument.internalSerialize(Serializer serializer, OMOutputFormat format,
+    public void AxiomDocument.internalSerialize(XmlHandler handler, OMOutputFormat format,
             boolean cache, boolean includeXMLDeclaration) throws StreamException {
         if (includeXMLDeclaration) {
             //Check whether the OMOutput char encoding and OMDocument char
@@ -63,10 +63,10 @@ public aspect AxiomDocumentSupport {
             if (version == null) {
                 version = "1.0";
             }
-            serializer.startDocument(null, version, encoding, true);
+            handler.startDocument(null, version, encoding, true);
         }
-        serializeChildren(serializer, format, cache);
-        serializer.endDocument();
+        serializeChildren(handler, format, cache);
+        handler.endDocument();
     }
 
     public final String AxiomDocument.getCharsetEncoding() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
Mon Feb  8 20:55:14 2016
@@ -63,8 +63,8 @@ import org.apache.axiom.om.impl.intf.Axi
 import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.axiom.util.namespace.MapBasedNamespaceContext;
 import org.apache.axiom.util.stax.XMLStreamIOException;
 import org.apache.axiom.util.stax.XMLStreamReaderUtils;
@@ -524,16 +524,35 @@ public aspect AxiomElementSupport {
         return findNamespaceURI("");
     }
 
-    public void AxiomElement.internalSerialize(Serializer serializer, OMOutputFormat format,
+    public void AxiomElement.internalSerialize(XmlHandler handler, OMOutputFormat format,
             boolean cache) throws StreamException {
-        defaultInternalSerialize(serializer, format, cache);
+        defaultInternalSerialize(handler, format, cache);
     }
     
-    public final void AxiomElement.defaultInternalSerialize(Serializer serializer, OMOutputFormat
format,
+    public final void AxiomElement.defaultInternalSerialize(XmlHandler handler, OMOutputFormat
format,
             boolean cache) throws StreamException {
-        serializer.serializeStartpart(this);
-        serializeChildren(serializer, format, cache);
-        serializer.endElement();
+        OMNamespace ns = getNamespace();
+        if (ns == null) {
+            handler.startElement("", getLocalName(), "");
+        } else {
+            handler.startElement(ns.getNamespaceURI(), getLocalName(), ns.getPrefix());
+        }
+        for (Iterator<OMNamespace> it = getAllDeclaredNamespaces(); it.hasNext(); )
{
+            ns = it.next();
+            handler.processNamespaceDeclaration(ns.getPrefix(), ns.getNamespaceURI());
+        }
+        for (Iterator<OMAttribute> it = getAllAttributes(); it.hasNext(); ) {
+            OMAttribute attr = it.next();
+            ns = attr.getNamespace();
+            if (ns == null) {
+                handler.processAttribute("", attr.getLocalName(), "", attr.getAttributeValue(),
attr.getAttributeType(), ((CoreAttribute)attr).coreGetSpecified());
+            } else {
+                handler.processAttribute(ns.getNamespaceURI(), attr.getLocalName(), ns.getPrefix(),
attr.getAttributeValue(), attr.getAttributeType(), ((CoreAttribute)attr).coreGetSpecified());
+            }
+        }
+        handler.attributesCompleted();
+        serializeChildren(handler, format, cache);
+        handler.endElement();
     }
 
     public final String AxiomElement.toStringWithConsume() throws XMLStreamException {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomEntityReferenceSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomEntityReferenceSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomEntityReferenceSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomEntityReferenceSupport.aj
Mon Feb  8 20:55:14 2016
@@ -21,16 +21,16 @@ package org.apache.axiom.om.impl.mixin;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.intf.AxiomEntityReference;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomEntityReferenceSupport {
     public final int AxiomEntityReference.getType() {
         return OMNode.ENTITY_REFERENCE_NODE;
     }
 
-    public final void AxiomEntityReference.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache) throws StreamException {
-        serializer.processEntityReference(coreGetName(), coreGetReplacementText());
+    public final void AxiomEntityReference.internalSerialize(XmlHandler handler, OMOutputFormat
format, boolean cache) throws StreamException {
+        handler.processEntityReference(coreGetName(), coreGetReplacementText());
     }
 
     public final String AxiomEntityReference.getName() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomProcessingInstructionSupport.aj
Mon Feb  8 20:55:14 2016
@@ -21,8 +21,8 @@ package org.apache.axiom.om.impl.mixin;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.intf.AxiomProcessingInstruction;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 
 public aspect AxiomProcessingInstructionSupport {
     public final int AxiomProcessingInstruction.getType() {
@@ -41,8 +41,8 @@ public aspect AxiomProcessingInstruction
         coreSetCharacterData(value, AxiomSemantics.INSTANCE);
     }
     
-    public final void AxiomProcessingInstruction.internalSerialize(Serializer serializer,
OMOutputFormat format, boolean cache) throws StreamException {
-        serializer.processProcessingInstruction(coreGetTarget() + " ", coreGetCharacterData().toString());
+    public final void AxiomProcessingInstruction.internalSerialize(XmlHandler handler, OMOutputFormat
format, boolean cache) throws StreamException {
+        handler.processProcessingInstruction(coreGetTarget() + " ", coreGetCharacterData().toString());
     }
     
     public final void AxiomProcessingInstruction.buildWithAttachments() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSerializableSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSerializableSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSerializableSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSerializableSupport.aj
Mon Feb  8 20:55:14 2016
@@ -44,7 +44,7 @@ public aspect AxiomSerializableSupport {
                 (MTOMXMLStreamWriter) xmlWriter : 
                     new MTOMXMLStreamWriter(xmlWriter);
         try {
-            internalSerialize(new StAXSerializer(this, writer), writer.getOutputFormat(),
cache);
+            internalSerialize(new StAXSerializer(writer).buildHandler(this), writer.getOutputFormat(),
cache);
         } catch (StreamException ex) {
             throw AxiomExceptionTranslator.toXMLStreamException(ex);
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
Mon Feb  8 20:55:14 2016
@@ -37,8 +37,8 @@ import org.apache.axiom.om.impl.common.b
 import org.apache.axiom.om.impl.common.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.common.util.OMDataSourceUtil;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -400,20 +400,20 @@ public aspect AxiomSourcedElementSupport
         }
     }
 
-    public void AxiomSourcedElement.internalSerialize(Serializer serializer, OMOutputFormat
format, boolean cache)
+    public void AxiomSourcedElement.internalSerialize(XmlHandler handler, OMOutputFormat
format, boolean cache)
             throws StreamException {
         if (isExpanded()) {
-            defaultInternalSerialize(serializer, format, cache);
+            defaultInternalSerialize(handler, format, cache);
         } else if (cache) {
             if (OMDataSourceUtil.isDestructiveWrite(dataSource)) {
                 forceExpand();
-                defaultInternalSerialize(serializer, format, true);
+                defaultInternalSerialize(handler, format, true);
             } else {
                 // TODO: the serializer ignores namespaceURI and localName
-                serializer.processOMDataSource(null, null, dataSource);
+                handler.processOMDataSource(null, null, dataSource);
             }
         } else {
-            serializer.processOMDataSource(null, null, dataSource); 
+            handler.processOMDataSource(null, null, dataSource); 
         }
     }
 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPMessageSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPMessageSupport.aj?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPMessageSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPMessageSupport.aj
Mon Feb  8 20:55:14 2016
@@ -23,8 +23,8 @@ import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.intf.AxiomElement;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPMessage;
@@ -53,9 +53,9 @@ public aspect AxiomSOAPMessageSupport {
     }
     
     // TODO: this violates OO design principles and should disappear in a future Axiom version
-    public final void AxiomSOAPMessage.internalSerialize(Serializer serializer, OMOutputFormat
format,
+    public final void AxiomSOAPMessage.internalSerialize(XmlHandler handler, OMOutputFormat
format,
             boolean cache, boolean includeXMLDeclaration) throws StreamException {
-        ((AxiomElement)getOMDocumentElement()).internalSerialize(serializer, format, cache);
+        ((AxiomElement)getOMDocumentElement()).internalSerialize(handler, format, cache);
     }
 
     public final SOAPEnvelope AxiomSOAPMessage.getSOAPEnvelope() {

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
Mon Feb  8 20:55:14 2016
@@ -24,8 +24,8 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.axiom.soap.SOAP11Version;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPConstants;
@@ -128,13 +128,13 @@ public abstract class SOAPEnvelopeImpl e
         // here do nothing as SOAPEnvelope doesn't have a parent !!!
     }
 
-    public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache)
+    public void internalSerialize(XmlHandler handler, OMOutputFormat format, boolean cache)
             throws StreamException {
 
         if (!format.isIgnoreXMLDeclaration()) {
             String charSetEncoding = format.getCharSetEncoding();
             String xmlVersion = format.getXmlVersion();
-            serializer.startDocument(
+            handler.startDocument(
                     null,
                     xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION
                             : xmlVersion,
@@ -142,7 +142,7 @@ public abstract class SOAPEnvelopeImpl e
                             : charSetEncoding,
                     true);
         }
-        super.internalSerialize(serializer, format, cache);
-        serializer.endDocument();
+        super.internalSerialize(handler, format, cache);
+        handler.endDocument();
     }
 }

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java?rev=1729251&r1=1729250&r2=1729251&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
Mon Feb  8 20:55:14 2016
@@ -26,8 +26,8 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.builder.Builder;
-import org.apache.axiom.om.impl.intf.Serializer;
 import org.apache.axiom.om.impl.stream.StreamException;
+import org.apache.axiom.om.impl.stream.XmlHandler;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axiom.soap.SOAPHeader;
@@ -119,20 +119,20 @@ public abstract class SOAPEnvelopeImpl e
         // here do nothing as SOAPEnvelope doesn't have a parent !!!
     }
 
-    public void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache)
+    public void internalSerialize(XmlHandler handler, OMOutputFormat format, boolean cache)
             throws StreamException {
         if (!format.isIgnoreXMLDeclaration()) {
             String charSetEncoding = format.getCharSetEncoding();
             String xmlVersion = format.getXmlVersion();
-            serializer.startDocument(
+            handler.startDocument(
                     null,
                     xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION : xmlVersion,
                     charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING
                             : charSetEncoding,
                     true);
         }
-        super.internalSerialize(serializer, format, cache);
-        serializer.endDocument();
+        super.internalSerialize(handler, format, cache);
+        handler.endDocument();
         if (!cache) {
             // let's try to close the builder/parser here since we are now done with the
             // non-caching code block serializing the top-level SOAPEnvelope element




Mime
View raw message