FileDocCategorySizeDatePackage
DelegateImpl.javaAPI DocJava SE 5 API3703Fri Aug 26 14:54:26 BST 2005com.sun.corba.se.impl.oa.poa

DelegateImpl

public class DelegateImpl extends Object implements org.omg.PortableServer.portable.Delegate

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private com.sun.corba.se.impl.logging.POASystemException
wrapper
private POAFactory
factory
Constructors Summary
public DelegateImpl(com.sun.corba.se.spi.orb.ORB orb, POAFactory factory)

	this.orb = orb ;
	this.wrapper = POASystemException.get( orb,
	    CORBALogDomains.OA ) ;
        this.factory = factory;
    
Methods Summary
public POAdefault_POA(Servant self)

        return factory.getRootPOA();
    
public org.omg.CORBA.Objectget_interface_def(Servant Self)

	throw wrapper.methodNotImplemented() ;
    
public booleanis_a(Servant self, java.lang.String repId)

        String[] repositoryIds = self._all_interfaces(poa(self),object_id(self));
	for ( int i=0; i<repositoryIds.length; i++ )
	    if ( repId.equals(repositoryIds[i]) )
		return true;

        return false;
    
public booleannon_existent(Servant self)

        //REVISIT
        try{
            byte[] oid = orb.peekInvocationInfo().id();
            if( oid == null) return true;
            else return false;
        } catch (EmptyStackException exception){
	    throw wrapper.noContext(exception) ;
        }
    
public byte[]object_id(Servant self)

        try{
            return orb.peekInvocationInfo().id();
        } catch (EmptyStackException exception){
	    throw wrapper.noContext(exception) ;
        }
    
public org.omg.CORBA.ORBorb(Servant self)

        return orb;
    
public POApoa(Servant self)

        try {
            return (POA)orb.peekInvocationInfo().oa();
        } catch (EmptyStackException exception){
	    POA returnValue = factory.lookupPOA(self);
	    if (returnValue != null) {
		return returnValue;
	    }
	    
	    throw wrapper.noContext( exception ) ;
        }
    
public org.omg.CORBA.Objectthis_object(Servant self)

        byte[] oid;
        POA poa;
        try {
            oid = orb.peekInvocationInfo().id();
            poa = (POA)orb.peekInvocationInfo().oa();
	    String repId = self._all_interfaces(poa,oid)[0] ;
	    return poa.create_reference_with_id(oid, repId); 
        } catch (EmptyStackException notInInvocationE) { 
            //Not within an invocation context
            POAImpl defaultPOA = null;
            try {
                defaultPOA = (POAImpl)self._default_POA();
            } catch (ClassCastException exception){
		throw wrapper.defaultPoaNotPoaimpl( exception ) ;
            }

            try {
                if (defaultPOA.getPolicies().isImplicitlyActivated() ||
                    (defaultPOA.getPolicies().isUniqueIds() && 
		     defaultPOA.getPolicies().retainServants())) {
                    return defaultPOA.servant_to_reference(self);
                } else {
		    throw wrapper.wrongPoliciesForThisObject() ;
		}    
            } catch ( org.omg.PortableServer.POAPackage.ServantNotActive e) {
		throw wrapper.thisObjectServantNotActive( e ) ;
            } catch ( org.omg.PortableServer.POAPackage.WrongPolicy e) {
		throw wrapper.thisObjectWrongPolicy( e ) ;
            }
        } catch (ClassCastException e) {
	    throw wrapper.defaultPoaNotPoaimpl( e ) ;
        }