CORBA 1.1 defines the notion of an object reference, which is the information needed to specify an object in the ORB. An object is defined by its ImplementationDef, InterfaceDef, and application-specific "reference data" used to identify or describe the object. An object reference is used as a handle to a remote object in method calls. When a server wants to export a reference to an object it implements, it supplies the object's ImplementationDef, InterfaceDef, and reference data to the Object Adapter, which returns the reference.
The structure of an object reference is opaque to the application, leaving its representation up to the ORB.
In DSOM, an object reference is represented as an object that can simply be used to identify the object on that server. The DSOM class that implements simple object references is called SOMDObject (corresponding to Object in CORBA 1.1.) However, in a client's address space, DSOM represents the remote object with a proxy object in order to allow the client to invoke methods on the target object as if it were local. When an object reference is passed from a server to a client, DSOM dynamically and automatically creates a proxy in the client for the remote object. Proxies are specialized forms of SOMDObject; accordingly, the base proxy class in DSOM SOMDClientProxy, is derived from SOMDObject.
In order to create a proxy object, DSOM must first build a proxy class. It does so automatically using SOM facilities for building classes at run time. The proxy class is constructed using multiple inheritance: the proxy object functionality is inherited from SOMDClientProxy, while just the interface of the target class is inherited.
In the newly derived proxy class, DSOM overrides each method inherited from the target class with a "remote dispatch" method that forwards an invocation request to the remote object. Consequently, the proxy object provides location transparency, and the client code invokes operations (methods) on the remote object using the same language bindings as if it were a local target object.
For example, recall the "Stack" class used in the tutorial example given earlier. When a server returns a reference to a remote "Stack" object to the client, DSOM builds a "Stack_ _Proxy" class (note two underscores in the name), derived from SOMDClientProxy and "Stack", and creates a proxy object from that class. When the client invokes the "push" method on the proxy,
_push(stk, &ev, 100);
the method is redispatched using the remote-dispatch method of the SOMDClientProxy class, and the method is forwarded to the target object.
CORBA defines several special operations on object references that operate on the local references (proxies) themselves, rather than on the remote objects. These operations are defined by the classes SOMOA (SOM Object Adapter), SOMDObject (which is DSOM's implementation of CORBA's Object "pseudo-class" and ORB (Object Request Broker class). Some of these operations are listed below, expressed in terms of their IDL definitions.
SOMOA methods (inherited from BOA):
sequence <octet,1024> ReferenceData; SOMDObject create (in ReferenceData id, in InterfaceDef intf in ImplementationDef impl);
Creates and returns an object reference.
SOMDObject methods:
SOMDObject duplicate ( );
Creates and returns a duplicate object reference.
void release ( );
Destroys an object reference.
boolean is_nil ( );
Tests to see if the object reference is NULL.
ORB methods:
string object_to_string ( SOMDObject obj );
Converts an object reference to a (storable) string form.
SOMDObject string_to_object ( string str );
Converts a string form back to the original object reference.