1
10package server;
11
12import java.rmi.Remote;
13import java.rmi.RemoteException;
14import java.rmi.server.UnicastRemoteObject;
15import java.math.BigDecimal;
16import org.jstk.example.bank.Exceptions;
17import org.jstk.example.bank.AccountIntf;
18
19public class RemoteAccountImpl extends UnicastRemoteObject implements common.RemoteAccount {
20 private AccountIntf acct = null;
21
22 public RemoteAccountImpl(AccountIntf acct) throws RemoteException {
23 this.acct = acct;
24 }
25 public void deposit(BigDecimal amt) throws Exceptions.AccountClosed, RemoteException {
26 acct.deposit(amt);
27 }
28 public void withdraw(BigDecimal amt) throws Exceptions.AccountClosed,
29 Exceptions.InsufficientAmount, RemoteException {
30 acct.withdraw(amt);
31 }
32 public void close() throws Exceptions.AccountClosed, RemoteException {
33 acct.close();
34 }
35 public BigDecimal getBalance() throws Exceptions.AccountClosed, RemoteException {
36 return acct.getBalance();
37 }
38 public String getAcctNo() throws RemoteException {
39 return acct.getAcctNo();
40 }
41 public String getStatement() throws RemoteException {
42 return acct.getStatement();
43 }
44}
45