|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable 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.AccountAlreadyExistingException
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 | |
---|---|
static java.lang.Integer |
CHANGED_AUTO_UPDATE
|
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 static boolean |
m_bIsInitialized
|
private DSAKeyPool |
m_keyPool
|
private java.util.Vector |
m_messageListeners
|
private PayAccountsFile.MyAccountListener |
m_MyAccountListener
|
private java.util.Vector |
m_paymentListeners
|
private static PayAccountsFile |
ms_AccountsFile
the one and only accountsfile |
private static int |
ms_keyPoolSize
|
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_LANGUAGE, XML_ATTR_VERSION |
Constructor Summary | |
---|---|
private |
PayAccountsFile()
At this time, the implementation supports only one single BI. |
Method Summary | |
---|---|
void |
addAccount(PayAccount newAccount)
Adds a new account |
void |
addMessageListener(IMessageListener listener)
|
void |
addPaymentListener(IPaymentListener listener)
|
PayAccount |
createAccount(PaymentInstanceDBEntry a_bi,
AsymmetricCryptoKeyPair a_keyPair,
XMLGenericText a_terms)
Creates a new Account. |
PayAccount |
createAccount(PaymentInstanceDBEntry a_bi,
XMLGenericText a_terms)
|
AsymmetricCryptoKeyPair |
createAccountKeyPair()
|
void |
deleteAccount(PayAccount a_account)
Deletes the account from the accountsfile and saves the file to disk. |
static void |
fireKnownMessages()
iterates over all accounts, and whenever there is a message it is sent to all MessageListeners reason for existence: JapNewView needs to load all messages at start-up (PayAccountsFile does already fire all message when it loads the accounts from the file, but that possibly happens before a MessageListener is initialized and added as a listener to PayAccountsFile) |
private void |
fireMessageReceived(PayMessage message)
|
private void |
fireMessageRemoved(PayMessage message)
|
PayAccount |
getAccount(long accountNumber,
java.lang.String a_piid)
Liefert PayAccount zur angegebenen Kontonummer. |
PayAccount |
getAccountAt(int rowIndex)
getAccountAt |
java.util.Enumeration |
getAccounts()
Returns an enumeration of all accounts |
java.util.Vector |
getAccounts(java.lang.String a_piid)
|
PayAccount |
getActiveAccount()
|
long |
getActiveAccountNumber()
|
PayAccount |
getAlternativeChargedAccount(java.lang.String a_piid)
|
PaymentInstanceDBEntry |
getBI(java.lang.String a_piID)
|
PayAccount |
getChargedAccount(java.lang.String a_piid)
|
PayAccount |
getChargedAccount(java.lang.String a_piid,
PayAccount a_excludeAccount)
|
static PayAccountsFile |
getInstance()
returns the one and only accountsfile. |
int |
getNumAccounts()
getNumAccounts |
java.util.Vector |
getPaymentInstances()
|
void |
gotCaptcha(ICaptchaSender a_source,
IImageEncodedCaptcha a_captcha)
This method is called whenever a captcha has been received from the Payment Instance. |
boolean |
hasActiveAccount()
|
boolean |
importAccounts(org.w3c.dom.Element elemAccountsFile,
IMiscPasswordReader a_passwordReader)
|
static boolean |
init(org.w3c.dom.Element elemAccountsFile,
IMiscPasswordReader a_passwordReader,
boolean a_bForceAIErrors,
int a_keyPoolSize)
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 |
messageReceived(PayMessage message)
just passes through a received message to the PayAccountsFile's MessageListeners |
void |
messageRemoved(PayMessage message)
|
void |
removePaymentListener(IPaymentListener a_listener)
|
void |
setActiveAccount(PayAccount a_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 |
int |
signalAccountRequest(MixCascade a_connectedCascade)
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.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
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
public static final java.lang.Integer CHANGED_AUTO_UPDATE
private static final java.lang.String XML_ATTR_IGNORE_AI_ERRORS
private static final java.lang.String XML_ATTR_ENABLE_BALANCE_AUTO_UPDATE
private static 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_messageListeners
private PayAccountsFile.MyAccountListener m_MyAccountListener
private DSAKeyPool m_keyPool
private static int ms_keyPoolSize
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 AsymmetricCryptoKeyPair createAccountKeyPair()
public void setIgnoreAIAccountError(boolean a_bIgnore)
a_bIgnore
- booleanpublic boolean isBalanceAutoUpdateEnabled()
public void setBalanceAutoUpdateEnabled(boolean a_bEnable)
public boolean isAIAccountErrorIgnored()
public boolean importAccounts(org.w3c.dom.Element elemAccountsFile, IMiscPasswordReader a_passwordReader) throws XMLParseException, java.lang.Exception
XMLParseException
java.lang.Exception
public static boolean init(org.w3c.dom.Element elemAccountsFile, IMiscPasswordReader a_passwordReader, boolean a_bForceAIErrors, int a_keyPoolSize)
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(PayAccount a_account)
public long getActiveAccountNumber()
public PayAccount getAccount(long accountNumber, java.lang.String a_piid)
accountNumber
- Kontonummer
PayAccount
oder null, wenn kein Konto unter der angebenen
Kontonummer vorhanden istpublic void deleteAccount(PayAccount a_account)
accountNumber
- account number
PayAccountsFile.AccountAlreadyExistingException
- Wenn ein Fehler bei Dateizugriff auftratpublic java.util.Enumeration getAccounts()
PayAccount
public static void fireKnownMessages()
public PayAccount getAlternativeChargedAccount(java.lang.String a_piid)
public PayAccount getChargedAccount(java.lang.String a_piid)
public PayAccount getChargedAccount(java.lang.String a_piid, PayAccount a_excludeAccount)
public java.util.Vector getAccounts(java.lang.String a_piid)
public void addAccount(PayAccount newAccount) throws PayAccountsFile.AccountAlreadyExistingException
account
- new account
PayAccountsFile.AccountAlreadyExistingException
- 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 void addMessageListener(IMessageListener listener)
private void fireMessageReceived(PayMessage message)
private void fireMessageRemoved(PayMessage message)
public PayAccount createAccount(PaymentInstanceDBEntry a_bi, XMLGenericText a_terms) throws java.lang.Exception
java.lang.Exception
public PayAccount createAccount(PaymentInstanceDBEntry a_bi, AsymmetricCryptoKeyPair a_keyPair, XMLGenericText a_terms) throws java.lang.Exception
a_keyPair
- RSA should not be used at the moment
java.lang.Exception
public int signalAccountRequest(MixCascade a_connectedCascade)
public void signalAccountError(XMLErrorMessage msg)
msg
- XMLErrorMessagepublic java.util.Vector getPaymentInstances()
public PaymentInstanceDBEntry getBI(java.lang.String a_piID)
public void gotCaptcha(ICaptchaSender a_source, IImageEncodedCaptcha a_captcha)
gotCaptcha
in interface IBIConnectionListener
a_source
- Objecta_captcha
- IImageEncodedCaptchapublic void messageReceived(PayMessage message)
messageReceived
in interface IMessageListener
public void messageRemoved(PayMessage message)
messageRemoved
in interface IMessageListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |