import IE.Iona.Orbix2.CORBA.SystemException; import IE.Iona.Orbix2._CORBA; import java.util.Vector; public class Client implements _CheckableOperations { private _BankRef server; private _AccountRef anAccount; private _CheckableRef thisClient; /** * Starts a new Client program * * @param Command line arguments@ */ public static void main(String[] args) { if (args.length != 2) System.out.println("Usage: java Client "); else new Client(args[0], args[1]); } /** * Constructor for the client program. Binds to the server, creates an * Account, then exits * * @param aHost@ * @param aServer@ */ public Client(String aHost, String aServer) { if (bind(aHost, aServer)) { try { // tie to self thisClient = new _tie_Checkable(this); } catch (SystemException se) { System.out.println("Client: could not tie to self\n" + se); } try { // create a new account anAccount = server.newAccount("Marty", thisClient); System.out.println("Client: Got new account"); } catch (SystemException se) { System.out.println("Client: could not get account\n" + se); } } } /** * Used to check if this object is still alive * * @return true@ */ public boolean stillLive() { return true; } /** * Binds to a specified server on a specified host * * @param aHost@ * @param aServer@ * @return true if bind was successful, otherwise false@ */ private boolean bind(String aHost, String aServer) { System.out.println("Client: In bind"); try { server = Bank._bind(":" + aServer, aHost); return true; } catch (SystemException se) { System.out.println("Client: Could not bind to server\n" + se); } return false; } }