Java Code Examples for org.omg.PortableServer.POAPackage.WrongPolicy

The following examples show how to use org.omg.PortableServer.POAPackage.WrongPolicy. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: jdk1.8-source-analysis   Source File: StubAdapter.java    License: Apache License 2.0 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 2
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <code>set_servant_manager</code>
 * <b>Section 3.3.8.10</b>
 */
public void set_servant_manager(ServantManager servantManager)
    throws WrongPolicy
{
    try {
        lock() ;

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

        mediator.setServantManager( servantManager ) ;
    } finally {
        unlock() ;
    }
}
 
Example 3
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 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 4
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <code>servant_to_id</code>
 * <b>3.3.8.19</b>
 */
public byte[] servant_to_id(Servant servant)
    throws ServantNotActive, WrongPolicy
{
    try {
        lock() ;

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

        return mediator.servantToId( servant ) ;
    } finally {
        unlock() ;
    }
}
 
Example 5
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <code>reference_to_id</code>
 * <b>3.3.8.22</b>
 */
public byte[] reference_to_id(org.omg.CORBA.Object reference)
    throws WrongAdapter, WrongPolicy
{
    try {
        lock() ;

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

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

        return internalReferenceToId( reference ) ;
    } finally {
        unlock() ;
    }
}
 
Example 6
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <code>id_to_servant</code>
 * <b>3.3.8.23</b>
 */
public Servant id_to_servant(byte[] id)
    throws ObjectNotActive, WrongPolicy
{
    try {
        lock() ;

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

        if( state >= STATE_DESTROYING ) {
            throw lifecycleWrapper().adapterDestroyed() ;
        }
        return mediator.idToServant( id ) ;
    } finally {
        unlock() ;
    }
}
 
Example 7
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 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 8
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 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 9
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 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
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 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
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * <code>servant_to_id</code>
 * <b>3.3.8.19</b>
 */
public byte[] servant_to_id(Servant servant)
    throws ServantNotActive, WrongPolicy
{
    try {
        lock() ;

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

        return mediator.servantToId( servant ) ;
    } finally {
        unlock() ;
    }
}
 
Example 12
Source Project: TencentKona-8   Source File: StubAdapter.java    License: GNU General Public License v2.0 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 13
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * <code>create_reference</code>
 * <b>3.3.8.17</b>
 */
public org.omg.CORBA.Object create_reference(String repId)
    throws WrongPolicy
{
    try {
        lock() ;

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

        return makeObject( repId, mediator.newSystemId()) ;
    } finally {
        unlock() ;
    }
}
 
Example 14
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 15
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    if (defaultServant != null)
        return defaultServant;

    throw new ObjectNotActive() ;
}
 
Example 16
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 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 17
Source Project: jdk1.8-source-analysis   Source File: POAImpl.java    License: Apache License 2.0 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 18
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 19
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 20
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 21
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 22
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 23
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
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 25
public Servant idToServant( byte[] id )
    throws WrongPolicy, ObjectNotActive
{
    if (defaultServant != null)
        return defaultServant;

    throw new ObjectNotActive() ;
}
 
Example 26
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * <code>get_servant_manager</code>
 * <b>Section 3.3.8.10</b>
 */
public ServantManager get_servant_manager() throws WrongPolicy
{
    try {
        lock() ;

        return mediator.getServantManager() ;
    } finally {
        unlock() ;
    }
}
 
Example 27
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 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 28
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 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 29
Source Project: TencentKona-8   Source File: POAImpl.java    License: GNU General Public License v2.0 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 30
public ServantManager getServantManager() throws WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 31
public Servant getDefaultServant() throws NoServant, WrongPolicy
{
    if (defaultServant == null)
        throw new NoServant();
    return defaultServant;
}
 
Example 32
public void setDefaultServant( Servant servant ) throws WrongPolicy
{
    this.defaultServant = servant;
    setDelegate(defaultServant, "DefaultServant".getBytes());
}
 
Example 33
public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 34
public void setDefaultServant( Servant servant ) throws WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 35
public void setDefaultServant( Servant servant ) throws WrongPolicy
{
    defaultServant = servant;
    setDelegate(defaultServant, "DefaultServant".getBytes());
}
 
Example 36
public ServantManager getServantManager() throws WrongPolicy
{
    throw new WrongPolicy();
}
 
Example 37
public  Key getKey(AOMEntry value) throws WrongPolicy
{
    return (Key)entryToKey.get( value ) ;
}
 
Example 38
public ServantManager getServantManager() throws WrongPolicy
{
    return activator;
}
 
Example 39
Source Project: jdk1.8-source-analysis   Source File: ActiveObjectMap.java    License: Apache License 2.0 4 votes vote down vote up
public Key getKey(Servant value) throws WrongPolicy
{
    AOMEntry entry = (AOMEntry)servantToEntry.get( value ) ;
    return getKey( entry ) ;
}
 
Example 40
Source Project: jdk1.8-source-analysis   Source File: ActiveObjectMap.java    License: Apache License 2.0 4 votes vote down vote up
public  Key getKey(AOMEntry value) throws WrongPolicy
{
    return (Key)entryToKey.get( value ) ;
}