KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > dsig > XMLObject


1 /*
2  * Portions copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  */

4 /*
5  * ===========================================================================
6  *
7  * (C) Copyright IBM Corp. 2003 All Rights Reserved.
8  *
9  * ===========================================================================
10  */

11 /*
12  * $Id: XMLObject.java,v 1.5 2005/05/10 16:03:48 mullan Exp $
13  */

14 package javax.xml.crypto.dsig;
15
16 import java.util.List JavaDoc;
17 import javax.xml.crypto.XMLStructure;
18
19 /**
20  * A representation of the XML <code>Object</code> element as defined in
21  * the <a HREF="http://www.w3.org/TR/xmldsig-core/">
22  * W3C Recommendation for XML-Signature Syntax and Processing</a>.
23  * An <code>XMLObject</code> may contain any data and may include optional
24  * MIME type, ID, and encoding attributes. The XML Schema Definition is
25  * defined as:
26  *
27  * <pre><code>
28  * &lt;element name="Object" type="ds:ObjectType"/&gt;
29  * &lt;complexType name="ObjectType" mixed="true"&gt;
30  * &lt;sequence minOccurs="0" maxOccurs="unbounded"&gt;
31  * &lt;any namespace="##any" processContents="lax"/&gt;
32  * &lt;/sequence&gt;
33  * &lt;attribute name="Id" type="ID" use="optional"/&gt;
34  * &lt;attribute name="MimeType" type="string" use="optional"/&gt;
35  * &lt;attribute name="Encoding" type="anyURI" use="optional"/&gt;
36  * &lt;/complexType&gt;
37  * </code></pre>
38  *
39  * A <code>XMLObject</code> instance may be created by invoking the
40  * {@link XMLSignatureFactory#newXMLObject newXMLObject} method of the
41  * {@link XMLSignatureFactory} class; for example:
42  *
43  * <pre>
44  * XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
45  * List content = Collections.singletonList(fac.newManifest(references)));
46  * XMLObject object = factory.newXMLObject(content, "object-1", null, null);
47  * </pre>
48  *
49  * <p>Note that this class is named <code>XMLObject</code> rather than
50  * <code>Object</code> to avoid naming clashes with the existing
51  * {@link java.lang.Object java.lang.Object} class.
52  *
53  * @author Sean Mullan
54  * @author JSR 105 Expert Group
55  * @author Joyce L. Leung
56  * @since 1.6
57  * @see XMLSignatureFactory#newXMLObject(List, String, String, String)
58  */

59 public interface XMLObject extends XMLStructure {
60
61     /**
62      * URI that identifies the <code>Object</code> element (this can be
63      * specified as the value of the <code>type</code> parameter of the
64      * {@link Reference} class to identify the referent's type).
65      */

66     final static String JavaDoc TYPE = "http://www.w3.org/2000/09/xmldsig#Object";
67
68     /**
69      * Returns an {@link java.util.Collections#unmodifiableList unmodifiable
70      * list} of {@link XMLStructure}s contained in this <code>XMLObject</code>,
71      * which represent elements from any namespace.
72      *
73      *<p>If there is a public subclass representing the type of
74      * <code>XMLStructure</code>, it is returned as an instance of that class
75      * (ex: a <code>SignatureProperties</code> element would be returned
76      * as an instance of {@link javax.xml.crypto.dsig.SignatureProperties}).
77      *
78      * @return an unmodifiable list of <code>XMLStructure</code>s (may be empty
79      * but never <code>null</code>)
80      */

81     List JavaDoc getContent();
82
83     /**
84      * Returns the Id of this <code>XMLObject</code>.
85      *
86      * @return the Id (or <code>null</code> if not specified)
87      */

88     String JavaDoc getId();
89     
90     /**
91      * Returns the mime type of this <code>XMLObject</code>. The
92      * mime type is an optional attribute which describes the data within this
93      * <code>XMLObject</code> (independent of its encoding).
94      *
95      * @return the mime type (or <code>null</code> if not specified)
96      */

97     String JavaDoc getMimeType();
98     
99     /**
100      * Returns the encoding URI of this <code>XMLObject</code>. The encoding
101      * URI identifies the method by which the object is encoded.
102      *
103      * @return the encoding URI (or <code>null</code> if not specified)
104      */

105     String JavaDoc getEncoding();
106 }
107
Popular Tags