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

IORInfoImpl

public final class IORInfoImpl extends LocalObject implements IORInfo, IORInfoExt
IORInfoImpl is the implementation of the IORInfo class, as described in orbos/99-12-02, section 7.

Fields Summary
private static final int
STATE_INITIAL
private static final int
STATE_ESTABLISHED
private static final int
STATE_DONE
private int
state
private ObjectAdapter
adapter
private ORB
orb
private ORBUtilSystemException
orbutilWrapper
private InterceptorsSystemException
wrapper
private OMGSystemException
omgWrapper
Constructors Summary
IORInfoImpl(ObjectAdapter adapter)
Creates a new IORInfo implementation. This info object will establish tagged components with the template for the provided IOR Template.


                              
        
        this.orb = adapter.getORB() ;

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

	this.adapter = adapter;
    
Methods Summary
public org.omg.PortableInterceptor.ObjectReferenceTemplateadapter_template()

	checkState( STATE_ESTABLISHED) ;

	// At this point, the iortemp must contain only a single
	// IIOPProfileTemplate.  This is a restriction of our
	// implementation.  Also, note the the ObjectReferenceTemplate
	// is called when a certain POA is created in a certain ORB
	// in a certain server, so the server_id, orb_id, and 
	// poa_id operations must be well-defined no matter what
	// kind of implementation is used: e.g., if a POA creates
	// IORs with multiple profiles, they must still all agree
	// about this information.  Thus, we are justified in
	// extracting the single IIOPProfileTemplate to create 
	// an ObjectReferenceTemplate here.

	return adapter.getAdapterTemplate() ;
    
private voidaddIORComponentToProfileInternal(org.omg.IOP.TaggedComponent tagged_component, java.util.Iterator iterator)
Internal utility method to add an IOR component to the set of profiles present in the iterator.

        // Convert the given IOP::TaggedComponent into the appropriate
        // type for the TaggedProfileTemplate
        TaggedComponentFactoryFinder finder = 
            orb.getTaggedComponentFactoryFinder();
        Object newTaggedComponent = finder.create( orb, tagged_component );
        
        // Iterate through TaggedProfileTemplates and add the given tagged
        // component to the appropriate one(s).
	boolean found = false;
        while( iterator.hasNext() ) {
	    found = true;
            TaggedProfileTemplate taggedProfileTemplate = 
                (TaggedProfileTemplate)iterator.next();
	    taggedProfileTemplate.add( newTaggedComponent );
        }

	// If no profile was found with the given id, throw a BAD_PARAM:
	// (See orbos/00-08-06, section 21.5.3.3.)
	if( !found ) {
	    throw omgWrapper.invalidProfileId() ;
	}
    
public voidadd_ior_component(org.omg.IOP.TaggedComponent tagged_component)
A portable ORB service implementation calls this method from its implementation of establish_components to add a tagged component to the set which will be included when constructing IORs. The components in this set will be included in all profiles.

Any number of components may exist with the same component ID.

param
tagged_component The IOP::TaggedComponent to add

	checkState( STATE_INITIAL ) ;

	if( tagged_component == null ) nullParam();
        addIORComponentToProfileInternal( tagged_component, 
					  adapter.getIORTemplate().iterator());
    
public voidadd_ior_component_to_profile(org.omg.IOP.TaggedComponent tagged_component, int profile_id)
A portable ORB service implementation calls this method from its implementation of establish_components to add a tagged component to the set which will be included when constructing IORs. The components in this set will be included in the specified profile.

Any number of components may exist with the same component ID.

If the given profile ID does not define a known profile or it is impossible to add components to thgat profile, BAD_PARAM is raised with a minor code of TBD_BP + 3.

param
tagged_component The IOP::TaggedComponent to add.
param
profile_id The IOP::ProfileId tof the profile to which this component will be added.

	checkState( STATE_INITIAL ) ;

	if( tagged_component == null ) nullParam();
        addIORComponentToProfileInternal( 
	    tagged_component, adapter.getIORTemplate().iteratorById( 
	    profile_id ) );
    
private voidcheckState(int expectedState)

	if (expectedState != state)
	    throw wrapper.badState1( new Integer(expectedState), new Integer(state) ) ;
    
private voidcheckState(int expectedState1, int expectedState2)

	if ((expectedState1 != state) && (expectedState2 != state))
	    throw wrapper.badState2( new Integer(expectedState1), 
		new Integer(expectedState2), new Integer(state) ) ;
    
public org.omg.PortableInterceptor.ObjectReferenceFactorycurrent_factory()

	checkState( STATE_ESTABLISHED) ;

	return adapter.getCurrentFactory() ;
    
public voidcurrent_factory(org.omg.PortableInterceptor.ObjectReferenceFactory factory)

	checkState( STATE_ESTABLISHED) ;

	adapter.setCurrentFactory( factory ) ;
    
public com.sun.corba.se.spi.oa.ObjectAdaptergetObjectAdapter()

	return adapter;
    
public intgetServerPort(java.lang.String type)

param
type The type of the server port (see connection.ORBSocketFactory for discussion).
return
The listen port number for that type.
throws
UnknownType if no port of the given type is found.

	checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;

	int port =
	    orb.getLegacyServerSocketManager()
	        .legacyGetTransientOrPersistentServerPort(type);
	if (port == -1) {
	    throw new UnknownType();
	}
	return port;
    
public org.omg.CORBA.Policyget_effective_policy(int type)
An ORB service implementation may determine what server side policy of a particular type is in effect for an IOR being constructed by calling the get_effective_policy operation. When the IOR being constructed is for an object implemented using a POA, all Policy objects passed to the PortableServer::POA::create_POA call that created that POA are accessible via get_effective_policy.

If a policy for the given type is not known to the ORB, then this operation will raise INV_POLICY with a standard minor code of 2.

param
type The CORBA::PolicyType specifying the type of policy to return.
return
The effective CORBA::Policy object of the requested type. If the given policy type is known, but no policy of that tpye is in effect, then this operation will return a nil object reference.

	checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;

	return adapter.getEffectivePolicy( type );
    
voidmakeStateDone()

	checkState( STATE_ESTABLISHED ) ;

	state = STATE_DONE ;
    
voidmakeStateEstablished()

	checkState( STATE_INITIAL ) ;

	state = STATE_ESTABLISHED ;
    
public intmanager_id()

	checkState( STATE_INITIAL, STATE_ESTABLISHED) ;

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

	throw orbutilWrapper.nullParam() ;
    
public shortstate()

	checkState( STATE_INITIAL, STATE_ESTABLISHED) ;

	return adapter.getState() ;