// // Tester.java (original) // import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; import java.util.Properties; import java.util.Vector; public class ShapeListClient { public static void main(String args[]) { String option = "Read"; String shapeType = "Rectangle"; if(args.length > 0) option = args[0]; // read or write if(args.length > 1) shapeType = args[1]; // specify Circle, Line etc try{ // create and initialize the ORB at port number 1500 Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1500"); ORB orb = ORB.init(args, props); // get the root naming context try{ org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // resolve the Object Reference in Naming NameComponent nc = new NameComponent("ShapeList", ""); NameComponent path [] = { nc }; try{ ShapeList shapeListRef = ShapeListHelper.narrow(ncRef.resolve(path)); if(option.equals("Read")){ Shape[] sList = shapeListRef.allShapes(); for(int i=0; i