Previous | Table of Contents | Next |
As object references are passed back and forth between two different object models through a bridge, and the references are
mapped through Views (as is the case in this specification), the potential exists for the creation of indefinitely long chains
of Views that delegate to other Views, which in turn delegate to other Views, and so on. To avoid this, the Views of at least
one object system must be able to expose the reference for the “foreign? object managed by the View. This exposure allows
other Views to determine whether an incoming object reference parameter is itself a View and, if so, obtain the “foreign?
reference that it manages. By passing the foreign reference directly into the foreign object system, the bridge can avoid
creating View chains.
This problem potentially exists for any View representing an object in a foreign object system. The IForeignObject interface
is specified to provide bridges access to object references from foreign object systems that are encapsulated in proxies.
typedef struct {unsigned long cbMaxSize;unsigned long cbLengthUsed;[ size_is(cbMaxSize), length_is(cbLengthUsed), unique ]
long *pValue;
} objSystemIDs;interface IForeignObject : IUnknown {
HRESULT GetForeignReference([in[ objSystemIDs systemIDs,[out] long *systemID,[out] LPSTR* objRef);
HRESULT GetUniqueId([out] LPSTR *id
The UUID for IForeignObject is:
{204F6242-3AEC-11cf-BBFC-444553540000}
The first parameter (systemIDs) is an array of long values that correspond to specific object systems. These values must be
positive, unique, and publicly known. The OMG will manage the allocation of identifier values in this space to guarantee uniqueness.
The value for the CORBA object system is the long value 1. The systemIDs array contains a list of IDs for object systems for
which the caller is interested in obtaining a reference. The order of IDs in the list indicates the caller’s order of preference.
If the View can produce a reference for at least one of the specified object systems, then the second parameter (systemID)
is the ID of the first object system in the incoming array that it can satisfy. The objRef out parameter will contain the
object reference converted to a string form. Each object system is responsible for providing a mechanism to convert its references
to strings, and back into references. For the CORBA object system, the string contains the IOR string form returned by CORBA::ORB::object_to_string,
as defined in the CORBA specification.
The choice of object reference strings is motivated by the following observations:
• Language mappings for object references do not prescribe the representation of object references. Therefore, it is impossible to reliably map any given ORB’s object references onto a fixed Automation parameter type.
• The object reference being returned from GetForeignObject may be from a different ORB than the caller. IORs in string form are the only externalized standard form of object reference supported by CORBA.
The purpose of the GetRepositoryID method is to support the ability of DICORBAAny
(see Section 19.8.4, “Mapping for anys,? on page 19-24) when it
wraps an object reference, to produce a type code for the object when asked to do so via DICORBAAny’s readonly typeCode property.
It is not possible to provide a similar inverse interface exposing COM references to CORBA clients through CORBA Views because
of limitations imposed by COM’s View of object identity and use of interface pointer as references.