ecash.internet
Class ECashSeller

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

public class ECashSeller
extends ECashGen
implements java.lang.Runnable

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

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

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
ECashSeller(ECashSellerListener listener)
          Creates an ECashSeller and loads the constants with the Const class.
 
Method Summary
 CreditDebitReport deposit(java.lang.String bankAddress, java.lang.String bankAccount, char[] password, java.lang.String notesExp)
          Deposits some notes at the bank.
 java.util.Vector getAmountList()
          Returns the list of all the amounts of the different notes.
 ECashSellerState getState()
          Returns an ECashSellerState object.
 void run()
           
 void setState(ECashSellerState state)
          Initializes the class with the specified state.
 void startServer()
          Starts the server of the seller, in order to be ready to answer buyers 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

ECashSeller

public ECashSeller(ECashSellerListener listener)
Creates an ECashSeller and loads the constants with the Const class.

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

getState

public ECashSellerState getState()
Returns an ECashSellerState 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:
ECashSellerState

setState

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

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

getAmountList

public java.util.Vector getAmountList()
Returns the list of all the amounts of the different notes. Each entry of this Vector is a String.

Returns:
the list of all the amounts from the different notes

startServer

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

See Also:
ECashGen.stopServer()

deposit

public CreditDebitReport deposit(java.lang.String bankAddress,
                                 java.lang.String bankAccount,
                                 char[] password,
                                 java.lang.String notesExp)
Deposits some notes at the bank.

Parameters:
bankAddress - the address of the bank, for example "124.123.132.233"
bankAccount - the account number
password - the password of the account
notesExp - the notes expression describing which notes must be deposited.
Returns:
a report describing the operation
See Also:
CreditDebitReport

run

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