Mapping objects to object references

SOMDServer also defines methods that implement mappings between SOMObjects and SOMDObjects (object references) and a method for dispatching method calls on SOM objects. These methods are used by the SOM Object Adapter (SOMOA) when converting remote requests into method calls and results into responses.

Recall from the topic "Proxy objects" in Section 6.3, "Basic Client Programming", that servers return proxies to remote objects as method results, not the remote objects themselves. Recall also that class libraries need not be designed to be distributed (that is, the code that implements the classes need not be aware of the existence of proxy objects at all). Thus, it is up to the DSOM run-time environment to ensure that proxies, rather than remote objects, are returned to clients. The SOMD_SOMOAObject and SOMD_ServerObject work together to perform this service. Whenever a result from a remote method call includes a SOMObject, the SOMD_SOMOAObject invokes the somdRefFromSOMObj method on SOMD_ServerObject, asking it to create a SOMDObject from the SOMObject.

The default implementation (i.e., SOMDServer's implementation) for somdRefFromSOMObj uses the create_SOM_ref method to return a "simple" reference for the SOMObject. Application-specific server objects (instances of a subclass of SOMDServer) may elect to use create or create_constant to construct the object reference if the application requires Reference Data to be stored.


[Back: Creation and destruction of SOM objects]
[Next: Hints on the use of create vs. create_constant]