PortableServer.POA Object
activate_object(servant)
Arguments:
servant: (Servant object) The servant to activate.
Description:
Activates the specified servant so that clients are able to invoke its methods. The servant is gotten from the POA using either inheritance or delegation.
Example:
import sys, CORBA, Bank__POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
class Account(Bank__POA.Account):
pass
# Servant through inheritance
servant = Account()
poa.activate_object(servant)
activate_object_with_id(oid, servant)
Arguments:
oid: (string) Arbitrary object id.
servant: (Servant object) The servant to which to bind the object id.
Description:
Associates the object id with the servant in the POA.
Example:
import sys, CORBA, Bank__POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
class Account(Bank__POA.Account):
pass
# Servant through inheritance
servant = Account()
poa.activate_object_with_id("bank_account", servant)
deactivate_object(servant)
Arguments:
servant: (Servant object) The servant to deactivate.
Description:
Deactivates the specified servant. Clients that hold a reference to this object and try to invoke a method will receive an IDL:CORBA/OBJECT_NOT_EXIST:1.0 exception.
Example:
import sys, CORBA, Bank__POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
class Account(Bank__POA.Account):
pass
# Servant through inheritance
servant = Account()
poa.activate_object(servant)
poa.deactivate_object(servant)
servant_to_reference(servant)
Arguments:
servant: (Servant object) The servant for which to obtain a reference.
Description:
Returns a CORBA object reference for the given servant.
Example:
import sys, CORBA, Bank__POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
class Account(Bank__POA.Account):
pass
# Servant through inheritance
servant = Account()
poa.activate_object(servant)
ref = poa.servant_to_reference(servant)
print "Reference for servant:", ref
reference_to_servant(reference)
Arguments:
reference: (CORBA.Object) The reference for which to obtain a servant.
Description:
Returns the servant for the object represented by the CORBA.Object reference.
Example:
import sys, CORBA, Bank__POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
class Account(Bank__POA.Account):
pass
# Servant through inheritance
servant = Account()
poa.activate_object(servant)
ref = poa.servant_to_reference(servant)
if servant == poa.reference_to_servant(ref):
print "We've come full circle."
_get_the_POAManager()
Description:
Returns the POA's manager, a PortableServer.POAManager object. PortableServer.POAManager currently only implements one method, activate(), which must be invoked prior to calling CORBA.ORB.run()
Example:
import sys, CORBA, Bank__POA
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
class Account(Bank__POA.Account):
pass
# Servant through inheritance
ref = Account()._this()
open("./bank.ior", "w").write(orb.object_to_string(ref))
poa._get_the_POAManager().activate()
orb.run()
|