cscie160.project
Class Client

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

public class Client
extends java.rmi.server.UnicastRemoteObject
implements ATMListener

By David Cheung

CSCIE160 Project

DUE 05-16-2001

Client class implements ATMListener so that it will do callbacks as required from the project spec.

This also performs the registration to the ATM.

in Main:

Client first contact ATMFactory instance.

Second, register itself to the ATM. The ATM provides methods to store the remote object in a vector.

Finally, perform the tests required in project spec.

See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
Client()
          constructor:
 
Method Summary
static AccountInfo getAccountInfo(int acctNum, int acctPin)
          creates an AccountInfo based on acctnum and pin and then returns it.
 void getNotify(TransactionNotification noteBox)
          Then this function is called, it will print out messages from ATM.
static void main(java.lang.String[] args)
          main:
static void performTestEight(ATM atm)
           
static void performTestFive(ATM atm)
           
static void performTestFour(ATM atm)
           
static void performTestNine(ATM atm)
           
static void performTestOne(ATM atm)
           
static void performTestSeven(ATM atm)
           
static void performTestSix(ATM atm)
           
static void performTestThree(ATM atm)
           
static void performTestTwo(ATM atm)
           
static void printBalances(ATM atm)
           
 void registerMe(ATM atmA)
          registers itself to the list of callbacks.
static void testATM(ATM atm)
           
 
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
 

Constructor Detail

Client

public Client()
       throws java.rmi.RemoteException
constructor:

need to call super() for RMI objects.

Method Detail

getNotify

public void getNotify(TransactionNotification noteBox)
               throws java.rmi.RemoteException
Then this function is called, it will print out messages from ATM.
Specified by:
getNotify in interface ATMListener

registerMe

public void registerMe(ATM atmA)
registers itself to the list of callbacks. calls addCallBack function from ATM.

getAccountInfo

public static AccountInfo getAccountInfo(int acctNum,
                                         int acctPin)
creates an AccountInfo based on acctnum and pin and then returns it.

main

public static void main(java.lang.String[] args)
main:

1) call ATM class.

2) lookup ATM factory.

3) use getATM from ATMfactory and stores it.

4) Register itself to ATM.

5) Perform tests. Modified some negative tests by adding "should fail!" messages when test is suppose to fail. this is useful when test passed when it should fail.


testATM

public static void testATM(ATM atm)

printBalances

public static void printBalances(ATM atm)

performTestOne

public static void performTestOne(ATM atm)

performTestTwo

public static void performTestTwo(ATM atm)

performTestThree

public static void performTestThree(ATM atm)

performTestFour

public static void performTestFour(ATM atm)

performTestFive

public static void performTestFive(ATM atm)

performTestSix

public static void performTestSix(ATM atm)

performTestSeven

public static void performTestSeven(ATM atm)

performTestEight

public static void performTestEight(ATM atm)

performTestNine

public static void performTestNine(ATM atm)