|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.pay.PayAccount
public class PayAccount
This class encapsulates one account and all additional data associated to one
account. This includes the key pair, the account number, the transfer certificates
for charging the account, cost confirmations and a balance certificate.
For storing the account data in a file the toXmlElement()
method is provided. It is recommended to encrypt the output of this method
before storing it to disk, because it includes the secret private key.
The XML structure is as follows:
Field Summary | |
---|---|
private XMLAccountCertificate |
m_accountCertificate
contains the account certificate |
private XMLAccountInfo |
m_accountInfo
contains the current account info (balance and cost confirmations) |
private java.util.Vector |
m_accountListeners
|
private boolean |
m_bBackupDone
|
private long |
m_currentBytes
the number of bytes which have been used bot not confirmed yet |
private org.w3c.dom.Document |
m_encryptedPrivateKey
|
private long |
m_mySpent
internal value for spent bytes. |
private IMyPrivateKey |
m_privateKey
contains the private key associated with this account |
private java.lang.String |
m_strBiID
|
private BI |
m_theBI
|
private java.util.Vector |
m_transCerts
contains zero or more xml transfer certificates as XMLTransCert |
private static java.lang.String |
VERSION
|
private static java.lang.String |
XML_ATTR_ACTIVE
|
private static java.lang.String |
XML_BACKUP_DONE
|
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_VERSION |
Constructor Summary | |
---|---|
PayAccount(org.w3c.dom.Element elemRoot,
IMiscPasswordReader a_passwordReader)
|
|
PayAccount(XMLAccountCertificate certificate,
IMyPrivateKey privateKey,
BI theBI)
Creates a PayAccount Objekt from the account certificate and the
private key. |
Method Summary | |
---|---|
void |
addAccountListener(IAccountListener listener)
|
void |
addCostConfirmation(XMLEasyCC cc)
addCostConfirmation |
void |
addTransCert(XMLTransCert cert)
|
XMLTransCert |
charge(IMutableProxyInterface a_proxys)
Request a transfer certificate from the BI |
private void |
deactivate(org.w3c.dom.Element elemKey)
|
void |
decryptPrivateKey(IMiscPasswordReader a_passwordReader)
|
private void |
decryptPrivateKey(org.w3c.dom.Node a_elemRoot,
IMiscPasswordReader a_passwordReader,
boolean a_bDeactivated)
|
XMLAccountInfo |
fetchAccountInfo(IMutableProxyInterface a_proxys,
boolean a_bForce)
Requests an AccountInfo XML structure from the BI. |
private void |
fireChangeEvent()
|
XMLAccountCertificate |
getAccountCertificate()
|
XMLAccountInfo |
getAccountInfo()
|
long |
getAccountNumber()
Returns the account's accountnumber |
XMLBalance |
getBalance()
getBalance |
java.sql.Timestamp |
getBalanceValidTime()
liefert zurueck, wann das Guthaben ungueltig wird (bei flatrate modellen) |
BI |
getBI()
|
long |
getCertifiedCredit()
Returns the current credit (i. |
java.sql.Timestamp |
getCreationTime()
Liefert das Erstellungsdatum des Kontos. |
long |
getCurrentCredit()
Returns the current credit (i. |
long |
getDeposit()
Returns the initial amount of the account (i. |
IMyPrivateKey |
getPrivateKey()
Returns the private key or null if the account is encrypted and not usable. |
IMyPublicKey |
getPublicKey()
|
long |
getSpent()
Returns the amount already spent. |
java.util.Vector |
getTransCerts()
Returns a vector with all transfer certificates |
boolean |
hasAccountInfo()
Returns true when an accountInfo object exists. |
boolean |
isBackupDone()
|
void |
setAccountInfo(XMLAccountInfo info)
This is not just a setter method. |
void |
setBackupDone(boolean a_bDone)
|
private void |
setValues(org.w3c.dom.Element elemRoot,
IMiscPasswordReader a_passwordReader)
|
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
Returns the xml representation of the account |
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc,
java.lang.String a_password)
|
long |
updateCurrentBytes(PacketCounter a_packetCounter)
Asks the PacketCounter for the current number of transferred bytes and updates the internal value. |
void |
updated()
Marks the account as updated so a ChangeEvent gets fired |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String XML_ELEMENT_NAME
private static final java.lang.String XML_ATTR_ACTIVE
private static final java.lang.String XML_BACKUP_DONE
private static final java.lang.String VERSION
private java.util.Vector m_transCerts
private XMLAccountCertificate m_accountCertificate
private XMLAccountInfo m_accountInfo
private IMyPrivateKey m_privateKey
private org.w3c.dom.Document m_encryptedPrivateKey
private long m_currentBytes
private java.util.Vector m_accountListeners
private boolean m_bBackupDone
private long m_mySpent
XMLBalance
, but the value in XMLBalance is calculated
by the BI while this here is calculated by the Jap. So the value here might
be more up to date in case the XMLBalance certificate is old.
private BI m_theBI
private java.lang.String m_strBiID
Constructor Detail |
---|
public PayAccount(org.w3c.dom.Element elemRoot, IMiscPasswordReader a_passwordReader) throws java.lang.Exception
java.lang.Exception
public PayAccount(XMLAccountCertificate certificate, IMyPrivateKey privateKey, BI theBI) throws java.lang.Exception
PayAccount
Objekt from the account certificate and the
private key.
certificate
- account certificate issued by the BIprivateKey
- the private key
java.lang.Exception
Method Detail |
---|
private void setValues(org.w3c.dom.Element elemRoot, IMiscPasswordReader a_passwordReader) throws java.lang.Exception
elemRoot
- Elementa_passwordReader
- a password reader; this method adds the account number as message object
java.lang.Exception
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
a_doc
- a document
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc, java.lang.String a_password)
public void addTransCert(XMLTransCert cert) throws java.lang.Exception
java.lang.Exception
public void setAccountInfo(XMLAccountInfo info) throws java.lang.Exception
info
- XMLAccountInfo
java.lang.Exception
public long getAccountNumber()
public boolean isBackupDone()
public void setBackupDone(boolean a_bDone)
public boolean hasAccountInfo()
public XMLAccountCertificate getAccountCertificate()
public java.sql.Timestamp getCreationTime()
public java.sql.Timestamp getBalanceValidTime()
public IMyPrivateKey getPrivateKey()
public IMyPublicKey getPublicKey()
public long getSpent()
public long getDeposit()
public long getCertifiedCredit()
Pay.fetchAccountInfo(long)
first.
public long getCurrentCredit()
updateCurrentBytes()
first.
public XMLAccountInfo getAccountInfo()
public java.util.Vector getTransCerts()
XMLTransCert
public long updateCurrentBytes(PacketCounter a_packetCounter) throws java.lang.Exception
java.lang.Exception
public void addCostConfirmation(XMLEasyCC cc) throws java.lang.Exception
java.lang.Exception
public void addAccountListener(IAccountListener listener)
private void fireChangeEvent()
public XMLBalance getBalance()
public XMLAccountInfo fetchAccountInfo(IMutableProxyInterface a_proxys, boolean a_bForce) throws java.lang.SecurityException, java.lang.Exception
a_bForce
- if the update is forced; if not, it might be prevented by
PayAccountsFile.isBalanceAutoUpdateEnabled()
java.lang.Exception
java.lang.SecurityException
- if the account is encrypted an not usablepublic XMLTransCert charge(IMutableProxyInterface a_proxys) throws java.lang.SecurityException, java.lang.Exception
accountNumber
- account number
java.lang.Exception
java.lang.SecurityException
- if the account is encrypted an not usablepublic void updated()
public BI getBI()
public void decryptPrivateKey(IMiscPasswordReader a_passwordReader) throws java.lang.Exception
java.lang.Exception
private void decryptPrivateKey(org.w3c.dom.Node a_elemRoot, IMiscPasswordReader a_passwordReader, boolean a_bDeactivated) throws java.lang.Exception
java.lang.Exception
private void deactivate(org.w3c.dom.Element elemKey) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |