cscie160.project
Class ATMImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--cscie160.project.ATMImpl
All Implemented Interfaces:
ATM, ATMParams, java.rmi.Remote, java.io.Serializable

public class ATMImpl
extends java.rmi.server.UnicastRemoteObject
implements ATM, ATMParams

See Also:
Serialized Form

Field Summary
protected  java.util.Vector fListeners
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface cscie160.project.ATMParams
ACCOUNTSTRLENGTH, BALANCEINQUIRY, DEPOSIT, TRANSFER, WITHDRAWAL
 
Constructor Summary
ATMImpl()
          | Constructor.
 
Method Summary
 void addListener(cscie160.project.ATMListener mListener)
          | Listeners interested in Events sign on here
 void deposit(cscie160.project.AccountInfo mAccountInfo, float mAmount)
          | Tells account to deposit [amount].
 void distributeEvent(java.util.EventObject mEvent)
          | Calls distributeEvent method on every mListener on global-mListener list get listeners signed on by type and call their distributeEvent method Note: any mListener on both global list and type-specific list will get two calls to handleEvent Note: since multiple remote objects can call methods on a single EventProducer, we have the possibility of interleaved execution of this method by multi-threads.
 float getBalance(cscie160.project.AccountInfo mAccountInfo)
          | Asks account for the balance of that account.
 void transfer(cscie160.project.AccountInfo mSrcAccountInfo, cscie160.project.AccountInfo mTgtAccountInfo, float mAmount)
          | Asks account for the balance in that account.
 void withdraw(cscie160.project.AccountInfo mAccountInfo, float mAmount)
          | Tells account to withdraw [amount]
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fListeners

protected java.util.Vector fListeners
Constructor Detail

ATMImpl

public ATMImpl()
        throws java.rmi.RemoteException
| Constructor. This ATM has three accounts

Method Detail

addListener

public void addListener(cscie160.project.ATMListener mListener)
                 throws java.rmi.RemoteException
| Listeners interested in Events sign on here

Specified by:
addListener in interface ATM
java.rmi.RemoteException

distributeEvent

public void distributeEvent(java.util.EventObject mEvent)
                     throws java.rmi.RemoteException
| Calls distributeEvent method on every mListener on global-mListener list get listeners signed on by type and call their distributeEvent method Note: any mListener on both global list and type-specific list will get two calls to handleEvent Note: since multiple remote objects can call methods on a single EventProducer, we have the possibility of interleaved execution of this method by multi-threads. Hence, we clone the listeners before using them. Thus, exporting an object for remote access may imply multi-threaded execution in its JVM without any explicit thread creation.

Specified by:
distributeEvent in interface ATM
java.rmi.RemoteException

getBalance

public float getBalance(cscie160.project.AccountInfo mAccountInfo)
                 throws java.rmi.RemoteException,
                        SecurityException
| Asks account for the balance of that account.

Specified by:
getBalance in interface ATM
Returns:
float Balance in [account]
java.rmi.RemoteException
SecurityException

deposit

public void deposit(cscie160.project.AccountInfo mAccountInfo,
                    float mAmount)
             throws java.rmi.RemoteException,
                    ATMException,
                    SecurityException
| Tells account to deposit [amount].

Specified by:
deposit in interface ATM
java.rmi.RemoteException
ATMException
SecurityException

withdraw

public void withdraw(cscie160.project.AccountInfo mAccountInfo,
                     float mAmount)
              throws java.rmi.RemoteException,
                     ATMException,
                     SecurityException
| Tells account to withdraw [amount]

Specified by:
withdraw in interface ATM
java.rmi.RemoteException
ATMException
SecurityException

transfer

public void transfer(cscie160.project.AccountInfo mSrcAccountInfo,
                     cscie160.project.AccountInfo mTgtAccountInfo,
                     float mAmount)
              throws java.rmi.RemoteException,
                     ATMException,
                     SecurityException
| Asks account for the balance in that account.

Specified by:
transfer in interface ATM
Returns:
float Balance in [account]
java.rmi.RemoteException
ATMException
SecurityException