1 28 29 30 package org.objectweb.corba.runtime; 31 32 35 public class ORBServiceImpl 36 extends org.omg.CORBA.LocalObject 37 implements ORBService 38 { 39 static final private String _class_name = "ORBServiceImpl"; 41 static final private String _service_id = ORBService.SERVICE_ID; 42 private org.omg.CORBA.ORB _orb; 43 private java.util.Hashtable _initial_references; 44 45 protected 47 ORBServiceImpl(org.omg.CORBA.ORB orb) 48 { 49 _orb = orb; 51 _initial_references = null; 52 } 53 54 58 59 63 final public org.omg.CORBA.ORB 64 getORB() 65 { 66 return _orb; 67 } 68 69 73 final public void 74 system_configuration_complete(SystemConfiguration cfg) 75 { 76 _initial_references = new java.util.Hashtable (); 77 } 78 79 final public void 80 destroy() 81 { 82 86 _orb.shutdown(true); 88 89 Runtime.getMainThread().stopORB(_orb); 91 92 _initial_references.clear(); 94 } 95 96 100 final public String 101 service_id() 102 { 103 return _service_id; 104 } 105 106 110 final public org.omg.CORBA.Object 111 string_to_object(String str) 112 { 113 return _orb.string_to_object(ORBFactoryImpl.extractIOR(str)); 115 } 116 117 final public String 118 object_to_string(org.omg.CORBA.Object obj) 119 { 120 return _orb.object_to_string(obj); 121 } 122 123 final public org.omg.CORBA.Any 124 create_any() 125 { 126 return _orb.create_any(); 127 } 128 129 final public org.omg.CORBA.Policy 130 create_policy(int type, org.omg.CORBA.Any value) 131 { 132 try { 133 return _orb.create_policy(type, value); 134 } catch (org.omg.CORBA.PolicyError ex) { 135 final String opname = "create_policy"; 137 TheLogger.debug(_class_name, opname, "IGNORE", ex); 138 return null; 139 } 140 } 141 142 final public java.io.Serializable 143 create_valuetype(String repid) 144 { 145 final String opname = "create_valuetype"; 146 147 org.omg.CORBA_2_3.ORB orb23 = (org.omg.CORBA_2_3.ORB )_orb; 149 org.omg.CORBA.portable.ValueFactory vfact = orb23.lookup_value_factory(repid); 150 151 if (vfact==null) { 153 final String msg = "IGNORE (no factory for: "+repid+")"; 154 TheLogger.debug(_class_name, opname, msg); 155 return null; 156 } 157 158 String opn = "create_valuetype"; 161 try { 162 java.lang.reflect.Method op = null; 163 op = vfact.getClass().getMethod(opn, new Class [0]); 164 return (java.io.Serializable )op.invoke(null, new Object [0]); 165 } catch (NoSuchMethodException ex) { 166 final String msg = "IGNORE (no \"create_valuetype\" operation for: "+repid+")"; 167 TheLogger.debug(_class_name, opname, msg, ex); 168 return null; 169 } catch (Exception ex) { 170 TheLogger.debug(_class_name, opname, "IGNORE", ex); 171 return null; 172 } 173 } 174 175 final public void 176 register_valuefactory(ValueFactory vfact) 177 { 178 org.omg.CORBA_2_3.ORB orb23 = (org.omg.CORBA_2_3.ORB )_orb; 179 orb23.register_value_factory(vfact.type_id(), vfact.value_factory()); 180 } 181 182 final public org.omg.CORBA.portable.ValueFactory 183 get_valuefactory(String type_id) 184 { 185 org.omg.CORBA_2_3.ORB orb23 = (org.omg.CORBA_2_3.ORB )_orb; 186 return orb23.lookup_value_factory(type_id); 187 } 188 189 final public org.omg.CORBA.Object 190 resolve_initial_references(String name) 191 { 192 org.omg.CORBA.Object res = (org.omg.CORBA.Object )_initial_references.get(name); 194 if (res!=null) { 195 return res; 196 } 197 198 try { 200 return _orb.resolve_initial_references(name); 201 } catch (Exception ex) { 202 final String opname = "resolve_initial_references"; 203 TheLogger.debug(_class_name, opname, "IGNORE", ex); 204 return null; 205 } 206 } 207 208 final public void 209 register_initial_references(String name, org.omg.CORBA.Object ref) 210 { 211 _initial_references.put(name, ref); 212 } 213 214 final public String [] 215 list_initial_references() 216 { 217 220 return (String [])_initial_references.keySet().toArray(new String [0]); 221 } 222 } 223 | Popular Tags |