[omniORB] Default servant and SYSTEM_ID

Ben Cullen Ben.Cullen at trema.com
Wed Jun 4 18:45:45 BST 2003


Hello All

I am trying to implement a default servant, which relies on the POA to
generate the object IDs. I therefore create the default servant's POA
with the following policies:

CORBA::PolicyList policy_list;
policy_list.length(7);
policy_list[0] = poa ->
create_id_assignment_policy(PortableServer::SYSTEM_ID);
policy_list[1] = poa ->
create_lifespan_policy(PortableServer::TRANSIENT);
policy_list[2] = poa ->
create_servant_retention_policy(PortableServer::NON_RETAIN);
policy_list[3] = poa ->
create_id_uniqueness_policy(PortableServer::MULTIPLE_ID);
policy_list[4] = poa ->
create_request_processing_policy(PortableServer::USE_DEFAULT_SERVANT);
policy_list[5] = poa ->
create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION
);
policy_list[6] = poa ->
create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);

I then create my object reference:

CORBA::Object_var obj = _poa -> create_reference(RepositoryId_string);

And get the system generated OID from the reference:

PortableServer::ObjectId_var oid = _poa -> reference_to_id(obj);

The returned OID has length 4, however the 4 octets appear to be blank.
When I then call ObjectId_to_string(oid), I get the following exception
thrown "omniORB: throw BAD_PARAM from portableserver.cc:394
(NO,BAD_PARAM_InvalidObjectId)".

Am I doing something wrong? Are SYSTEM_ID together with
USE_DEFAULT_SERVANT policies permitted?
Any help would be much appreciated.

Note, I have managed to implement successfully using the policy:

policy_list[0] = poa ->
create_id_assignment_policy(PortableServer::SYSTEM_ID);

And generate my own OIDs by using:

PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId(my_oid_string);
CORBA::Object_var obj = _poa -> create_reference_with_id(oid,
RepositoryId_string);

Thanks in advance, Ben.



More information about the omniORB-list mailing list