src/share/classes/com/sun/corba/se/spi/orb/ORB.java

Mon, 17 Dec 2012 07:43:20 -0800

author
mbankal
date
Mon, 17 Dec 2012 07:43:20 -0800
changeset 445
0ca1fc7c5f44
parent 380
47adb42076f1
child 475
39d15bbb5741
permissions
-rw-r--r--

7141694: Improving CORBA internals
Reviewed-by: coffeys, ahgross

duke@1 1 /*
coffeys@380 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@158 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@158 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@158 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 * or visit www.oracle.com if you need additional information or have any
ohair@158 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.corba.se.spi.orb;
duke@1 27
duke@1 28 import java.util.Map ;
duke@1 29 import java.util.HashMap ;
duke@1 30 import java.util.Properties ;
duke@1 31 import java.util.concurrent.ConcurrentHashMap;
duke@1 32 import java.util.logging.Logger ;
duke@1 33
duke@1 34 import java.security.AccessController ;
duke@1 35 import java.security.PrivilegedAction ;
duke@1 36
duke@1 37 import org.omg.CORBA.TCKind ;
duke@1 38
duke@1 39 import com.sun.corba.se.pept.broker.Broker ;
duke@1 40 import com.sun.corba.se.pept.transport.ByteBufferPool;
duke@1 41
duke@1 42 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
duke@1 43 import com.sun.corba.se.spi.protocol.ClientDelegateFactory ;
duke@1 44 import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
duke@1 45 import com.sun.corba.se.spi.protocol.CorbaMessageMediator ;
duke@1 46 import com.sun.corba.se.spi.protocol.PIHandler ;
duke@1 47 import com.sun.corba.se.spi.resolver.LocalResolver ;
duke@1 48 import com.sun.corba.se.spi.resolver.Resolver ;
duke@1 49 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
duke@1 50 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
duke@1 51 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
duke@1 52 import com.sun.corba.se.spi.monitoring.MonitoringConstants;
duke@1 53 import com.sun.corba.se.spi.monitoring.MonitoringManager;
duke@1 54 import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
duke@1 55 import com.sun.corba.se.spi.monitoring.MonitoringFactories;
duke@1 56
duke@1 57 import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
duke@1 58 import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
duke@1 59 import com.sun.corba.se.spi.ior.ObjectKey ;
duke@1 60 import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
duke@1 61 import com.sun.corba.se.spi.ior.IOR ;
duke@1 62
duke@1 63 import com.sun.corba.se.spi.orbutil.closure.Closure ;
duke@1 64
duke@1 65 import com.sun.corba.se.spi.orb.Operation ;
duke@1 66 import com.sun.corba.se.spi.orb.ORBData ;
duke@1 67 import com.sun.corba.se.spi.orb.ORBVersion ;
duke@1 68 import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
duke@1 69
duke@1 70 import com.sun.corba.se.spi.oa.OAInvocationInfo ;
duke@1 71 import com.sun.corba.se.spi.transport.CorbaTransportManager;
duke@1 72
duke@1 73 import com.sun.corba.se.spi.logging.LogWrapperFactory ;
duke@1 74 import com.sun.corba.se.spi.logging.LogWrapperBase ;
duke@1 75 import com.sun.corba.se.spi.logging.CORBALogDomains ;
duke@1 76
duke@1 77 import com.sun.corba.se.spi.copyobject.CopierManager ;
duke@1 78
duke@1 79 import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
duke@1 80 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;
duke@1 81
duke@1 82 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
duke@1 83
duke@1 84 // XXX needs an SPI or else it does not belong here
duke@1 85 import com.sun.corba.se.impl.corba.TypeCodeImpl ;
duke@1 86 import com.sun.corba.se.impl.corba.TypeCodeFactory ;
duke@1 87
duke@1 88 // XXX Should there be a SPI level constants ?
duke@1 89 import com.sun.corba.se.impl.orbutil.ORBConstants ;
duke@1 90
duke@1 91 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
duke@1 92
duke@1 93 import com.sun.corba.se.impl.transport.ByteBufferPoolImpl;
duke@1 94
duke@1 95 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
duke@1 96 import com.sun.corba.se.impl.logging.OMGSystemException ;
duke@1 97
duke@1 98 import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
duke@1 99
duke@1 100 import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
mbankal@445 101 import sun.awt.AppContext;
duke@1 102
duke@1 103 public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
duke@1 104 implements Broker, TypeCodeFactory
duke@1 105 {
duke@1 106 // As much as possible, this class should be stateless. However,
duke@1 107 // there are a few reasons why it is not:
duke@1 108 //
duke@1 109 // 1. The ORB debug flags are defined here because they are accessed
duke@1 110 // frequently, and we do not want a cast to the impl just for that.
duke@1 111 // 2. typeCodeMap and primitiveTypeCodeConstants are here because they
duke@1 112 // are needed in both ORBImpl and ORBSingleton.
duke@1 113 // 3. Logging support is here so that we can avoid problems with
duke@1 114 // incompletely initialized ORBs that need to perform logging.
duke@1 115
duke@1 116 // Flag set at compile time to debug flag processing: this can't
duke@1 117 // be one of the xxxDebugFlags because it is used to debug the mechanism
duke@1 118 // that sets the xxxDebugFlags!
duke@1 119 public static boolean ORBInitDebug = false;
duke@1 120
duke@1 121 // Currently defined debug flags. Any additions must be called xxxDebugFlag.
duke@1 122 // All debug flags must be public boolean types.
duke@1 123 // These are set by passing the flag -ORBDebug x,y,z in the ORB init args.
duke@1 124 // Note that x,y,z must not contain spaces.
duke@1 125 public boolean transportDebugFlag = false ;
duke@1 126 public boolean subcontractDebugFlag = false ;
duke@1 127 public boolean poaDebugFlag = false ;
duke@1 128 public boolean poaConcurrencyDebugFlag = false ;
duke@1 129 public boolean poaFSMDebugFlag = false ;
duke@1 130 public boolean orbdDebugFlag = false ;
duke@1 131 public boolean namingDebugFlag = false ;
duke@1 132 public boolean serviceContextDebugFlag = false ;
duke@1 133 public boolean transientObjectManagerDebugFlag = false ;
duke@1 134 public boolean giopVersionDebugFlag = false;
duke@1 135 public boolean shutdownDebugFlag = false;
duke@1 136 public boolean giopDebugFlag = false;
duke@1 137 public boolean invocationTimingDebugFlag = false ;
duke@1 138
duke@1 139 // SystemException log wrappers. Protected so that they can be used in
duke@1 140 // subclasses.
duke@1 141 protected static ORBUtilSystemException staticWrapper ;
duke@1 142 protected ORBUtilSystemException wrapper ;
duke@1 143 protected OMGSystemException omgWrapper ;
duke@1 144
duke@1 145 // This map is needed for resolving recursive type code placeholders
duke@1 146 // based on the unique repository id.
duke@1 147 // XXX Should this be a WeakHashMap for GC?
duke@1 148 private Map typeCodeMap ;
duke@1 149
duke@1 150 private TypeCodeImpl[] primitiveTypeCodeConstants ;
duke@1 151
duke@1 152 // ByteBufferPool - needed by both ORBImpl and ORBSingleton
duke@1 153 ByteBufferPool byteBufferPool;
duke@1 154
duke@1 155 // Local testing
duke@1 156 // XXX clean this up, probably remove these
duke@1 157 public abstract boolean isLocalHost( String hostName ) ;
duke@1 158 public abstract boolean isLocalServerId( int subcontractId, int serverId ) ;
duke@1 159
duke@1 160 // Invocation stack manipulation
duke@1 161 public abstract OAInvocationInfo peekInvocationInfo() ;
duke@1 162 public abstract void pushInvocationInfo( OAInvocationInfo info ) ;
duke@1 163 public abstract OAInvocationInfo popInvocationInfo() ;
duke@1 164
duke@1 165 public abstract CorbaTransportManager getCorbaTransportManager();
duke@1 166 public abstract LegacyServerSocketManager getLegacyServerSocketManager();
duke@1 167
duke@1 168 // wrapperMap maintains a table of LogWrapper instances used by
duke@1 169 // different classes to log exceptions. The key is a StringPair
duke@1 170 // representing LogDomain and ExceptionGroup.
duke@1 171 private Map wrapperMap ;
duke@1 172
duke@1 173 private static Map staticWrapperMap = new ConcurrentHashMap();
duke@1 174
coffeys@380 175 protected MonitoringManager monitoringManager;
duke@1 176
mbankal@445 177 private static PresentationManager setupPresentationManager() {
duke@1 178 staticWrapper = ORBUtilSystemException.get(
duke@1 179 CORBALogDomains.RPC_PRESENTATION ) ;
duke@1 180
duke@1 181 boolean useDynamicStub =
duke@1 182 ((Boolean)AccessController.doPrivileged(
duke@1 183 new PrivilegedAction() {
duke@1 184 public java.lang.Object run() {
duke@1 185 return Boolean.valueOf( Boolean.getBoolean (
duke@1 186 ORBConstants.USE_DYNAMIC_STUB_PROPERTY ) ) ;
duke@1 187 }
duke@1 188 }
duke@1 189 )).booleanValue() ;
duke@1 190
duke@1 191 PresentationManager.StubFactoryFactory dynamicStubFactoryFactory =
duke@1 192 (PresentationManager.StubFactoryFactory)AccessController.doPrivileged(
duke@1 193 new PrivilegedAction() {
duke@1 194 public java.lang.Object run() {
duke@1 195 PresentationManager.StubFactoryFactory sff =
duke@1 196 PresentationDefaults.getProxyStubFactoryFactory() ;
duke@1 197
duke@1 198 String className = System.getProperty(
duke@1 199 ORBConstants.DYNAMIC_STUB_FACTORY_FACTORY_CLASS,
duke@1 200 "com.sun.corba.se.impl.presentation.rmi.bcel.StubFactoryFactoryBCELImpl" ) ;
duke@1 201
duke@1 202 try {
duke@1 203 // First try the configured class name, if any
duke@1 204 Class cls = ORBClassLoader.loadClass( className ) ;
duke@1 205 sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ;
duke@1 206 } catch (Exception exc) {
duke@1 207 // Use the default. Log the error as a warning.
duke@1 208 staticWrapper.errorInSettingDynamicStubFactoryFactory(
duke@1 209 exc, className ) ;
duke@1 210 }
duke@1 211
duke@1 212 return sff ;
duke@1 213 }
duke@1 214 }
duke@1 215 ) ;
duke@1 216
mbankal@445 217 PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ;
mbankal@445 218 pm.setStubFactoryFactory( false,
duke@1 219 PresentationDefaults.getStaticStubFactoryFactory() ) ;
mbankal@445 220 pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
mbankal@445 221 return pm;
duke@1 222 }
duke@1 223
coffeys@380 224 public void destroy() {
coffeys@380 225 wrapper = null;
coffeys@380 226 omgWrapper = null;
coffeys@380 227 typeCodeMap = null;
coffeys@380 228 primitiveTypeCodeConstants = null;
coffeys@380 229 byteBufferPool = null;
coffeys@380 230 }
coffeys@380 231
mbankal@445 232 /**
mbankal@445 233 * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific
mbankal@445 234 * AppContext to hold it. Creates and records one if needed.
duke@1 235 */
duke@1 236 public static PresentationManager getPresentationManager()
duke@1 237 {
mbankal@445 238 AppContext ac = AppContext.getAppContext();
mbankal@445 239 PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class);
mbankal@445 240 if (pm == null) {
mbankal@445 241 pm = setupPresentationManager();
mbankal@445 242 ac.put(PresentationManager.class, pm);
mbankal@445 243 }
mbankal@445 244 return pm;
duke@1 245 }
duke@1 246
duke@1 247 /** Get the appropriate StubFactoryFactory. This
duke@1 248 * will be dynamic or static depending on whether
duke@1 249 * com.sun.CORBA.ORBUseDynamicStub is true or false.
duke@1 250 */
duke@1 251 public static PresentationManager.StubFactoryFactory
duke@1 252 getStubFactoryFactory()
duke@1 253 {
mbankal@445 254 PresentationManager gPM = getPresentationManager();
mbankal@445 255 boolean useDynamicStubs = gPM.useDynamicStubs() ;
mbankal@445 256 return gPM.getStubFactoryFactory( useDynamicStubs ) ;
duke@1 257 }
duke@1 258
duke@1 259 protected ORB()
duke@1 260 {
duke@1 261 // Initialize logging first, since it is needed nearly
duke@1 262 // everywhere (for example, in TypeCodeImpl).
duke@1 263 wrapperMap = new ConcurrentHashMap();
duke@1 264 wrapper = ORBUtilSystemException.get( this,
duke@1 265 CORBALogDomains.RPC_PRESENTATION ) ;
duke@1 266 omgWrapper = OMGSystemException.get( this,
duke@1 267 CORBALogDomains.RPC_PRESENTATION ) ;
duke@1 268
duke@1 269 typeCodeMap = new HashMap();
duke@1 270
duke@1 271 primitiveTypeCodeConstants = new TypeCodeImpl[] {
duke@1 272 new TypeCodeImpl(this, TCKind._tk_null),
duke@1 273 new TypeCodeImpl(this, TCKind._tk_void),
duke@1 274 new TypeCodeImpl(this, TCKind._tk_short),
duke@1 275 new TypeCodeImpl(this, TCKind._tk_long),
duke@1 276 new TypeCodeImpl(this, TCKind._tk_ushort),
duke@1 277 new TypeCodeImpl(this, TCKind._tk_ulong),
duke@1 278 new TypeCodeImpl(this, TCKind._tk_float),
duke@1 279 new TypeCodeImpl(this, TCKind._tk_double),
duke@1 280 new TypeCodeImpl(this, TCKind._tk_boolean),
duke@1 281 new TypeCodeImpl(this, TCKind._tk_char),
duke@1 282 new TypeCodeImpl(this, TCKind._tk_octet),
duke@1 283 new TypeCodeImpl(this, TCKind._tk_any),
duke@1 284 new TypeCodeImpl(this, TCKind._tk_TypeCode),
duke@1 285 new TypeCodeImpl(this, TCKind._tk_Principal),
duke@1 286 new TypeCodeImpl(this, TCKind._tk_objref),
duke@1 287 null, // tk_struct
duke@1 288 null, // tk_union
duke@1 289 null, // tk_enum
duke@1 290 new TypeCodeImpl(this, TCKind._tk_string),
duke@1 291 null, // tk_sequence
duke@1 292 null, // tk_array
duke@1 293 null, // tk_alias
duke@1 294 null, // tk_except
duke@1 295 new TypeCodeImpl(this, TCKind._tk_longlong),
duke@1 296 new TypeCodeImpl(this, TCKind._tk_ulonglong),
duke@1 297 new TypeCodeImpl(this, TCKind._tk_longdouble),
duke@1 298 new TypeCodeImpl(this, TCKind._tk_wchar),
duke@1 299 new TypeCodeImpl(this, TCKind._tk_wstring),
duke@1 300 new TypeCodeImpl(this, TCKind._tk_fixed),
duke@1 301 new TypeCodeImpl(this, TCKind._tk_value),
duke@1 302 new TypeCodeImpl(this, TCKind._tk_value_box),
duke@1 303 new TypeCodeImpl(this, TCKind._tk_native),
duke@1 304 new TypeCodeImpl(this, TCKind._tk_abstract_interface)
duke@1 305 } ;
duke@1 306
duke@1 307 monitoringManager =
duke@1 308 MonitoringFactories.getMonitoringManagerFactory( ).
duke@1 309 createMonitoringManager(
duke@1 310 MonitoringConstants.DEFAULT_MONITORING_ROOT,
duke@1 311 MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
duke@1 312 }
duke@1 313
duke@1 314 // Typecode support: needed in both ORBImpl and ORBSingleton
duke@1 315 public TypeCodeImpl get_primitive_tc(int kind)
duke@1 316 {
coffeys@380 317 synchronized (this) {
coffeys@380 318 checkShutdownState();
coffeys@380 319 }
duke@1 320 try {
duke@1 321 return primitiveTypeCodeConstants[kind] ;
duke@1 322 } catch (Throwable t) {
duke@1 323 throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ;
duke@1 324 }
duke@1 325 }
duke@1 326
duke@1 327 public synchronized void setTypeCode(String id, TypeCodeImpl code)
duke@1 328 {
coffeys@380 329 checkShutdownState();
duke@1 330 typeCodeMap.put(id, code);
duke@1 331 }
duke@1 332
duke@1 333 public synchronized TypeCodeImpl getTypeCode(String id)
duke@1 334 {
coffeys@380 335 checkShutdownState();
duke@1 336 return (TypeCodeImpl)typeCodeMap.get(id);
duke@1 337 }
duke@1 338
duke@1 339 public MonitoringManager getMonitoringManager( ) {
coffeys@380 340 synchronized (this) {
coffeys@380 341 checkShutdownState();
coffeys@380 342 }
duke@1 343 return monitoringManager;
duke@1 344 }
duke@1 345
duke@1 346 // Special non-standard set_parameters method for
duke@1 347 // creating a precisely controlled ORB instance.
duke@1 348 // An ORB created by this call is affected only by
duke@1 349 // those properties passes explicitly in props, not by
duke@1 350 // the system properties and orb.properties files as
duke@1 351 // with the standard ORB.init methods.
duke@1 352 public abstract void set_parameters( Properties props ) ;
duke@1 353
duke@1 354 // ORB versioning
duke@1 355 public abstract ORBVersion getORBVersion() ;
duke@1 356 public abstract void setORBVersion( ORBVersion version ) ;
duke@1 357
duke@1 358 // XXX This needs a better name
duke@1 359 public abstract IOR getFVDCodeBaseIOR() ;
duke@1 360
duke@1 361 /**
duke@1 362 * Handle a bad server id for the given object key. This should
duke@1 363 * always through an exception: either a ForwardException to
duke@1 364 * allow another server to handle the request, or else an error
duke@1 365 * indication. XXX Remove after ORT for ORBD work is integrated.
duke@1 366 */
duke@1 367 public abstract void handleBadServerId( ObjectKey okey ) ;
duke@1 368 public abstract void setBadServerIdHandler( BadServerIdHandler handler ) ;
duke@1 369 public abstract void initBadServerIdHandler() ;
duke@1 370
duke@1 371 public abstract void notifyORB() ;
duke@1 372
duke@1 373 public abstract PIHandler getPIHandler() ;
duke@1 374
duke@1 375 public abstract void checkShutdownState();
duke@1 376
duke@1 377 // Dispatch support: in the ORB because it is needed for shutdown.
duke@1 378 // This is used by the first level server side subcontract.
duke@1 379 public abstract boolean isDuringDispatch() ;
duke@1 380 public abstract void startingDispatch();
duke@1 381 public abstract void finishedDispatch();
duke@1 382
duke@1 383 /** Return this ORB's transient server ID. This is needed for
duke@1 384 * initializing object adapters.
duke@1 385 */
duke@1 386 public abstract int getTransientServerId();
duke@1 387
duke@1 388 public abstract ServiceContextRegistry getServiceContextRegistry() ;
duke@1 389
duke@1 390 public abstract RequestDispatcherRegistry getRequestDispatcherRegistry();
duke@1 391
duke@1 392 public abstract ORBData getORBData() ;
duke@1 393
duke@1 394 public abstract void setClientDelegateFactory( ClientDelegateFactory factory ) ;
duke@1 395
duke@1 396 public abstract ClientDelegateFactory getClientDelegateFactory() ;
duke@1 397
duke@1 398 public abstract void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) ;
duke@1 399
duke@1 400 public abstract CorbaContactInfoListFactory getCorbaContactInfoListFactory() ;
duke@1 401
duke@1 402 // XXX These next 7 methods should be moved to a ResolverManager.
duke@1 403
duke@1 404 /** Set the resolver used in this ORB. This resolver will be used for list_initial_services
duke@1 405 * and resolve_initial_references.
duke@1 406 */
duke@1 407 public abstract void setResolver( Resolver resolver ) ;
duke@1 408
duke@1 409 /** Get the resolver used in this ORB. This resolver will be used for list_initial_services
duke@1 410 * and resolve_initial_references.
duke@1 411 */
duke@1 412 public abstract Resolver getResolver() ;
duke@1 413
duke@1 414 /** Set the LocalResolver used in this ORB. This LocalResolver is used for
duke@1 415 * register_initial_reference only.
duke@1 416 */
duke@1 417 public abstract void setLocalResolver( LocalResolver resolver ) ;
duke@1 418
duke@1 419 /** Get the LocalResolver used in this ORB. This LocalResolver is used for
duke@1 420 * register_initial_reference only.
duke@1 421 */
duke@1 422 public abstract LocalResolver getLocalResolver() ;
duke@1 423
duke@1 424 /** Set the operation used in string_to_object calls. The Operation must expect a
duke@1 425 * String and return an org.omg.CORBA.Object.
duke@1 426 */
duke@1 427 public abstract void setURLOperation( Operation stringToObject ) ;
duke@1 428
duke@1 429 /** Get the operation used in string_to_object calls. The Operation must expect a
duke@1 430 * String and return an org.omg.CORBA.Object.
duke@1 431 */
duke@1 432 public abstract Operation getURLOperation() ;
duke@1 433
duke@1 434 /** Set the ServerRequestDispatcher that should be used for handling INS requests.
duke@1 435 */
duke@1 436 public abstract void setINSDelegate( CorbaServerRequestDispatcher insDelegate ) ;
duke@1 437
duke@1 438 // XXX The next 5 operations should be moved to an IORManager.
duke@1 439
duke@1 440 /** Factory finders for the various parts of the IOR: tagged components, tagged
duke@1 441 * profiles, and tagged profile templates.
duke@1 442 */
duke@1 443 public abstract TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() ;
duke@1 444 public abstract IdentifiableFactoryFinder getTaggedProfileFactoryFinder() ;
duke@1 445 public abstract IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() ;
duke@1 446
duke@1 447 public abstract ObjectKeyFactory getObjectKeyFactory() ;
duke@1 448 public abstract void setObjectKeyFactory( ObjectKeyFactory factory ) ;
duke@1 449
duke@1 450 // Logging SPI
duke@1 451
duke@1 452 /**
duke@1 453 * Returns the logger based on the category.
duke@1 454 */
duke@1 455 public Logger getLogger( String domain )
duke@1 456 {
coffeys@380 457 synchronized (this) {
coffeys@380 458 checkShutdownState();
coffeys@380 459 }
duke@1 460 ORBData odata = getORBData() ;
duke@1 461
duke@1 462 // Determine the correct ORBId. There are 3 cases:
duke@1 463 // 1. odata is null, which happens if we are getting a logger before
duke@1 464 // ORB initialization is complete. In this case we cannot determine
duke@1 465 // the ORB ID (it's not known yet), so we set the ORBId to
duke@1 466 // _INITIALIZING_.
duke@1 467 // 2. odata is not null, so initialization is complete, but ORBId is set to
duke@1 468 // the default "". To avoid a ".." in
duke@1 469 // the log domain, we simply use _DEFAULT_ in this case.
duke@1 470 // 3. odata is not null, ORBId is not "": just use the ORBId.
duke@1 471 String ORBId ;
duke@1 472 if (odata == null)
duke@1 473 ORBId = "_INITIALIZING_" ;
duke@1 474 else {
duke@1 475 ORBId = odata.getORBId() ;
duke@1 476 if (ORBId.equals(""))
duke@1 477 ORBId = "_DEFAULT_" ;
duke@1 478 }
duke@1 479
duke@1 480 return getCORBALogger( ORBId, domain ) ;
duke@1 481 }
duke@1 482
duke@1 483 public static Logger staticGetLogger( String domain )
duke@1 484 {
duke@1 485 return getCORBALogger( "_CORBA_", domain ) ;
duke@1 486 }
duke@1 487
duke@1 488 private static Logger getCORBALogger( String ORBId, String domain )
duke@1 489 {
duke@1 490 String fqLogDomain = CORBALogDomains.TOP_LEVEL_DOMAIN + "." +
duke@1 491 ORBId + "." + domain;
duke@1 492
duke@1 493 return Logger.getLogger( fqLogDomain, ORBConstants.LOG_RESOURCE_FILE );
duke@1 494 }
duke@1 495
duke@1 496 /** get the log wrapper class (its type is dependent on the exceptionGroup) for the
duke@1 497 * given log domain and exception group in this ORB instance.
duke@1 498 */
duke@1 499 public LogWrapperBase getLogWrapper( String logDomain,
duke@1 500 String exceptionGroup, LogWrapperFactory factory )
duke@1 501 {
duke@1 502 StringPair key = new StringPair( logDomain, exceptionGroup ) ;
duke@1 503
duke@1 504 LogWrapperBase logWrapper = (LogWrapperBase)wrapperMap.get( key );
duke@1 505 if (logWrapper == null) {
duke@1 506 logWrapper = factory.create( getLogger( logDomain ) );
duke@1 507 wrapperMap.put( key, logWrapper );
duke@1 508 }
duke@1 509
duke@1 510 return logWrapper;
duke@1 511 }
duke@1 512
duke@1 513 /** get the log wrapper class (its type is dependent on the exceptionGroup) for the
duke@1 514 * given log domain and exception group in this ORB instance.
duke@1 515 */
duke@1 516 public static LogWrapperBase staticGetLogWrapper( String logDomain,
duke@1 517 String exceptionGroup, LogWrapperFactory factory )
duke@1 518 {
duke@1 519 StringPair key = new StringPair( logDomain, exceptionGroup ) ;
duke@1 520
duke@1 521 LogWrapperBase logWrapper = (LogWrapperBase)staticWrapperMap.get( key );
duke@1 522 if (logWrapper == null) {
duke@1 523 logWrapper = factory.create( staticGetLogger( logDomain ) );
duke@1 524 staticWrapperMap.put( key, logWrapper );
duke@1 525 }
duke@1 526
duke@1 527 return logWrapper;
duke@1 528 }
duke@1 529
duke@1 530 // get a reference to a ByteBufferPool, a pool of NIO ByteBuffers
duke@1 531 // NOTE: ByteBuffer pool must be unique per ORB, not per process.
duke@1 532 // There can be more than one ORB per process.
duke@1 533 // This method must also be inherited by both ORB and ORBSingleton.
duke@1 534 public ByteBufferPool getByteBufferPool()
duke@1 535 {
coffeys@380 536 synchronized (this) {
coffeys@380 537 checkShutdownState();
coffeys@380 538 }
duke@1 539 if (byteBufferPool == null)
duke@1 540 byteBufferPool = new ByteBufferPoolImpl(this);
duke@1 541
duke@1 542 return byteBufferPool;
duke@1 543 }
duke@1 544
duke@1 545 public abstract void setThreadPoolManager(ThreadPoolManager mgr);
duke@1 546
duke@1 547 public abstract ThreadPoolManager getThreadPoolManager();
duke@1 548
duke@1 549 public abstract CopierManager getCopierManager() ;
duke@1 550 }
duke@1 551
duke@1 552 // End of file.

mercurial