Previous Table of Contents Next


17.7.3 ICORBAFactory Interface


   All interworking solutions that expose COM Views of CORBA objects shall expose the ICORBAFactory interface. This interface is designed to support general, simple mechanisms for creating new CORBA object instances and binding to existing CORBA object references by name.

   interface ICORBAFactory: IUnknown {HRESULT CreateObject( [in] LPWSTR factoryName, [out, retval] IUknown ** val);HRESULT GetObject([in] LPWSTR objectName, [out, retval] IUknown ** val);}

   The UUID for the ICORBAFactory interface is:

   {204F6240-3AEC-11cf-BBFC-444553540000}

   A COM class implementing ICORBAFactory must be registered in the Windows System Registry on the client machine using the following class id, class id tag, and Program Id respectively:

   {913D82C0-3B00-11cf-BBFC-444553540000}DEFINE_GUID(IID_ICORBAFactory, 0x913d82c0, 0x3b00, 0x11cf, 0xbb, 0xfc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);“CORBA.Factory.COM?

   The CORBA factory object may be implemented as a singleton object (i.e., subsequent calls to create the object may return the same interface pointer).

   We define a similar interface, DICORBAFactory, that supports creating new CORBA object instances and binding to existing CORBA objects for Automation clients. DICORBAFactory is an Automation Dual Interface. (For an explanation of Automation Dual interfaces, see the Mapping: Automation and CORBA chapter.)

   interface DICORBAFactory: IDispatch {HRESULT CreateObject( [in] BSTR factoryName, [out,retval] IDispatch ** val);HRESULT GetObject([in] BSTR objectName, [out, retval]IDispatch ** val);}

   The UUID for the DICORBAFactory interface is:

   {204F6241-3AEC-11cf-BBFC-444553540000}

   An instance of this class must be registered in the Windows System Registry by calling on the client machine using the Program Id “CORBA.Factory.?

   The CreateObject and GetObject methods are intended to approximate the usage model and behavior of the Visual Basic CreateObject and GetObject functions.

   The first method, CreateObject, causes the following actions:

   Another name form that is specialized to CORBA is a single name with a preceding period, such as “.NameService?. When the name takes this form, the Interworking solution shall interpret the identifier (without the preceding period) as a name in the ORB Initialization interface. Specifically, the name shall be used as the parameter to an invocation of the CORBA::ORB::ResolveInitialReferences method on the ORB pseudo-object associated with the ICORBAFactory. The resulting object reference is bound to an appropriate COM or Automation View, which is returned to the caller.