Object references, ReferenceData, and the ReferenceData table

One of SOMOA's responsibilities is to support the creation of object references (SOMDObjects). Recall from the "Stack" example discussion (in Section 6.2) that an object reference is an exportable "handle" to an object and that proxies are examples of object references. The SOMOA interface supports three operations for creating object references: create, create_constant, and create_SOM_ref.

The create and create_constant methods allow a serve to associate application-specific data about an object with an object reference for that object. This data, called reference data, is represented in a sequence of up to 1024 bytes of information about the object. This sequence, defined by the type ReferenceData, may contain the object's location, state, or any other characteristics meaningful to the application. Usually, ReferenceData is used by a server process to locate or activate an object in the server. ReferenceData, and hence the methods create and create_constant are usually only used in connection with persistent objects (objects whose lifetimes exceed that of the process that created them).

The create method differs from the create_constant method in the following way: ReferenceData associated with an object reference constructed by create_constant is immutable whereas the the ReferenceData associated with an object reference created by create can be changed (via the change_id method). References created with create_constant return true when the method is_constant is invoked on them.

The create method stores the ReferenceData in a ReferenceData table associated with the server, while create_constant maintains the ReferenceData as a constant part of the object reference. The ReferenceData associated with an object reference (whether it was constructed using create or create_constant can be retrieved via the SOMOA method get_id.

The IDL SOMOA interface declarations of create, create_constant, get_id, and change_id, and the SOMDObject interface declaration of is_constant are presented below.

/* From the SOMOA interface */

   sequence <octet,1024> Referencedata;
   SOMDObject create(in ReferenceData id, in InterfaceDef intf,
                     in ImplementationDef impl);

   SOMDObject create_constant(in ReferenceData id,
                              in InterfaceDef intf,
                              in ImplementationDef impl);

   ReferenceData get_id(in SOMDObject objref);

   void change_id(in SOMDObject objref, in ReferenceData id);

/* From the SOMDObject interface */

   boolean is_constant();

An example of how ReferenceData can be used by an application follows the description of SOMDServer objects in the next section


[Back: Managing objects in the server]
[Next: Simple SOM object references]