1 import org.omg.CORBA.*; 2 3 import java.io.*; 4 13 14 public class Client 15 { 16 17 public static void main( String [] args ) 18 throws Exception 19 { 20 if( args.length != 1 ) 21 { 22 System.out.println( "Usage: jaco Client <ior_file>" ); 23 System.exit( 1 ); 24 } 25 26 27 File f = new File( args[ 0 ] ); 28 29 if( ! f.exists() ) 31 { 32 System.out.println("File " + args[0] + 33 " does not exist."); 34 35 System.exit( -1 ); 36 } 37 38 if( f.isDirectory() ) 40 { 41 System.out.println("File " + args[0] + 42 " is a directory."); 43 44 System.exit( -1 ); 45 } 46 47 org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( args, null ); 49 50 BufferedReader br = 51 new BufferedReader( new FileReader( f )); 52 53 org.omg.CORBA.Object obj = 55 orb.string_to_object( br.readLine() ); 56 57 br.close(); 58 59 GoodDay gd = GoodDayHelper.narrow( obj ); 60 61 System.out.println( "hello_simple(): " + gd.hello_simple()); 62 System.out.println( "hello_wide(): " + 63 gd.hello_wide( "daß düdelt und dödelt")); 64 65 try 66 { 67 gd.test(); 68 } 69 catch( GoodDayPackage.WStringException wse ) 70 { 71 System.out.println("Exception: " + wse.why ); 72 } 73 } 74 } 76 | Popular Tags |