1 package demo.value.idl; 2 3 import java.io.*; 4 5 import org.omg.CORBA.*; 6 import org.omg.PortableServer.*; 7 8 9 public class Server 10 { 11 public static void main(String [] args) 12 { 13 if( args.length != 1 ) 14 { 15 System.out.println( 16 "Usage: java demo.value.idl.Server <ior_file>"); 17 System.exit( 1 ); 18 } 19 20 try 21 { 22 ORB orb = ORB.init( args, null ); 24 25 POA poa = 27 POAHelper.narrow( orb.resolve_initial_references( "RootPOA" )); 28 29 poa.the_POAManager().activate(); 30 31 ValueServerImpl s = new ValueServerImpl(); 32 33 org.omg.CORBA.Object obj = poa.servant_to_reference( s ); 35 36 PrintWriter pw = 37 new PrintWriter( new FileWriter( args[ 0 ] )); 38 39 pw.println( orb.object_to_string( obj )); 41 42 pw.flush(); 43 pw.close(); 44 45 orb.run(); 47 } 48 catch( Exception e ) 49 { 50 System.out.println( e ); 51 } 52 } 53 } 54 | Popular Tags |