Java Code Examples for org.omg.PortableServer.Servant

The following are top voted examples for showing how to use org.omg.PortableServer.Servant. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: StubAdapter.java   Source Code and License 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 2
Project: OpenJSharp   File: POAImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <code>set_servant</code>
 * <b>Section 3.3.8.13</b>
 */
public void set_servant(Servant defaultServant)
    throws WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling set_servant on poa " +
                this + " defaultServant=" + defaultServant ) ;
        }

        mediator.setDefaultServant( defaultServant ) ;
    } finally {
        unlock() ;
    }
}
 
Example 3
Project: OpenJSharp   File: POAImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <code>servant_to_reference</code>
 * <b>3.3.8.20</b>
 */
public org.omg.CORBA.Object servant_to_reference(Servant servant)
    throws ServantNotActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling servant_to_reference(servant=" +
                servant + ") on poa " + this ) ;
        }

        byte[] oid = mediator.servantToId(servant);
        String repId = servant._all_interfaces( this, oid )[0] ;
        return create_reference_with_id(oid, repId);
    } finally {
        unlock() ;
    }
}
 
Example 4
Project: OpenJSharp   File: POAImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <code>reference_to_servant</code>
 * <b>3.3.8.21</b>
 */
public Servant reference_to_servant(org.omg.CORBA.Object reference)
    throws ObjectNotActive, WrongPolicy, WrongAdapter
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling reference_to_servant(reference=" +
                reference + ") on poa " + this ) ;
        }

        if ( state >= STATE_DESTROYING ) {
            throw lifecycleWrapper().adapterDestroyed() ;
        }

        // reference_to_id should throw WrongAdapter
        // if the objref was not created by this POA
        byte [] id = internalReferenceToId(reference);

        return mediator.idToServant( id ) ;
    } finally {
        unlock() ;
    }
}
 
Example 5
Project: OpenJSharp   File: POAImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <code>id_to_reference</code>
 * <b>3.3.8.24</b>
 */
public org.omg.CORBA.Object id_to_reference(byte[] id)
    throws ObjectNotActive, WrongPolicy

{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this, "Calling id_to_reference(id=" +
                id + ") on poa " + this ) ;
        }

        if( state >= STATE_DESTROYING ) {
            throw lifecycleWrapper().adapterDestroyed() ;
        }

        Servant s = mediator.idToServant( id ) ;
        String repId = s._all_interfaces( this, id )[0] ;
        return makeObject(repId, id );
    } finally {
        unlock() ;
    }
}
 
Example 6
Project: openjdk-jdk10   File: POAPolicyMediatorBase_R.java   Source Code and License 6 votes vote down vote up
protected void activateServant( ActiveObjectMap.Key key, AOMEntry entry, Servant servant )
{
    setDelegate(servant, key.id );

    if (orb.shutdownDebugFlag) {
        System.out.println("Activating object " + servant +
            " with POA " + poa);
    }

    activeObjectMap.putServant( servant, entry ) ;

    if (Util.isInstanceDefined()) {
        POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
        POAFactory factory = pm.getFactory() ;
        factory.registerPOAForServant(poa, servant);
    }
}
 
Example 7
Project: openjdk-jdk10   File: StubAdapter.java   Source Code and License 6 votes vote down vote up
/** Use implicit activation to get an object reference for the servant.
 */
public static org.omg.CORBA.Object activateServant( Servant servant )
{
    POA poa = servant._default_POA() ;
    org.omg.CORBA.Object ref = null ;

    try {
        ref = poa.servant_to_reference( servant ) ;
    } catch (ServantNotActive sna) {
        throw wrapper.getDelegateServantNotActive( sna ) ;
    } catch (WrongPolicy wp) {
        throw wrapper.getDelegateWrongPolicy( wp ) ;
    }

    // Make sure that the POAManager is activated if no other
    // POAManager state management has taken place.
    POAManager mgr = poa.the_POAManager() ;
    if (mgr instanceof POAManagerImpl) {
        POAManagerImpl mgrImpl = (POAManagerImpl)mgr ;
        mgrImpl.implicitActivation() ;
    }

    return ref ;
}
 
Example 8
Project: openjdk-jdk10   File: StubAdapter.java   Source Code and License 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 9
Project: openjdk-jdk10   File: POAImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <code>servant_to_reference</code>
 * <b>3.3.8.20</b>
 */
