anon.pay.xml
Class XMLAccountInfo

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

public class XMLAccountInfo
extends java.lang.Object
implements IXMLEncodable

This class represents an XML AccountInfo structure (XMLBalance plus cost confirmations for the account) The following XML structure is used:

 <AccountInfo>
    <Balance>
       <AccountNumber> ..</AccountNumber>
       <Deposit>...</Deposit>
       <Spent>....</Spent>
       <Validtime>...</Validtime>
       <Timestamp>...</Timestamp>
       <Signature> //Unterschrift der BI
          ...
       </Signature>
    </Balance>
    <CostConfirmations> //Kostenbest?tigungen, die
                                           von den einzelnen AI's
                                           abgerechnet wurden
       <CC>...</CC>
       <CC>...</CC>
    </CostConfirmations>
 </AccountInfo>
 

Author:
Bastian Voigt

Field Summary
private  XMLBalance m_balance
          the balance certificate
private  java.util.Hashtable m_costConfirmations
          a collection of costconfirmations (one for each mixcascade that was used with this account)
static java.lang.String XML_ELEMENT_NAME_COST_CONFIRMATIONS
           
 
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
XMLAccountInfo()
           
XMLAccountInfo(org.w3c.dom.Document document)
          XMLAccountInfo
XMLAccountInfo(org.w3c.dom.Element xml)
          Creates a Balance from an existing XML docuemnt
XMLAccountInfo(java.lang.String xml)
          Creates an AccountInfo object from a string.
XMLAccountInfo(XMLBalance bal)
           
 
Method Summary
 long addCC(XMLEasyCC a_cc)
          Adds a cost confirmation xml structure to the accountinfo.
 long getAllCCsTransferredBytes()
          returns the overall sum of all the transfered bytes of all CCs belonging to this account.
 XMLBalance getBalance()
           
 XMLEasyCC getCC(java.lang.String priceCertHash)
          getCC - returns the cost confirmation with the specified aiName
 java.util.Enumeration getCCs()
          Returns an enumeration of all the available cost confirmations for this account.
 void setBalance(XMLBalance b1)
          setBalance
private  void setValues(org.w3c.dom.Element elemRoot)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_ELEMENT_NAME_COST_CONFIRMATIONS

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

m_balance

private XMLBalance m_balance
the balance certificate


m_costConfirmations

private java.util.Hashtable m_costConfirmations
a collection of costconfirmations (one for each mixcascade that was used with this account)

Constructor Detail

XMLAccountInfo

public XMLAccountInfo(XMLBalance bal)

XMLAccountInfo

public XMLAccountInfo(java.lang.String xml)
               throws java.lang.Exception
Creates an AccountInfo object from a string.

Throws:
java.lang.Exception

XMLAccountInfo

public XMLAccountInfo()

XMLAccountInfo

public XMLAccountInfo(org.w3c.dom.Element xml)
               throws java.lang.Exception
Creates a Balance from an existing XML docuemnt

Parameters:
xml - the node that represents the Balance
verifier - JAPSignature must be initialized and ready to verify XML (or null)
Throws:
java.lang.Exception - on invalid xml format or invalid signature

XMLAccountInfo

public XMLAccountInfo(org.w3c.dom.Document document)
               throws java.lang.Exception
XMLAccountInfo

Parameters:
document - Document
Throws:
java.lang.Exception
Method Detail

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

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

addCC

public long addCC(XMLEasyCC a_cc)
           throws java.lang.Exception
Adds a cost confirmation xml structure to the accountinfo. Note: If a cost confirmation for the same AI is already present it will be overwritten. Only adds the CC if it has the same amount or more bytes than the previous one.

Parameters:
xmlCC - XMLEasyCC
Returns:
the difference in the number of bytes between the old and the new costconfirmation for the same AI
Throws:
java.lang.Exception

setValues

private void setValues(org.w3c.dom.Element elemRoot)
                throws java.lang.Exception
Throws:
java.lang.Exception

getBalance

public XMLBalance getBalance()

getCC

public XMLEasyCC getCC(java.lang.String priceCertHash)
getCC - returns the cost confirmation with the specified aiName

Parameters:
string - String
Returns:
XMLEasyCC

getCCs

public java.util.Enumeration getCCs()
Returns an enumeration of all the available cost confirmations for this account.

Returns:
Enumeration

getAllCCsTransferredBytes

public long getAllCCsTransferredBytes()
returns the overall sum of all the transfered bytes of all CCs belonging to this account.

Returns:

setBalance

public void setBalance(XMLBalance b1)
setBalance

Parameters:
b1 - XMLBalance