1 20 package org.objectweb.modfact.corba.provider; 21 22 import org.objectweb.modfact.corba.helper.CORBACommon; 23 24 28 public class CORBAProvider implements CORBACommon { 29 30 36 public org.omg.CORBA.Object readIOR(org.omg.CORBA.ORB orb, String filename) { 37 try { 38 System.err.println("Reading stringified IOR from file " + filename); 39 java.io.BufferedReader input = new java.io.BufferedReader (new java.io.FileReader (filename)); 40 String line = input.readLine(); 41 return orb.string_to_object(line); 42 } catch (java.io.IOException ex) { 43 System.err.println("Problem opening/reading IOR file: " + ex); 44 } catch (org.omg.CORBA.SystemException ex) { 45 ex.printStackTrace(); 46 System.err.println("CORBA system exception in string_to_object: " + ex); 47 } 48 return null; 49 } 50 51 57 public void writeIOR(org.omg.CORBA.ORB orb, org.omg.CORBA.Object obj, String filename) { 58 try { 59 System.err.println("Writing stringified IOR to file " + filename); 60 java.io.FileWriter output = new java.io.FileWriter (filename); 61 output.write(orb.object_to_string(obj) + "\n"); 62 output.close(); 63 return; 64 } catch (java.io.IOException ex) { 65 System.err.println("Problem opening/writing IOR file: " + ex); 66 } catch (org.omg.CORBA.SystemException ex) { 67 ex.printStackTrace(); 68 System.err.println("CORBA system exception in object_to_string: " + ex); 69 } 70 } 71 72 78 public void printIOR(org.omg.CORBA.ORB orb, org.omg.CORBA.Object obj, java.io.PrintStream output) { 79 try { 80 output.println(orb.object_to_string(obj) + "\n"); 81 return; 82 } catch (org.omg.CORBA.SystemException ex) { 83 ex.printStackTrace(); 84 System.err.println("CORBA system exception in object_to_string: " + ex); 85 } 86 } 87 88 } 89 | Popular Tags |