[omniORB] IOR Distributor?

Frédéric Prin frederic.prin@silvaco.com
Thu, 18 Apr 2002 09:30:38 +0200


Hi Nick,

I just follow the discussion you had with Jennie. I had the same requirement
for my project and I use Corbaloc URI too (on a good Duncan advice!)

My pb was to properly and programatically pass the -ORBpoa_iiop_port to to
the ORB_init() function from inside the main() of the server. I do that by
pushing my strings to argc, argv (seems not very clean to me....)

I saw you use a "magic" 4th parameter of ORB_init that suits my needs ?
> CORBA::ORB_init(argc, argv, "omniORB4", options);

is it only available for OmniORB 4 ?

TIA

|        Frédéric Prin
| Senior Software Engineer
|
|         S I L V A C O
| Grenoble REsearch CEnter
| Tel 04 56 38 10 33

----- Original Message -----
From: Nick Murtagh <murtaghn@tcd.ie>
To: Jennie Holmes <jennie_l_holmes@yahoo.com>
Cc: <omniorb-list@uk.research.att.com>
Sent: Wednesday, April 17, 2002 11:46 PM
Subject: Re: [omniORB] IOR Distributor?


> On Wednesday 17 April 2002 22:13, you wrote:
> > This would be perfect!  Is there an example of it
> > somewhere, or detailed instructions on how to do
> > the omniORB server side?  All I have in my current
> > program is the root POA.  Do I just substitute the
> > string "omniINSPOA"?  And how do I give it a name?
>
> I did this myself recently. Replace <hostname>, <port>, <objectid> with
your
> own bits. And changes all the references to Object_i to whatever your
server
> implementation is called. Hope this helps!
>
> // start here
>
> // Initialise the ORB.
> const char * options[][2] =
>   {{ "endPoint","giop:tcp:<hostname>:<port>" }, { 0, 0 }};
> CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4", options)=
;
>
> // Obtain a reference to the omniINSPOA.
> CORBA::Object_var obj = orb->resolve_initial_references("omniINSPOA")=
;
> PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
>
> // We allocate the objects on the heap.  Since these are reference
> // counted objects, they will be deleted by the POA when they are no
> // longer needed.
> Object_i * object = new Object_i();
>
> // Create simple object ids
> PortableServer::ObjectId_var objectId =
>   PortableServer::string_to_ObjectId("<objectid>");
>
> // Activate the objects.  This tells the POA that the objects are
> // ready to accept requests.
> poa -> activate_object_with_id(objectId, object);
>
> // Remove references - these are now handled by the POA
> object -> _remove_ref();
>
> // Obtain a POAManager, and tell the POA to start accepting
> // requests on its objects.
> PortableServer::POAManager_var pman = poa->the_POAManager();
> pman->activate();
>
> orb->run();
> orb->destroy();
>
> // end here
>