You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/06/05 08:58:11 UTC

svn commit: r1683665 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/ implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ implementations/axiom-impl/src/main/java/org/apache/axiom/om/imp...

Author: veithen
Date: Fri Jun  5 06:58:11 2015
New Revision: 1683665

URL: http://svn.apache.org/r1683665
Log:
Use AspectJ to define the serialize methods at exactly the right levels in the class hierarchy. This allows to eliminate a couple of hacks in DOOM.

Added:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomDocType.java   (with props)
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomEntityReference.java   (with props)
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNode.java   (with props)
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNodeSupport.aj   (with props)
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstruction.java   (with props)
Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomComment.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomContainerSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomSerializableSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMEntityReferenceImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomComment.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomComment.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomComment.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomComment.java Fri Jun  5 06:58:11 2015
@@ -21,6 +21,6 @@ package org.apache.axiom.om.impl.common;
 import org.apache.axiom.core.CoreComment;
 import org.apache.axiom.om.OMComment;
 
-public interface AxiomComment extends OMComment, AxiomChildNode, CoreComment {
+public interface AxiomComment extends OMComment, AxiomLeafNode, CoreComment {
 
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomContainerSupport.aj?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomContainerSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomContainerSupport.aj Fri Jun  5 06:58:11 2015
@@ -18,10 +18,14 @@
  */
 package org.apache.axiom.om.impl.common;
 
+import java.io.OutputStream;
+import java.io.Writer;
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.SAXSource;
 
@@ -30,17 +34,22 @@ import org.apache.axiom.om.OMContainer;
 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.OMSourcedElement;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.OMXMLStreamReader;
 import org.apache.axiom.om.OMXMLStreamReaderConfiguration;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.OMFactoryEx;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.impl.common.serializer.pull.OMXMLStreamReaderExAdapter;
 import org.apache.axiom.om.impl.common.serializer.pull.PullSerializer;
+import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.sax.XMLReaderImpl;
+import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
 import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
 import org.apache.axiom.om.util.OMXMLStreamReaderValidator;
+import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.xml.sax.InputSource;
@@ -237,4 +246,106 @@ public aspect AxiomContainerSupport {
         result.setLexicalHandler(handler);
         return result;
     }
+
+    public final void AxiomContainer.serialize(OutputStream output) throws XMLStreamException {
+        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output);
+        try {
+            serialize(xmlStreamWriter);
+        } finally {
+            xmlStreamWriter.close();
+        }
+    }
+
+    public final void AxiomContainer.serialize(Writer writer) throws XMLStreamException {
+        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer);
+        try {
+            serialize(xmlStreamWriter);
+        } finally {
+            xmlStreamWriter.close();
+        }
+    }
+
+    public final void AxiomContainer.serializeAndConsume(OutputStream output) throws XMLStreamException {
+        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output);
+        try {
+            serializeAndConsume(xmlStreamWriter);
+        } finally {
+            xmlStreamWriter.close();
+        }
+    }
+
+    public final void AxiomContainer.serializeAndConsume(Writer writer) throws XMLStreamException {
+        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer);
+        try {
+            serializeAndConsume(xmlStreamWriter);
+        } finally {
+            xmlStreamWriter.close();
+        }
+    }
+
+    public final void AxiomContainer.serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, true);
+        try {
+            try {
+                internalSerialize(new StAXSerializer(this, writer), format, true);
+            } catch (OutputException ex) {
+                throw (XMLStreamException)ex.getCause();
+            }
+            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
+            writer.flush();
+        } finally {
+            writer.close();
+        }
+    }
+
+    public final void AxiomContainer.serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer =
+                new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        try {
+            try {
+                internalSerialize(new StAXSerializer(this, writer), format, true);
+            } catch (OutputException ex) {
+                throw (XMLStreamException)ex.getCause();
+            }
+            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
+            writer.flush();
+        } finally {
+            writer.close();
+        }
+    }
+
+    public final void AxiomContainer.serializeAndConsume(OutputStream output, OMOutputFormat format)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, false);
+        try {
+            try {
+                internalSerialize(new StAXSerializer(this, writer), format, false);
+            } catch (OutputException ex) {
+                throw (XMLStreamException)ex.getCause();
+            }
+            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
+            writer.flush();
+        } finally {
+            writer.close();
+        }
+    }
+
+    public final void AxiomContainer.serializeAndConsume(Writer writer2, OMOutputFormat format)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer =
+                new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        try {
+            try {
+                internalSerialize(new StAXSerializer(this, writer), format, false);
+            } catch (OutputException ex) {
+                throw (XMLStreamException)ex.getCause();
+            }
+            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
+            writer.flush();
+        } finally {
+            writer.close();
+        }
+    }
 }

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomDocType.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomDocType.java?rev=1683665&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomDocType.java (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomDocType.java Fri Jun  5 06:58:11 2015
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.common;
+
+import org.apache.axiom.om.OMDocType;
+
+public interface AxiomDocType extends OMDocType, AxiomLeafNode {
+
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomDocType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomEntityReference.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomEntityReference.java?rev=1683665&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomEntityReference.java (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomEntityReference.java Fri Jun  5 06:58:11 2015
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.common;
+
+import org.apache.axiom.om.OMEntityReference;
+
+public interface AxiomEntityReference extends OMEntityReference, AxiomLeafNode {
+
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomEntityReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNode.java?rev=1683665&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNode.java (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNode.java Fri Jun  5 06:58:11 2015
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.common;
+
+public interface AxiomLeafNode extends AxiomChildNode {
+
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNodeSupport.aj?rev=1683665&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNodeSupport.aj (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNodeSupport.aj Fri Jun  5 06:58:11 2015
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.common;
+
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMOutputFormat;
+
+public aspect AxiomLeafNodeSupport {
+    public final void AxiomLeafNode.serialize(OutputStream output) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serialize(Writer writer) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serializeAndConsume(OutputStream output) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serializeAndConsume(Writer writer) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+
+    public final void AxiomLeafNode.serializeAndConsume(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        throw new UnsupportedOperationException("Only supported on OMContainer instances");
+    }
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomLeafNodeSupport.aj
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstruction.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstruction.java?rev=1683665&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstruction.java (added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstruction.java Fri Jun  5 06:58:11 2015
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.common;
+
+import org.apache.axiom.om.OMProcessingInstruction;
+
+public interface AxiomProcessingInstruction extends OMProcessingInstruction, AxiomLeafNode {
+
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomProcessingInstruction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomSerializableSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomSerializableSupport.aj?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomSerializableSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomSerializableSupport.aj Fri Jun  5 06:58:11 2015
@@ -18,10 +18,37 @@
  */
 package org.apache.axiom.om.impl.common;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.om.impl.common.serializer.push.OutputException;
+import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
 
 public aspect AxiomSerializableSupport {
+    public final void AxiomSerializable.serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        serialize(xmlWriter, true);
+    }
+
+    public final void AxiomSerializable.serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        serialize(xmlWriter, false);
+    }
+
+    public final void AxiomSerializable.serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException {
+        // If the input xmlWriter is not an MTOMXMLStreamWriter, then wrapper it
+        MTOMXMLStreamWriter writer = xmlWriter instanceof MTOMXMLStreamWriter ?
+                (MTOMXMLStreamWriter) xmlWriter : 
+                    new MTOMXMLStreamWriter(xmlWriter);
+        try {
+            internalSerialize(new StAXSerializer(this, writer), writer.getOutputFormat(), cache);
+        } catch (OutputException ex) {
+            throw (XMLStreamException)ex.getCause();
+        }
+        writer.flush();
+    }
+
     public void AxiomSerializable.close(boolean build) {
         OMXMLParserWrapper builder = getBuilder();
         if (build) {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomText.java Fri Jun  5 06:58:11 2015
@@ -20,6 +20,6 @@ package org.apache.axiom.om.impl.common;
 
 import org.apache.axiom.om.OMText;
 
-public interface AxiomText extends OMText, AxiomChildNode {
+public interface AxiomText extends OMText, AxiomLeafNode {
     AxiomText createInstanceOfSameType();
 }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java Fri Jun  5 06:58:11 2015
@@ -32,13 +32,11 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.dom.DOMMetaFactory;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.common.AxiomDocument;
 import org.apache.axiom.om.impl.common.OMDocumentHelper;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Comment;
 import org.w3c.dom.DOMException;
@@ -349,27 +347,6 @@ public class DocumentImpl extends RootNo
         this.xmlStandalone = "yes".equalsIgnoreCase(isStandalone);
     }
 
-    public void serializeAndConsume(OutputStream output, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
-        try {
-            internalSerialize(new StAXSerializer(this, writer), format, false);
-        } catch (OutputException ex) {
-            throw (XMLStreamException)ex.getCause();
-        }
-        writer.flush();
-    }
-
-    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
-        try {
-            internalSerialize(new StAXSerializer(this, writer), format, true);
-        } catch (OutputException ex) {
-            throw (XMLStreamException)ex.getCause();
-        }
-        writer.flush();
-    }
-
     public void setXMLVersion(String version) {
         this.xmlVersion = version;
     }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java Fri Jun  5 06:58:11 2015
@@ -20,15 +20,14 @@
 package org.apache.axiom.om.impl.dom;
 
 import org.apache.axiom.dom.DOMDocumentType;
-import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.common.AxiomDocType;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 import org.w3c.dom.NamedNodeMap;
 
-public class DocumentTypeImpl extends LeafNode implements DOMDocumentType, OMDocType, OMNodeEx {
+public class DocumentTypeImpl extends LeafNode implements DOMDocumentType, AxiomDocType {
     private final String rootName;
     private final String publicId;
     private final String systemId;

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java Fri Jun  5 06:58:11 2015
@@ -21,17 +21,17 @@ package org.apache.axiom.om.impl.dom;
 import static org.apache.axiom.dom.DOMExceptionUtil.newDOMException;
 
 import org.apache.axiom.dom.DOMEntityReference;
-import org.apache.axiom.om.OMEntityReference;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.common.AxiomEntityReference;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-public class EntityReferenceImpl extends ChildNode implements OMEntityReference, DOMEntityReference {
+public class EntityReferenceImpl extends ChildNode implements AxiomEntityReference, DOMEntityReference {
     private final String name;
     private final String replacementText;
 

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java Fri Jun  5 06:58:11 2015
@@ -27,14 +27,10 @@ import org.apache.axiom.om.OMCloneOption
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMInformationItem;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.common.InformationItem;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
-import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
@@ -401,131 +397,6 @@ public abstract class NodeImpl extends I
     
     abstract void build();
 
-    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        serialize(xmlWriter, true);
-    }
-
-    public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        serialize(xmlWriter, false);
-    }
-
-    public void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException {
-        MTOMXMLStreamWriter writer = xmlWriter instanceof MTOMXMLStreamWriter ?
-                (MTOMXMLStreamWriter) xmlWriter : 
-                    new MTOMXMLStreamWriter(xmlWriter);
-        try {
-            internalSerialize(new StAXSerializer((OMSerializable)this, writer), writer.getOutputFormat(), cache);
-        } catch (OutputException ex) {
-            throw (XMLStreamException)ex.getCause();
-        }
-        writer.flush();
-    }
-
-    public void serialize(OutputStream output) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output);
-        try {
-            serialize(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serialize(Writer writer) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer);
-        try {
-            serialize(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serializeAndConsume(OutputStream output)
-            throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output);
-        try {
-            serializeAndConsume(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serializeAndConsume(Writer writer) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer);
-        try {
-            serializeAndConsume(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serialize(OutputStream output, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, true);
-        try {
-            try {
-                internalSerialize(new StAXSerializer((OMSerializable)this, writer), format, true);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
-    public void serialize(Writer writer2, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils
-                .createXMLStreamWriter(writer2));
-        writer.setOutputFormat(format);
-        try {
-            try {
-                internalSerialize(new StAXSerializer((OMSerializable)this, writer), format, true);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
-    public void serializeAndConsume(OutputStream output, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, false);
-        try {
-            try {
-                internalSerialize(new StAXSerializer((OMSerializable)this, writer), format, false);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
-    public void serializeAndConsume(Writer writer2, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils
-                .createXMLStreamWriter(writer2));
-        try {
-            writer.setOutputFormat(format);
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            try {
-                internalSerialize(new StAXSerializer((OMSerializable)this, writer), format, false);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
     // This method is actually defined by ISerializable, but ISerializable is only implemented
     // by certain subclasses (for the reason, see AXIOM-385).
     public abstract void internalSerialize(Serializer serializer, OMOutputFormat format, boolean cache) throws OutputException;

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java Fri Jun  5 06:58:11 2015
@@ -22,15 +22,14 @@ package org.apache.axiom.om.impl.dom;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMProcessingInstruction;
-import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Node;
 import org.w3c.dom.ProcessingInstruction;
 
-public class ProcessingInstructionImpl extends LeafNode implements ProcessingInstruction, OMProcessingInstruction, OMNodeEx {
+public class ProcessingInstructionImpl extends LeafNode implements ProcessingInstruction, AxiomProcessingInstruction {
     private String target;
     private String value;
 

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java Fri Jun  5 06:58:11 2015
@@ -21,14 +21,14 @@ package org.apache.axiom.om.impl.llom;
 
 import org.apache.axiom.om.OMCloneOptions;
 import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.common.AxiomDocType;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 
-public class OMDocTypeImpl extends OMLeafNode implements OMDocType {
+public class OMDocTypeImpl extends OMLeafNode implements AxiomDocType {
     private final String rootName;
     private final String publicId;
     private final String systemId;

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMEntityReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMEntityReferenceImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMEntityReferenceImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMEntityReferenceImpl.java Fri Jun  5 06:58:11 2015
@@ -20,14 +20,14 @@ package org.apache.axiom.om.impl.llom;
 
 import org.apache.axiom.om.OMCloneOptions;
 import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMEntityReference;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.common.AxiomEntityReference;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 
-public class OMEntityReferenceImpl extends OMLeafNode implements OMEntityReference {
+public class OMEntityReferenceImpl extends OMLeafNode implements AxiomEntityReference {
     private final String name;
     private final String replacementText;
 

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMLeafNode.java Fri Jun  5 06:58:11 2015
@@ -23,8 +23,9 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.common.AxiomLeafNode;
 
-public abstract class OMLeafNode extends OMNodeImpl {
+public abstract class OMLeafNode extends OMNodeImpl implements AxiomLeafNode {
     public OMLeafNode(OMContainer parent, OMFactory factory, boolean fromBuilder) {
         super(factory);
         if (parent != null) {

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java Fri Jun  5 06:58:11 2015
@@ -24,11 +24,11 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMProcessingInstruction;
+import org.apache.axiom.om.impl.common.AxiomProcessingInstruction;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
 
-public class OMProcessingInstructionImpl extends OMLeafNode implements OMProcessingInstruction {
+public class OMProcessingInstructionImpl extends OMLeafNode implements AxiomProcessingInstruction {
     protected String target;
     protected String value;
 

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java Fri Jun  5 06:58:11 2015
@@ -19,19 +19,8 @@
 
 package org.apache.axiom.om.impl.llom;
 
-import java.io.OutputStream;
-import java.io.Writer;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.common.AxiomSerializable;
-import org.apache.axiom.om.impl.common.serializer.push.OutputException;
-import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
-import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -51,127 +40,4 @@ public abstract class OMSerializableImpl
         }
         return factory;
     }
-
-    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        serialize(xmlWriter, true);
-    }
-
-    public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        serialize(xmlWriter, false);
-    }
-
-    public void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException {
-        // If the input xmlWriter is not an MTOMXMLStreamWriter, then wrapper it
-        MTOMXMLStreamWriter writer = xmlWriter instanceof MTOMXMLStreamWriter ?
-                (MTOMXMLStreamWriter) xmlWriter : 
-                    new MTOMXMLStreamWriter(xmlWriter);
-        try {
-            internalSerialize(new StAXSerializer(this, writer), writer.getOutputFormat(), cache);
-        } catch (OutputException ex) {
-            throw (XMLStreamException)ex.getCause();
-        }
-        writer.flush();
-    }
-
-    public void serialize(OutputStream output) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output);
-        try {
-            serialize(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serialize(Writer writer) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer);
-        try {
-            serialize(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serializeAndConsume(OutputStream output) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(output);
-        try {
-            serializeAndConsume(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serializeAndConsume(Writer writer) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(writer);
-        try {
-            serializeAndConsume(xmlStreamWriter);
-        } finally {
-            xmlStreamWriter.close();
-        }
-    }
-
-    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, true);
-        try {
-            try {
-                internalSerialize(new StAXSerializer(this, writer), format, true);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
-    public void serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException {
-        MTOMXMLStreamWriter writer =
-                new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2));
-        writer.setOutputFormat(format);
-        try {
-            try {
-                internalSerialize(new StAXSerializer(this, writer), format, true);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
-    public void serializeAndConsume(OutputStream output, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format, false);
-        try {
-            try {
-                internalSerialize(new StAXSerializer(this, writer), format, false);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
-
-    public void serializeAndConsume(Writer writer2, OMOutputFormat format)
-            throws XMLStreamException {
-        MTOMXMLStreamWriter writer =
-                new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2));
-        writer.setOutputFormat(format);
-        try {
-            try {
-                internalSerialize(new StAXSerializer(this, writer), format, false);
-            } catch (OutputException ex) {
-                throw (XMLStreamException)ex.getCause();
-            }
-            // TODO: the flush is necessary because of an issue with the lifecycle of MTOMXMLStreamWriter
-            writer.flush();
-        } finally {
-            writer.close();
-        }
-    }
 }

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1683665&r1=1683664&r2=1683665&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java (original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java Fri Jun  5 06:58:11 2015
@@ -41,7 +41,6 @@ import org.apache.axiom.om.impl.common.O
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
-import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -54,9 +53,7 @@ import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.sax.SAXResult;
 
 import java.io.IOException;
-import java.io.OutputStream;
 import java.io.StringWriter;
-import java.io.Writer;
 import java.util.Iterator;
 
 /**
@@ -650,106 +647,6 @@ public class OMSourcedElementImpl extend
         }
     }
 
-    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        // The contract is to serialize with caching
-        try {
-            internalSerialize(new StAXSerializer(this, xmlWriter), new OMOutputFormat(), true);
-        } catch (OutputException ex) {
-            throw (XMLStreamException)ex.getCause();
-        }
-    }
-
-    public void serialize(OutputStream output) throws XMLStreamException {
-        OMOutputFormat format = new OMOutputFormat();
-        serialize(output, format);
-    }
-
-    public void serialize(Writer writer) throws XMLStreamException {
-        OMOutputFormat format = new OMOutputFormat();
-        serialize(writer, format);
-    }
-
-    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        if (isExpanded) {
-            super.serialize(output, format);
-        } else if (OMDataSourceUtil.isDestructiveWrite(dataSource)) {
-            forceExpand();
-            super.serialize(output, format);
-        } else {
-            dataSource.serialize(output, format);
-        }
-    }
-
-    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
-        if (isExpanded) {
-            super.serialize(writer, format);
-        } else if (OMDataSourceUtil.isDestructiveWrite(dataSource)) {
-            forceExpand();
-            super.serialize(writer, format);
-        } else {
-            dataSource.serialize(writer, format);
-        }
-    }
-
-    public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
-            throws XMLStreamException {
-        try {
-            internalSerialize(new StAXSerializer(this, xmlWriter), new OMOutputFormat(), false);
-        } catch (OutputException ex) {
-            throw (XMLStreamException)ex.getCause();
-        }
-    }
-
-    public void serializeAndConsume(OutputStream output) throws XMLStreamException {
-        if (log.isDebugEnabled()) {
-            log.debug("serialize " + getPrintableName() + " to output stream");
-        }
-        OMOutputFormat format = new OMOutputFormat();
-        if (isExpanded()) {
-            super.serializeAndConsume(output, format);
-        } else {
-            dataSource.serialize(output, format);
-        }
-    }
-
-    public void serializeAndConsume(Writer writer) throws XMLStreamException {
-        if (log.isDebugEnabled()) {
-            log.debug("serialize " + getPrintableName() + " to writer");
-        }
-        if (isExpanded()) {
-            super.serializeAndConsume(writer);
-        } else {
-            OMOutputFormat format = new OMOutputFormat();
-            dataSource.serialize(writer, format); 
-        }
-    }
-
-    public void serializeAndConsume(OutputStream output, OMOutputFormat format)
-            throws XMLStreamException {
-        if (log.isDebugEnabled()) {
-            log.debug("serialize formatted " + getPrintableName() +
-                    " to output stream");
-        }
-        if (isExpanded()) {
-            super.serializeAndConsume(output, format);
-        } else {
-            dataSource.serialize(output, format); 
-        }
-    }
-
-    public void serializeAndConsume(Writer writer, OMOutputFormat format)
-            throws XMLStreamException {
-        if (log.isDebugEnabled()) {
-            log.debug("serialize formatted " + getPrintableName() +
-                    " to writer");
-        }
-        if (isExpanded()) {
-            super.serializeAndConsume(writer, format);
-        } else {
-            dataSource.serialize(writer, format); 
-        }
-    }
-
     public OMNode detach() throws OMException {
         // detach without expanding the tree
         boolean complete = isComplete();