org.apache.jcp.xml.dsig.internal.dom
Class DOMRetrievalMethod

java.lang.Object
  extended by org.apache.jcp.xml.dsig.internal.dom.BaseStructure
      extended by org.apache.jcp.xml.dsig.internal.dom.DOMStructure
          extended by org.apache.jcp.xml.dsig.internal.dom.DOMRetrievalMethod
All Implemented Interfaces:
DOMURIReference, RetrievalMethod, URIReference, XMLStructure

public final class DOMRetrievalMethod
extends DOMStructure
implements RetrievalMethod, DOMURIReference

DOM-based implementation of RetrievalMethod.

Author:
Sean Mullan, Joyce Leung

Constructor Summary
DOMRetrievalMethod(Element rmElem, XMLCryptoContext context, Provider provider)
          Creates a DOMRetrievalMethod from an element.
DOMRetrievalMethod(String uri, String type, List<? extends Transform> transforms)
          Creates a DOMRetrievalMethod containing the specified URIReference and List of Transforms.
 
Method Summary
 Data dereference(XMLCryptoContext context)
          Dereferences the KeyInfo information referenced by this RetrievalMethod and applies the specified Transforms.
 XMLStructure dereferenceAsXMLStructure(XMLCryptoContext context)
           
 boolean equals(Object obj)
           
 Node getHere()
          Returns the here node.
 List<Transform> getTransforms()
          Returns an unmodifiable list of Transforms of this RetrievalMethod.
 String getType()
          Returns the type of data referenced by this URI.
 String getURI()
          Returns the URI of the referenced KeyInfo information.
 int hashCode()
           
 void marshal(XmlWriter xwriter, String dsPrefix, XMLCryptoContext context)
           
 
Methods inherited from class org.apache.jcp.xml.dsig.internal.dom.BaseStructure
isFeatureSupported, textOfNode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
 

Constructor Detail

DOMRetrievalMethod

public DOMRetrievalMethod(String uri,
                          String type,
                          List<? extends Transform> transforms)
Creates a DOMRetrievalMethod containing the specified URIReference and List of Transforms.

Parameters:
uri - the URI
type - the type
transforms - a list of Transforms. The list is defensively copied to prevent subsequent modification. May be null or empty.
Throws:
IllegalArgumentException - if the format of uri is invalid, as specified by Reference's URI attribute in the W3C specification for XML-Signature Syntax and Processing
NullPointerException - if uriReference is null
ClassCastException - if transforms contains any entries that are not of type Transform

DOMRetrievalMethod

public DOMRetrievalMethod(Element rmElem,
                          XMLCryptoContext context,
                          Provider provider)
                   throws MarshalException
Creates a DOMRetrievalMethod from an element.

Parameters:
rmElem - a RetrievalMethod element
Throws:
MarshalException
Method Detail

getURI

public String getURI()
Description copied from interface: RetrievalMethod
Returns the URI of the referenced KeyInfo information.

Specified by:
getURI in interface RetrievalMethod
Specified by:
getURI in interface URIReference
Returns:
the URI of the referenced KeyInfo information in RFC 2396 format (never null)

getType

public String getType()
Description copied from interface: URIReference
Returns the type of data referenced by this URI.

Specified by:
getType in interface URIReference
Returns:
the type (a URI) of the data object (may be null if not specified)

getTransforms

public List<Transform> getTransforms()
Description copied from interface: RetrievalMethod
Returns an unmodifiable list of Transforms of this RetrievalMethod.

Specified by:
getTransforms in interface RetrievalMethod
Returns:
an unmodifiable list of Transform objects (may be empty but never null).

marshal

public void marshal(XmlWriter xwriter,
                    String dsPrefix,
                    XMLCryptoContext context)
             throws MarshalException
Specified by:
marshal in class DOMStructure
Throws:
MarshalException

getHere

public Node getHere()
Description copied from interface: DOMURIReference
Returns the here node.

Specified by:
getHere in interface DOMURIReference
Returns:
the attribute or processing instruction node or the parent element of the text node that directly contains the URI

dereference

public Data dereference(XMLCryptoContext context)
                 throws URIReferenceException
Description copied from interface: RetrievalMethod
Dereferences the KeyInfo information referenced by this RetrievalMethod and applies the specified Transforms.

Specified by:
dereference in interface RetrievalMethod
Parameters:
context - an XMLCryptoContext that may contain additional useful information for dereferencing the URI. The context's baseURI and dereferencer parameters (if specified) are used to resolve and dereference this RetrievalMethod
Returns:
a Data object representing the raw contents of the KeyInfo information referenced by this RetrievalMethod. It is the caller's responsibility to convert the returned data to an appropriate KeyInfo object.
Throws:
URIReferenceException - if there is an error while dereferencing

dereferenceAsXMLStructure

public XMLStructure dereferenceAsXMLStructure(XMLCryptoContext context)
                                       throws URIReferenceException
Throws:
URIReferenceException

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2000–2013 The Apache Software Foundation. All rights reserved.