gov.grants.apply.util
Class GrantApplicationHash

java.lang.Object
  extended bygov.grants.apply.util.GrantApplicationHash

public class GrantApplicationHash
extends java.lang.Object

This is a convenience object that simplifies the hashing processing to one method call.

Author:
David Wong

Field Summary
(package private) static org.apache.log4j.Logger log
           
(package private) static java.security.MessageDigest messageDigester
           
 
Method Summary
static java.lang.String computeAttachmentHash(byte[] attachment)
          Computes the hash of an binary attachment.
static java.lang.String computeGrantFormsHash(org.w3c.dom.Document xml)
          Computes the hash value for the Grants.gov application XML.
static java.lang.String computeGrantFormsHash(GrantApplicationXpath xpath)
          Computes the hash value for the Grants.gov application XML.
static java.lang.String computeGrantFormsHash(java.lang.String xml)
          Computes the hash value for the Grants.gov application XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static final org.apache.log4j.Logger log

messageDigester

static java.security.MessageDigest messageDigester
Method Detail

computeGrantFormsHash

public static final java.lang.String computeGrantFormsHash(java.lang.String xml)
                                                    throws java.lang.Exception
Computes the hash value for the Grants.gov application XML.

Parameters:
xml - The Grants.gov application XML.
Returns:
The SHA-1 hash value of <grant:forms> tag inside the application XML.
Throws:
java.lang.Exception - When the XML cannot be parsed.

computeAttachmentHash

public static final java.lang.String computeAttachmentHash(byte[] attachment)
                                                    throws java.lang.Exception
Computes the hash of an binary attachment.

Parameters:
attachment -
Returns:
The SHA-1 hash value of the attachment byte array.
Throws:
java.lang.Exception

computeGrantFormsHash

public static final java.lang.String computeGrantFormsHash(GrantApplicationXpath xpath)
                                                    throws java.lang.Exception
Computes the hash value for the Grants.gov application XML.

Parameters:
xpath - An xpath object holding the Grants.gov application XML.
Returns:
The SHA-1 hash value of <grant:forms> tag inside the application XML.
Throws:
java.lang.Exception - When the XML cannot be parsed.

computeGrantFormsHash

public static final java.lang.String computeGrantFormsHash(org.w3c.dom.Document xml)
                                                    throws java.lang.Exception
Computes the hash value for the Grants.gov application XML.

Parameters:
xml - The Grants.gov application XML.
Returns:
The SHA-1 hash value of <grant:forms> tag inside the application XML.
Throws:
java.lang.Exception - When the XML cannot be parsed.