1 package demo.imr; 2 3 import java.io.*; 4 import org.omg.CORBA.*; 5 6 import org.jacorb.util.*; 7 8 public class Client 9 { 10 public static void main( String args[] ) 11 { 12 if( args.length != 1 ) 13 { 14 System.out.println( "Usage: jaco demo.imr.Client <ior_file>" ); 15 System.exit( 1 ); 16 } 17 18 try 19 { 20 File f = new File( args[ 0 ] ); 21 22 if( ! f.exists() ) 24 { 25 System.out.println("File " + args[0] + 26 " does not exist."); 27 28 System.exit( -1 ); 29 } 30 31 if( f.isDirectory() ) 33 { 34 System.out.println("File " + args[0] + 35 " is a directory."); 36 37 System.exit( -1 ); 38 } 39 40 ORB orb = ORB.init( args, null ); 42 43 BufferedReader br = 44 new BufferedReader( new FileReader( f )); 45 46 org.omg.CORBA.Object obj = 48 orb.string_to_object( br.readLine() ); 49 50 br.close(); 51 52 SomeIf demo = SomeIfHelper.narrow( obj ); 54 55 System.out.println("Client: will call server"); 57 demo.op(); 58 System.out.println("Client: successfully called server"); 59 } 60 catch( Exception ex ) 61 { 62 System.err.println( ex ); 63 } 64 } 65 } 66 67 | Popular Tags |