Search code examples
javacorba

Get access to the ORB into an implementation?


I have a tricky problem. And being new to CORBA, I'm unable to get out of it.

How can I instantiate an implementation object from another implementation?

Usually, if I have an interface A. I would create an A_Impl class (in a A_Impl.java file), extending from the A_POA class generated from the idl.

Then, on the server side I would do something like this :

AImpl  my_a_impl = new A_Impl ();
org.omg.CORBA.Object ref = orb.activate_object(my_a_impl);
A my_a_object = A.narrow(ref);

But what when one of the methods of another object B needs to return A?

In my B_impl class, I don't have access to the orb and thus cannot get a reference to my object by using the activate_object method.

How can I then return such an object?

Any help would be greatly appreciated. Thanks in advance !


Solution

  • It seems like (for a non comprehensible reason for me), constructors are not generated by the idl. Creating constructors allows me to simply pass objects as references and make them visible to my classes. Yes... as simple as that :)