ohair@286: /* ohair@286: * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package javax.xml.bind.attachment; ohair@286: ohair@286: import javax.activation.DataHandler; ohair@286: ohair@286: /** ohair@286: *
Enables JAXB unmarshalling of a root document containing optimized binary data formats.
ohair@286: * ohair@286: *This API enables an efficient cooperative processing of optimized ohair@286: * binary data formats between a JAXB 2.0 implementation and MIME-based package ohair@286: * processor (MTOM/XOP and WS-I AP 1.0). JAXB unmarshals the body of a package, delegating the ohair@286: * understanding of the packaging format being used to a MIME-based ohair@286: * package processor that implements this abstract class.
ohair@286: * ohair@286: *This abstract class identifies if a package requires XOP processing, {@link #isXOPPackage()} and provides retrieval of binary content stored as attachments by content-id.
ohair@286: * ohair@286: *getAttachment*(String cid)
ref:swaRef
specified in
ohair@286: * Section 4.4 Referencing Attachments from the SOAP Envelope
ohair@286: * Lookup MIME content by content-id, cid
, and return as a {@link DataHandler}.
The returned DataHandler
instance must be configured
ohair@286: * to meet the following required mapping constaint.
ohair@286: *
ohair@286: * Required Mappings between MIME and Java Types ohair@286: * | |
---|---|
MIME Type | ohair@286: *Java Type | ohair@286: *
DataHandler.getContentType() |
ohair@286: * instanceof DataHandler.getContent() |
ohair@286: *
image/gif | ohair@286: *java.awt.Image | ohair@286: *
image/jpeg | ohair@286: *java.awt.Image | ohair@286: *
text/xml or application/xml | ohair@286: *javax.xml.transform.Source | ohair@286: *
xs:anyURI
datatype. If {@link #isXOPPackage()}
ohair@286: * ==true
, it must be a valid URI per the cid:
URI scheme (see RFC 2387)
ohair@286: *
ohair@286: * @return
ohair@286: * a {@link DataHandler} that represents the MIME attachment.
ohair@286: *
ohair@286: * @throws IllegalArgumentException if the attachment for the given cid is not found.
ohair@286: */
ohair@286: public abstract DataHandler getAttachmentAsDataHandler(String cid);
ohair@286:
ohair@286: /**
ohair@286: * Retrieve the attachment identified by content-id, cid
, as a byte[]
xs:anyURI
datatype. If {@link #isXOPPackage()}
ohair@286: * ==true
, it must be a valid URI per the cid:
URI scheme (see RFC 2387)
ohair@286: *
ohair@286: * @return byte[] representation of attachment identified by cid.
ohair@286: *
ohair@286: * @throws IllegalArgumentException if the attachment for the given cid is not found.
ohair@286: */
ohair@286: public abstract byte[] getAttachmentAsByteArray(String cid);
ohair@286:
ohair@286: /**
ohair@286: * Read-only property that returns true if JAXB unmarshaller needs to perform XOP processing.
ohair@286: * ohair@286: *This method returns true
when the constraints specified
ohair@286: * in Identifying XOP Documents are met.
ohair@286: * This value must not change during the unmarshalling process.