|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.pay.PayAccountsFile
public class PayAccountsFile
This class encapsulates a collection of accounts. One of the accounts in the collection is always active, except when the collection is empty. GUI classes can register a IPaymentListener with this class to be informed about all payment specific events. The class can be initialized from an XML structure and can also save all internal information in an XML structure before shutdown. For saving the accounts information, the following XML structure is used:
<PayAccountsFile version="1.0"> <MainAccountNumber>123465</MainAccountNumber> <Accounts> <Account version="1.0"> <AccountCertificate>...</AccountCertificate> // Kontozertiufkat von der BI unterschrieben <RSAPrivateKey>...</RSAPrivateKey> //der geheime Schl?ssel zum Zugriff auf das Konto <TransferCertificates> //offenen Transaktionsummern .... </TransferCertifcates> <AccountInfo>...</AccountInfo> //Kontostand (siehe XMLAccountInfo) </Account> . . . </Accounts> </PayAccountsFile>
Nested Class Summary | |
---|---|
static class |
PayAccountsFile.AccountAlreadyExisting
Thrown if an account with same account number was already existing when trying to add it. |
private class |
PayAccountsFile.MyAccountListener
Listens to changes inside the accounts and forwards the events to our paymentListeners |
Field Summary | |
---|---|
private java.util.Vector |
m_Accounts
contains a vector of PayAccount objects, one for each account |
private PayAccount |
m_ActiveAccount
the active account |
private boolean |
m_bEnableBalanceAutoUpdate
|
private boolean |
m_bIgnoreAIAccountErrorMessages
|
private boolean |
m_bIsInitialized
|
private java.util.Vector |
m_knownPIs
|
private PayAccountsFile.MyAccountListener |
m_MyAccountListener
|
private java.util.Vector |
m_paymentListeners
|
private static PayAccountsFile |
ms_AccountsFile
the one and only accountsfile |
private static java.lang.String |
XML_ATTR_ENABLE_BALANCE_AUTO_UPDATE
|
private static java.lang.String |
XML_ATTR_IGNORE_AI_ERRORS
|
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 | |
---|---|
private |
PayAccountsFile()
At this time, the implementation supports only one single BI. |
Method Summary | |
---|---|
void |
addAccount(PayAccount account)
Adds a new account |
void |
addKnownPI(BI a_bi)
Adds a payment instance to the list of known payment instances |
void |
addKnownPI(org.w3c.dom.Element a_elemPI)
Adds a payment instance to the list of known payment instances |
void |
addPaymentListener(IPaymentListener listener)
|
PayAccount |
createAccount(BI a_bi,
IMutableProxyInterface a_proxys,
AsymmetricCryptoKeyPair a_keyPair)
Creates a new Account. |
void |
deleteAccount(long accountNumber)
Deletes the account from the accountsfile and saves the file to disk. |
PayAccount |
getAccount(long accountNumber)
Liefert PayAccount zur angegebenen Kontonummer. |
PayAccount |
getAccountAt(int rowIndex)
getAccountAt |
java.util.Enumeration |
getAccounts()
Returns an enumeration of all accounts |
PayAccount |
getActiveAccount()
|
long |
getActiveAccountNumber()
|
BI |
getBI(java.lang.String a_piID)
|
static PayAccountsFile |
getInstance()
returns the one and only accountsfile. |
java.util.Enumeration |
getKnownPIs()
Gets the list of known Payment Instances |
int |
getNumAccounts()
getNumAccounts |
void |
gotCaptcha(ICaptchaSender a_source,
IImageEncodedCaptcha a_captcha)
This method is called whenever a captcha has been received from the Payment Instance. |
boolean |
hasActiveAccount()
|
static boolean |
init(org.w3c.dom.Element elemAccountsFile,
IMiscPasswordReader a_passwordReader,
boolean a_bForceAIErrors)
Performs the initialization. |
boolean |
isAIAccountErrorIgnored()
Returns if error messages from the AI should be ignored. |
boolean |
isBalanceAutoUpdateEnabled()
Returns if account balances are automatically updated. |
boolean |
isInitialized()
isInitialized |
void |
removePaymentListener(IPaymentListener a_listener)
|
void |
setActiveAccount(long accountNumber)
|
void |
setActiveAccount(PayAccount account)
|
void |
setBalanceAutoUpdateEnabled(boolean a_bEnable)
|
void |
setIgnoreAIAccountError(boolean a_bIgnore)
Defined if error messages from the AI should be ignored. |
void |
signalAccountError(XMLErrorMessage msg)
signalAccountError |
boolean |
signalAccountRequest()
signalAccountRequest |
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
constructs the xml structure |
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc,
java.lang.String a_password)
|
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_IGNORE_AI_ERRORS
private static final java.lang.String XML_ATTR_ENABLE_BALANCE_AUTO_UPDATE
private boolean m_bIsInitialized
private boolean m_bIgnoreAIAccountErrorMessages
private boolean m_bEnableBalanceAutoUpdate
private java.util.Vector m_Accounts
private PayAccount m_ActiveAccount
private static PayAccountsFile ms_AccountsFile
private java.util.Vector m_paymentListeners
private java.util.Vector m_knownPIs
private PayAccountsFile.MyAccountListener m_MyAccountListener
Constructor Detail |
---|
private PayAccountsFile()
Method Detail |
---|
public static PayAccountsFile getInstance()
init(BI, Element)
was not yet called,
you get an empty instance which is not really useful.
public void setIgnoreAIAccountError(boolean a_bIgnore)
a_bIgnore
- booleanpublic boolean isBalanceAutoUpdateEnabled()
public void setBalanceAutoUpdateEnabled(boolean a_bEnable)
public boolean isAIAccountErrorIgnored()
public static boolean init(org.w3c.dom.Element elemAccountsFile, IMiscPasswordReader a_passwordReader, boolean a_bForceAIErrors)
a_passwordReader
- a password reader for encrypted account files; message: AccountNumber
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 boolean hasActiveAccount()
public PayAccount getActiveAccount()
public void setActiveAccount(long accountNumber)
public void setActiveAccount(PayAccount account)
public long getActiveAccountNumber()
public PayAccount getAccount(long accountNumber)
accountNumber
- Kontonummer
PayAccount
oder null, wenn kein Konto unter der angebenen
Kontonummer vorhanden istpublic void deleteAccount(long accountNumber)
accountNumber
- account number
java.lang.Exception
- Wenn ein Fehler bei Dateizugriff auftratpublic java.util.Enumeration getAccounts()
PayAccount
public void addAccount(PayAccount account) throws java.lang.Exception
account
- new account
java.lang.Exception
- If the same account was already addedpublic int getNumAccounts()
public PayAccount getAccountAt(int rowIndex)
rowIndex
- int
public boolean isInitialized()
public void addPaymentListener(IPaymentListener listener)
public void removePaymentListener(IPaymentListener a_listener)
public PayAccount createAccount(BI a_bi, IMutableProxyInterface a_proxys, AsymmetricCryptoKeyPair a_keyPair) throws java.lang.Exception
a_keyPair
- RSA should not be used at the moment
java.lang.Exception
public boolean signalAccountRequest()
public void signalAccountError(XMLErrorMessage msg)
msg
- XMLErrorMessagepublic java.util.Enumeration getKnownPIs()
public void addKnownPI(BI a_bi)
public void addKnownPI(org.w3c.dom.Element a_elemPI)
public BI getBI(java.lang.String a_piID) throws java.lang.Exception
java.lang.Exception
public void gotCaptcha(ICaptchaSender a_source, IImageEncodedCaptcha a_captcha)
gotCaptcha
in interface IBIConnectionListener
a_source
- Objecta_captcha
- IImageEncodedCaptcha
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |