topdown.service
Class BankServiceImpl

java.lang.Object
  extended bytopdown.service.BankServiceImpl

public class BankServiceImpl
extends java.lang.Object

The is the bank service implementation class. It implements the remote service interface and creates the underlying bank class this service makes available to remote users.


Field Summary
private  Bank m_bank
          The underlying bank instance.
 
Constructor Summary
BankServiceImpl()
          Creates a bank service instance that wraps a bank object.
 
Method Summary
 java.lang.String createAccount(java.lang.String acctName, float initBalance)
          Creates a bank account.
 void deposit(java.lang.String acctID, float amount)
          Deposits money into the given account.
 java.lang.String getAccountID(java.lang.String acctName)
          Returns the account ID associated with the provided account owner's name.
 float getBalance(java.lang.String acctID, java.lang.String acctName)
          Returns the current balance of the account.
 void withdraw(java.lang.String acctID, float amount)
          Withdraws money from the given account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bank

private Bank m_bank
The underlying bank instance.

Constructor Detail

BankServiceImpl

public BankServiceImpl()
Creates a bank service instance that wraps a bank object.

Method Detail

createAccount

public java.lang.String createAccount(java.lang.String acctName,
                                      float initBalance)
                               throws java.rmi.RemoteException,
                                      AccountException
Creates a bank account. This class simply delegates the call to the underlying bank instance.

Parameters:
acctName - the name of the account owner.
initBalance - the initial balance for the account.
Returns:
the account ID.
Throws:
java.rmi.RemoteException - if an unexpected system error occurs.
AccountException - if the initial balance is insufficient (<= 0).

deposit

public void deposit(java.lang.String acctID,
                    float amount)
             throws java.rmi.RemoteException,
                    AccountException
Deposits money into the given account.

Parameters:
acctID - the ID of the account into which the deposit is made.
amount - the amount of money to deposit.
Throws:
java.rmi.RemoteException - if an unexpected system error occurs.
AccountException - if no account is found for the given account ID.

withdraw

public void withdraw(java.lang.String acctID,
                     float amount)
              throws java.rmi.RemoteException,
                     AccountException
Withdraws money from the given account.

Parameters:
acctID - the account ID for the account from which the money will be withdrawn.
amount - the amount of money to withdraw.
Throws:
java.rmi.RemoteException - if an unexpected system error occurs.
AccountException - if the amount of money withdrawn exceeds the maximum amount allowed ($2000.00).

getBalance

public float getBalance(java.lang.String acctID,
                        java.lang.String acctName)
                 throws java.rmi.RemoteException,
                        AccountException
Returns the current balance of the account.

Parameters:
acctID - the account ID of the account.
acctName - the name of the account owner.
Returns:
the balance of the account.
Throws:
java.rmi.RemoteException - if an unexpected system error occurs.
AccountException - if no account is found for the given account ID.

getAccountID

public java.lang.String getAccountID(java.lang.String acctName)
                              throws java.rmi.RemoteException,
                                     AccountException
Returns the account ID associated with the provided account owner's name.

Parameters:
acctName - the name of the account owner.
Returns:
the account ID.
Throws:
java.rmi.RemoteException - if an unexpected system error occurs.
AccountException - if no account is found for the provided owner name.