Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
41161 views
/*1* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26* ===========================================================================27*28* (C) Copyright IBM Corp. 2003 All Rights Reserved.29*30* ===========================================================================31*/32/*33* $Id: XMLObject.java,v 1.5 2005/05/10 16:03:48 mullan Exp $34*/35package javax.xml.crypto.dsig;3637import java.util.List;38import javax.xml.crypto.XMLStructure;3940/**41* A representation of the XML <code>Object</code> element as defined in42* the <a href="http://www.w3.org/TR/xmldsig-core/">43* W3C Recommendation for XML-Signature Syntax and Processing</a>.44* An <code>XMLObject</code> may contain any data and may include optional45* MIME type, ID, and encoding attributes. The XML Schema Definition is46* defined as:47*48* <pre><code>49* <element name="Object" type="ds:ObjectType"/>50* <complexType name="ObjectType" mixed="true">51* <sequence minOccurs="0" maxOccurs="unbounded">52* <any namespace="##any" processContents="lax"/>53* </sequence>54* <attribute name="Id" type="ID" use="optional"/>55* <attribute name="MimeType" type="string" use="optional"/>56* <attribute name="Encoding" type="anyURI" use="optional"/>57* </complexType>58* </code></pre>59*60* A <code>XMLObject</code> instance may be created by invoking the61* {@link XMLSignatureFactory#newXMLObject newXMLObject} method of the62* {@link XMLSignatureFactory} class; for example:63*64* <pre>65* XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");66* Manifest manifest = fac.newManifest(references);67* List<XMLStructure> content = Collections.singletonList(manifest);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 than72* <code>Object</code> to avoid naming clashes with the existing73* {@link java.lang.Object java.lang.Object} class.74*75* @author Sean Mullan76* @author JSR 105 Expert Group77* @author Joyce L. Leung78* @since 1.679* @see XMLSignatureFactory#newXMLObject(List, String, String, String)80*/81public interface XMLObject extends XMLStructure {8283/**84* URI that identifies the <code>Object</code> element (this can be85* specified as the value of the <code>type</code> parameter of the86* {@link Reference} class to identify the referent's type).87*/88static final String TYPE = "http://www.w3.org/2000/09/xmldsig#Object";8990/**91* Returns an {@link java.util.Collections#unmodifiableList unmodifiable92* 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 of96* <code>XMLStructure</code>, it is returned as an instance of that class97* (ex: a <code>SignatureProperties</code> element would be returned98* as an instance of {@link javax.xml.crypto.dsig.SignatureProperties}).99*100* @return an unmodifiable list of <code>XMLStructure</code>s (may be empty101* but never <code>null</code>)102*/103List<XMLStructure> getContent();104105/**106* Returns the Id of this <code>XMLObject</code>.107*108* @return the Id (or <code>null</code> if not specified)109*/110String getId();111112/**113* Returns the mime type of this <code>XMLObject</code>. The114* mime type is an optional attribute which describes the data within this115* <code>XMLObject</code> (independent of its encoding).116*117* @return the mime type (or <code>null</code> if not specified)118*/119String getMimeType();120121/**122* Returns the encoding URI of this <code>XMLObject</code>. The encoding123* URI identifies the method by which the object is encoded.124*125* @return the encoding URI (or <code>null</code> if not specified)126*/127String getEncoding();128}129130131