Re: problem about DSI

David Weir <[email protected]> Tue, 13 Dec 2005 18:22:56 -0330
Newsgroups gmane.comp.corba.orbacus
Organization Object Oriented Concepts, Inc. - An IONA Company
Message-ID <[email protected]>
Hello Anil,

On Mon, Dec 12, 2005 at 06:57:39AM -0800, Anil Pandge wrote:
> Hi sir,
> 
> I am new to ORBACUS as well CORBA also. I want to know some
> information about DSI creation.
> 
> I created one server with DSI, by setting policies NON_RETAIN
> and USE_DEFAULT_SERVANT, it is running fine.
> 
> But I am not able to transport IOR of DSI servant to client.
> 
> I tried it with Create_referance call but it is giving me large
> errors while runtime, when I am calling that function from client.
> 
> My main problem is how to capture initial object reference
> and pass it to client.

Please see my comments inline:

> Code is as follows: (server side)
>
> -----
> 
> org.omg.PortableServer.POA rootPOA = 
>     org.omg.PortableServer.POAHelper.narrow(
> 
> orb.resolve_initial_references("RootPOA"));
> org.omg.PortableServer.POAManager manager =
>     rootPOA.the_POAManager(); 
> 
> // Create the account POA with the right policies
> 
> org.omg.CORBA.Policy[] accountPolicies = {
>     rootPOA.create_servant_retention_policy(
>         ServantRetentionPolicyValue.NON_RETAIN),
>     rootPOA.create_request_processing_policy(
>         RequestProcessingPolicyValue.USE_DEFAULT_SERVANT),
> };
> 
> POA accountPOA = rootPOA.create_POA("bank_account_poa",
>                                     manager,
>                                     accountPolicies);
> 
> AccountImpl accountServant = new AccountImpl(orb);
> accountPOA.set_servant(accountServant);

Assuming that AccountImpl inherits from
"org.omg.PortableServer.DynamicImplementation", I would have
thought that the AccountImpl would also take "accountPOA" as 
an argument. Then, you would be able to do the following:

-----

byte[] oidDSI = ("accountDSI").getBytes();
try
{
    accountPOA.activate_object_with_id(oidDSI, accountServant);
}
catch ...
{
}

org.omg.CORBA.Object objDSI = 
    accountPOA.create_reference_with_id(oidDSI, "IDL:Bank/Account:1.0"); 

Then do "object_to_string" as you did in your example.

-----

I think this boils down to the same thing that you tried except the
servant id is explicitly provided. The USER_ID policy is normally
specified for a POAManager that contains DSI servants.

> 
> org.omg.CORBA.Object obj = 
>     accountPOA.create_reference("IDL:Bank/Account:1.0"); 
> 
> try{
>     String fname = "accout.ior";
>     PrintWriter out = new PrintWriter(new FileWriter(fname));
>     out.println(orb.object_to_string(obj));
>     out.flush();
>     out.close();
>  }
>  catch(IOException ex){
>      ex.printStackTrace();
>  }
>  
>  manager.activate();
> 
> -----
>
> Can you please help me? Can you tell me any good document
> which will tell about DSI?

For more information on DSI, please take a look at the following 
article:

http://www.cuj.com/documents/s=7977/cujcexp2011vinoski/

There are more articles in this series that discuss other aspects of
Dynamic CORBA; they are referenced from the above article.

> Thanks.
> -Anil Pandge.

Cheers,
Dave

-- 
David Weir                          
Team Orbacus - Your CORBA Source
E-Mail: [email protected]
WWW: http://www.orbacus.com
_______________________________________________
OB-Users Mailing List - [email protected]
http://mail.ooc.nf.ca/mailman/listinfo/ob-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html