INS service of omniORB

INS service of omniORB

Post by Thomas Richte » Wed, 23 Jul 2003 22:31:34



Hi folks,

the INS implementation of omniOrb gives me mild headaches as I'm not
quite sure how to use it. Despite the default POA, omniOrb offers a
POA named "omniINSPOA" which is supposed to create objects with simple
(human-readable) object keys. Unfortunately, I don't get these keys
to work with omniORB 4.0.0.

Here's what I'm currently doing:

1) Obtain the root POA and the omniINSPOA

Orb = CORBA::ORB_init(argc,argv);
Poa = PortableServer::POA::_narrow(Orb->resolve_initial_references("RootPOA"));
OmniINSPOA = PortableServer::POA::_narrow(Orb->resolve_initial_references("omniINSPOA"));

2) Activating the POAs.

OmniINSPOA->the_POAManager()->activate();
POAMgr = Poa->the_POAManager();
POAMgr->activate();

Q: Do I have here two separate POA managers or are both
refering to the same manager and I only need to activate once?

3) Building and activating a servant for an object to be registered
at the omniINSPOA. For that, we first need an object id (the policy of
the omniINSPOA is RETAIN and USER_ID):

PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId("VESessionMgr"); // name of the game.
Orb->the_OmniINSPOA()->activate_object_with_id(oid,this);

4) If I now "blindly" 'stringify' this registered object as follows, I get a
working, but not really "human readable" form of the object:

CORBA::Object_var obj = OmniINSPOA->id_to_reference(oid);
fprintf(stdout,"%s\n",(Orb->object_to_string(obj)));

this gives a traditional IOR: string that I'd like to avoid in first place.

5) If I generate a human-readable URI from the same object following the
rules of Corba 2.4 as follows:

fprintf(stdout,"%s\n","corbaloc::iiop:cleopatra.math.tu-berlin.de/VESessionMgr\n");

I get a non-working object reference. "cleopatra.math.tu-berlin.de" is the
name of the local machine.

6) The client of this CORBA service is a JAVA program, it either reads the
stringified object from a file, or tries to obtain it by INS thru
resolve_initial_references. Whereas the first works with "traditional"
stringifying but not with the hand-tooled URI, using INS doesn't seem to work
at all. Here's the code:

f = new BufferedReader(new FileReader("corbaIOR.txt"));
ior = f.readLine();
f.close();
ORB orb = ORB.init(args, null);          
// Traditional de-stringify works for traditional stringification. It
// does not work for the hand-made URI.
org.omg.CORBA.Object o = orb.string_to_object(ior);

// Alternative code:
// The following tries to resolve the URI by means of resolve_initial_references
// and the suitable command line argument
// "-ORBDefaultInitRef corbaloc:cleopatra.math.tu-berlin.de"
org.omg.CORBA.Object o = orb.resolve_initial_references("VESessionMgr");

Now, does anyone have a good "recipe" for providing easy, human-readable
URIs to identify CORBA objects on a given named machine on a given port in
a net?

Greetings,
        Thomas

 
 
 

INS service of omniORB

Post by Duncan Grisb » Thu, 24 Jul 2003 18:13:50




Quote:>2) Activating the POAs.

>OmniINSPOA->the_POAManager()->activate();
>POAMgr = Poa->the_POAManager();
>POAMgr->activate();

>Q: Do I have here two separate POA managers or are both
>refering to the same manager and I only need to activate once?

The two POAs have separate POA managers, so if you want to contact
objects in both POAs, you must activate both managers. If you only
have objects in the omniINSPOA, you don't need to activate the
RootPOA.

[...]

Quote:>5) If I generate a human-readable URI from the same object following the
>rules of Corba 2.4 as follows:

>fprintf(stdout,"%s\n","corbaloc::iiop:cleopatra.math.tu-berlin.de/VESessionMgr\n");

>I get a non-working object reference. "cleopatra.math.tu-berlin.de" is the
>name of the local machine.

You don't get a working object reference because you haven't done
anything to choose which port the server is listening on. If you don't
specify a port in the corbaloc URI, it defaults to 2809. You must tell
the server to listen on the port you want with an endPoint parameter.
For example, you could use a command line argument of

  -ORBendPoint giop:tcp::2809

Quote:>6) The client of this CORBA service is a JAVA program, it either reads the
>stringified object from a file, or tries to obtain it by INS thru
>resolve_initial_references.

There is no particular reason to use resolve_initial_references. You
are better off passing the corbaloc URI to string_to_object.

Once you have properly pinned the server's port down, the approach
with -ORBDefaultInitRef and resolve_initial_references will work,
though.

Cheers,

Duncan.

--
 -- Duncan Grisby         --

   -- http://www.grisby.org --

 
 
 

INS service of omniORB

Post by Thomas Richte » Sat, 26 Jul 2003 00:49:01


Hi Duncan,

Quote:> The two POAs have separate POA managers, so if you want to contact
> objects in both POAs, you must activate both managers. If you only
> have objects in the omniINSPOA, you don't need to activate the
> RootPOA.

Thanks!

Quote:> You don't get a working object reference because you haven't done
> anything to choose which port the server is listening on. If you don't
> specify a port in the corbaloc URI, it defaults to 2809. You must tell
> the server to listen on the port you want with an endPoint parameter.
> For example, you could use a command line argument of
>   -ORBendPoint giop:tcp::2809

Ah, so that's it! Great, added this, and all works like a charm
now! Thanks a lot!

Greetings,
        Thomas

 
 
 

1. Event Service for omniOrb

I am developing an integrated application using omniOrb to interface between
the applications processes. We have realised that we could do with some sort
of event service to capture particular events from anywhere in the
application and ensure that they are delivered to the appropriate process.

Does anyone know if someone has developed an event service for (or that
would be compatible with) omniOrb.

Adrian Thorne
EDS Ltd

2. RAM upgrades

3. omniorb running as nt service: it is possible?

4. FS: Original 1084S(D) Carton

5. INS (International Network Services)

6. How to install 2 different versions of Win98 on the same computer?

7. Event Service, Notification Service and Messaging Service

8. CEC'2002 - Extended Deadline

9. Service Management Software for Computer Service Businesses!!

10. Service Management Software for Computer Service Businesses!

11. Service Management Software for Computer Service Businesses!!