AW: [omniORB] Persistent CORBA objects
Fischer, Clemens
clemens.fischer at atlas.de
Fri Mar 2 12:14:59 GMT 2007
Hi,
creating a persistent CORBA object usually requires setting the lifespan and id assignment policy of the POA.
You can either create a new POA with the desired policies like this:
orb = CORBA.ORB_init(sys.argv)
poa = orb.resolve_initial_references("RootPOA")
policies = [ poa.create_lifespan_policy(PortableServer.PERSISTENT),
poa.create_id_assignment_policy(PortableServer.USER_ID) ]
poa = poa.create_POA("MyPOA", None, policies)
or use omniORB's special POA named "omniINSPOA" which already has these policies set:
orb = CORBA.ORB_init(sys.argv)
poa = orb.resolve_initial_references("omniINSPOA")
When you activate the servant in this POA you have to specify the object id:
id = "MyObjectId"
poa.activate_object_with_id(id, servant)
Finally you must specify the server's endpoint address by the -ORBendPoint parameter, like in this example:
python MyServer.py -ORBendPoint ::localhost:5555
The benefit of using omniINSPOA (besides simplicity) is that your object is not only persistent, but also supports the corbaloc object resolution scheme.
This example object can be resolved by:
orb.string_to_object("corbaloc:iiop:localhost:5555/MyObjectId")
Clemens
________________________________
Von: omniorb-list-bounces at omniorb-support.com [mailto:omniorb-list-bounces at omniorb-support.com] Im Auftrag von Daschner, Stefan
Gesendet: Donnerstag, 1. März 2007 11:16
An: omniorb-list at omniorb-support.com
Betreff: [omniORB] Persistent CORBA objects
Hello,
does anybody know how to make a CORBA object persistent ?
What I found in the documentation is that the POA's Lifespan Policy determines
whether objects created within it are transient or persistent.
But how can I set the POA's Lifespan Policy ?
I'm using omniORBpy-3.0-rc1.
Thanks, Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20070302/6243205a/attachment.htm
More information about the omniORB-list
mailing list