public org.omg.CORBA.Object servant_to_reference(Servant servant)
    throws ServantNotActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling servant_to_reference(servant=" +
                servant + ") on poa " + this ) ;
        }

        byte[] oid = mediator.servantToId(servant);
        String repId = servant._all_interfaces( this, oid )[0] ;
        return create_reference_with_id(oid, repId);
    } finally {
        unlock() ;
    }
}
 
Example 10
Project: openjdk-jdk10   File: POAImpl.java   Source Code and License 6 votes vote down vote up
/**
 * <code>reference_to_servant</code>
 * <b>3.3.8.21</b>
 */
public Servant reference_to_servant(org.omg.CORBA.Object reference)
    throws ObjectNotActive, WrongPolicy, WrongAdapter
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling reference_to_servant(reference=" +
                reference + ") on poa " + this ) ;
        }

        if ( state >= STATE_DESTROYING ) {
            throw lifecycleWrapper().adapterDestroyed() ;
        }

        // reference_to_id should throw WrongAdapter
        // if the objref was not created by this POA
        byte [] id = internalReferenceToId(reference);

        return mediator.idToServant( id ) ;
    } finally {
        unlock() ;
    }
}
 
Example 11
Project: openjdk-jdk10   File: POAPolicyMediatorBase_R.java   Source Code and License 5 votes vote down vote up
protected void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry,
    Servant s ) throws ObjectNotActive, WrongPolicy
{
    // Default does nothing, but the USE_SERVANT_MANAGER case
    // must handle etherealization

    activeObjectMap.remove(key);

    if (Util.isInstanceDefined()) {
        POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
        POAFactory factory = pm.getFactory() ;
        factory.unregisterPOAForServant(poa, s);
    }
}
 
Example 12
Project: openjdk-jdk10   File: POAPolicyMediatorBase_R.java   Source Code and License 5 votes vote down vote up
protected Servant internalKeyToServant( ActiveObjectMap.Key key )
{
    AOMEntry entry = activeObjectMap.get(key);
    if (entry == null)
        return null ;

    return activeObjectMap.getServant( entry ) ;
}
 
Example 13
Project: OpenJSharp   File: ServantManagerImpl.java   Source Code and License 5 votes vote down vote up
public Servant preinvoke(byte[] oid, POA adapter, String operation,
                         CookieHolder cookie) throws ForwardRequest
{

    String objKey = new String(oid);

    Servant servant = (Servant) contexts.get(objKey);

    if (servant == null)
    {
             servant =  readInContext(objKey);
    }

    return servant;
}
 
Example 14
Project: OpenJSharp   File: POAPolicyMediatorImpl_NR_UDS.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    if (defaultServant != null)
        return defaultServant;

    throw new ObjectNotActive() ;
}
 
Example 15
Project: OpenJSharp   File: POAImpl.java   Source Code and License 5 votes vote down vote up
/**
 * <code>activate_object</code>
 * <b>Section 3.3.8.14</b>
 */
public byte[] activate_object(Servant servant)
    throws ServantAlreadyActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling activate_object on poa " + this +
                " (servant=" + servant + ")" ) ;
        }

        // Allocate a new system-generated object-id.
        // This will throw WrongPolicy if not SYSTEM_ID
        // policy.
        byte[] id = mediator.newSystemId();

        try {
            mediator.activateObject( id, servant ) ;
        } catch (ObjectAlreadyActive oaa) {
            // This exception can not occur in this case,
            // since id is always brand new.
            //
        }

        return id ;
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting activate_object on poa " + this ) ;
        }

        unlock() ;
    }
}
 
Example 16
Project: OpenJSharp   File: POAImpl.java   Source Code and License 5 votes vote down vote up
/**
 * <code>activate_object_with_id</code>
 * <b>Section 3.3.8.15</b>
 */
public void activate_object_with_id(byte[] id,
                                                 Servant servant)
    throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling activate_object_with_id on poa " + this +
                " (servant=" + servant + " id=" + id + ")" ) ;
        }

        // Clone the id to avoid possible errors due to aliasing
        // (e.g. the client passes the id in and then changes it later).
        byte[] idClone = (byte[])(id.clone()) ;

        mediator.activateObject( idClone, servant ) ;
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting activate_object_with_id on poa " + this ) ;
        }

        unlock() ;
    }
}
 
Example 17
Project: openjdk-jdk10   File: ActiveObjectMap.java   Source Code and License 5 votes vote down vote up
public final void remove( Key key )
{
    AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ;
    Servant servant = (Servant)entryToServant.remove( entry ) ;
    if (servant != null)
        servantToEntry.remove( servant ) ;

    removeEntry( entry, key ) ;
}
 
Example 18
Project: OpenJSharp   File: POACurrent.java   Source Code and License 5 votes vote down vote up
Servant getServant()
{
    Servant servant = (Servant)(peekThrowInternal().getServantContainer());
    // If is OK for the servant to be null.
    // This could happen if POAImpl.getServant is called but
    // POAImpl.internalGetServant throws an exception.
    return servant;
}
 
Example 19
Project: OpenJSharp   File: ActiveObjectMap.java   Source Code and License 5 votes vote down vote up
public final void remove( Key key )
{
    AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ;
    Servant servant = (Servant)entryToServant.remove( entry ) ;
    if (servant != null)
        servantToEntry.remove( servant ) ;

    removeEntry( entry, key ) ;
}
 
Example 20
Project: OpenJSharp   File: POAPolicyMediatorImpl_R_UDS.java   Source Code and License 5 votes vote down vote up
protected java.lang.Object internalGetServant( byte[] id,
    String operation ) throws ForwardRequest
{
    Servant servant = internalIdToServant( id ) ;
    if (servant == null)
        servant = defaultServant ;

    if (servant == null)
        throw poa.invocationWrapper().poaNoDefaultServant() ;

    return servant ;
}
 
Example 21
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_R_AOM.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    Servant s = internalIdToServant( id ) ;

    if (s == null)
        throw new ObjectNotActive() ;
    else
        return s;
}
 
Example 22
Project: OpenJSharp   File: POAPolicyMediatorImpl_R_UDS.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
    Servant s = internalKeyToServant(key);

    if (s == null)
        if (defaultServant != null)
            s = defaultServant;

    if (s == null)
        throw new ObjectNotActive() ;

    return s;
}
 
Example 23
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_R_USM.java   Source Code and License 5 votes vote down vote up
public void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry,
    Servant servant ) throws ObjectNotActive, WrongPolicy
{
    if (activator == null)
        throw poa.invocationWrapper().poaNoServantManager() ;

    Etherealizer eth = new Etherealizer( this, key, entry, servant, poa.getDebug() ) ;
    entry.startEtherealize( eth ) ;
}
 
Example 24
Project: OpenJSharp   File: POAPolicyMediatorImpl_R_AOM.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    Servant s = internalIdToServant( id ) ;

    if (s == null)
        throw new ObjectNotActive() ;
    else
        return s;
}
 
Example 25
Project: OpenJSharp   File: POAPolicyMediatorBase_R.java   Source Code and License 5 votes vote down vote up
protected Servant internalKeyToServant( ActiveObjectMap.Key key )
{
    AOMEntry entry = activeObjectMap.get(key);
    if (entry == null)
        return null ;

    return activeObjectMap.getServant( entry ) ;
}
 
Example 26
Project: OpenJSharp   File: POAPolicyMediatorBase_R.java   Source Code and License 5 votes vote down vote up
public final void activateObject(byte[] id, Servant servant)
    throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
{
    if (isUnique && activeObjectMap.contains(servant))
        throw new ServantAlreadyActive();
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;

    AOMEntry entry = activeObjectMap.get( key ) ;

    // Check for an ObjectAlreadyActive error
    entry.activateObject() ;
    activateServant( key, entry, servant ) ;
}
 
Example 27
Project: OpenJSharp   File: POAPolicyMediatorBase_R.java   Source Code and License 5 votes vote down vote up
public Servant deactivateObject( ActiveObjectMap.Key key )
    throws ObjectNotActive, WrongPolicy
{
    if (orb.poaDebugFlag) {
        ORBUtility.dprint( this,
            "Calling deactivateObject for key " + key ) ;
    }

    try {
        AOMEntry entry = activeObjectMap.get(key);
        if (entry == null)
            throw new ObjectNotActive();

        Servant s = activeObjectMap.getServant( entry ) ;
        if (s == null)
            throw new ObjectNotActive();

        if (orb.poaDebugFlag) {
            System.out.println("Deactivating object " + s + " with POA " + poa);
        }

        deactivateHelper( key, entry, s ) ;

        return s ;
    } finally {
        if (orb.poaDebugFlag) {
            ORBUtility.dprint( this,
                "Exiting deactivateObject" ) ;
        }
    }
}
 
Example 28
Project: OpenJSharp   File: POAPolicyMediatorImpl_R_USM.java   Source Code and License 5 votes vote down vote up
public Etherealizer( POAPolicyMediatorImpl_R_USM mediator,
    ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
    boolean debug )
{
    this.mediator = mediator ;
    this.key = key ;
    this.entry = entry;
    this.servant = servant;
    this.debug = debug ;
}
 
Example 29
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_R_UDS.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
    Servant s = internalKeyToServant(key);

    if (s == null)
        if (defaultServant != null)
            s = defaultServant;

    if (s == null)
        throw new ObjectNotActive() ;

    return s;
}
 
Example 30
Project: OpenJSharp   File: POAPolicyMediatorImpl_R_USM.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
    AOMEntry entry = activeObjectMap.get(key);

    Servant servant = activeObjectMap.getServant( entry ) ;
    if (servant != null)
        return servant ;
    else
        throw new ObjectNotActive() ;
}
 
Example 31
Project: openjdk-jdk10   File: POACurrent.java   Source Code and License 5 votes vote down vote up
Servant getServant()
{
    Servant servant = (Servant)(peekThrowInternal().getServantContainer());
    // If is OK for the servant to be null.
    // This could happen if POAImpl.getServant is called but
    // POAImpl.internalGetServant throws an exception.
    return servant;
}
 
Example 32
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_R_USM.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
    AOMEntry entry = activeObjectMap.get(key);

    Servant servant = activeObjectMap.getServant( entry ) ;
    if (servant != null)
        return servant ;
    else
        throw new ObjectNotActive() ;
}
 
Example 33
Project: OpenJSharp   File: ServerRequestInfoImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example 34
Project: openjdk-jdk10   File: POAPolicyMediatorBase_R.java   Source Code and License 5 votes vote down vote up
public Servant deactivateObject( ActiveObjectMap.Key key )
    throws ObjectNotActive, WrongPolicy
{
    if (orb.poaDebugFlag) {
        ORBUtility.dprint( this,
            "Calling deactivateObject for key " + key ) ;
    }

    try {
        AOMEntry entry = activeObjectMap.get(key);
        if (entry == null)
            throw new ObjectNotActive();

        Servant s = activeObjectMap.getServant( entry ) ;
        if (s == null)
            throw new ObjectNotActive();

        if (orb.poaDebugFlag) {
            System.out.println("Deactivating object " + s + " with POA " + poa);
        }

        deactivateHelper( key, entry, s ) ;

        return s ;
    } finally {
        if (orb.poaDebugFlag) {
            ORBUtility.dprint( this,
                "Exiting deactivateObject" ) ;
        }
    }
}
 
Example 35
Project: openjdk-jdk10   File: ServantManagerImpl.java   Source Code and License 5 votes vote down vote up
public Servant preinvoke(byte[] oid, POA adapter, String operation,
                         CookieHolder cookie) throws ForwardRequest
{

    String objKey = new String(oid);

    Servant servant = (Servant) contexts.get(objKey);

    if (servant == null)
    {
             servant =  readInContext(objKey);
    }

    return servant;
}
 
Example 36
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_NR_UDS.java   Source Code and License 5 votes vote down vote up
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    if (defaultServant != null)
        return defaultServant;

    throw new ObjectNotActive() ;
}
 
Example 37
Project: openjdk-jdk10   File: POAImpl.java   Source Code and License 5 votes vote down vote up
/**
 * <code>get_servant</code>
 * <b>Section 3.3.8.12</b>
 */
public Servant get_servant() throws NoServant, WrongPolicy
{
    try {
        lock() ;

        return mediator.getDefaultServant() ;
    } finally {
        unlock() ;
    }
}
 
Example 38
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_NR_USM.java   Source Code and License 5 votes vote down vote up
public void returnServant()
{
    OAInvocationInfo info = orb.peekInvocationInfo();
    if (locator == null)
        return;

    try {
        poa.unlock() ;
        locator.postinvoke(info.id(), (POA)(info.oa()),
            info.getOperation(), info.getCookieHolder().value,
            (Servant)(info.getServantContainer()) );
    } finally {
        poa.lock() ;
    }
}
 
Example 39
Project: openjdk-jdk10   File: POAImpl.java   Source Code and License 5 votes vote down vote up
/**
 * <code>activate_object_with_id</code>
 * <b>Section 3.3.8.15</b>
 */
public void activate_object_with_id(byte[] id,
                                                 Servant servant)
    throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy
{
    try {
        lock() ;

        if (debug) {
            ORBUtility.dprint( this,
                "Calling activate_object_with_id on poa " + this +
                " (servant=" + servant + " id=" + id + ")" ) ;
        }

        // Clone the id to avoid possible errors due to aliasing
        // (e.g. the client passes the id in and then changes it later).
        byte[] idClone = (byte[])(id.clone()) ;

        mediator.activateObject( idClone, servant ) ;
    } finally {
        if (debug) {
            ORBUtility.dprint( this,
                "Exiting activate_object_with_id on poa " + this ) ;
        }

        unlock() ;
    }
}
 
Example 40
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_R_AOM.java   Source Code and License 4 votes vote down vote up
public Servant getDefaultServant() throws NoServant, WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 41
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_NR_USM.java   Source Code and License 4 votes vote down vote up
public void setDefaultServant( Servant servant ) throws WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 42
Project: openjdk-jdk10   File: POAPolicyMediatorBase_R.java   Source Code and License 4 votes vote down vote up
protected Servant internalIdToServant( byte[] id )
{
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
    return internalKeyToServant( key ) ;
}
 
Example 43
Project: OpenJSharp   File: NamingContextImpl.java   Source Code and License 4 votes vote down vote up
/**
* Implements resolving names in this NamingContext. The first component
* of the supplied name is resolved in this NamingContext by calling
* Resolve(). If there are no more components in the name, the
* resulting object reference is returned. Otherwise, the resulting object
* reference must have been bound as a context and be narrowable to
* a NamingContext. If this is the case, the remaining
* components of the name is resolved in the resulting NamingContext.
* This method is static for maximal reuse - even for extended naming
* context implementations where the recursive semantics still apply.
* @param impl an implementation of NamingContextDataStore
* @param n a sequence of NameComponents which is the name to be resolved.
* @return the object reference bound under the supplied name.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
* multiple components was supplied, but the first component could not be
* resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
* proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied
* name is invalid (i.e., has length less than 1).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system
* exceptions.
* @see resolve
*/
 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
                                              NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound,
            org.omg.CosNaming.NamingContextPackage.CannotProceed,
            org.omg.CosNaming.NamingContextPackage.InvalidName
 {
     org.omg.CORBA.Object obj = null;
     BindingTypeHolder bth = new BindingTypeHolder();


     // Length must be greater than 0
     if (n.length < 1)
         throw new InvalidName();

     // The identifier must be set
     if (n.length == 1) {
         synchronized (impl) {
             // Resolve first level in this context
             obj = impl.Resolve(n[0],bth);
         }
         if (obj == null) {
             // Object was not found
             throw new NotFound(NotFoundReason.missing_node,n);
         }
         return obj;
     } else {
         // n.length > 1
         if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) {
             throw new InvalidName();
         }

         NamingContext context = resolveFirstAsContext(impl,n);

         // Compute restOfName = name[1..length]
         NameComponent[] tail = new NameComponent[n.length -1];
         System.arraycopy(n,1,tail,0,n.length-1);

         // Resolve rest of name in context
         try {
             // First try to resolve using the local call, this should work
             // most of the time unless there are federated naming contexts.
             Servant servant = impl.getNSPOA().reference_to_servant(
                 context );
             return doResolve(((NamingContextDataStore)servant), tail) ;
         } catch( Exception e ) {
             return context.resolve(tail);
         }
     }
 }
 
Example 44
Project: OpenJSharp   File: ServantManagerImpl.java   Source Code and License 4 votes vote down vote up
public void postinvoke(byte[] oid, POA adapter, String operation,
                       java.lang.Object cookie, Servant servant)
{
    // nada
}
 
Example 45
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_R_USM.java   Source Code and License 4 votes vote down vote up
public void etherealizeAll()
{
    if (activator != null)  {
        Set keySet = activeObjectMap.keySet() ;

        // Copy the elements in the set to an array to avoid
        // changes in the set due to concurrent modification
        ActiveObjectMap.Key[] keys =
            (ActiveObjectMap.Key[])keySet.toArray(
                new ActiveObjectMap.Key[ keySet.size() ] ) ;

        for (int ctr=0; ctr<keySet.size(); ctr++) {
            ActiveObjectMap.Key key = keys[ctr] ;
            AOMEntry entry = activeObjectMap.get( key ) ;
            Servant servant = activeObjectMap.getServant( entry ) ;
            if (servant != null) {
                boolean remainingActivations =
                    activeObjectMap.hasMultipleIDs(entry) ;

                // Here we etherealize in the thread that called this
                // method, rather than etherealizing in a new thread
                // as in the deactivate case.  We still inform the
                // entry state machine so that only one thread at a
                // time can call the etherealize method.
                entry.startEtherealize( null ) ;
                try {
                    poa.unlock() ;
                    try {
                        activator.etherealize(key.id, poa, servant, true,
                            remainingActivations);
                    } catch (Exception exc) {
                        // ignore all exceptions
                    }
                } finally {
                    poa.lock() ;
                    entry.etherealizeComplete() ;
                }
            }
        }
    }
}
 
Example 46
Project: OpenJSharp   File: POAPolicyMediatorImpl_NR_UDS.java   Source Code and License 4 votes vote down vote up
public void setDefaultServant( Servant servant ) throws WrongPolicy
{
    this.defaultServant = servant;
    setDelegate(defaultServant, "DefaultServant".getBytes());
}
 
Example 47
Project: OpenJSharp   File: POAPolicyMediatorImpl_NR_UDS.java   Source Code and License 4 votes vote down vote up
public final void activateObject(byte[] id, Servant servant)
    throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
{
    throw new WrongPolicy();
}
 
Example 48
Project: OpenJSharp   File: POAPolicyMediatorImpl_NR_UDS.java   Source Code and License 4 votes vote down vote up
public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 49
Project: OpenJSharp   File: POAPolicyMediatorImpl_NR_UDS.java   Source Code and License 4 votes vote down vote up
public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 50
Project: openjdk-jdk10   File: POAImpl.java   Source Code and License 4 votes vote down vote up
public String[] getInterfaces( java.lang.Object servant, byte[] objectId )
{
    Servant serv = (Servant)servant ;
    return serv._all_interfaces( this, objectId ) ;
}
 
Example 51
Project: openjdk-jdk10   File: POAPolicyMediatorImpl_NR_USM.java   Source Code and License 4 votes vote down vote up
public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 52
Project: OpenJSharp   File: POAImpl.java   Source Code and License 4 votes vote down vote up
public String[] getInterfaces( java.lang.Object servant, byte[] objectId )
{
    Servant serv = (Servant)servant ;
    return serv._all_interfaces( this, objectId ) ;
}
 
Example 53
Project: OpenJSharp   File: POAPolicyMediator.java   Source Code and License 4 votes vote down vote up
void activateObject( byte[] id, Servant servant )
throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ;
 
Example 54
Project: OpenJSharp   File: POACurrent.java   Source Code and License 4 votes vote down vote up
void setServant(Servant servant)
{
    peekThrowInternal().setServant( servant );
}
 
Example 55
Project: OpenJSharp   File: ActiveObjectMap.java   Source Code and License 4 votes vote down vote up
public final boolean contains(Servant value)
{
    return servantToEntry.containsKey( value ) ;
}
 
Example 56
Project: openjdk-jdk10   File: POAPolicyMediator.java   Source Code and License 4 votes vote down vote up
void activateObject( byte[] id, Servant servant )
throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ;
 
Example 57
Project: OpenJSharp   File: ActiveObjectMap.java   Source Code and License 4 votes vote down vote up
public final void putServant( Servant servant, AOMEntry value )
{
    entryToServant.put( value, servant ) ;
    servantToEntry.put( servant, value ) ;
}
 
Example 58
Project: openjdk-jdk10   File: ActiveObjectMap.java   Source Code and License 4 votes vote down vote up
public final boolean contains(Servant value)
{
    return servantToEntry.containsKey( value ) ;
}
 
Example 59
Project: openjdk-jdk10   File: ActiveObjectMap.java   Source Code and License 4 votes vote down vote up
public final void putServant( Servant servant, AOMEntry value )
{
    entryToServant.put( value, servant ) ;
    servantToEntry.put( servant, value ) ;
}
 
Example 60
Project: OpenJSharp   File: POAPolicyMediatorBase_R.java   Source Code and License 4 votes vote down vote up
protected Servant internalIdToServant( byte[] id )
{
    ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
    return internalKeyToServant( key ) ;
}