Wed, 26 Feb 2014 23:04:12 +0000
8035618: Four api/org_omg/CORBA TCK tests fail under plugin only
Reviewed-by: mchung, chegar
duke@1 | 1 | /* |
coffeys@591 | 2 | * Copyright (c) 2002, 2014, 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 | |
mbankal@445 | 100 | import sun.awt.AppContext; |
coffeys@475 | 101 | import sun.corba.SharedSecrets; |
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 | |
coffeys@591 | 173 | static class Holder { |
coffeys@591 | 174 | static final PresentationManager defaultPresentationManager = |
coffeys@591 | 175 | setupPresentationManager(); |
coffeys@591 | 176 | } |
coffeys@591 | 177 | private static final Object pmLock = new Object(); |
coffeys@591 | 178 | |
duke@1 | 179 | private static Map staticWrapperMap = new ConcurrentHashMap(); |
duke@1 | 180 | |
coffeys@380 | 181 | protected MonitoringManager monitoringManager; |
duke@1 | 182 | |
mbankal@445 | 183 | private static PresentationManager setupPresentationManager() { |
duke@1 | 184 | staticWrapper = ORBUtilSystemException.get( |
duke@1 | 185 | CORBALogDomains.RPC_PRESENTATION ) ; |
duke@1 | 186 | |
duke@1 | 187 | boolean useDynamicStub = |
duke@1 | 188 | ((Boolean)AccessController.doPrivileged( |
duke@1 | 189 | new PrivilegedAction() { |
duke@1 | 190 | public java.lang.Object run() { |
duke@1 | 191 | return Boolean.valueOf( Boolean.getBoolean ( |
duke@1 | 192 | ORBConstants.USE_DYNAMIC_STUB_PROPERTY ) ) ; |
duke@1 | 193 | } |
duke@1 | 194 | } |
duke@1 | 195 | )).booleanValue() ; |
duke@1 | 196 | |
duke@1 | 197 | PresentationManager.StubFactoryFactory dynamicStubFactoryFactory = |
duke@1 | 198 | (PresentationManager.StubFactoryFactory)AccessController.doPrivileged( |
duke@1 | 199 | new PrivilegedAction() { |
duke@1 | 200 | public java.lang.Object run() { |
duke@1 | 201 | PresentationManager.StubFactoryFactory sff = |
duke@1 | 202 | PresentationDefaults.getProxyStubFactoryFactory() ; |
duke@1 | 203 | |
duke@1 | 204 | String className = System.getProperty( |
duke@1 | 205 | ORBConstants.DYNAMIC_STUB_FACTORY_FACTORY_CLASS, |
duke@1 | 206 | "com.sun.corba.se.impl.presentation.rmi.bcel.StubFactoryFactoryBCELImpl" ) ; |
duke@1 | 207 | |
duke@1 | 208 | try { |
duke@1 | 209 | // First try the configured class name, if any |
coffeys@475 | 210 | Class<?> cls = SharedSecrets.getJavaCorbaAccess().loadClass( className ) ; |
duke@1 | 211 | sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ; |
duke@1 | 212 | } catch (Exception exc) { |
duke@1 | 213 | // Use the default. Log the error as a warning. |
duke@1 | 214 | staticWrapper.errorInSettingDynamicStubFactoryFactory( |
duke@1 | 215 | exc, className ) ; |
duke@1 | 216 | } |
duke@1 | 217 | |
duke@1 | 218 | return sff ; |
duke@1 | 219 | } |
duke@1 | 220 | } |
duke@1 | 221 | ) ; |
duke@1 | 222 | |
mbankal@445 | 223 | PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ; |
mbankal@445 | 224 | pm.setStubFactoryFactory( false, |
duke@1 | 225 | PresentationDefaults.getStaticStubFactoryFactory() ) ; |
mbankal@445 | 226 | pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; |
mbankal@445 | 227 | return pm; |
duke@1 | 228 | } |
duke@1 | 229 | |
coffeys@380 | 230 | public void destroy() { |
coffeys@380 | 231 | wrapper = null; |
coffeys@380 | 232 | omgWrapper = null; |
coffeys@380 | 233 | typeCodeMap = null; |
coffeys@380 | 234 | primitiveTypeCodeConstants = null; |
coffeys@380 | 235 | byteBufferPool = null; |
coffeys@380 | 236 | } |
coffeys@380 | 237 | |
mbankal@445 | 238 | /** |
mbankal@445 | 239 | * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific |
mbankal@445 | 240 | * AppContext to hold it. Creates and records one if needed. |
duke@1 | 241 | */ |
duke@1 | 242 | public static PresentationManager getPresentationManager() |
duke@1 | 243 | { |
coffeys@591 | 244 | SecurityManager sm = System.getSecurityManager(); |
coffeys@591 | 245 | if (sm != null && AppContext.getAppContexts().size() > 0) { |
coffeys@591 | 246 | AppContext ac = AppContext.getAppContext(); |
coffeys@591 | 247 | if (ac != null) { |
coffeys@591 | 248 | synchronized (pmLock) { |
coffeys@591 | 249 | PresentationManager pm = |
coffeys@591 | 250 | (PresentationManager) ac.get(PresentationManager.class); |
coffeys@591 | 251 | if (pm == null) { |
coffeys@591 | 252 | pm = setupPresentationManager(); |
coffeys@591 | 253 | ac.put(PresentationManager.class, pm); |
coffeys@591 | 254 | } |
coffeys@591 | 255 | return pm; |
coffeys@591 | 256 | } |
coffeys@591 | 257 | } |
mbankal@445 | 258 | } |
coffeys@591 | 259 | |
coffeys@591 | 260 | // No security manager or AppContext |
coffeys@591 | 261 | return Holder.defaultPresentationManager; |
duke@1 | 262 | } |
duke@1 | 263 | |
duke@1 | 264 | /** Get the appropriate StubFactoryFactory. This |
duke@1 | 265 | * will be dynamic or static depending on whether |
duke@1 | 266 | * com.sun.CORBA.ORBUseDynamicStub is true or false. |
duke@1 | 267 | */ |
duke@1 | 268 | public static PresentationManager.StubFactoryFactory |
duke@1 | 269 | getStubFactoryFactory() |
duke@1 | 270 | { |
mbankal@445 | 271 | PresentationManager gPM = getPresentationManager(); |
mbankal@445 | 272 | boolean useDynamicStubs = gPM.useDynamicStubs() ; |
mbankal@445 | 273 | return gPM.getStubFactoryFactory( useDynamicStubs ) ; |
duke@1 | 274 | } |
duke@1 | 275 | |
duke@1 | 276 | protected ORB() |
duke@1 | 277 | { |
duke@1 | 278 | // Initialize logging first, since it is needed nearly |
duke@1 | 279 | // everywhere (for example, in TypeCodeImpl). |
duke@1 | 280 | wrapperMap = new ConcurrentHashMap(); |
duke@1 | 281 | wrapper = ORBUtilSystemException.get( this, |
duke@1 | 282 | CORBALogDomains.RPC_PRESENTATION ) ; |
duke@1 | 283 | omgWrapper = OMGSystemException.get( this, |
duke@1 | 284 | CORBALogDomains.RPC_PRESENTATION ) ; |
duke@1 | 285 | |
duke@1 | 286 | typeCodeMap = new HashMap(); |
duke@1 | 287 | |
duke@1 | 288 | primitiveTypeCodeConstants = new TypeCodeImpl[] { |
duke@1 | 289 | new TypeCodeImpl(this, TCKind._tk_null), |
duke@1 | 290 | new TypeCodeImpl(this, TCKind._tk_void), |
duke@1 | 291 | new TypeCodeImpl(this, TCKind._tk_short), |
duke@1 | 292 | new TypeCodeImpl(this, TCKind._tk_long), |
duke@1 | 293 | new TypeCodeImpl(this, TCKind._tk_ushort), |
duke@1 | 294 | new TypeCodeImpl(this, TCKind._tk_ulong), |
duke@1 | 295 | new TypeCodeImpl(this, TCKind._tk_float), |
duke@1 | 296 | new TypeCodeImpl(this, TCKind._tk_double), |
duke@1 | 297 | new TypeCodeImpl(this, TCKind._tk_boolean), |
duke@1 | 298 | new TypeCodeImpl(this, TCKind._tk_char), |
duke@1 | 299 | new TypeCodeImpl(this, TCKind._tk_octet), |
duke@1 | 300 | new TypeCodeImpl(this, TCKind._tk_any), |
duke@1 | 301 | new TypeCodeImpl(this, TCKind._tk_TypeCode), |
duke@1 | 302 | new TypeCodeImpl(this, TCKind._tk_Principal), |
duke@1 | 303 | new TypeCodeImpl(this, TCKind._tk_objref), |
duke@1 | 304 | null, // tk_struct |
duke@1 | 305 | null, // tk_union |
duke@1 | 306 | null, // tk_enum |
duke@1 | 307 | new TypeCodeImpl(this, TCKind._tk_string), |
duke@1 | 308 | null, // tk_sequence |
duke@1 | 309 | null, // tk_array |
duke@1 | 310 | null, // tk_alias |
duke@1 | 311 | null, // tk_except |
duke@1 | 312 | new TypeCodeImpl(this, TCKind._tk_longlong), |
duke@1 | 313 | new TypeCodeImpl(this, TCKind._tk_ulonglong), |
duke@1 | 314 | new TypeCodeImpl(this, TCKind._tk_longdouble), |
duke@1 | 315 | new TypeCodeImpl(this, TCKind._tk_wchar), |
duke@1 | 316 | new TypeCodeImpl(this, TCKind._tk_wstring), |
duke@1 | 317 | new TypeCodeImpl(this, TCKind._tk_fixed), |
duke@1 | 318 | new TypeCodeImpl(this, TCKind._tk_value), |
duke@1 | 319 | new TypeCodeImpl(this, TCKind._tk_value_box), |
duke@1 | 320 | new TypeCodeImpl(this, TCKind._tk_native), |
duke@1 | 321 | new TypeCodeImpl(this, TCKind._tk_abstract_interface) |
duke@1 | 322 | } ; |
duke@1 | 323 | |
duke@1 | 324 | monitoringManager = |
duke@1 | 325 | MonitoringFactories.getMonitoringManagerFactory( ). |
duke@1 | 326 | createMonitoringManager( |
duke@1 | 327 | MonitoringConstants.DEFAULT_MONITORING_ROOT, |
duke@1 | 328 | MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION); |
duke@1 | 329 | } |
duke@1 | 330 | |
duke@1 | 331 | // Typecode support: needed in both ORBImpl and ORBSingleton |
duke@1 | 332 | public TypeCodeImpl get_primitive_tc(int kind) |
duke@1 | 333 | { |
coffeys@380 | 334 | synchronized (this) { |
coffeys@380 | 335 | checkShutdownState(); |
coffeys@380 | 336 | } |
duke@1 | 337 | try { |
duke@1 | 338 | return primitiveTypeCodeConstants[kind] ; |
duke@1 | 339 | } catch (Throwable t) { |
duke@1 | 340 | throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ; |
duke@1 | 341 | } |
duke@1 | 342 | } |
duke@1 | 343 | |
duke@1 | 344 | public synchronized void setTypeCode(String id, TypeCodeImpl code) |
duke@1 | 345 | { |
coffeys@380 | 346 | checkShutdownState(); |
duke@1 | 347 | typeCodeMap.put(id, code); |
duke@1 | 348 | } |
duke@1 | 349 | |
duke@1 | 350 | public synchronized TypeCodeImpl getTypeCode(String id) |
duke@1 | 351 | { |
coffeys@380 | 352 | checkShutdownState(); |
duke@1 | 353 | return (TypeCodeImpl)typeCodeMap.get(id); |
duke@1 | 354 | } |
duke@1 | 355 | |
duke@1 | 356 | public MonitoringManager getMonitoringManager( ) { |
coffeys@380 | 357 | synchronized (this) { |
coffeys@380 | 358 | checkShutdownState(); |
coffeys@380 | 359 | } |
duke@1 | 360 | return monitoringManager; |
duke@1 | 361 | } |
duke@1 | 362 | |
duke@1 | 363 | // Special non-standard set_parameters method for |
duke@1 | 364 | // creating a precisely controlled ORB instance. |
duke@1 | 365 | // An ORB created by this call is affected only by |
duke@1 | 366 | // those properties passes explicitly in props, not by |
duke@1 | 367 | // the system properties and orb.properties files as |
duke@1 | 368 | // with the standard ORB.init methods. |
duke@1 | 369 | public abstract void set_parameters( Properties props ) ; |
duke@1 | 370 | |
duke@1 | 371 | // ORB versioning |
duke@1 | 372 | public abstract ORBVersion getORBVersion() ; |
duke@1 | 373 | public abstract void setORBVersion( ORBVersion version ) ; |
duke@1 | 374 | |
duke@1 | 375 | // XXX This needs a better name |
duke@1 | 376 | public abstract IOR getFVDCodeBaseIOR() ; |
duke@1 | 377 | |
duke@1 | 378 | /** |
duke@1 | 379 | * Handle a bad server id for the given object key. This should |
duke@1 | 380 | * always through an exception: either a ForwardException to |
duke@1 | 381 | * allow another server to handle the request, or else an error |
duke@1 | 382 | * indication. XXX Remove after ORT for ORBD work is integrated. |
duke@1 | 383 | */ |
duke@1 | 384 | public abstract void handleBadServerId( ObjectKey okey ) ; |
duke@1 | 385 | public abstract void setBadServerIdHandler( BadServerIdHandler handler ) ; |
duke@1 | 386 | public abstract void initBadServerIdHandler() ; |
duke@1 | 387 | |
duke@1 | 388 | public abstract void notifyORB() ; |
duke@1 | 389 | |
duke@1 | 390 | public abstract PIHandler getPIHandler() ; |
duke@1 | 391 | |
duke@1 | 392 | public abstract void checkShutdownState(); |
duke@1 | 393 | |
duke@1 | 394 | // Dispatch support: in the ORB because it is needed for shutdown. |
duke@1 | 395 | // This is used by the first level server side subcontract. |
duke@1 | 396 | public abstract boolean isDuringDispatch() ; |
duke@1 | 397 | public abstract void startingDispatch(); |
duke@1 | 398 | public abstract void finishedDispatch(); |
duke@1 | 399 | |
duke@1 | 400 | /** Return this ORB's transient server ID. This is needed for |
duke@1 | 401 | * initializing object adapters. |
duke@1 | 402 | */ |
duke@1 | 403 | public abstract int getTransientServerId(); |
duke@1 | 404 | |
duke@1 | 405 | public abstract ServiceContextRegistry getServiceContextRegistry() ; |
duke@1 | 406 | |
duke@1 | 407 | public abstract RequestDispatcherRegistry getRequestDispatcherRegistry(); |
duke@1 | 408 | |
duke@1 | 409 | public abstract ORBData getORBData() ; |
duke@1 | 410 | |
duke@1 | 411 | public abstract void setClientDelegateFactory( ClientDelegateFactory factory ) ; |
duke@1 | 412 | |
duke@1 | 413 | public abstract ClientDelegateFactory getClientDelegateFactory() ; |
duke@1 | 414 | |
duke@1 | 415 | public abstract void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) ; |
duke@1 | 416 | |
duke@1 | 417 | public abstract CorbaContactInfoListFactory getCorbaContactInfoListFactory() ; |
duke@1 | 418 | |
duke@1 | 419 | // XXX These next 7 methods should be moved to a ResolverManager. |
duke@1 | 420 | |
duke@1 | 421 | /** Set the resolver used in this ORB. This resolver will be used for list_initial_services |
duke@1 | 422 | * and resolve_initial_references. |
duke@1 | 423 | */ |
duke@1 | 424 | public abstract void setResolver( Resolver resolver ) ; |
duke@1 | 425 | |
duke@1 | 426 | /** Get the resolver used in this ORB. This resolver will be used for list_initial_services |
duke@1 | 427 | * and resolve_initial_references. |
duke@1 | 428 | */ |
duke@1 | 429 | public abstract Resolver getResolver() ; |
duke@1 | 430 | |
duke@1 | 431 | /** Set the LocalResolver used in this ORB. This LocalResolver is used for |
duke@1 | 432 | * register_initial_reference only. |
duke@1 | 433 | */ |
duke@1 | 434 | public abstract void setLocalResolver( LocalResolver resolver ) ; |
duke@1 | 435 | |
duke@1 | 436 | /** Get the LocalResolver used in this ORB. This LocalResolver is used for |
duke@1 | 437 | * register_initial_reference only. |
duke@1 | 438 | */ |
duke@1 | 439 | public abstract LocalResolver getLocalResolver() ; |
duke@1 | 440 | |
duke@1 | 441 | /** Set the operation used in string_to_object calls. The Operation must expect a |
duke@1 | 442 | * String and return an org.omg.CORBA.Object. |
duke@1 | 443 | */ |
duke@1 | 444 | public abstract void setURLOperation( Operation stringToObject ) ; |
duke@1 | 445 | |
duke@1 | 446 | /** Get the operation used in string_to_object calls. The Operation must expect a |
duke@1 | 447 | * String and return an org.omg.CORBA.Object. |
duke@1 | 448 | */ |
duke@1 | 449 | public abstract Operation getURLOperation() ; |
duke@1 | 450 | |
duke@1 | 451 | /** Set the ServerRequestDispatcher that should be used for handling INS requests. |
duke@1 | 452 | */ |
duke@1 | 453 | public abstract void setINSDelegate( CorbaServerRequestDispatcher insDelegate ) ; |
duke@1 | 454 | |
duke@1 | 455 | // XXX The next 5 operations should be moved to an IORManager. |
duke@1 | 456 | |
duke@1 | 457 | /** Factory finders for the various parts of the IOR: tagged components, tagged |
duke@1 | 458 | * profiles, and tagged profile templates. |
duke@1 | 459 | */ |
duke@1 | 460 | public abstract TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() ; |
duke@1 | 461 | public abstract IdentifiableFactoryFinder getTaggedProfileFactoryFinder() ; |
duke@1 | 462 | public abstract IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() ; |
duke@1 | 463 | |
duke@1 | 464 | public abstract ObjectKeyFactory getObjectKeyFactory() ; |
duke@1 | 465 | public abstract void setObjectKeyFactory( ObjectKeyFactory factory ) ; |
duke@1 | 466 | |
duke@1 | 467 | // Logging SPI |
duke@1 | 468 | |
duke@1 | 469 | /** |
duke@1 | 470 | * Returns the logger based on the category. |
duke@1 | 471 | */ |
duke@1 | 472 | public Logger getLogger( String domain ) |
duke@1 | 473 | { |
coffeys@380 | 474 | synchronized (this) { |
coffeys@380 | 475 | checkShutdownState(); |
coffeys@380 | 476 | } |
duke@1 | 477 | ORBData odata = getORBData() ; |
duke@1 | 478 | |
duke@1 | 479 | // Determine the correct ORBId. There are 3 cases: |
duke@1 | 480 | // 1. odata is null, which happens if we are getting a logger before |
duke@1 | 481 | // ORB initialization is complete. In this case we cannot determine |
duke@1 | 482 | // the ORB ID (it's not known yet), so we set the ORBId to |
duke@1 | 483 | // _INITIALIZING_. |
duke@1 | 484 | // 2. odata is not null, so initialization is complete, but ORBId is set to |
duke@1 | 485 | // the default "". To avoid a ".." in |
duke@1 | 486 | // the log domain, we simply use _DEFAULT_ in this case. |
duke@1 | 487 | // 3. odata is not null, ORBId is not "": just use the ORBId. |
duke@1 | 488 | String ORBId ; |
duke@1 | 489 | if (odata == null) |
duke@1 | 490 | ORBId = "_INITIALIZING_" ; |
duke@1 | 491 | else { |
duke@1 | 492 | ORBId = odata.getORBId() ; |
duke@1 | 493 | if (ORBId.equals("")) |
duke@1 | 494 | ORBId = "_DEFAULT_" ; |
duke@1 | 495 | } |
duke@1 | 496 | |
duke@1 | 497 | return getCORBALogger( ORBId, domain ) ; |
duke@1 | 498 | } |
duke@1 | 499 | |
duke@1 | 500 | public static Logger staticGetLogger( String domain ) |
duke@1 | 501 | { |
duke@1 | 502 | return getCORBALogger( "_CORBA_", domain ) ; |
duke@1 | 503 | } |
duke@1 | 504 | |
duke@1 | 505 | private static Logger getCORBALogger( String ORBId, String domain ) |
duke@1 | 506 | { |
duke@1 | 507 | String fqLogDomain = CORBALogDomains.TOP_LEVEL_DOMAIN + "." + |
duke@1 | 508 | ORBId + "." + domain; |
duke@1 | 509 | |
duke@1 | 510 | return Logger.getLogger( fqLogDomain, ORBConstants.LOG_RESOURCE_FILE ); |
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 LogWrapperBase getLogWrapper( 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)wrapperMap.get( key ); |
duke@1 | 522 | if (logWrapper == null) { |
duke@1 | 523 | logWrapper = factory.create( getLogger( logDomain ) ); |
duke@1 | 524 | wrapperMap.put( key, logWrapper ); |
duke@1 | 525 | } |
duke@1 | 526 | |
duke@1 | 527 | return logWrapper; |
duke@1 | 528 | } |
duke@1 | 529 | |
duke@1 | 530 | /** get the log wrapper class (its type is dependent on the exceptionGroup) for the |
duke@1 | 531 | * given log domain and exception group in this ORB instance. |
duke@1 | 532 | */ |
duke@1 | 533 | public static LogWrapperBase staticGetLogWrapper( String logDomain, |
duke@1 | 534 | String exceptionGroup, LogWrapperFactory factory ) |
duke@1 | 535 | { |
duke@1 | 536 | StringPair key = new StringPair( logDomain, exceptionGroup ) ; |
duke@1 | 537 | |
duke@1 | 538 | LogWrapperBase logWrapper = (LogWrapperBase)staticWrapperMap.get( key ); |
duke@1 | 539 | if (logWrapper == null) { |
duke@1 | 540 | logWrapper = factory.create( staticGetLogger( logDomain ) ); |
duke@1 | 541 | staticWrapperMap.put( key, logWrapper ); |
duke@1 | 542 | } |
duke@1 | 543 | |
duke@1 | 544 | return logWrapper; |
duke@1 | 545 | } |
duke@1 | 546 | |
duke@1 | 547 | // get a reference to a ByteBufferPool, a pool of NIO ByteBuffers |
duke@1 | 548 | // NOTE: ByteBuffer pool must be unique per ORB, not per process. |
duke@1 | 549 | // There can be more than one ORB per process. |
duke@1 | 550 | // This method must also be inherited by both ORB and ORBSingleton. |
duke@1 | 551 | public ByteBufferPool getByteBufferPool() |
duke@1 | 552 | { |
coffeys@380 | 553 | synchronized (this) { |
coffeys@380 | 554 | checkShutdownState(); |
coffeys@380 | 555 | } |
duke@1 | 556 | if (byteBufferPool == null) |
duke@1 | 557 | byteBufferPool = new ByteBufferPoolImpl(this); |
duke@1 | 558 | |
duke@1 | 559 | return byteBufferPool; |
duke@1 | 560 | } |
duke@1 | 561 | |
duke@1 | 562 | public abstract void setThreadPoolManager(ThreadPoolManager mgr); |
duke@1 | 563 | |
duke@1 | 564 | public abstract ThreadPoolManager getThreadPoolManager(); |
duke@1 | 565 | |
duke@1 | 566 | public abstract CopierManager getCopierManager() ; |
duke@1 | 567 | } |
duke@1 | 568 | |
duke@1 | 569 | // End of file. |