changeset 495:43683fefd932

8042058: Missing deleted files from JDK-8040754 breaks jdk9/dev build Reviewed-by: chegar
author mchung
date Mon, 28 Apr 2014 14:57:14 -0700
parents f51b5ea42589
children 779f8b21c75f
files src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java
diffstat 3 files changed, 0 insertions(+), 727 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java	Mon Apr 28 14:05:34 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.xml.internal.org.jvnet.staxex.util;
-
-import java.util.Iterator;
-
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.stream.XMLStreamException;
-
-import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
-import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
-import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-/**
- * SaajStaxReaderEx
- *
- * @author shih-chang.chen@oracle.com
- */
-public class SaajStaxReaderEx extends DOMStreamReader implements XMLStreamReaderEx {
-    //TODO extends com.sun.xml.internal.ws.streaming.DOMStreamReader
-    private BinaryText binaryText = null;
-    private Base64Data base64AttData = null;
-
-    public SaajStaxReaderEx(SOAPElement se) {
-        super(se);
-    }
-
-    @Override
-    public int next() throws XMLStreamException {
-        binaryText = null;
-        base64AttData = null;
-        while(true) {
-            int r = _next();
-            switch (r) {
-            case CHARACTERS:
-                if (_current instanceof BinaryText) {
-                    binaryText = (BinaryText) _current;
-                    base64AttData = new Base64Data();
-                    try {
-                        base64AttData.set(binaryText.getDataHandler());
-//System.out.println("--------------- debug SaajStaxReaderEx binaryText " + binaryText);
-                    } catch (SOAPException e) {
-                        throw new XMLStreamException(e);
-                    }
-                } else {
-                    // if we are currently at text node, make sure that this is a meaningful text node.
-                    Node prev = _current.getPreviousSibling();
-                    if(prev!=null && prev.getNodeType()==Node.TEXT_NODE)
-                        continue;   // nope. this is just a continuation of previous text that should be invisible
-
-                    Text t = (Text)_current;
-                    wholeText = t.getWholeText();
-                    if(wholeText.length()==0)
-                        continue;   // nope. this is empty text.
-                }
-                return CHARACTERS;
-            case START_ELEMENT:
-                splitAttributes();
-                return START_ELEMENT;
-            default:
-                return r;
-            }
-        }
-    }
-
-    @Override
-    public String getElementTextTrim() throws XMLStreamException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public CharSequence getPCDATA() throws XMLStreamException {
-        return (binaryText != null) ? base64AttData : getText();
-    }
-
-    @Override
-    public com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx getNamespaceContext() {
-        return new com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx() {
-
-            @Override
-            public String getNamespaceURI(String prefix) {
-                return _current.lookupNamespaceURI(prefix);
-            }
-
-            @Override
-            public String getPrefix(String uri) {
-                return _current.lookupPrefix(uri);
-            }
-
-            @Override
-            public Iterator getPrefixes(String arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Iterator<Binding> iterator() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-        };
-    }
-
-
-    @Override
-    public int getTextLength() {
-        return (binaryText != null) ? base64AttData.length() : super.getTextLength();
-    }
-
-    @Override
-    public int getTextStart() {
-        return (binaryText != null) ? 0: super.getTextStart();
-    }
-
-    @Override
-    public char[] getTextCharacters() {
-        if (binaryText != null) {
-            char[] chars = new char[base64AttData.length()];
-            base64AttData.writeTo(chars, 0);
-            return chars;
-        }
-        return super.getTextCharacters();
-    }
-}
--- a/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java	Mon Apr 28 14:05:34 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.xml.internal.org.jvnet.staxex.util;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.w3c.dom.Comment;
-import org.w3c.dom.Node;
-
-/**
- * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
- *
- * @author shih-chang.chen@oracle.com
- */
-public class SaajStaxWriter implements XMLStreamWriter {
-
-    protected SOAPMessage soap;
-    protected String envURI;
-    protected SOAPElement currentElement;
-
-    static final protected String Envelope = "Envelope";
-    static final protected String Header = "Header";
-    static final protected String Body = "Body";
-    static final protected String xmlns = "xmlns";
-
-    public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
-        soap = msg;
-        this.envURI = uri;
-    }
-
-    public SOAPMessage getSOAPMessage() {
-        return soap;
-    }
-
-    protected SOAPElement getEnvelope() throws SOAPException {
-        return soap.getSOAPPart().getEnvelope();
-    }
-
-    @Override
-    public void writeStartElement(final String localName) throws XMLStreamException {
-        try {
-            currentElement = currentElement.addChildElement(localName);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeStartElement(final String ns, final String ln) throws XMLStreamException {
-        writeStartElement(null, ln, ns);
-    }
-
-    @Override
-    public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException {
-        try {
-            if (envURI.equals(ns)) {
-                if (Envelope.equals(ln)) {
-                    currentElement = getEnvelope();
-                    fixPrefix(prefix);
-                    return;
-                } else if (Header.equals(ln)) {
-                    currentElement = soap.getSOAPHeader();
-                    fixPrefix(prefix);
-                    return;
-                } else if (Body.equals(ln)) {
-                    currentElement = soap.getSOAPBody();
-                    fixPrefix(prefix);
-                    return;
-                }
-            }
-            currentElement = (prefix == null) ?
-                    currentElement.addChildElement(new QName(ns, ln)) :
-                    currentElement.addChildElement(ln, prefix, ns);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    private void fixPrefix(final String prfx) throws XMLStreamException {
-        String oldPrfx = currentElement.getPrefix();
-        if (prfx != null && !prfx.equals(oldPrfx)) {
-            currentElement.setPrefix(prfx);
-        }
-    }
-
-    @Override
-    public void writeEmptyElement(final String uri, final String ln) throws XMLStreamException {
-        writeStartElement(null, ln, uri);
-    }
-
-    @Override
-    public void writeEmptyElement(final String prefix, final String ln, final String uri) throws XMLStreamException {
-        writeStartElement(prefix, ln, uri);
-    }
-
-    @Override
-    public void writeEmptyElement(final String ln) throws XMLStreamException {
-        writeStartElement(null, ln, null);
-    }
-
-    @Override
-    public void writeEndElement() throws XMLStreamException {
-        if (currentElement != null) currentElement = currentElement.getParentElement();
-    }
-
-    @Override
-    public void writeEndDocument() throws XMLStreamException {
-    }
-
-    @Override
-    public void close() throws XMLStreamException {
-    }
-
-    @Override
-    public void flush() throws XMLStreamException {
-    }
-
-    @Override
-    public void writeAttribute(final String ln, final String val) throws XMLStreamException {
-        writeAttribute(null, null, ln, val);
-    }
-
-    @Override
-    public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException {
-        try {
-            if (ns == null) {
-                if (prefix == null && xmlns.equals(ln)) {
-                    currentElement.addNamespaceDeclaration("", value);
-                } else {
-                    currentElement.setAttributeNS("", ln, value);
-                }
-            } else {
-                QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix);
-                currentElement.addAttribute(name, value);
-            }
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeAttribute(final String ns, final String ln, final String val) throws XMLStreamException {
-        writeAttribute(null, ns, ln, val);
-    }
-
-    @Override
-    public void writeNamespace(String prefix, final String uri) throws XMLStreamException {
-
-        // make prefix default if null or "xmlns" (according to javadoc)
-        if (prefix == null || "xmlns".equals(prefix)) {
-            prefix = "";
-        }
-
-        try {
-            currentElement.addNamespaceDeclaration(prefix, uri);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeDefaultNamespace(final String uri) throws XMLStreamException {
-        writeNamespace("", uri);
-    }
-
-    @Override
-    public void writeComment(final String data) throws XMLStreamException {
-        Comment c = soap.getSOAPPart().createComment(data);
-        currentElement.appendChild(c);
-    }
-
-    @Override
-    public void writeProcessingInstruction(final String target) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createProcessingInstruction(target, "");
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createProcessingInstruction(target, data);
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeCData(final String data) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createCDATASection(data);
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeDTD(final String dtd) throws XMLStreamException {
-        //TODO ... Don't do anything here
-    }
-
-    @Override
-    public void writeEntityRef(final String name) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createEntityReference(name);
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeStartDocument() throws XMLStreamException {
-    }
-
-    @Override
-    public void writeStartDocument(final String version) throws XMLStreamException {
-        if (version != null) soap.getSOAPPart().setXmlVersion(version);
-    }
-
-    @Override
-    public void writeStartDocument(final String encoding, final String version) throws XMLStreamException {
-        if (version != null) soap.getSOAPPart().setXmlVersion(version);
-        if (encoding != null) {
-            try {
-                soap.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding);
-            } catch (SOAPException e) {
-                throw new XMLStreamException(e);
-            }
-        }
-    }
-
-    @Override
-    public void writeCharacters(final String text) throws XMLStreamException {
-        try {
-            currentElement.addTextNode(text);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException {
-        char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len);
-        try {
-            currentElement.addTextNode(new String(chr));
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public String getPrefix(final String uri) throws XMLStreamException {
-        return currentElement.lookupPrefix(uri);
-    }
-
-    @Override
-    public void setPrefix(final String prefix, final String uri) throws XMLStreamException {
-        try {
-            this.currentElement.addNamespaceDeclaration(prefix, uri);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void setDefaultNamespace(final String uri) throws XMLStreamException {
-        setPrefix("", uri);
-    }
-
-    @Override
-    public void setNamespaceContext(final NamespaceContext context)throws XMLStreamException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Object getProperty(final String name) throws IllegalArgumentException {
-        //TODO the following line is to make eclipselink happy ... they are aware of this problem -
-        if (javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES.equals(name)) return Boolean.FALSE;
-        return null;
-    }
-
-    @Override
-    public NamespaceContext getNamespaceContext() {
-        return new NamespaceContext() {
-            public String getNamespaceURI(final String prefix) {
-                return currentElement.getNamespaceURI(prefix);
-            }
-            public String getPrefix(final String namespaceURI) {
-                return currentElement.lookupPrefix(namespaceURI);
-            }
-            public Iterator getPrefixes(final String namespaceURI) {
-                return new Iterator() {
-                    String prefix = getPrefix(namespaceURI);
-                    public boolean hasNext() {
-                        return (prefix != null);
-                    }
-                    public Object next() {
-                        if (!hasNext()) throw new java.util.NoSuchElementException();
-                        String next = prefix;
-                        prefix = null;
-                        return next;
-                    }
-                    public void remove() {}
-                };
-            }
-        };
-    }
-}
--- a/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java	Mon Apr 28 14:05:34 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.xml.internal.org.jvnet.staxex.util;
-
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.UUID;
-
-import javax.activation.DataHandler;
-import javax.xml.bind.attachment.AttachmentMarshaller;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.stream.XMLStreamException;
-
-import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
-import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
-import com.sun.xml.internal.org.jvnet.staxex.MtomEnabled;
-import com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx;
-import com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler;
-import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
-//
-//import com.sun.xml.internal.ws.api.message.saaj.SaajStaxWriter;
-//import com.sun.xml.internal.ws.developer.StreamingDataHandler;
-//import com.sun.xml.internal.ws.streaming.MtomStreamWriter;
-
-/**
- * SaajStaxWriterEx converts XMLStreamWriterEx calls to build an orasaaj SOAPMessage with BinaryTextImpl.
- *
- * @author shih-chang.chen@oracle.com
- */
-public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterEx, MtomStreamWriter {
-
-    static final protected String xopNS = "http://www.w3.org/2004/08/xop/include";
-    static final protected String Include = "Include";
-    static final protected String href = "href";
-
-    private enum State {xopInclude, others};
-    private State state = State.others;
-    private BinaryText binaryText;
-
-    public SaajStaxWriterEx(SOAPMessage msg, String uri) throws SOAPException {
-        super(msg, uri);
-    }
-
-    public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException {
-        if (xopNS.equals(ns) && Include.equals(ln)) {
-            state = State.xopInclude;
-            return;
-        } else {
-            super.writeStartElement(prefix, ln, ns);
-        }
-    }
-
-    @Override
-    public void writeEndElement() throws XMLStreamException {
-        if (state.equals(State.xopInclude)) {
-            state = State.others;
-        } else {
-            super.writeEndElement();
-        }
-    }
-
-    @Override
-    public void writeAttribute(String prefix, String ns, String ln, String value) throws XMLStreamException {
-        if (binaryText != null && href.equals(ln)) {
-            return;
-        } else {
-            super.writeAttribute(prefix, ns, ln, value);
-        }
-    }
-
-//    @Override
-//    public void writeComment(String data) throws XMLStreamException {
-//        ((ElementImpl)currentElement).addCommentNode(data);
-//    }
-//
-//    @Override
-//    public void writeCData(String data) throws XMLStreamException {
-//      CDataTextImpl cdt = new CDataTextImpl(soap.getSOAPPart(), data);
-//        currentElement.appendChild(cdt);
-//    }
-
-    @Override
-    public NamespaceContextEx getNamespaceContext() {
-        return new NamespaceContextEx() {
-            public String getNamespaceURI(String prefix) {
-                return currentElement.getNamespaceURI(prefix);
-            }
-            public String getPrefix(String namespaceURI) {
-                return currentElement.lookupPrefix(namespaceURI);
-            }
-            public Iterator getPrefixes(final String namespaceURI) {
-                return new Iterator() {
-                    String prefix = getPrefix(namespaceURI);
-                    public boolean hasNext() {
-                        return (prefix != null);
-                    }
-                    public Object next() {
-                        if (prefix == null) throw new java.util.NoSuchElementException();
-                        String next = prefix;
-                        prefix = null;
-                        return next;
-                    }
-                    public void remove() {}
-                };
-            }
-            public Iterator<Binding> iterator() {
-                return new Iterator<Binding>() {
-                    public boolean hasNext() { return false; }
-                    public Binding next() { return null; }
-                    public void remove() {}
-                };
-            }
-        };
-    }
-
-    @Override
-    public void writeBinary(DataHandler data) throws XMLStreamException {
-//      binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl)soap, null, currentElement.getOwnerDocument(), data);
-//      currentElement.appendChild(binaryText);
-        addBinaryText(data);
-    }
-
-    @Override
-    public OutputStream writeBinary(String arg0) throws XMLStreamException {
-        return null;
-    }
-
-    @Override
-    public void writeBinary(byte[] data, int offset, int length, String contentType) throws XMLStreamException {
-//        if (mtomThreshold == -1 || mtomThreshold > length) return null;
-        byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
-        if (currentElement instanceof MtomEnabled) {
-            binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
-        } else {
-            throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
-        }
-    }
-
-    @Override
-    public void writePCDATA(CharSequence arg0) throws XMLStreamException {
-        if (arg0 instanceof Base64Data) {
-            // The fix of StreamReaderBufferCreator preserves this dataHandler
-            addBinaryText(((Base64Data) arg0).getDataHandler());
-        } else {
-            // We should not normally get here as we expect a DataHandler,
-            // but this is the most general solution.  If we do get
-            // something other than a Data Handler, create a Text node with
-            // the data.  Another alternative would be to throw an exception,
-            // but in the most general case, we don't know whether this input
-            // is expected.
-            try {
-                currentElement.addTextNode(arg0.toString());
-            } catch (SOAPException e) {
-                throw new XMLStreamException("Cannot add Text node", e);
-            }
-        }
-    }
-
-    static private String encodeCid() {
-        String cid = "example.jaxws.sun.com";
-        String name = UUID.randomUUID() + "@";
-        return name + cid;
-    }
-
-    private String addBinaryText(DataHandler data) {
-        String hrefOrCid = null;
-        if (data instanceof StreamingDataHandler) {
-            hrefOrCid = ((StreamingDataHandler) data).getHrefCid();
-        }
-        if (hrefOrCid == null) hrefOrCid = encodeCid();
-
-        String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid;
-        // Should we do the threshold processing on DataHandler ? But that would be
-        // expensive as DataHolder need to read the data again from its source
-      //binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data);
-      //currentElement.appendChild(binaryText);
-        if (currentElement instanceof MtomEnabled) {
-            binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data);
-        } else {
-            throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
-        }
-        return hrefOrCid;
-    }
-
-    public AttachmentMarshaller getAttachmentMarshaller() {
-        return new AttachmentMarshaller() {
-            @Override
-            public String addMtomAttachment(DataHandler data, String ns, String ln) {
-//                if (mtomThreshold == -1) return null;
-                String hrefOrCid = addBinaryText(data);
-//                return binaryText.getHref();
-                return hrefOrCid;
-            }
-
-            @Override
-            public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String ns, String ln) {
-//                if (mtomThreshold == -1 || mtomThreshold > length) return null;
-                byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
-//                binaryText = (BinaryTextImpl) ((ElementImpl) currentElement).addAsBase64TextNode(bytes);
-                if (currentElement instanceof MtomEnabled) {
-                    binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
-                } else {
-                    throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
-                }
-                return binaryText.getHref();
-            }
-
-            @Override
-            public String addSwaRefAttachment(DataHandler data) {
-                return "cid:"+encodeCid();
-            }
-
-            @Override
-            public boolean isXOPPackage() {
-                return true;
-            }
-        };
-    }
-}