1 5 package ve.luz.ica.jackass.ref; 6 7 import java.io.BufferedReader ; 8 import java.io.FileNotFoundException ; 9 import java.io.FileReader ; 10 import java.io.IOException ; 11 12 import org.omg.CORBA.ORB ; 13 import org.omg.IIOP.ProfileBody_1_1; 14 import org.omg.IOP.IOR ; 15 import org.omg.IOP.TAG_INTERNET_IOP ; 16 import org.omg.IOP.TaggedComponent ; 17 import org.omg.IOP.TaggedProfile ; 18 19 20 24 public final class IORRipper 25 { 26 30 public static void main(String [] args) 31 { 32 FileReader fr = null; 33 String serverRef = null; 34 35 if (args.length < 1) 36 { 37 System.err.println("Usage: java " + IORRipper.class.getName() + " filename"); 38 System.err.println("where filename is the name of a file with an IOR"); 39 System.exit(1); 40 } 41 try 43 { 44 fr = new FileReader (args[0]); 45 serverRef = (new BufferedReader (fr)).readLine(); 46 } 47 catch (FileNotFoundException ex_FF) 48 { 49 ex_FF.printStackTrace(); 50 } 51 catch (IOException ex_IO) 52 { 53 ex_IO.printStackTrace(); 54 } 55 56 try 58 { 59 ORB orb = ORB.init(args, null); 60 RefUtil refUtil = new RefUtil(orb); 61 64 65 org.omg.CORBA.Object obj = orb.string_to_object(serverRef); 67 69 IORData iorData = refUtil.rip(obj); 70 IOR ior = iorData.ior; 71 System.out.println("IOR = " + ior); 72 System.out.println("Type ID:" + ior.type_id); 73 System.out.println("Profiles: "); 74 for (int i = 0; i < ior.profiles.length; i++) 75 { 76 TaggedProfile profile = ior.profiles[i]; 77 System.out.println("Profile " + i + ": " + profile); 78 System.out.println("\tTag: " + profile.tag); 79 System.out.println("\tData:" + profile.profile_data); 80 81 if (profile.tag == TAG_INTERNET_IOP.value && iorData.isIIOP_1_1()) 82 { 83 ProfileBody_1_1 profBody = iorData.profileBody; 84 System.out.println("\tProfileBody: " + profBody); 85 TaggedComponent [] components = profBody.components; 86 System.out.println("\t\tProfileBody Components: " + components); 87 for (int j = 0; j < components.length; j++) 88 { 89 TaggedComponent component = components[j]; 90 System.out.println("\t\t\tComponent[" + j + "]=" + component.tag + 91 ", " + component.component_data + ", " + new String (component.component_data)); 92 } 93 } 94 95 } 96 } 97 catch (Exception ex) 98 { 99 ex.printStackTrace(); 100 } 101 } 102 } 103 | Popular Tags |