Source Code Cross Referenced for AttachmentUnmarshaller.java in  » 6.0-JDK-Core » xml » javax » xml » bind » attachment » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.bind.attachment 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.xml.bind.attachment;
027
028        import javax.activation.DataHandler;
029
030        /**
031         * <p>Enables JAXB unmarshalling of a root document containing optimized binary data formats.</p>
032         *
033         * <p>This API enables an efficient cooperative processing of optimized
034         * binary data formats between a JAXB 2.0 implementation and MIME-based package
035         * processor (MTOM/XOP and WS-I AP 1.0). JAXB unmarshals the body of a package, delegating the 
036         * understanding of the packaging format being used to a MIME-based 
037         * package processor that implements this abstract class.</p>
038         *
039         * <p>This abstract class identifies if a package requires XOP processing, {@link #isXOPPackage()} and provides retrieval of binary content stored as attachments by content-id.</p>
040         *
041         * <h2>Identifying the content-id, cid, to pass to <code>getAttachment*(String cid)</code></h2>
042         * <ul>
043         * <li>
044         * For XOP processing, the infoset representation of the cid is described 
045         * in step 2a in 
046         * <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#interpreting_xop_packages">Section 3.2 Interpreting XOP Packages</a>
047         * </li>
048         * <li>
049         * For WS-I AP 1.0, the cid is identified as an element or attribute of 
050         * type <code>ref:swaRef </code> specified in 
051         * <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">Section 4.4 Referencing Attachments from the SOAP Envelope</a>
052         * </li>
053         * </ul>
054         * 
055         * @author Marc Hadley
056         * @author Kohsuke Kawaguchi
057         * @author Joseph Fialli
058         * 
059         * @since JAXB 2.0
060         * 
061         * @see javax.xml.bind.Unmarshaller#setAttachmentUnmarshaller(AttachmentUnmarshaller)
062         *
063         * @see <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a>
064         * @see <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html">WS-I Attachments Profile Version 1.0.</a>
065         * @see <a href="http://www.w3.org/TR/xml-media-types/">Describing Media Content of Binary Data in XML</a>
066         */
067        public abstract class AttachmentUnmarshaller {
068            /**
069             * <p>Lookup MIME content by content-id, <code>cid</code>, and return as a {@link DataHandler}.</p>
070             * 
071             * <p>The returned <code>DataHandler</code> instance must be configured
072             * to meet the following required mapping constaint. 
073             * <table border="2" rules="all" cellpadding="4">
074             *   <thead>
075             *     <tr>
076             *       <th align="center" colspan="2">
077             *       Required Mappings between MIME and Java Types
078             *       </tr>
079             *     <tr>
080             *       <th>MIME Type</th>
081             *       <th>Java Type</th>
082             *     </tr>
083             *     </tr>
084             *     <tr>
085             *       <th><code>DataHandler.getContentType()</code></th>
086             *       <th><code>instanceof DataHandler.getContent()</code></th>
087             *     </tr>
088             *   </thead>
089             *   <tbody>
090             *     <tr>
091             *       <td>image/gif</td>
092             *       <td>java.awt.Image</td>
093             *     </tr>
094             *     <tr>
095             *       <td>image/jpeg</td>
096             *       <td>java.awt.Image</td>
097             *     </tr>
098             *     <tr>
099             *       <td>text/xml  or application/xml</td>
100             *       <td>javax.xml.transform.Source</td>
101             *     </tr>
102             *   </tbody>
103             *  </table>
104             * Note that it is allowable to support additional mappings.</p>
105             * 
106             * @param cid It is expected to be a valid lexical form of the XML Schema 
107             * <code>xs:anyURI</code> datatype. If <code>{@link #isXOPPackage()}
108             * ==true</code>, it must be a valid URI per the <code>cid:</code> URI scheme (see <a href="http://www.ietf.org/rfc/rfc2387.txt">RFC 2387</a>)
109             * 
110             * @return
111             *       a {@link DataHandler} that represents the MIME attachment.
112             *
113             * @throws IllegalArgumentException if the attachment for the given cid is not found.
114             */
115            public abstract DataHandler getAttachmentAsDataHandler(String cid);
116
117            /**
118             * <p>Retrieve the attachment identified by content-id, <code>cid</code>,  as a <tt>byte[]</tt></p>.
119             *
120             * @param cid It is expected to be a valid lexical form of the XML Schema 
121             * <code>xs:anyURI</code> datatype. If <code>{@link #isXOPPackage()}
122             * ==true</code>, it must be a valid URI per the <code>cid:</code> URI scheme (see <a href="http://www.ietf.org/rfc/rfc2387.txt">RFC 2387</a>)
123             *
124             * @return byte[] representation of attachment identified by cid.
125             * 
126             * @throws IllegalArgumentException if the attachment for the given cid is not found.
127             */
128            public abstract byte[] getAttachmentAsByteArray(String cid);
129
130            /**
131             * <p>Read-only property that returns true if JAXB unmarshaller needs to perform XOP processing.</p>
132             *
133             * <p>This method returns <code>true</code> when the constraints specified
134             * in  <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#identifying_xop_documents">Identifying XOP Documents</a> are met.
135             * This value must not change during the unmarshalling process.</p>
136             *
137             * @return true when MIME context is a XOP Document.
138             */
139            public boolean isXOPPackage() {
140                return false;
141            }
142        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.