org.apache.axiom.om.util
Class DigestGenerator

java.lang.Object
  extended by org.apache.axiom.om.util.DigestGenerator

public class DigestGenerator
extends java.lang.Object

Helper class to provide the functionality of the digest value generation. This is an implementation of the DOMHASH algorithm on OM.


Field Summary
static java.lang.String md5DigestAlgorithm
          String representing the MD5 digest algorithm
static java.lang.String sha1DigestAlgorithm
          String representing the SHA1 digest algorithm
static java.lang.String shaDigestAlgorithm
          String representing the SHA digest algorithm
 
Constructor Summary
DigestGenerator()
           
 
Method Summary
 boolean compareOMAttribute(OMAttribute attribute, OMAttribute comparingAttribute, java.lang.String digestAlgorithm)
          Compares two OMAttributes for the XML equality
 boolean compareOMDocument(OMDocument document, OMDocument comparingDocument, java.lang.String digestAlgorithm)
          Compares two OMDocuments for the XML equality
 boolean compareOMNode(OMNode node, OMNode comparingNode, java.lang.String digestAlgorithm)
          Compares two OMNodes for the XML equality
 java.util.Collection getAttributesWithoutNS(OMElement element)
          Gets the collection of attributes which are none namespace declarations for an OMElement
 byte[] getDigest(OMAttribute attribute, java.lang.String digestAlgorithm)
          This method is an overloaded method for the digest generation for OMAttribute
 byte[] getDigest(OMDocument document, java.lang.String digestAlgorithm)
          This method is an overloaded method for the digest generation for OMDocument
 byte[] getDigest(OMElement element, java.lang.String digestAlgorithm)
          This method is an overloaded method for the digest generation for OMElement
 byte[] getDigest(OMNode node, java.lang.String digestAlgorithm)
          This method is an overloaded method for the digest generation for OMNode
 byte[] getDigest(OMProcessingInstruction pi, java.lang.String digestAlgorithm)
          This method is an overloaded method for the digest generation for OMProcessingInstruction
 byte[] getDigest(OMText text, java.lang.String digestAlgorithm)
          This method is an overloaded method for the digest generation for OMText
 java.lang.String getExpandedName(OMAttribute attribute)
          This method is an overloaded method for getting the expanded name namespaceURI followed by the local name for OMAttribute
 java.lang.String getExpandedName(OMElement element)
          This method is an overloaded method for getting the expanded name namespaceURI followed by the local name for OMElement
 java.lang.String getStringRepresentation(byte[] array)
          Gets the String representation of the byte array
 java.util.Collection getValidElements(OMDocument document)
          Gets the valid element collection of an OMDocument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

md5DigestAlgorithm

public static final java.lang.String md5DigestAlgorithm
String representing the MD5 digest algorithm

See Also:
Constant Field Values

shaDigestAlgorithm

public static final java.lang.String shaDigestAlgorithm
String representing the SHA digest algorithm

See Also:
Constant Field Values

sha1DigestAlgorithm

public static final java.lang.String sha1DigestAlgorithm
String representing the SHA1 digest algorithm

See Also:
Constant Field Values
Constructor Detail

DigestGenerator

public DigestGenerator()
Method Detail

getDigest

public byte[] getDigest(OMDocument document,
                        java.lang.String digestAlgorithm)
                 throws OMException
This method is an overloaded method for the digest generation for OMDocument

Parameters:
document -
digestAlgorithm -
Returns:
Returns a byte array representing the calculated digest
Throws:
OMException

getDigest

public byte[] getDigest(OMNode node,
                        java.lang.String digestAlgorithm)
This method is an overloaded method for the digest generation for OMNode

Parameters:
node -
digestAlgorithm -
Returns:
Returns a byte array representing the calculated digest value

getDigest

public byte[] getDigest(OMElement element,
                        java.lang.String digestAlgorithm)
                 throws OMException
This method is an overloaded method for the digest generation for OMElement

Parameters:
element -
digestAlgorithm -
Returns:
Returns a byte array representing the calculated digest value
Throws:
OMException

getDigest

public byte[] getDigest(OMProcessingInstruction pi,
                        java.lang.String digestAlgorithm)
                 throws OMException
This method is an overloaded method for the digest generation for OMProcessingInstruction

Parameters:
pi -
digestAlgorithm -
Returns:
Returns a byte array representing the calculated digest value
Throws:
OMException

getDigest

public byte[] getDigest(OMAttribute attribute,
                        java.lang.String digestAlgorithm)
                 throws OMException
This method is an overloaded method for the digest generation for OMAttribute

Parameters:
attribute -
digestAlgorithm -
Returns:
Returns a byte array representing the calculated digest value
Throws:
OMException

getDigest

public byte[] getDigest(OMText text,
                        java.lang.String digestAlgorithm)
                 throws OMException
This method is an overloaded method for the digest generation for OMText

Parameters:
text -
digestAlgorithm -
Returns:
Returns a byte array representing the calculated digest value
Throws:
OMException

getExpandedName

public java.lang.String getExpandedName(OMElement element)
This method is an overloaded method for getting the expanded name namespaceURI followed by the local name for OMElement

Parameters:
element -
Returns:
Returns the expanded name of OMElement

getExpandedName

public java.lang.String getExpandedName(OMAttribute attribute)
This method is an overloaded method for getting the expanded name namespaceURI followed by the local name for OMAttribute

Parameters:
attribute -
Returns:
Returns the expanded name of the OMAttribute

getAttributesWithoutNS

public java.util.Collection getAttributesWithoutNS(OMElement element)
Gets the collection of attributes which are none namespace declarations for an OMElement

Parameters:
element -
Returns:
Returns the collection of attributes which are none namespace declarations

getValidElements

public java.util.Collection getValidElements(OMDocument document)
Gets the valid element collection of an OMDocument. OMElement and OMProcessingInstruction only

Parameters:
document -
Returns:
Returns a collection of OMProcessingInstructions and OMElements

getStringRepresentation

public java.lang.String getStringRepresentation(byte[] array)
Gets the String representation of the byte array

Parameters:
array -
Returns:
Returns the String of the byte

compareOMNode

public boolean compareOMNode(OMNode node,
                             OMNode comparingNode,
                             java.lang.String digestAlgorithm)
Compares two OMNodes for the XML equality

Parameters:
node -
comparingNode -
digestAlgorithm -
Returns:
Returns true if the OMNode XML contents are equal

compareOMDocument

public boolean compareOMDocument(OMDocument document,
                                 OMDocument comparingDocument,
                                 java.lang.String digestAlgorithm)
Compares two OMDocuments for the XML equality

Parameters:
document -
comparingDocument -
digestAlgorithm -
Returns:
Returns true if the OMDocument XML content are equal

compareOMAttribute

public boolean compareOMAttribute(OMAttribute attribute,
                                  OMAttribute comparingAttribute,
                                  java.lang.String digestAlgorithm)
Compares two OMAttributes for the XML equality

Parameters:
attribute -
comparingAttribute -
digestAlgorithm -
Returns:
Returns true if the OMDocument XML content are equal