1 /*
2  * @(#) $Id: RMIBCShell.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.io.InputStreamReader;
13import java.io.BufferedReader;
14import common.RemoteBank;
15import java.rmi.Naming;
16
17import org.jstk.example.bank.client.BankClient;
18
19public class RMIBCShell {
20    public static void main(String[] args) throws Exception {
21        BankClient bc = new BankClient();
22        RemoteBank rbank = (RemoteBank)Naming.lookup("rmi://" + args[0] + "/" + "MyRemoteBank");
23        bc.init(new BankProxy(rbank));
24        while (true){
25            System.out.print("rbcsh>");
26            System.out.flush();
27            String cmdline = new BufferedReader(new InputStreamReader(System.in)).readLine();
28            String[] cmdargs = cmdline.split("\\s");
29
30            String result = bc.execCommand(cmdargs);
31            System.out.println(result);
32        }
33    }
34}