FileDocCategorySizeDatePackage
ORBInitInfoImpl.javaAPI DocJava SE 5 API11299Fri Aug 26 14:54:22 BST 2005com.sun.corba.se.impl.interceptors

ORBInitInfoImpl

public final class ORBInitInfoImpl extends org.omg.CORBA.LocalObject implements com.sun.corba.se.spi.legacy.interceptor.ORBInitInfoExt, org.omg.PortableInterceptor.ORBInitInfo
ORBInitInfoImpl is the implementation of the ORBInitInfo class to be passed to ORBInitializers, as described in orbos/99-12-02.

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private com.sun.corba.se.impl.logging.InterceptorsSystemException
wrapper
private com.sun.corba.se.impl.logging.ORBUtilSystemException
orbutilWrapper
private com.sun.corba.se.impl.logging.OMGSystemException
omgWrapper
private String[]
args
private String
orbId
private org.omg.IOP.CodecFactory
codecFactory
private int
stage
public static final int
STAGE_PRE_INIT
public static final int
STAGE_POST_INIT
public static final int
STAGE_CLOSED
private static final String
MESSAGE_ORBINITINFO_INVALID
Constructors Summary
ORBInitInfoImpl(com.sun.corba.se.spi.orb.ORB orb, String[] args, String orbId, org.omg.IOP.CodecFactory codecFactory)
Creates a new ORBInitInfoImpl object (scoped to package)

param
args The arguments passed to ORB_init.

 
                        
         
	     
    
	this.orb = orb;

	wrapper = InterceptorsSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
	orbutilWrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
	omgWrapper = OMGSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;

	this.args = args;
	this.orbId = orbId;
	this.codecFactory = codecFactory;
    
Methods Summary
public voidadd_client_request_interceptor(org.omg.PortableInterceptor.ClientRequestInterceptor interceptor)
This operation is used to add a client-side request Interceptor to the list of client-side request Interceptors.

If a client-side request Interceptor has already been registered with this Interceptor's name, DuplicateName is raised.

	checkStage();
	if( interceptor == null ) nullParam();

	orb.getPIHandler().register_interceptor( interceptor, 
	    InterceptorList.INTERCEPTOR_TYPE_CLIENT );
    
public voidadd_client_request_interceptor_with_policy(org.omg.PortableInterceptor.ClientRequestInterceptor interceptor, org.omg.CORBA.Policy[] policies)

	// XXX ignore policies for now
	add_client_request_interceptor( interceptor ) ;
    
public voidadd_ior_interceptor(org.omg.PortableInterceptor.IORInterceptor interceptor)
This operation is used to add an IOR Interceptor to the list of IOR Interceptors.

If an IOR Interceptor has already been registered with this Interceptor's name, DuplicateName is raised.

	checkStage();
	if( interceptor == null ) nullParam();

	orb.getPIHandler().register_interceptor( interceptor, 
	    InterceptorList.INTERCEPTOR_TYPE_IOR );
    
public voidadd_ior_interceptor_with_policy(org.omg.PortableInterceptor.IORInterceptor interceptor, org.omg.CORBA.Policy[] policies)

	// XXX ignore policies for now
	add_ior_interceptor( interceptor ) ;
    
public voidadd_server_request_interceptor(org.omg.PortableInterceptor.ServerRequestInterceptor interceptor)
This operation is used to add a server-side request Interceptor to the list of server-side request Interceptors.

If a server-side request Interceptor has already been registered with this Interceptor's name, DuplicateName is raised.

	checkStage();
	if( interceptor == null ) nullParam();
	
	orb.getPIHandler().register_interceptor( interceptor, 
	    InterceptorList.INTERCEPTOR_TYPE_SERVER );
    
public voidadd_server_request_interceptor_with_policy(org.omg.PortableInterceptor.ServerRequestInterceptor interceptor, org.omg.CORBA.Policy[] policies)

	// XXX ignore policies for now
	add_server_request_interceptor( interceptor ) ;
    
public intallocate_slot_id()
A service calls allocate_slot_id to allocate a slot on PortableInterceptor::Current.

return
The index to the slot which has been allocated.

	checkStage();

        return ((PICurrent)orb.getPIHandler().getPICurrent()).allocateSlotId( );

    
