[omniORB] corbaloc/corbaname

Duncan Grisby dgrisby@uk.research.att.com
Fri, 22 Feb 2002 11:42:03 +0000


On Thursday 21 February, Nick Murtagh wrote:

> How do you instantiate an object so that it listens on a specific host and 
> port with a given object key? I know this is an RTFM type question, but I 
> didn't see it mentioned in the omniORB docs, and the CORBA spec is a little 
> hard to read :)

There is no standard way to do it, so you won't find it in the CORBA
spec. omniORB does it with a special POA. You use code like this (in
Python since it's easier to read)

  orb = CORBA.ORB_init(sys.argv)
  ins_poa = orb.resolve_initial_references("omniINSPOA")

  servant = MyImplementation()
  ins_poa.activate_object_with_id("example", servant)

  ins_poa._get_the_POAManager().activate()
  orb.run()

The object is now available as corbaloc::host.name:port/example. You
should pin down the port number with -ORBpoa_iiop_port in omniORB 3 or
-ORBendPoint in omniORB 4.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --