1 2 5 14 package org.jacorb.trading.client.proxy; 15 16 import java.io.*; 17 import java.util.*; 18 19 import org.omg.CORBA.*; 20 import org.omg.PortableServer.*; 21 22 public class ProxyDemo 23 { 24 public static void main(String [] args) 25 { 26 if( args.length != 1 ) 27 { 28 usage(); 29 } 30 31 String iorfile = args[0]; 32 33 ORB orb = ORB.init(args, null); 35 36 try 37 { 38 POA poa = 39 POAHelper.narrow(orb.resolve_initial_references("RootPOA")); 40 41 poa.the_POAManager().activate(); 42 } 43 catch(Exception e) 44 { 45 e.printStackTrace(); 46 } 47 48 ProxyLookupImpl impl = new ProxyLookupImpl(); 50 impl._this_object( orb ); 51 52 try 53 { 54 FileOutputStream out = new FileOutputStream(iorfile); 55 PrintWriter pw = new PrintWriter(out); 56 pw.println(orb.object_to_string(impl._this())); 57 pw.flush(); 58 out.close(); 59 } 60 catch (IOException e) 61 { 62 System.err.println("Unable to write IOR to file " + iorfile); 63 System.exit(1); 64 } 65 66 orb.run(); 67 System.exit(0); 68 } 69 70 71 protected static void usage() 72 { 73 System.err.println("Usage: org.jacorb.trading.client.proxy.ProxyDemo iorfile"); 74 System.exit(1); 75 } 76 } 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | Popular Tags |