1 package demo.hello; 2 3 import java.io.*; 4 import org.omg.CORBA.*; 5 6 public class Client 7 { 8 public static void main( String args[] ) 9 { 10 if( args.length != 1 ) 11 { 12 System.out.println( "Usage: jaco demo.hello.Client <ior_file>" ); 13 System.exit( 1 ); 14 } 15 16 try 17 { 18 File f = new File( args[ 0 ] ); 19 20 if( ! f.exists() ) 22 { 23 System.out.println("File " + args[0] + 24 " does not exist."); 25 26 System.exit( -1 ); 27 } 28 29 if( f.isDirectory() ) 31 { 32 System.out.println("File " + args[0] + 33 " is a directory."); 34 35 System.exit( -1 ); 36 } 37 38 ORB orb = ORB.init( args, null ); 40 41 BufferedReader br = 42 new BufferedReader( new FileReader( f )); 43 44 org.omg.CORBA.Object obj = 46 orb.string_to_object( br.readLine() ); 47 48 br.close(); 49 50 GoodDay goodDay = GoodDayHelper.narrow( obj ); 53 54 55 System.out.println( goodDay.hello_simple() ); 57 58 System.out.println( "wide string: " + 60 goodDay.hello_wide( "Hello Wörld, from ß ö 1 2 3 0 *&^%$#@!@")); 61 62 } 63 catch( Exception ex ) 64 { 65 ex.printStackTrace(); 66 } 67 } 68 } 69 70 | Popular Tags |