1 20 21 package org.jacorb.orb.util; 22 23 26 27 import org.jacorb.orb.ParsedIOR; 28 import java.io.*; 29 30 public class PingObject 31 { 32 public static void main( String args[] ) 33 { 34 org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null); 35 String iorString = null; 36 37 if( args.length < 1 || args.length > 2 ) 38 { 39 System.err.println("Usage: java org.jacorb.orb.util.PingObject [ ior_str | -f filename ]"); 40 System.exit( 1 ); 41 } 42 43 if( args[0].equals("-f")) 44 { 45 try 46 { 47 BufferedReader br = new BufferedReader( new FileReader( args[1] )); 48 iorString = br.readLine(); 49 } 50 catch ( IOException ioe ) 51 { 52 ioe.printStackTrace(); 53 System.exit(1); 54 } 55 } 56 else 57 { 58 iorString = args[0]; 59 } 60 61 org.omg.CORBA.Object o = orb.string_to_object( iorString ); 62 63 if( o == null ) 64 { 65 System.out.println("Could not convert " + iorString + " to an object"); 66 } 67 else 68 { 69 try 70 { 71 System.out.println("Object exists: " + (!o._non_existent())); 72 } 73 catch (org.omg.CORBA.SystemException e) 74 { 75 System.out.println("Object not reachable! (Exception: " + e + ")"); 76 } 77 78 } 79 } 80 } 81 | Popular Tags |