1 /*
2  * @(#) $Id: IteratorProxy.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 client;
11
12import java.rmi.Remote;
13import java.rmi.RemoteException;
14import java.util.Iterator;
15import common.RemoteIterator;
16import common.RemoteAccount;
17
18public class IteratorProxy implements Iterator {
19    private RemoteIterator ri;
20    public IteratorProxy(RemoteIterator ri){
21        this.ri = ri;
22    }
23    public boolean hasNext(){
24        try {
25            return ri.hasNext();
26        } catch (RemoteException re){
27            throw new RuntimeException(re);
28        }
29    }
30    public Object next(){
31        try {
32            return new AccountProxy((RemoteAccount)ri.next());
33        } catch (RemoteException re){
34            throw new RuntimeException(re);
35        }
36    }
37    public void remove(){
38        try {
39            ri.remove();
40        } catch (RemoteException re){
41            throw new RuntimeException(re);
42        }
43    }
44}
45