1
10package server;
11
12import java.rmi.RemoteException;
13import java.rmi.server.UnicastRemoteObject;
14import java.util.Iterator;
15import org.jstk.example.bank.BankIntf;
16import org.jstk.example.bank.AccountIntf;
17
18import common.RemoteIterator;
19
20public class RemoteIteratorImpl extends UnicastRemoteObject implements RemoteIterator {
21 private BankIntf bi;
22 private Iterator itr;
23 public RemoteIteratorImpl(BankIntf bi) throws RemoteException {
24 this.bi = bi;
25 itr = bi.accounts();
26 }
27 public boolean hasNext() throws RemoteException {
28 return itr.hasNext();
29 }
30 public Object next() throws RemoteException {
31 return new RemoteAccountImpl((AccountIntf)itr.next());
32 }
33 public void remove() throws RemoteException {
34 itr.remove();
35 }
36}
37