[omniORB] help on "active_object_with_id"

Stefan Seefeld seefelds@MAGELLAN.UMontreal.CA
Tue, 07 Nov 2000 22:05:34 -0500


Victor Chen wrote:
> 
> I want to set the object ID by string defore active it, but it fail on
>    poa->activate_object_with_id(managerId,mytimeref);
> 
> How can I resolve this problem?
> 
>  try {
>     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
>     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
>     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);

the root POA isn't suitable here, as it only supports the systemId policy.
You need to allocate a new child POA, set the userId policy and use that.

>     PortableServer::POAManager_var pman = poa->the_POAManager();
>     pman->activate();
>     MyTime_impl* mytimeref = new MyTime_impl();
>     PortableServer::ObjectId_var managerId =
>                            PortableServer::string_to_ObjectId("my time object");
>     poa->activate_object_with_id(managerId,mytimeref);
>     orb->run();
>     orb->destroy();
>   }
>   catch(CORBA::SystemException&) {
>     printf("Caught CORBA::SystemException.");
>   }

Regards,	Stefan
_______________________________________________________              
              
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: seefelds@magellan.umontreal.ca

_______________________________________________________

      ...ich hab' noch einen Koffer in Berlin...