1 package server;
2 
3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
5 import java.util.Iterator;
6 import org.jstk.example.bank.BankIntf;
7 import org.jstk.example.bank.AccountIntf;
8 
9 import common.RemoteIterator;
10
11public class RemoteIteratorImpl extends UnicastRemoteObject implements RemoteIterator {
12    private BankIntf bi;
13    private Iterator itr;
14    public RemoteIteratorImpl(BankIntf bi) throws RemoteException {
15        this.bi = bi;
16        itr = bi.accounts();
17    }
18    public boolean hasNext() throws RemoteException {
19        return itr.hasNext();
20    }
21    public Object next() throws RemoteException {
22        return new RemoteAccountImpl((AccountIntf)itr.next());
23    }
24    public void remove() throws RemoteException {
25        itr.remove();
26    }
27}
28