Class ORBInitializerHolder
- java.lang.Object
-
- org.omg.PortableInterceptor.ORBInitializerHolder
-
- All Implemented Interfaces:
Streamable
public final class ORBInitializerHolder extends java.lang.Object implements Streamable
Facilitates interceptor registration and ORB initialization.Interceptors are intended to be a means by which ORB services gain access to ORB processing, effectively becoming part of the ORB. Since Interceptors are part of the ORB, when
ORB.initreturns an ORB, the Interceptors shall have been registered. Interceptors cannot be registered on an ORB after it has been returned by a call toORB.init.An Interceptor is registered by registering an associated
ORBInitializerobject which implements theORBInitializerinterface. When an ORB is initializing, it shall call each registeredORBInitializer, passing it anORBInitInfoobject which is used to register its Interceptor.Registering ORB Initializers in Java
ORBInitializers are registered via Java ORB properties.
The property names are of the form:
whereorg.omg.PortableInterceptor.ORBInitializerClass.<Service><Service>is the string name of a class which implements
To avoid name collisions, the reverse DNS name convention should be used. For example, if company X has three initializers, it could define the following properties:org.omg.PortableInterceptor.ORBInitializerorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Init1org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init2org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init3
org.omg.PortableInterceptor.ORBInitializerClassshall be collected, the<Service>portion of each property shall be extracted, an object shall be instantiated with the<Service>string as its class name, and thepre_initandpost_initmethods shall be called on that object. If there are any exceptions, the ORB shall ignore them and proceed.Example
A client-side logging service written by company X, for example, may have the following ORBInitializer implementation:
package com.x.logging; import org.omg.PortableInterceptor.Interceptor; import org.omg.PortableInterceptor.ORBInitializer; import org.omg.PortableInterceptor.ORBInitInfo; public class LoggingService implements ORBInitializer { void pre_init( ORBInitInfo info ) { // Instantiate the Logging Service s Interceptor. Interceptor interceptor = new LoggingInterceptor(); // Register the Logging Service s Interceptor. info.add_client_request_interceptor( interceptor ); } void post_init( ORBInitInfo info ) { // This service does not need two init points. } }To run a program calledMyAppusing this logging service, the user could type:java -Dorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Logging.LoggingService MyAppNotes about Registering Interceptors
Request Interceptors are registered on a per-ORB basis.
To achieve virtual per-object Interceptors, query the policies on the target from within the interception points to determine whether they should do any work.
To achieve virtual per-POA Interceptors, instantiate each POA with a different ORB. While Interceptors may be ordered administratively, there is no concept of order with respect to the registration of Interceptors. Request Interceptors are concerned with service contexts. Service contexts have no order, so there is no purpose for request Interceptors to have an order. IOR Interceptors are concerned with tagged components. Tagged components also have no order, so there is no purpose for IOR Interceptors to have an order.
Registration code should avoid using the ORB (i.e., calling
ORB.initwith the providedorb_id). Since registration occurs during ORB initialization, results of invocations on this ORB while it is in this state are undefined.- See Also:
ORBInitInfo
-
-
Field Summary
Fields Modifier and Type Field Description ORBInitializervalue
-
Constructor Summary
Constructors Constructor Description ORBInitializerHolder()ORBInitializerHolder(ORBInitializer initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void_read(InputStream i)Reads data fromistreamand initalizes thevaluefield of the Holder with the unmarshalled data.TypeCode_type()Retrieves theTypeCodeobject corresponding to the value in thevaluefield of the Holder.void_write(OutputStream o)Marshals toostreamthe value in thevaluefield of the Holder.
-
-
-
Field Detail
-
value
public ORBInitializer value
-
-
Constructor Detail
-
ORBInitializerHolder
public ORBInitializerHolder()
-
ORBInitializerHolder
public ORBInitializerHolder(ORBInitializer initialValue)
-
-
Method Detail
-
_read
public void _read(InputStream i)
Description copied from interface:StreamableReads data fromistreamand initalizes thevaluefield of the Holder with the unmarshalled data.- Specified by:
_readin interfaceStreamable- Parameters:
i- the InputStream that represents the CDR data from the wire.
-
_write
public void _write(OutputStream o)
Description copied from interface:StreamableMarshals toostreamthe value in thevaluefield of the Holder.- Specified by:
_writein interfaceStreamable- Parameters:
o- the CDR OutputStream
-
_type
public TypeCode _type()
Description copied from interface:StreamableRetrieves theTypeCodeobject corresponding to the value in thevaluefield of the Holder.- Specified by:
_typein interfaceStreamable- Returns:
- the
TypeCodeobject for the value held in the holder
-
-