1 /*
2  * @(#) $Id: RemoteIteratorImpl.java,v 1.2 2003/07/08 08:13:52 pankaj Exp $
3  *
4  * Copyright (c) 2002-03 by Pankaj Kumar (http://www.pankaj-k.net). 
5  * All rights reserved.
6  *
7  * The license governing the use of this file can be found in the 
8  * root directory of the containing software.
9  */
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