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