ecash.internet
Class ECashBank

java.lang.Object
  |
  +--ecash.internet.ECashGen
        |
        +--ecash.internet.ECashBank
All Implemented Interfaces:
java.lang.Runnable

public class ECashBank
extends ECashGen
implements java.lang.Runnable

Extension of the ECashGen class which adds specific methods for a bank.

Author:
Michel Deriaz
See Also:
ECashGen, ECashBuyer, ECashSeller

Field Summary
 
Fields inherited from class ecash.internet.ECashGen
BANK_PORT, CHEAT_AMOUNTS_NOT_ALL_THE_SAME, CHEAT_NOTE_REUSED_BY_BUYER, CHEAT_NOTE_REUSED_BY_SELLER, CHEAT_WRONG_PASSWORD, CHEAT_WRONG_REVEALED_NOTES, CHEAT_WRONG_RIS, CHEAT_WRONG_SIGNATURE, CONNECTION_CLOSED_BY_SERVER, KEY_NOT_AVAILABLE, NOTES_EXP_SYNTAX_ERROR, NOTES_NOT_AVAILABLE, OK, OP_BUY, OP_DEPOSIT, OP_GET_KEY, OP_PAY, SELLER_PORT, SERVER_NOT_READY, TRANS_OK
 
Constructor Summary
ECashBank(ECashBankListener listener)
          Creates a ECashBank and loads the constants with the Const class.
 
Method Summary
 void genKey()
          Creates a new pair of keys.
 ECashBankState getState()
          Returns an ECashBankState object.
 void run()
           
 void setState(ECashBankState state)
          Initializes the class with the specified state.
 void startServer()
          Starts the server of the bank, in order to be ready to answer clients requests.
 
Methods inherited from class ecash.internet.ECashGen
checkIfNotesAvailable, close, getKey, getKey, getREGEXP, handshakeClient, handshakeServer, hasBankKey, receiveCrypted, sendCrypted, sendCrypted, setKey, stopServer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ECashBank

public ECashBank(ECashBankListener listener)
Creates a ECashBank and loads the constants with the Const class.

Parameters:
listener - the class that implements the ECashBankListener interface
Method Detail

getState

public ECashBankState getState()
Returns an ECashBankState object. The idea is to write this object on a hard-disk (using Tools.writeObject()) and retrieve it through the setState() method next time the program is loaded (using Tools.readObject()).

Returns:
the current state
See Also:
ECashBankState

setState

public void setState(ECashBankState state)
Initializes the class with the specified state.

Parameters:
state - the state
See Also:
getState(), ECashBankState

genKey

public void genKey()
Creates a new pair of keys.


startServer

public void startServer()
Starts the server of the bank, in order to be ready to answer clients requests.

See Also:
ECashGen.stopServer()

run

public void run()
Specified by:
run in interface java.lang.Runnable