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 2022/11/06 14:30:16 UTC

[ws-axiom] branch master updated: [AXIOM-506] Replace OMText.getDataHandler()

This is an automated email from the ASF dual-hosted git repository.

veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git


The following commit(s) were added to refs/heads/master by this push:
     new d6c42034c [AXIOM-506] Replace OMText.getDataHandler()
d6c42034c is described below

commit d6c42034c664e49b60290769d1892d310044338a
Author: Andreas Veithen <an...@gmail.com>
AuthorDate: Sun Nov 6 14:30:05 2022 +0000

    [AXIOM-506] Replace OMText.getDataHandler()
---
 axiom-api/pom.xml                                  |   6 -
 .../src/main/java/org/apache/axiom/om/OMText.java  |   9 +-
 .../org/apache/axiom/om/impl/jaxp/OMSource.java    |  52 ---
 .../axiom/om/impl/serialize/OMXMLReader.java       | 365 ---------------------
 .../java/org/apache/axiom/om/util/TextHelper.java  | 104 ------
 .../org/apache/axiom/om/util/TextHelperTest.java   | 136 --------
 .../GetDataHandlerBridgeMethodInjector.java        |  77 -----
 .../axiom/buildutils/classes/PostProcessMojo.java  |  90 -----
 implementations/pom.xml                            |   1 -
 .../om/impl/common/factory/OMFactoryImpl.java      |   4 +-
 .../apache/axiom/om/impl/mixin/AxiomTextMixin.java |   7 +-
 .../java/org/apache/axiom/samples/MTOMSample.java  |  12 +-
 systests/compat-tests/pom.xml                      |  99 ------
 .../src/test/java/DataHandlerTest.java             |  46 ---
 .../om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java |  12 +-
 systests/pom.xml                                   |   1 -
 .../TestReadAttachmentBeforeRootPartComplete.java  |  13 +-
 .../factory/TestCreateOMTextFromBlobProvider.java  |   2 +-
 .../jaxb/TestDataHandlerExpansion.java             |   3 +-
 .../jaxb/TestDataHandlerSerializationWithMTOM.java |  11 +-
 .../push/WriteBlobProviderScenario.java            |   5 +-
 .../om/sourcedelement/push/WriteBlobScenario.java  |   5 +-
 .../apache/axiom/ts/om/text/TestCloneBinary.java   |   3 +-
 .../apache/axiom/ts/om/xop/XOPRoundtripTest.java   |   3 +-
 .../soap12/envelope/TestBuildWithAttachments.java  |   6 +-
 .../soap12/envelope/TestMTOMForwardStreaming.java  |   9 +-
 .../axiom/ts/soap12/mtom/TestBuilderDetach.java    |   3 +-
 27 files changed, 56 insertions(+), 1028 deletions(-)

diff --git a/axiom-api/pom.xml b/axiom-api/pom.xml
index 6de2c96cb..03577785a 100644
--- a/axiom-api/pom.xml
+++ b/axiom-api/pom.xml
@@ -140,12 +140,6 @@
                 <artifactId>buildutils-maven-plugin</artifactId>
                 <version>${project.version}</version>
                 <executions>
-                    <execution>
-                        <id>post-process-classes</id>
-                        <goals>
-                            <goal>post-process-classes</goal>
-                        </goals>
-                    </execution>
                     <execution>
                         <id>post-process-sources-jar</id>
                         <goals>
diff --git a/axiom-api/src/main/java/org/apache/axiom/om/OMText.java b/axiom-api/src/main/java/org/apache/axiom/om/OMText.java
index 595a33a5c..29d6cb4ac 100644
--- a/axiom-api/src/main/java/org/apache/axiom/om/OMText.java
+++ b/axiom-api/src/main/java/org/apache/axiom/om/OMText.java
@@ -19,9 +19,10 @@
 
 package org.apache.axiom.om;
 
-import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 
+import org.apache.axiom.blob.Blob;
+
 /**
  * Represents character data in an XML document. A node of this type is used to
  * represent character data that may appear in element content as well as the
@@ -80,11 +81,11 @@ public interface OMText extends OMNode {
     OMNamespace getNamespace();
 
     /**
-     * Gets the datahandler.
+     * Returns a {@link Blob} containing the base64-decoded content of this node.
      *
-     * @return Returns datahandler.
+     * @return the base64-decoded content
      */
-    DataHandler getDataHandler();
+    Blob getBlob();
 
     /** @return Returns boolean flag saying whether the node contains an optimized text or not. */
     // TODO: inconsistent naming
diff --git a/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java b/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java
deleted file mode 100644
index b38ece65c..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/om/impl/jaxp/OMSource.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.jaxp;
-
-import javax.xml.transform.sax.SAXSource;
-
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.serialize.OMXMLReader;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-
-/**
- * Implementation of {@link javax.xml.transform.Source} for AXIOM.
- * The implementation is based on {@link SAXSource} and directly transforms an AXIOM
- * tree into a stream of SAX events using {@link OMXMLReader}.
- * <p>
- * Note that this class only supports {@link ContentHandler} and {@link LexicalHandler}.
- * {@link DTDHandler} and {@link DeclHandler} are not supported.
- * 
- * @deprecated As of version 1.2.13, application code should use
- * {@link OMContainer#getSAXSource(boolean)} instead of this class.
- */
-public class OMSource extends SAXSource {
-    public OMSource(OMElement element) {
-        this((OMContainer)element);
-    }
-    
-    public OMSource(OMContainer node) {
-        super(new OMXMLReader(node), new InputSource());
-    }
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java b/axiom-compat/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java
deleted file mode 100644
index 666bef38c..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * 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.serialize;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.activation.DataHandler;
-import javax.xml.transform.sax.SAXSource;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMComment;
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDocType;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMEntityReference;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMProcessingInstruction;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.jaxp.OMSource;
-import org.apache.axiom.util.base64.Base64EncodingWriterOutputStream;
-import org.apache.axiom.util.sax.AbstractXMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-
-/**
- * SAX {@link XMLReader} implementation that traverses a given OM tree and invokes the
- * callback methods on the configured {@link ContentHandler}. This can be used to
- * serialize an Axiom tree to SAX.
- * <p>
- * Note that this class only supports {@link ContentHandler} and {@link LexicalHandler}.
- * {@link DTDHandler} and {@link DeclHandler} are not supported.
- * <p>
- * This class can also generate SAX events for a subtree. This is the case if the
- * element passed to the constructor is not the root element of the document. In this
- * case, care is taken to properly generate <code>startPrefixMapping</code> and
- * <code>endPrefixMapping</code> events also for namespace mappings declared on the ancestors
- * of the element.
- * <p>
- * To understand why this is important, consider the following example:
- * <pre>&lt;root xmlns:ns="urn:ns"&gt;&lt;element attr="ns:someThing"/&gt;&lt;root&gt;</pre>
- * In that case, to correctly interpret the attribute value, the SAX content handler must be
- * aware of the namespace mapping for the {@code ns} prefix, even if the serialization starts
- * only at the child element.
- * 
- * @deprecated This class is used internally by {@link OMSource}. Starting with Axiom 1.2.13,
- * application code should use {@link OMContainer#getSAXSource(boolean)} to serialize an OM tree to
- * SAX. If there is a need to obtain an {@link XMLReader} instance, use
- * {@link SAXSource#getXMLReader()} on the {@link SAXSource} returned by
- * {@link OMContainer#getSAXSource(boolean)}.
- */
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class OMXMLReader extends AbstractXMLReader {
-    private final OMContainer root;
-    private final AttributesAdapter attributesAdapter = new AttributesAdapter();
-    
-    public OMXMLReader(OMContainer root) {
-        this.root = root;
-    }
-
-    @Override
-    public void parse(InputSource input) throws IOException, SAXException {
-        parse();
-    }
-
-    @Override
-    public void parse(String systemId) throws IOException, SAXException {
-        parse();
-    }
-    
-    private void parse() throws SAXException {
-        if (root instanceof OMDocument) {
-            generateEvents((OMDocument)root);
-        } else {
-            OMElement element = (OMElement)root;
-            contentHandler.startDocument();
-            generateParentPrefixMappingEvents(element, true);
-            generateEvents(element);
-            generateParentPrefixMappingEvents(element, false);
-            contentHandler.endDocument();
-        }
-    }
-    
-    private void generateEvents(OMDocument document) throws SAXException {
-        contentHandler.startDocument();
-        generateEventsForChildren(document);
-        contentHandler.endDocument();
-    }
-    
-    private void generatePrefixMappingEvents(OMNamespace ns, boolean start) throws SAXException {
-        String prefix = ns.getPrefix();
-        if (prefix != null) {
-            if (start) {
-                contentHandler.startPrefixMapping(prefix, ns.getNamespaceURI());
-            } else {
-                contentHandler.endPrefixMapping(prefix);
-            }
-        }
-    }
-    
-    private void generatePrefixMappingEvents(OMElement omElement, boolean start)
-            throws SAXException {
-        
-        for (Iterator it = omElement.getAllDeclaredNamespaces(); it.hasNext(); ) {
-            generatePrefixMappingEvents((OMNamespace)it.next(), start);
-        }
-    }
-
-    private void generateParentPrefixMappingEvents(OMElement omElement, boolean start)
-            throws SAXException {
-        
-        if (!(omElement.getParent() instanceof OMElement)) {
-            return;
-        }
-        // Maintain a set of the prefixes we have already seen. This is required to take into
-        // account that a namespace mapping declared on an element can hide another one declared
-        // for the same prefix on an ancestor of the element.
-        Set/*<String>*/ seenPrefixes = new HashSet();
-        for (Iterator it = omElement.getAllDeclaredNamespaces(); it.hasNext(); ) {
-            seenPrefixes.add(((OMNamespace)it.next()).getPrefix());
-        }
-        OMElement current = omElement;
-        while (true) {
-            OMContainer parent = current.getParent();
-            if (!(parent instanceof OMElement)) {
-                return;
-            }
-            current = (OMElement)parent;
-            for (Iterator it = current.getAllDeclaredNamespaces(); it.hasNext(); ) {
-                OMNamespace ns = (OMNamespace)it.next();
-                if (seenPrefixes.add(ns.getPrefix())) {
-                    generatePrefixMappingEvents(ns, start);
-                }
-            }
-        }
-    }
-    
-    private void generateEvents(OMElement omElement) throws SAXException {
-        generatePrefixMappingEvents(omElement, true);
-        OMNamespace omNamespace = omElement.getNamespace();
-        String uri;
-        String prefix;
-        if (omNamespace != null) {
-            uri = omNamespace.getNamespaceURI();
-            prefix = omNamespace.getPrefix();
-        } else {
-            uri = "";
-            prefix = null;
-        }
-        String localName = omElement.getLocalName();
-        String qName;
-        if (prefix == null || prefix.length() == 0) {
-            qName = localName;
-        } else {
-            qName = prefix + ":" + localName;
-        }
-        // For performance reasons, we always reuse the same instance of AttributesAdapter.
-        // This is explicitely allowed by the specification of the startElement method.
-        attributesAdapter.setAttributes(omElement);
-        contentHandler.startElement(uri, localName, qName, attributesAdapter);
-        generateEventsForChildren(omElement);
-        contentHandler.endElement(uri, localName, qName);
-        generatePrefixMappingEvents(omElement, false);
-    }
-    
-    private void generateEventsForChildren(OMContainer parent) throws SAXException {
-        for (Iterator it = parent.getChildren(); it.hasNext(); ) {
-            OMNode node = (OMNode)it.next();
-            switch (node.getType()) {
-                case OMNode.DTD_NODE:
-                    if (lexicalHandler != null) {
-                        OMDocType doctype = (OMDocType)node;
-                        lexicalHandler.startDTD(doctype.getRootName(), doctype.getPublicId(), doctype.getSystemId());
-                        lexicalHandler.endDTD();
-                    }
-                    break;
-                case OMNode.ELEMENT_NODE:
-                    generateEvents((OMElement)node);
-                    break;
-                case OMNode.TEXT_NODE:
-                    generateEvents((OMText)node, false);
-                    break;
-                case OMNode.SPACE_NODE:
-                    generateEvents((OMText)node, true);
-                    break;
-                case OMNode.CDATA_SECTION_NODE:
-                    if (lexicalHandler != null) {
-                        lexicalHandler.startCDATA();
-                    }
-                    generateEvents((OMText)node, false);
-                    if (lexicalHandler != null) {
-                        lexicalHandler.endCDATA();
-                    }
-                    break;
-                case OMNode.COMMENT_NODE:
-                    if (lexicalHandler != null) {
-                        char[] ch = ((OMComment)node).getValue().toCharArray();
-                        lexicalHandler.comment(ch, 0, ch.length);
-                    }
-                    break;
-                case OMNode.PI_NODE:
-                    OMProcessingInstruction pi = (OMProcessingInstruction)node;
-                    contentHandler.processingInstruction(pi.getTarget(), pi.getValue());
-                    break;
-                case OMNode.ENTITY_REFERENCE_NODE:
-                    contentHandler.skippedEntity(((OMEntityReference)node).getName());
-                    break;
-                default:
-                    throw new IllegalStateException("Unrecognized node type " + node.getType());
-            }
-        }
-    }
-    
-    private void generateEvents(OMText omText, boolean space) throws SAXException {
-        if (omText.isBinary()) {
-            // Stream the binary content
-            DataHandler dh = omText.getDataHandler();
-            Base64EncodingWriterOutputStream out = new Base64EncodingWriterOutputStream(new ContentHandlerWriter(contentHandler));
-            try {
-                dh.writeTo(out);
-                out.complete();
-            } catch (IOException ex) {
-                Throwable cause = ex.getCause();
-                if (cause instanceof SAXException) {
-                    throw (SAXException)ex.getCause();
-                } else {
-                    throw new SAXException(ex);
-                }
-            }
-        } else {
-            char[] ch = omText.getTextCharacters();
-            if (space) {
-                contentHandler.ignorableWhitespace(ch, 0, ch.length);
-            } else {
-                contentHandler.characters(ch, 0, ch.length);
-            }
-        }
-    }
-
-    protected static class AttributesAdapter implements Attributes {
-        private List/*<OMAttribute>*/ attributes = new ArrayList(5);
-
-        public void setAttributes(OMElement element) {
-            attributes.clear();
-            for (Iterator it = element.getAllAttributes(); it.hasNext(); ) {
-                attributes.add(it.next());
-            }
-        }
-
-        @Override
-        public int getLength() {
-            return attributes.size();
-        }
-
-        @Override
-        public int getIndex(String qName) {
-            for (int i=0, len=attributes.size(); i<len; i++) {
-                if (getQName(i).equals(qName)) {
-                    return i;
-                }
-            }
-            return -1;
-        }
-
-        @Override
-        public int getIndex(String uri, String localName) {
-            for (int i=0, len=attributes.size(); i<len; i++) {
-                if (getURI(i).equals(uri) && getLocalName(i).equals(localName)) {
-                    return i;
-                }
-            }
-            return -1;
-        }
-
-        @Override
-        public String getLocalName(int index) {
-            return ((OMAttribute)attributes.get(index)).getLocalName();
-        }
-
-        @Override
-        public String getQName(int index) {
-            OMAttribute attribute = ((OMAttribute)attributes.get(index));
-            OMNamespace ns = attribute.getNamespace();
-            if (ns == null) {
-                return attribute.getLocalName();
-            } else {
-                String prefix = ns.getPrefix();
-                if (prefix == null || prefix.length() == 0) {
-                    return attribute.getLocalName();
-                } else {
-                    return ns.getPrefix() + ":" + attribute.getLocalName();
-                }
-            }
-        }
-
-        @Override
-        public String getType(int index) {
-            return ((OMAttribute)attributes.get(index)).getAttributeType();
-        }
-
-        @Override
-        public String getType(String qName) {
-            int index = getIndex(qName);
-            return index == -1 ? null : getType(index);
-        }
-
-        @Override
-        public String getType(String uri, String localName) {
-            int index = getIndex(uri, localName);
-            return index == -1 ? null : getType(index);
-        }
-
-        @Override
-        public String getURI(int index) {
-            OMNamespace ns = ((OMAttribute)attributes.get(index)).getNamespace();
-            return ns == null ? "" : ns.getNamespaceURI();
-        }
-
-        @Override
-        public String getValue(int index) {
-            return ((OMAttribute)attributes.get(index)).getAttributeValue();
-        }
-
-        @Override
-        public String getValue(String qName) {
-            int index = getIndex(qName);
-            return index == -1 ? null : getValue(index);
-        }
-
-        @Override
-        public String getValue(String uri, String localName) {
-            int index = getIndex(uri, localName);
-            return index == -1 ? null : getValue(index);
-        }
-    }
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/om/util/TextHelper.java b/axiom-compat/src/main/java/org/apache/axiom/om/util/TextHelper.java
deleted file mode 100644
index 3de26c069..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/om/util/TextHelper.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.activation.DataHandler;
-
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.util.base64.Base64EncodingStringBufferOutputStream;
-import org.apache.axiom.util.base64.Base64Utils;
-
-/**
- * @deprecated Class containing only deprecated utility methods.
- */
-public class TextHelper {
-    /**
-     * @deprecated This method was internally used by Axiom before version 1.2.9 but is no longer
-     *             required.
-     */
-    public static String toString(InputStream inStream) throws IOException {
-        StringBuffer buffer = new StringBuffer();
-        toStringBuffer(inStream, buffer);
-        return buffer.toString();
-    }
-    
-    /**
-     * @deprecated This method was internally used by Axiom before version 1.2.9 but is no longer
-     *             required.
-     */
-    public static void toStringBuffer(InputStream inStream, StringBuffer buffer) throws IOException {
-        int avail = inStream.available();
-        
-        // The Base64 will increase the size by 1.33 + some additional 
-        // space at the data byte[] boundaries.  So a factor of 1.35 is used
-        // to ensure capacity.
-        if (avail > 0) {
-            buffer.ensureCapacity((int) (avail* 1.35) + buffer.length());
-        }
-        
-        // The size of the buffer must be a multiple of 3. Otherwise usage of the
-        // stateless Base64 class would produce filler characters inside the Base64
-        // encoded text.
-        byte[] data = new byte[1023];
-        boolean eos = false;
-        do {
-            int len = 0;
-            do {
-                // Always fill the buffer entirely (unless the end of the stream has
-                // been reached); see above.
-                int read = inStream.read(data, len, data.length-len);
-                if (read == -1) {
-                    eos = true;
-                    break;
-                }
-                len += read;
-            } while (len < data.length);
-            Base64Utils.encode(data, 0, len, buffer);
-        } while (!eos);
-    }
-    
-    /**
-     * @deprecated If you really need to write the base64 encoded content of an {@link OMText}
-     *             instance to a {@link StringBuffer}, then request the {@link DataHandler} using
-     *             {@link OMText#getDataHandler()} and use
-     *             {@link Base64EncodingStringBufferOutputStream} to encode it.
-     */
-    public static void toStringBuffer(OMText omText, StringBuffer buffer) throws IOException {
-        // If an InputStream is present, stream the BASE64 text to the StreamBuffer
-        if (omText.isOptimized()) {
-           DataHandler dh = omText.getDataHandler();
-           if (dh != null) {
-               InputStream is = dh.getInputStream();
-               if (is != null) {
-                   toStringBuffer(is, buffer);
-                   return;
-               }
-           }
-        }
-        
-        // Otherwise append the text
-        buffer.append(omText.getText());
-        return;
-    }
-    
-}
diff --git a/axiom-compat/src/test/java/org/apache/axiom/om/util/TextHelperTest.java b/axiom-compat/src/test/java/org/apache/axiom/om/util/TextHelperTest.java
deleted file mode 100644
index 75ae0869c..000000000
--- a/axiom-compat/src/test/java/org/apache/axiom/om/util/TextHelperTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.util;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-
-import javax.activation.DataHandler;
-import javax.activation.FileDataSource;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.SequenceInputStream;
-
-import junit.framework.TestCase;
-
-/**
- * Validate TextHelper code
- */
-@SuppressWarnings("deprecation")
-public class TextHelperTest extends TestCase {
-    private File tempDir;
-    private File file;
-    private FileInputStream fis;
-    private static final long SIZE = 101 * 1024; // More than the threshold
-    private static final long EXPECTED_BASE64_SIZE = 137900;
-    private static final String EXPECTED_STARTS_WITH = 
-        "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJC";
-    
-    
-    public TextHelperTest(String testName) {
-        super(testName);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        tempDir = new File(System.getProperty("basedir", "."), "target/temp");
-        tempDir.mkdirs();
-        file = new File(tempDir, "TextHelperTest.txt");
-        FileOutputStream fos = new FileOutputStream(file);
-        BufferedOutputStream bos = new BufferedOutputStream(fos);
-        for (long i = 0; i < SIZE; i++) {
-            bos.write((byte)(i % 256));
-        }
-        bos.flush();
-        bos.close();
-        fis = new FileInputStream(file);
-        file.deleteOnExit();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        if (file != null) {
-            file.delete();
-        }
-    }
-    
-    /**
-     * Test the InputStream - > BASE64 String 
-     * code.
-     * 
-     * @throws Exception
-     */
-    public void test_toString() throws Exception {
-        String text = TextHelper.toString(fis);
-        assertTrue(text.length() > SIZE);
-        assertTrue(text.length() == EXPECTED_BASE64_SIZE);
-        assertTrue(text.startsWith(EXPECTED_STARTS_WITH));
-    }
-    
-    /**
-     * Regression test for AXIOM-101.
-     * 
-     * @throws Exception
-     */
-    public void test_toString2() throws Exception {
-        InputStream in = new SequenceInputStream(
-                new ByteArrayInputStream("aa".getBytes()),
-                new ByteArrayInputStream("a".getBytes()));
-        assertEquals("YWFh", TextHelper.toString(in));
-    }
-    
-    /**
-     * Test the InputStream -> BASE64 StringBuffer code
-     * @throws Exception
-     */
-    public void test_toStringBuffer() throws Exception {
-        StringBuffer buffer = new StringBuffer();
-        TextHelper.toStringBuffer(fis, buffer);
-        assertTrue(buffer.length() > SIZE);
-        String text = buffer.toString();
-        assertTrue(text.length() == EXPECTED_BASE64_SIZE);
-        assertTrue(text.startsWith(EXPECTED_STARTS_WITH));
-    }
-    
-    /**
-     * Test the OMText -> StringBuffer code
-     * @throws Exception
-     */
-    public void test_fromOMText() throws Exception {
-        
-        OMFactory factory = OMAbstractFactory.getOMFactory();
-        FileDataSource fds = new FileDataSource(file);
-        DataHandler dh = new DataHandler(fds);
-        OMText omText = factory.createOMText(dh, true);
-        StringBuffer buffer = new StringBuffer();
-        TextHelper.toStringBuffer(omText, buffer);
-        assertTrue(buffer.length() > SIZE);
-        String text = buffer.toString();
-        assertTrue(text.length() == EXPECTED_BASE64_SIZE);
-        assertTrue(text.startsWith(EXPECTED_STARTS_WITH));
-    }
-}
\ No newline at end of file
diff --git a/buildutils/buildutils-maven-plugin/src/main/java/org/apache/axiom/buildutils/classes/GetDataHandlerBridgeMethodInjector.java b/buildutils/buildutils-maven-plugin/src/main/java/org/apache/axiom/buildutils/classes/GetDataHandlerBridgeMethodInjector.java
deleted file mode 100644
index 9684f0d45..000000000
--- a/buildutils/buildutils-maven-plugin/src/main/java/org/apache/axiom/buildutils/classes/GetDataHandlerBridgeMethodInjector.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.buildutils.classes;
-
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-/**
- * Injects a bridge method for {@code getDataHandler} returning {@link Object}, for compatibility
- * with previous versions of {@code OMText}.
- */
-final class GetDataHandlerBridgeMethodInjector extends ClassVisitor {
-    private String className;
-
-    GetDataHandlerBridgeMethodInjector(ClassVisitor cv) {
-        super(Opcodes.ASM9, cv);
-    }
-
-    @Override
-    public void visit(
-            int version,
-            int access,
-            String name,
-            String signature,
-            String superName,
-            String[] interfaces) {
-        super.visit(version, access, name, signature, superName, interfaces);
-        className = name;
-    }
-
-    @Override
-    public MethodVisitor visitMethod(
-            int access, String name, String desc, String signature, String[] exceptions) {
-        if (name.equals("getDataHandler")) {
-            if (desc.equals("()Ljavax/activation/DataHandler;")) {
-                MethodVisitor mv =
-                        super.visitMethod(
-                                (access | Opcodes.ACC_BRIDGE | Opcodes.ACC_SYNTHETIC)
-                                        & ~Opcodes.ACC_FINAL,
-                                name,
-                                "()Ljava/lang/Object;",
-                                null,
-                                exceptions);
-                if ((access & Opcodes.ACC_ABSTRACT) == 0) {
-                    mv.visitCode();
-                    mv.visitVarInsn(Opcodes.ALOAD, 0);
-                    mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className, name, desc, false);
-                    mv.visitInsn(Opcodes.ARETURN);
-                    mv.visitMaxs(1, 1);
-                    mv.visitEnd();
-                }
-            } else if ((access & Opcodes.ACC_BRIDGE) != 0 && desc.equals("()Ljava/lang/Object;")) {
-                // Skip any existing bridge method so that the transformation is idempotent. That's
-                // important when rebuilding without cleaning.
-                return null;
-            }
-        }
-        return super.visitMethod(access, name, desc, signature, exceptions);
-    }
-}
diff --git a/buildutils/buildutils-maven-plugin/src/main/java/org/apache/axiom/buildutils/classes/PostProcessMojo.java b/buildutils/buildutils-maven-plugin/src/main/java/org/apache/axiom/buildutils/classes/PostProcessMojo.java
deleted file mode 100644
index f7683c5bd..000000000
--- a/buildutils/buildutils-maven-plugin/src/main/java/org/apache/axiom/buildutils/classes/PostProcessMojo.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.buildutils.classes;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.ClassWriter;
-
-@Mojo(name = "post-process-classes", defaultPhase = LifecyclePhase.PROCESS_CLASSES)
-public class PostProcessMojo extends AbstractMojo {
-    @Parameter(property = "project.build.outputDirectory", required = true, readonly = true)
-    private File classesDir;
-
-    @Override
-    public void execute() throws MojoExecutionException, MojoFailureException {
-        if (!classesDir.exists()) {
-            return;
-        }
-        DirectoryScanner ds = new DirectoryScanner();
-        ds.setIncludes(new String[] {"**/*.class"});
-        ds.setBasedir(classesDir);
-        ds.scan();
-        for (String relativePath : ds.getIncludedFiles()) {
-            File file = new File(classesDir, relativePath);
-            ClassWriter classWriter;
-            try {
-                InputStream in = new FileInputStream(file);
-                try {
-                    ClassReader classReader = new ClassReader(in);
-                    classWriter = new ClassWriter(classReader, 0);
-                    ClassVisitor classVisitor = classWriter;
-                    if (relativePath.equals("org/apache/axiom/om/OMText.class")
-                            || relativePath.equals(
-                                    "org/apache/axiom/om/impl/llom/AxiomCharacterDataNodeImpl.class")
-                            || relativePath.equals(
-                                    "org/apache/axiom/om/impl/dom/DOMTextNodeImpl.class")) {
-                        classVisitor = new GetDataHandlerBridgeMethodInjector(classVisitor);
-                    }
-                    classReader.accept(classVisitor, 0);
-                } finally {
-                    in.close();
-                }
-            } catch (IOException ex) {
-                throw new MojoExecutionException(
-                        "Failed to read " + relativePath + ": " + ex.getMessage(), ex);
-            }
-            try {
-                OutputStream out = new FileOutputStream(file);
-                try {
-                    out.write(classWriter.toByteArray());
-                } finally {
-                    out.close();
-                }
-            } catch (IOException ex) {
-                throw new MojoExecutionException(
-                        "Failed to write " + relativePath + ": " + ex.getMessage(), ex);
-            }
-        }
-    }
-}
diff --git a/implementations/pom.xml b/implementations/pom.xml
index 92d5d8f10..67202f286 100644
--- a/implementations/pom.xml
+++ b/implementations/pom.xml
@@ -67,7 +67,6 @@
                 <executions>
                     <execution>
                         <goals>
-                            <goal>post-process-classes</goal>
                             <goal>post-process-sources-jar</goal>
                         </goals>
                     </execution>
diff --git a/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java b/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
index 9add26edd..ca3d8f705 100644
--- a/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
+++ b/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
@@ -428,9 +428,7 @@ public class OMFactoryImpl implements OMFactory {
                     if (text.isBinary()) {
                         content =
                                 new TextContent(
-                                        text.getContentID(),
-                                        text.getDataHandler(),
-                                        text.isOptimized());
+                                        text.getContentID(), text.getBlob(), text.isOptimized());
                     } else {
                         content = text.getText();
                     }
diff --git a/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/mixin/AxiomTextMixin.java b/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/mixin/AxiomTextMixin.java
index 7f06fefba..ff776a645 100644
--- a/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/mixin/AxiomTextMixin.java
+++ b/mixins/om-mixins/src/main/java/org/apache/axiom/om/impl/mixin/AxiomTextMixin.java
@@ -21,6 +21,7 @@ package org.apache.axiom.om.impl.mixin;
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 
+import org.apache.axiom.blob.Blob;
 import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.mime.activation.PartDataHandler;
 import org.apache.axiom.om.OMElement;
@@ -129,11 +130,11 @@ public abstract class AxiomTextMixin implements AxiomText {
     }
 
     @Override
-    public final DataHandler getDataHandler() {
+    public final Blob getBlob() {
         try {
             Object content = coreGetCharacterData();
             if (content instanceof TextContent) {
-                return DataHandlerUtils.toDataHandler(((TextContent) content).getBlob());
+                return ((TextContent) content).getBlob();
             } else {
                 throw new OMException("No DataHandler available");
             }
@@ -150,7 +151,7 @@ public abstract class AxiomTextMixin implements AxiomText {
     @Override
     public final void buildWithAttachments() {
         if (isOptimized()) {
-            DataHandler dataHandler = getDataHandler();
+            DataHandler dataHandler = DataHandlerUtils.getDataHandler(getBlob());
             if (dataHandler instanceof PartDataHandler) {
                 ((PartDataHandler) dataHandler).getPart().fetch();
             }
diff --git a/samples/src/test/java/org/apache/axiom/samples/MTOMSample.java b/samples/src/test/java/org/apache/axiom/samples/MTOMSample.java
index d67240a33..468153e69 100644
--- a/samples/src/test/java/org/apache/axiom/samples/MTOMSample.java
+++ b/samples/src/test/java/org/apache/axiom/samples/MTOMSample.java
@@ -23,15 +23,14 @@ import java.io.OutputStream;
 import java.net.URL;
 import java.net.URLConnection;
 
-import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
 
 import junit.framework.TestCase;
 
+import org.apache.axiom.blob.Blob;
 import org.apache.axiom.mime.MultipartBody;
-import org.apache.axiom.mime.activation.PartDataHandlerBlobFactory;
-import org.apache.axiom.mime.activation.PartDataHandler;
+import org.apache.axiom.mime.PartBlob;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
@@ -69,15 +68,14 @@ public class MTOMSample extends TestCase {
         MultipartBody multipartBody = MultipartBody.builder()
                 .setInputStream(in)
                 .setContentType(connection.getContentType())
-                .setPartBlobFactory(PartDataHandlerBlobFactory.DEFAULT)
                 .build();
         SOAPEnvelope response = OMXMLBuilderFactory.createSOAPModelBuilder(multipartBody).getSOAPEnvelope();
         OMElement retrieveContentResponse = response.getBody().getFirstElement();
         OMElement content = retrieveContentResponse.getFirstElement();
-        // Extract the DataHandler representing the optimized binary data
-        DataHandler dh = ((OMText)content.getFirstOMChild()).getDataHandler();
+        // Extract the Blob representing the optimized binary data
+        Blob blob = ((OMText)content.getFirstOMChild()).getBlob();
         // Stream the content of the MIME part
-        InputStream contentStream = ((PartDataHandler)dh).getPart().getInputStream(false);
+        InputStream contentStream = ((PartBlob)blob).getPart().getInputStream(false);
         // Write the content to the result stream
         IOUtils.copy(contentStream, result);
         contentStream.close();
diff --git a/systests/compat-tests/pom.xml b/systests/compat-tests/pom.xml
deleted file mode 100644
index 278aaf793..000000000
--- a/systests/compat-tests/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.ws.commons.axiom</groupId>
-        <artifactId>systests</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>compat-tests</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>axiom-impl</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>axiom-dom</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.synapse</groupId>
-            <artifactId>synapse-core</artifactId>
-            <version>3.0.1</version>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.apache.synapse</groupId>
-                    <artifactId>synapse-securevault</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.synapse</groupId>
-                    <artifactId>synapse-commons</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.synapse</groupId>
-                    <artifactId>synapse-tasks</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.synapse</groupId>
-                    <artifactId>synapse-nhttp-transport</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.wso2.eventing</groupId>
-                    <artifactId>wso2eventing-api</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.wso2.caching</groupId>
-                    <artifactId>wso2caching-core</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.wso2.uri.template</groupId>
-                    <artifactId>wso2-uri-templates</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.axis2</groupId>
-                    <artifactId>axis2-adb</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.ws.commons.axiom</groupId>
-                    <artifactId>axiom-dom</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.neethi</groupId>
-                    <artifactId>neethi</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>testutils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/systests/compat-tests/src/test/java/DataHandlerTest.java b/systests/compat-tests/src/test/java/DataHandlerTest.java
deleted file mode 100644
index 500d9aba8..000000000
--- a/systests/compat-tests/src/test/java/DataHandlerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-import static com.google.common.truth.Truth.assertThat;
-
-import javax.activation.DataHandler;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.testutils.activation.TestDataSource;
-import org.apache.synapse.util.PayloadHelper;
-import org.junit.Test;
-
-public class DataHandlerTest {
-    private void test(String feature) {
-        DataHandler dh = new DataHandler(new TestDataSource('x', 1000));
-        SOAPEnvelope envelope = OMAbstractFactory.getMetaFactory(feature).getSOAP11Factory().createDefaultSOAPMessage().getSOAPEnvelope();
-        PayloadHelper.setBinaryPayload(envelope, dh);
-        assertThat(PayloadHelper.getBinaryPayload(envelope)).isSameInstanceAs(dh);
-    }
-
-    @Test
-    public void testLLOM() {
-        test(OMAbstractFactory.FEATURE_DEFAULT);
-    }
-
-    @Test
-    public void testDOOM() {
-        test(OMAbstractFactory.FEATURE_DOM);
-    }
-}
diff --git a/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java b/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
index e77470ef9..690e35249 100644
--- a/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
+++ b/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
@@ -20,6 +20,7 @@
 package org.apache.axiom.om.impl.mtom;
 
 import org.apache.axiom.attachments.Attachments;
+import org.apache.axiom.blob.Blob;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
@@ -29,8 +30,6 @@ import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.soap.SOAPModelBuilder;
 import org.apache.axiom.ts.soap.MTOMSample;
 
-import javax.activation.DataHandler;
-
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -81,7 +80,7 @@ public class MTOMStAXSOAPModelBuilderTest extends TestCase {
 
         Iterator childIt = data.getChildren();
         OMElement child = (OMElement) childIt.next();
-        OMText blob = (OMText) child.getFirstOMChild();
+        OMText blobNode = (OMText) child.getFirstOMChild();
         /*
          * Following is the procedure the user has to follow to read objects in
          * OBBlob User has to know the object type & whether it is serializable.
@@ -90,8 +89,7 @@ public class MTOMStAXSOAPModelBuilderTest extends TestCase {
          */
         byte[] expectedObject = new byte[] { 13, 56, 65, 32, 12, 12, 7, -3, -2,
                 -1, 98 };
-        DataHandler actualDH;
-        actualDH = blob.getDataHandler();
+        Blob actualBlob = blobNode.getBlob();
         //ByteArrayInputStream object = (ByteArrayInputStream) actualDH
         //.getContent();
         //byte[] actualObject= null;
@@ -125,9 +123,9 @@ public class MTOMStAXSOAPModelBuilderTest extends TestCase {
         // At this moment only the SOAP part should have been loaded
         assertEquals(1, attachments.getContentIDList().size());
         for (OMText node : binaryNodes) {
-            // Request the DataHandler and do something with it to make sure
+            // Request the Blob and do something with it to make sure
             // the part is loaded
-            node.getDataHandler().getInputStream().close();
+            node.getBlob().getInputStream().close();
         }
         assertEquals(binaryNodes.size() + 1, attachments.getContentIDList().size());
     }
diff --git a/systests/pom.xml b/systests/pom.xml
index d4ec578bc..690272fe0 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -32,7 +32,6 @@
     <name>System Tests</name>
 
     <modules>
-        <module>compat-tests</module>
         <module>cross-om-tests</module>
         <module>eclipse-tests</module>
         <module>jaxws-tests</module>
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestReadAttachmentBeforeRootPartComplete.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestReadAttachmentBeforeRootPartComplete.java
index bd14fb255..69fbfa815 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestReadAttachmentBeforeRootPartComplete.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestReadAttachmentBeforeRootPartComplete.java
@@ -23,6 +23,7 @@ import java.io.OutputStream;
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
 
+import org.apache.axiom.blob.Blob;
 import org.apache.axiom.blob.Blobs;
 import org.apache.axiom.blob.MemoryBlob;
 import org.apache.axiom.mime.MultipartBody;
@@ -77,8 +78,8 @@ public class TestReadAttachmentBeforeRootPartComplete extends AxiomTestCase {
         // Serialize the message
         OMOutputFormat format = new OMOutputFormat();
         format.setDoOptimize(true);
-        MemoryBlob blob = Blobs.createMemoryBlob();
-        OutputStream out = blob.getOutputStream();
+        MemoryBlob xop = Blobs.createMemoryBlob();
+        OutputStream out = xop.getOutputStream();
         orgRoot.serialize(out, format);
         out.close();
 
@@ -88,16 +89,16 @@ public class TestReadAttachmentBeforeRootPartComplete extends AxiomTestCase {
                         factory,
                         StAXParserConfiguration.NON_COALESCING,
                         MultipartBody.builder()
-                                .setInputStream(blob.getInputStream())
+                                .setInputStream(xop.getInputStream())
                                 .setContentType(format.getContentType())
                                 .build());
         OMElement root = builder.getDocumentElement();
         OMElement child1 = (OMElement) root.getFirstOMChild();
         OMText text = (OMText) child1.getFirstOMChild();
         assertTrue(text.isBinary());
-        // Access the DataHandler
-        DataHandler dh = text.getDataHandler();
-        IOTestUtils.compareStreams(ds.getInputStream(), dh.getInputStream());
+        // Access the Blob
+        Blob blob = text.getBlob();
+        IOTestUtils.compareStreams(ds.getInputStream(), blob.getInputStream());
         OMElement child2 = (OMElement) child1.getNextOMSibling();
         assertFalse(child2.isComplete());
         assertEquals(s, child2.getText());
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromBlobProvider.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromBlobProvider.java
index a38ddbb62..47940e9ad 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromBlobProvider.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromBlobProvider.java
@@ -63,7 +63,7 @@ public class TestCreateOMTextFromBlobProvider extends AxiomTestCase {
         String contentID = nullContentID ? null : UIDGenerator.generateContentId();
         OMText text = factory.createOMText(contentID, prov, true);
         assertFalse(prov.isBlobCreated());
-        assertEquals(text.getDataHandler().getContent(), "Data");
+        assertEquals(DataHandlerUtils.toDataHandler(text.getBlob()).getContent(), "Data");
         assertTrue(prov.isBlobCreated());
         if (contentID == null) {
             assertThat(text.getContentID()).isNotNull();
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerExpansion.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerExpansion.java
index 136ebb1e3..864e26ab2 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerExpansion.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerExpansion.java
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.ds.jaxb.JAXBOMDataSource;
 import org.apache.axiom.ts.AxiomTestCase;
 import org.apache.axiom.ts.jaxb.beans.DocumentBean;
+import org.apache.axiom.util.activation.DataHandlerUtils;
 
 /**
  * Tests the expansion of an {@link OMSourcedElement} backed by a {@link JAXBOMDataSource} with a
@@ -57,6 +58,6 @@ public class TestDataHandlerExpansion extends AxiomTestCase {
         OMText content = (OMText) child.getFirstOMChild();
         assertTrue(content.isBinary());
         assertTrue(content.isOptimized());
-        assertSame(dh, content.getDataHandler());
+        assertSame(dh, DataHandlerUtils.toDataHandler(content.getBlob()));
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java
index cc8221228..bc69c1efc 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java
@@ -24,6 +24,7 @@ import javax.activation.DataHandler;
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
 
+import org.apache.axiom.blob.Blob;
 import org.apache.axiom.blob.Blobs;
 import org.apache.axiom.blob.MemoryBlob;
 import org.apache.axiom.mime.MultipartBody;
@@ -66,8 +67,8 @@ public class TestDataHandlerSerializationWithMTOM extends AxiomTestCase {
         // Serialize the message
         OMOutputFormat format = new OMOutputFormat();
         format.setDoOptimize(true);
-        MemoryBlob blob = Blobs.createMemoryBlob();
-        OutputStream out = blob.getOutputStream();
+        MemoryBlob mtom = Blobs.createMemoryBlob();
+        OutputStream out = mtom.getOutputStream();
         orgEnvelope.serialize(out, format);
         out.close();
         assertFalse(element.isExpanded());
@@ -75,7 +76,7 @@ public class TestDataHandlerSerializationWithMTOM extends AxiomTestCase {
         // Parse the serialized message
         MultipartBody mb =
                 MultipartBody.builder()
-                        .setInputStream(blob.getInputStream())
+                        .setInputStream(mtom.getInputStream())
                         .setContentType(format.getContentType())
                         .build();
         assertEquals(2, mb.getPartCount());
@@ -89,7 +90,7 @@ public class TestDataHandlerSerializationWithMTOM extends AxiomTestCase {
         OMText content = (OMText) contentElement.getFirstOMChild();
         assertTrue(content.isBinary());
         assertTrue(content.isOptimized());
-        DataHandler dh = content.getDataHandler();
-        assertEquals("some content", IOUtils.toString(dh.getInputStream(), "utf-8"));
+        Blob blob = content.getBlob();
+        assertEquals("some content", IOUtils.toString(blob.getInputStream(), "utf-8"));
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobProviderScenario.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobProviderScenario.java
index 170adb229..82c4384a2 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobProviderScenario.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobProviderScenario.java
@@ -78,11 +78,12 @@ public class WriteBlobProviderScenario implements PushOMDataSourceScenario {
         OMText child = (OMText) element.getFirstOMChild();
         if (dataHandlersPreserved) {
             Assert.assertTrue(child.isBinary());
-            Assert.assertSame(dh, child.getDataHandler());
+            Assert.assertSame(dh, DataHandlerUtils.toDataHandler(child.getBlob()));
         } else {
             child.setBinary(true);
             IOTestUtils.compareStreams(
-                    dh.getInputStream(), child.getDataHandler().getInputStream());
+                    dh.getInputStream(),
+                    DataHandlerUtils.toDataHandler(child.getBlob()).getInputStream());
         }
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobScenario.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobScenario.java
index 978b3aab2..9e3f78a90 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobScenario.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/push/WriteBlobScenario.java
@@ -69,12 +69,13 @@ public class WriteBlobScenario implements PushOMDataSourceScenario {
         OMText child = (OMText) element.getFirstOMChild();
         if (dataHandlersPreserved) {
             Assert.assertTrue(child.isBinary());
-            Assert.assertSame(dh, child.getDataHandler());
+            Assert.assertSame(dh, DataHandlerUtils.toDataHandler(child.getBlob()));
         } else {
             // TODO: this will only work if a single text node was created
             child.setBinary(true);
             IOTestUtils.compareStreams(
-                    dh.getInputStream(), child.getDataHandler().getInputStream());
+                    dh.getInputStream(),
+                    DataHandlerUtils.toDataHandler(child.getBlob()).getInputStream());
         }
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestCloneBinary.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestCloneBinary.java
index 2f42d569c..5d6653022 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestCloneBinary.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestCloneBinary.java
@@ -30,6 +30,7 @@ import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.testutils.activation.RandomDataSource;
 import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.util.activation.DataHandlerUtils;
 
 public class TestCloneBinary extends AxiomTestCase {
     private boolean fetch;
@@ -60,6 +61,6 @@ public class TestCloneBinary extends AxiomTestCase {
         OMText clone = (OMText) text.clone(options);
         assertTrue(clone.isBinary());
         assertEquals(fetch, attachmentAccessor.isLoaded());
-        assertSame(dh, clone.getDataHandler());
+        assertSame(dh, DataHandlerUtils.toDataHandler(clone.getBlob()));
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java
index 8a313ab98..ec933368d 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java
@@ -31,6 +31,7 @@ import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.XOPEncoded;
 import org.apache.axiom.testutils.activation.TestDataSource;
 import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.util.activation.DataHandlerUtils;
 
 public class XOPRoundtripTest extends AxiomTestCase {
     public XOPRoundtripTest(OMMetaFactory metaFactory) {
@@ -54,6 +55,6 @@ public class XOPRoundtripTest extends AxiomTestCase {
         assertNotNull(child);
         assertTrue(child.isBinary());
         assertTrue(child.isOptimized());
-        assertSame(dh, child.getDataHandler());
+        assertSame(dh, DataHandlerUtils.toDataHandler(child.getBlob()));
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestBuildWithAttachments.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestBuildWithAttachments.java
index 2cb5103cf..52c96b742 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestBuildWithAttachments.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestBuildWithAttachments.java
@@ -56,11 +56,9 @@ public class TestBuildWithAttachments extends AxiomTestCase {
         OMElement image2 = it.next();
 
         IOTestUtils.compareStreams(
-                ((OMText) image1.getFirstOMChild()).getDataHandler().getInputStream(),
-                sample.getPart(1));
+                ((OMText) image1.getFirstOMChild()).getBlob().getInputStream(), sample.getPart(1));
 
         IOTestUtils.compareStreams(
-                ((OMText) image2.getFirstOMChild()).getDataHandler().getInputStream(),
-                sample.getPart(2));
+                ((OMText) image2.getFirstOMChild()).getBlob().getInputStream(), sample.getPart(2));
     }
 }
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestMTOMForwardStreaming.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestMTOMForwardStreaming.java
index 58777bc82..25e41df4d 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestMTOMForwardStreaming.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestMTOMForwardStreaming.java
@@ -39,6 +39,7 @@ import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.testutils.activation.TestDataSource;
 import org.apache.axiom.testutils.io.IOTestUtils;
 import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.util.activation.DataHandlerUtils;
 
 /**
  * Tests that attachments are streamed (i.e. not read entirely into memory) if the original message
@@ -150,12 +151,16 @@ public class TestMTOMForwardStreaming extends AxiomTestCase {
 
             IOTestUtils.compareStreams(
                     ds1.getInputStream(),
-                    ((PartDataHandler) ((OMText) data1.getFirstOMChild()).getDataHandler())
+                    ((PartDataHandler)
+                                    DataHandlerUtils.toDataHandler(
+                                            ((OMText) data1.getFirstOMChild()).getBlob()))
                             .getPart()
                             .getInputStream(false));
             IOTestUtils.compareStreams(
                     ds2.getInputStream(),
-                    ((PartDataHandler) ((OMText) data2.getFirstOMChild()).getDataHandler())
+                    ((PartDataHandler)
+                                    DataHandlerUtils.toDataHandler(
+                                            ((OMText) data2.getFirstOMChild()).getBlob()))
                             .getPart()
                             .getInputStream(false));
         } finally {
diff --git a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java
index a9a06b0b5..78b42d6cb 100644
--- a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java
+++ b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java
@@ -61,8 +61,7 @@ public class TestBuilderDetach extends AxiomTestCase {
                 OMText text = (OMText) node;
                 if (text.isBinary()) {
                     IOTestUtils.compareStreams(
-                            sample.getPart(text.getContentID()),
-                            text.getDataHandler().getInputStream());
+                            sample.getPart(text.getContentID()), text.getBlob().getInputStream());
                     binaryCount++;
                 }
             }