[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jacorb-developer
Subject:    [jacorb-developer] Re: Tie Problem
From:       "xpalol () mhp ! es" <xpalol () mhp ! es>
Date:       2000-12-18 12:46:55
Message-ID: 4.3.0.20001218134623.00a7e930 () mail ! mhp ! es
[Download RAW message or body]

Hello,

Thanks for your answer Gerald:

 >>    In my project I'm using a POATie solution and it works ok.  
 >> However, I'm interested in casting the object recieved into 
 >> the original implementation (because it has extra functionalities).
 >> 
 >> Here is the source to get the corba object:
 >>    implHello hi = new implHello();
 >>    org.omg.CORBA.Object ob = Utils.poa.servant_to_reference(
 >>      new foo.HelloPOATie((foo.HelloOperations)hi));
 >>    foo.Hello obHello = foo.HelloHelper.narrow(ob);
 >>    return obHello;
 >> 
 >> Once I recieve this object I'm trying to cast it into a 
 >> POATie since I want to get the delegate:
 >>    foo.HelloPOATie mytie = (foo.HelloPOATie)obHello;
 >
 > This is not legel, obHello is a reference and not a POA
 > or POATie skeleton anymore. The transformation happened
 > in the call to poa.servant_to_reference - and there is no
 > way back. 

I was afraid of this :-(

 >> Does anyone know what I'm doing wrong? Do I have to keep a 
 >> reference to the implementation?
 >
 > Yes, that's the only way.

I do not agree with you.  I've found a way back using the
reference_to_servant (from the poa):

   implHello hi = null;
   foo.HelloPOATie mytie =
     (foo.HelloPOATie)Utils.poa.reference_to_servant(obHello);
   hi = (implHello) mytie._delegate();

and it seems to work.

--

Xavier de Palol
LSI - UPC
Spain


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic