[omniORB] Default servant and SYSTEM_ID

baileyk at schneider.com baileyk at schneider.com
Thu Jun 5 16:19:00 BST 2003


I haven't seen anyone answer this, so I'll take a guess.

Not every object ID can be represented as a string (a null terminated
sequence of chars), since the object ID is a sequence<octet>.  Embedded
zero bytes are allowed in an object ID, and I think omniORB is complaining
that this makes conversion to string impossible.  The reason the system
generated ID has zero bytes is likely because its probably generated via a
numerical counter.   The first object reference generated has a four byte
object ID with all bytes zero because the counter is starting at zero.  The
next one will have three zero bytes and a one.

I think the only way to guarantee you can convert an ID to a string is to
supply the ID yourself, as you've already found.  Why do you want the
system generated IDs as strings?

Kendall




                                                                                                                                         
                      "Ben Cullen"                                                                                                       
                      <Ben.Cullen at trema.com>               To:       <omniorb-list at omniorb-support.com>                                  
                      Sent by:                             cc:                                                                           
                      omniorb-list-bounces at omniorb-        Fax to:                                                                       
                      support.com                          Subject:  [omniORB] Default servant and SYSTEM_ID                             
                                                                                                                                         
                                                                                                                                         
                      06/04/2003 10:45 AM                                                                                                
                                                                                                                                         
                                                                                                                                         




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.

_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list








More information about the omniORB-list mailing list