Previous Table of Contents Next


19.8.7 Getting Initial CORBA Object References


   The DICORBAFactory interface, described in Section 17.7.3, “ICORBAFactory Interface,? on page 17-24, provides a mechanism that is more suitable for the typical programmer in an Automation controller environment such as Visual Basic.

   The implementation of the DICORBAFactory interface is not prescribed, but possible options include delegating to the OMG Naming Service and using the Windows System Registry1.

   The use of this interface from Visual Basic would appear as:

   Dim theORBfactory as ObjectDim Target as ObjectSet theORBfactory=CreateObject(“CORBA.Factory?)Set Target=theORBfactory.GetObject

   (“software.sales.accounts?)

   In Visual Basic 4.0 projects that have preloaded the standard CORBA Type Library, the code could appear as follows:

   Dim Target as ObjectSet Target=theORBfactory.GetObject(“soft-ware.sales.accounts?)

   The stringified name used to identify the desired target object should follow the rules for arguments to DICORBAFactory::GetObject described in Section 17.7.3, “ICORBAFactory Interface,? on page 17-24.

   A special name space for names with a period in the first position can be used to resolve an initial reference to the OMG Object Services (for example, the Naming Service, the Life Cycle Service, and so forth). For example, a reference for the Naming Service can be found using:

   Dim NameContext as ObjectSet NameContext=theORBfactory.GetObject(“.NameService?)

   Generally the GetObject method will be used to retrieve object references from the Registry/Naming Service. The CreateObjectmethod is really just a shorthand notation for GetObject(“someName?).create. It is intended to be used for object references to objects supporting a CORBAServices Factory interface.

   1. It is always permissible to directly register a CORBA Automation bridging object directly with the Windows Registry. The administration and assignment of ProgIds for direct registration should follow the naming rules described in the Interworking Architecture chapter.