anon.pay.xml
Class XMLPriceCertificate

java.lang.Object
  extended by anon.pay.xml.XMLPriceCertificate
All Implemented Interfaces:
IXMLEncodable

public class XMLPriceCertificate
extends java.lang.Object
implements IXMLEncodable

Contains the functionality for creating and parsing XML Price Certificates can be constructed from an xml Document in String, byte[] or Element representation

Version:
1.0
Author:
Elmar Schraml

Field Summary
private  java.lang.String m_biID
           
private  org.w3c.dom.Document m_docThePriceCert
           
private  java.lang.String m_hashValue
           
private  double m_rate
           
private  java.sql.Timestamp m_signatureTime
           
private  java.lang.String m_subjectKeyIdentifier
           
private static java.lang.String XML_ELEM_BIID
           
private static java.lang.String XML_ELEM_RATE
           
private static java.lang.String XML_ELEM_SIG_TIME
           
private static java.lang.String XML_ELEM_SUBJECT_KEY_IDENTIFIER
           
static java.lang.String XML_ELEMENT_NAME
           
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
XMLPriceCertificate(byte[] xmldata)
           
XMLPriceCertificate(char[] xmldata)
           
XMLPriceCertificate(org.w3c.dom.Document xml)
           
XMLPriceCertificate(org.w3c.dom.Element xml)
           
XMLPriceCertificate(java.lang.String xml)
           
XMLPriceCertificate(java.lang.String subjectKeyIdentifier, double rate, java.lang.String biID)
          XMLPriceCertificate: new price cert that has not been signed yet, and therefore has no signature-node and signatureTime
XMLPriceCertificate(java.lang.String subjectKeyIdentifier, double rate, java.sql.Timestamp signatureTime, java.lang.String biID)
           
XMLPriceCertificate(java.lang.String subjectKeyIdentifier, double rate, java.sql.Timestamp signatureTime, java.lang.String biID, java.lang.String signatureXml)
           
 
Method Summary
 void addSignature(java.lang.String signatureXml)
           
private  void addSignatureNode(org.w3c.dom.Document a_doc, java.lang.String signatureXml)
           
private static java.lang.String formatEuroCentValue(double centvalue)
           
 java.lang.String getBiID()
           
 org.w3c.dom.Document getDocument()
           
 java.lang.String getHashValue()
           
 double getRate()
           
 java.sql.Timestamp getSignatureTime()
           
 java.lang.String getSubjectKeyIdentifier()
           
private  org.w3c.dom.Node internal_toXmlElement(org.w3c.dom.Document a_doc)
          internal_toXmlElement
private  void setValues(org.w3c.dom.Element xml)
          Parses the XML representation and sets the internal values
 boolean sign(IMyPrivateKey key)
           
 java.lang.String toString()
          toString: responsible for the representation of a price cert in a GUI component
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 boolean verify(PaymentInstanceDBEntry a_bi)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_ELEMENT_NAME

public static final java.lang.String XML_ELEMENT_NAME
See Also:
Constant Field Values

m_subjectKeyIdentifier

private java.lang.String m_subjectKeyIdentifier

m_rate

private double m_rate

m_signatureTime

private java.sql.Timestamp m_signatureTime

m_biID

private java.lang.String m_biID

m_hashValue

private java.lang.String m_hashValue

m_docThePriceCert

private org.w3c.dom.Document m_docThePriceCert

XML_ELEM_SUBJECT_KEY_IDENTIFIER

private static final java.lang.String XML_ELEM_SUBJECT_KEY_IDENTIFIER
See Also:
Constant Field Values

XML_ELEM_RATE

private static final java.lang.String XML_ELEM_RATE
See Also:
Constant Field Values

XML_ELEM_SIG_TIME

private static final java.lang.String XML_ELEM_SIG_TIME
See Also:
Constant Field Values

XML_ELEM_BIID

private static final java.lang.String XML_ELEM_BIID
See Also:
Constant Field Values
Constructor Detail

XMLPriceCertificate

public XMLPriceCertificate(java.lang.String subjectKeyIdentifier,
                           double rate,
                           java.sql.Timestamp signatureTime,
                           java.lang.String biID)
Parameters:
rate - int
creationTime - Timestamp
biID - String

XMLPriceCertificate

public XMLPriceCertificate(java.lang.String subjectKeyIdentifier,
                           double rate,
                           java.lang.String biID)
XMLPriceCertificate: new price cert that has not been signed yet, and therefore has no signature-node and signatureTime

Parameters:
subjectKeyIdentifier - String
rate - double
biID - String

XMLPriceCertificate

public XMLPriceCertificate(java.lang.String subjectKeyIdentifier,
                           double rate,
                           java.sql.Timestamp signatureTime,
                           java.lang.String biID,
                           java.lang.String signatureXml)

XMLPriceCertificate

public XMLPriceCertificate(java.lang.String xml)
                    throws java.lang.Exception
Throws:
java.lang.Exception

XMLPriceCertificate

public XMLPriceCertificate(char[] xmldata)
                    throws java.lang.Exception
Throws:
java.lang.Exception

XMLPriceCertificate

public XMLPriceCertificate(byte[] xmldata)
                    throws java.lang.Exception
Throws:
java.lang.Exception

XMLPriceCertificate

public XMLPriceCertificate(org.w3c.dom.Element xml)
                    throws XMLParseException
Throws:
XMLParseException

XMLPriceCertificate

public XMLPriceCertificate(org.w3c.dom.Document xml)
                    throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

addSignature

public void addSignature(java.lang.String signatureXml)

addSignatureNode

private void addSignatureNode(org.w3c.dom.Document a_doc,
                              java.lang.String signatureXml)

internal_toXmlElement

private org.w3c.dom.Node internal_toXmlElement(org.w3c.dom.Document a_doc)
internal_toXmlElement

Parameters:
m_docThePriceCert - Document
Returns:
Node

sign

public boolean sign(IMyPrivateKey key)

verify

public boolean verify(PaymentInstanceDBEntry a_bi)

setValues

private void setValues(org.w3c.dom.Element xml)
                throws XMLParseException
Parses the XML representation and sets the internal values

Parameters:
xml - Node
Throws:
java.lang.Exception
XMLParseException

getSignatureTime

public java.sql.Timestamp getSignatureTime()

getRate

public double getRate()

getSubjectKeyIdentifier

public java.lang.String getSubjectKeyIdentifier()

getBiID

public java.lang.String getBiID()

getHashValue

public java.lang.String getHashValue()

getDocument

public org.w3c.dom.Document getDocument()

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Return an element that can be appended to the document.

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element

toString

public java.lang.String toString()
toString: responsible for the representation of a price cert in a GUI component

Overrides:
toString in class java.lang.Object
Returns:
String:Formatted as: Price: XX.XX Eurocent, [signed: dd.mm.yyyy | not signed]

formatEuroCentValue

private static java.lang.String formatEuroCentValue(double centvalue)