1 22 package org.jboss.system; 23 24 import java.util.Properties ; 25 import org.omg.CORBA.Any ; 26 import org.omg.CORBA.Context ; 27 import org.omg.CORBA.ContextList ; 28 import org.omg.CORBA.Current ; 29 import org.omg.CORBA.Environment ; 30 import org.omg.CORBA.ExceptionList ; 31 import org.omg.CORBA.INITIALIZE ; 32 import org.omg.CORBA.NamedValue ; 33 import org.omg.CORBA.NO_IMPLEMENT ; 34 import org.omg.CORBA.NVList ; 35 import org.omg.CORBA.ORBPackage.InvalidName ; 36 import org.omg.CORBA.Request ; 37 import org.omg.CORBA.StructMember ; 38 import org.omg.CORBA.TCKind ; 39 import org.omg.CORBA.TypeCode ; 40 import org.omg.CORBA.UnionMember ; 41 import org.omg.CORBA.ValueMember ; 42 import org.omg.CORBA_2_3.ORB ; 43 44 73 public class ORBSingleton extends ORB 74 { 75 76 public static String DELEGATE_CLASS_KEY = "org.jboss.ORBSingletonDelegate"; 77 78 79 private static ORB delegate = null; 80 81 85 public ORBSingleton() 86 { 87 if (delegate == null) 88 { 89 String className = System.getProperty(DELEGATE_CLASS_KEY); 90 if (className == null) 91 className = "org.jacorb.orb.ORBSingleton"; 92 try 93 { 94 delegate = (ORB )Class.forName(className).newInstance(); 95 } 96 catch (ClassNotFoundException ex) 97 { 98 } 99 catch (Exception ex) { 100 throw new INITIALIZE ( 101 "can't instantiate ORBSingleton implementation " + className); 102 } 103 104 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 105 if (cl == null) 106 cl = ClassLoader.getSystemClassLoader(); 107 try 108 { 109 delegate = (ORB )Class.forName(className, true, cl).newInstance(); 110 } 111 catch (Exception ex) 112 { 113 throw new INITIALIZE ( 114 "can't instantiate ORBSingleton implementation " + className); 115 } 116 } 117 } 118 119 125 public Any create_any() 126 { 127 return delegate.create_any(); 128 } 129 130 public TypeCode create_alias_tc(String id, 131 String name, 132 TypeCode original_type) 133 { 134 return delegate.create_alias_tc(id, name, original_type); 135 } 136 137 public TypeCode create_array_tc(int length, TypeCode element_type) 138 { 139 return delegate.create_array_tc(length, element_type); 140 } 141 142 public TypeCode create_enum_tc(String id, String name, String [] members) 143 { 144 return delegate.create_enum_tc(id, name, members); 145 } 146 147 public TypeCode create_exception_tc(String id, 148 String name, 149 StructMember [] members) 150 { 151 return delegate.create_exception_tc(id, name, members); 152 } 153 154 public TypeCode create_interface_tc(String id, String name) 155 { 156 return delegate.create_interface_tc(id, name); 157 } 158 159 public TypeCode create_fixed_tc(short digits, short scale) 160 { 161 return delegate.create_fixed_tc(digits, scale); 162 } 163 164 public TypeCode create_recursive_tc(String id) 165 { 166 return delegate.create_recursive_tc(id); 167 } 168 169 172 public TypeCode create_recursive_sequence_tc(int bound, int offset) 173 { 174 throw new NO_IMPLEMENT ("deprecated by CORBA 2.3"); 175 } 176 177 public TypeCode create_sequence_tc(int bound, TypeCode element_type) 178 { 179 return delegate.create_sequence_tc(bound, element_type); 180 } 181 182 public TypeCode create_string_tc(int bound) 183 { 184 return delegate.create_string_tc(bound); 185 } 186 187 public TypeCode create_wstring_tc(int bound) 188 { 189 return delegate.create_wstring_tc(bound); 190 } 191 192 public TypeCode create_struct_tc(String id, 193 String name, 194 StructMember [] members) 195 { 196 return delegate.create_struct_tc(id, name, members); 197 } 198 199 public TypeCode create_union_tc(String id, 200 String name, 201 TypeCode discriminator_type, 202 UnionMember [] members) 203 { 204 return delegate.create_union_tc(id, name, 205 discriminator_type, members); 206 } 207 208 public TypeCode get_primitive_tc(TCKind tcKind) 209 { 210 return delegate.get_primitive_tc(tcKind); 211 } 212 213 public TypeCode create_value_tc(String id, 214 String name, 215 short type_modifier, 216 TypeCode concrete_base, 217 ValueMember [] members) 218 { 219 return delegate.create_value_tc(id, name, type_modifier, 220 concrete_base, members); 221 } 222 223 public TypeCode create_value_box_tc(String id, 224 String name, 225 TypeCode boxed_type) 226 { 227 return delegate.create_value_box_tc(id, name, boxed_type); 228 } 229 230 public TypeCode create_abstract_interface_tc(String id, String name) 231 { 232 return delegate.create_abstract_interface_tc(id, name); 233 } 234 235 public TypeCode create_native_tc(String id, String name) 236 { 237 return delegate.create_native_tc(id, name); 238 } 239 240 241 242 public ExceptionList create_exception_list() 243 { 244 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 245 } 246 247 public NVList create_list(int count) 248 { 249 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 250 } 251 252 public NamedValue create_named_value(String name, Any value, int flags) 253 { 254 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 255 } 256 257 public NVList create_operation_list(org.omg.CORBA.Object obj) 258 { 259 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 260 } 261 262 public org.omg.CORBA.Object string_to_object(String str) 263 { 264 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 265 } 266 267 public Environment create_environment() 268 { 269 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 270 } 271 272 public ContextList create_context_list() 273 { 274 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 275 } 276 277 public org.omg.CORBA.portable.OutputStream create_output_stream() 278 { 279 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 280 } 281 282 285 public Current get_current() 286 { 287 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 288 } 289 290 public Context get_default_context() 291 { 292 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 293 } 294 295 public Request get_next_response() 296 { 297 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 298 } 299 300 public String [] list_initial_services() 301 { 302 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 303 } 304 305 public String object_to_string(org.omg.CORBA.Object obj) 306 { 307 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 308 } 309 310 public boolean poll_next_response() 311 { 312 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 313 } 314 315 public org.omg.CORBA.Object resolve_initial_references(String identifier) 316 throws InvalidName 317 { 318 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 319 } 320 321 public void send_multiple_requests_deferred(Request [] req) 322 { 323 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 324 } 325 326 public void send_multiple_requests_oneway(Request [] req) 327 { 328 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 329 } 330 331 protected void set_parameters(String [] args, Properties props) 332 { 333 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 334 } 335 336 protected void set_parameters(java.applet.Applet app, Properties props) 337 { 338 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 339 } 340 341 public void run() 342 { 343 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 344 } 345 346 public void shutdown(boolean wait_for_completion) 347 { 348 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 349 } 350 351 public boolean work_pending() 352 { 353 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 354 } 355 356 public void perform_work() 357 { 358 throw new NO_IMPLEMENT ("The Singleton ORB only permits factory methods"); 359 } 360 } 361 | Popular Tags |