blob: ffa264aa5f3e0b21b9172ba4aeb3a64824753e41 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Portions Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26/*
27 * ===========================================================================
28 *
29 * (C) Copyright IBM Corp. 2003 All Rights Reserved.
30 *
31 * ===========================================================================
32 */
33/*
34 * $Id: XMLObject.java,v 1.5 2005/05/10 16:03:48 mullan Exp $
35 */
36package javax.xml.crypto.dsig;
37
38import java.util.List;
39import javax.xml.crypto.XMLStructure;
40
41/**
42 * A representation of the XML <code>Object</code> element as defined in
43 * the <a href="http://www.w3.org/TR/xmldsig-core/">
44 * W3C Recommendation for XML-Signature Syntax and Processing</a>.
45 * An <code>XMLObject</code> may contain any data and may include optional
46 * MIME type, ID, and encoding attributes. The XML Schema Definition is
47 * defined as:
48 *
49 * <pre><code>
50 * &lt;element name="Object" type="ds:ObjectType"/&gt;
51 * &lt;complexType name="ObjectType" mixed="true"&gt;
52 * &lt;sequence minOccurs="0" maxOccurs="unbounded"&gt;
53 * &lt;any namespace="##any" processContents="lax"/&gt;
54 * &lt;/sequence&gt;
55 * &lt;attribute name="Id" type="ID" use="optional"/&gt;
56 * &lt;attribute name="MimeType" type="string" use="optional"/&gt;
57 * &lt;attribute name="Encoding" type="anyURI" use="optional"/&gt;
58 * &lt;/complexType&gt;
59 * </code></pre>
60 *
61 * A <code>XMLObject</code> instance may be created by invoking the
62 * {@link XMLSignatureFactory#newXMLObject newXMLObject} method of the
63 * {@link XMLSignatureFactory} class; for example:
64 *
65 * <pre>
66 * XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
67 * List content = Collections.singletonList(fac.newManifest(references)));
68 * XMLObject object = factory.newXMLObject(content, "object-1", null, null);
69 * </pre>
70 *
71 * <p>Note that this class is named <code>XMLObject</code> rather than
72 * <code>Object</code> to avoid naming clashes with the existing
73 * {@link java.lang.Object java.lang.Object} class.
74 *
75 * @author Sean Mullan
76 * @author JSR 105 Expert Group
77 * @author Joyce L. Leung
78 * @since 1.6
79 * @see XMLSignatureFactory#newXMLObject(List, String, String, String)
80 */
81public interface XMLObject extends XMLStructure {
82
83 /**
84 * URI that identifies the <code>Object</code> element (this can be
85 * specified as the value of the <code>type</code> parameter of the
86 * {@link Reference} class to identify the referent's type).
87 */
88 final static String TYPE = "http://www.w3.org/2000/09/xmldsig#Object";
89
90 /**
91 * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
92 * list} of {@link XMLStructure}s contained in this <code>XMLObject</code>,
93 * which represent elements from any namespace.
94 *
95 *<p>If there is a public subclass representing the type of
96 * <code>XMLStructure</code>, it is returned as an instance of that class
97 * (ex: a <code>SignatureProperties</code> element would be returned
98 * as an instance of {@link javax.xml.crypto.dsig.SignatureProperties}).
99 *
100 * @return an unmodifiable list of <code>XMLStructure</code>s (may be empty
101 * but never <code>null</code>)
102 */
103 List getContent();
104
105 /**
106 * Returns the Id of this <code>XMLObject</code>.
107 *
108 * @return the Id (or <code>null</code> if not specified)
109 */
110 String getId();
111
112 /**
113 * Returns the mime type of this <code>XMLObject</code>. The
114 * mime type is an optional attribute which describes the data within this
115 * <code>XMLObject</code> (independent of its encoding).
116 *
117 * @return the mime type (or <code>null</code> if not specified)
118 */
119 String getMimeType();
120
121 /**
122 * Returns the encoding URI of this <code>XMLObject</code>. The encoding
123 * URI identifies the method by which the object is encoded.
124 *
125 * @return the encoding URI (or <code>null</code> if not specified)
126 */
127 String getEncoding();
128}