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