public java.lang.String[]arguments()
This attribute contains the arguments passed to ORB_init. They may or may not contain the ORB's arguments

	checkStage();
	return args;
    
private voidcheckStage()
Throws an exception if the current stage is STAGE_CLOSED. This is called before any method is invoked to ensure that no method invocations are attempted after all calls to post_init() are completed.

	if( stage == STAGE_CLOSED ) {
	    throw wrapper.orbinitinfoInvalid() ;
	}
    
public org.omg.IOP.CodecFactorycodec_factory()
This attribute is the IOP::CodecFactory. The CodecFactory is normally obtained via a call to ORB::resolve_initial_references( "CodecFactory" ) but since the ORB is not yet available and Interceptors, particularly when processing service contexts, will require a Codec, a means of obtaining a Codec is necessary during ORB intialization.

	checkStage();
	return codecFactory;
    
public com.sun.corba.se.spi.orb.ORBgetORB()
Return the ORB behind this ORBInitInfo. This is defined in the ORBInitInfoExt interface.

	return orb ;
    
private voidnullParam()
Called when an invalid null parameter was passed. Throws a BAD_PARAM with a minor code of 1

	throw orbutilWrapper.nullParam() ;
    
public java.lang.Stringorb_id()
This attribute is the ID of the ORB being initialized

	checkStage();
	return orbId;
    
public voidregister_initial_reference(java.lang.String id, org.omg.CORBA.Object obj)
See orbos/99-12-02, Chapter 11, Dynamic Initial References on page 11-81. This operation is identical to ORB::register_initial_reference described there. This same functionality exists here because the ORB, not yet fully initialized, is not yet available but initial references may need to be registered as part of Interceptor registration.

This method may not be called during post_init.

	checkStage();
	if( id == null ) nullParam();

	// As per CORBA 3.0 section 21.8.1, 
	// if null is passed as the obj parameter,
	// throw BAD_PARAM with minor code OMGSystemException.RIR_WITH_NULL_OBJECT.
	// Though the spec is talking about IDL null, we will address both
	// Java null and IDL null:
	// Note: Local Objects can never be nil!
	if( obj == null ) {
	    throw omgWrapper.rirWithNullObject() ;
	}

	// This check was made to determine that the objref is a 
	// non-local objref that is fully
	// initialized: this was called only for its side-effects of
	// possibly throwing exceptions.  However, registering
	// local objects should be permitted!
	// XXX/Revisit?
	// IOR ior = ORBUtility.getIOR( obj ) ;

	// Delegate to ORB.  If ORB version throws InvalidName, convert to
	// equivalent Portable Interceptors InvalidName.
	try {
	    orb.register_initial_reference( id, obj );
	} catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
	    InvalidName exc = new InvalidName( e.getMessage() );
	    exc.initCause( e ) ;
	    throw exc ;
	}
    
public voidregister_policy_factory(int type, org.omg.PortableInterceptor.PolicyFactory policy_factory)
Register a PolicyFactory for the given PolicyType.

If a PolicyFactory already exists for the given PolicyType, BAD_INV_ORDER is raised with a minor code of TBD_BIO+2.

	checkStage();
	if( policy_factory == null ) nullParam();
        orb.getPIHandler().registerPolicyFactory( type, policy_factory );
    
public org.omg.CORBA.Objectresolve_initial_references(java.lang.String id)
This operation is only valid during post_init. It is identical to ORB::resolve_initial_references. This same functionality exists here because the ORB, not yet fully initialized, is not yet available, but initial references may be required from the ORB as part of Interceptor registration.

(incorporates changes from errata in orbos/00-01-01)

This method may not be called during pre_init.

	checkStage();
	if( id == null ) nullParam();

	if( stage == STAGE_PRE_INIT ) {
	    // Initializer is not allowed to invoke this method during 
	    // this stage.

	    // _REVISIT_ Spec issue: What exception should really be 
	    // thrown here?
	    throw wrapper.rirInvalidPreInit() ;
	}

	org.omg.CORBA.Object objRef = null;
	
	try {
	    objRef = orb.resolve_initial_references( id );
        }
	catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
	    // Convert PIDL to IDL exception:
	    throw new InvalidName();
	}

	return objRef;
    
voidsetStage(int stage)
Sets the current stage we are in. This limits access to certain functionality.

	this.stage = stage;