36d869267588770d9dae01bbf75cc576.ppt
- Количество слайдов: 87
COM, DCOM Heterogeneous DCOM and Microsoft DNA Richard J. Bonneau, Ph. D. Systems Application Integration Engineering (SAIE) Industry Solutions Division (ISD) Compaq Computer Corp.
With Acknowledgements to: Developing With COM On UNIX And Open. VMS Mohan Rao Cavale Development Lead COM/UNIX Microsoft Corporation Frank Hayes Gaitan D’Antoni Engineering Manager Project Leader COM For Digital UNIX COM For Open. VMS Compaq
Goals of talk High level and code-level view of the COM/DCOM concepts n See a COM/DCOM demo live n Extensions of DCOM to Heterogeneous platforms n DNA as industry-level solutions integration framework n – Infrastructure Components – Industry Integration Efforts
Presentation Caveats “Techy talk” - not marketing hype n Not comprehensive - nor in-depth n A broad brush of many concepts n Hands-on - tools (VC++, VB, registry, . . . ), code segments in VB/VC, examples (VB and VC) … n Not an expert - just a knowledgeable user who likes to lecture !!! n
Outline COM - the basics n A COM demo or two. . . n Distributing COM n Heterogeneous COM - OVMS and Tru 64 UNIX n Future of COM: DNA components and DNA for different industries n Summary n
An Important Equation! For all intents and purposes: OLE = COM = DCOM = Active. X = COM+ !!! Simplifies the TLA world considerably!!
An Important In. Equation! n / COM Objects = C++ Objects n Although they can be implemented using C++ objects or Java objects or even VB objects
COM - the basics n Component Object Model n Components - critical to development of distributed 3 -tier enterprise applications – provide services to requestors (clients) – small units of software for dev and maint – easily deployed and accessible n ‘Everything’ in MS Windows 9 x/NT is a component!!
COM - the evolution Ultimate goal - software reusability!! n “In the beginning” - Single program source file n Procedures/functions and #include n Compile functions into a library and link into final image n Have compiled routines in a separate sharable library or dynamic link library n
COM - the evolution - part II On source level - Objects as organizing principle - Within a given program or through include files n Object libraries- reduce compilation overhead n What’s important? - the method calls n Interface as n – collection of methods – a connection point between client and object server n Collect interfaces into separate containers -
The basics - continued Interface: A rigorously defined binary structure allowing independent development of clients and servers n MS designed to be language, platform, hardware neutral!! n Defines the programming contract between client and server n
The interface - continued Derived from some known issues in doing multi-platform C++ development - see Don Box book (Essential COM) n Simple concept with sweeping implications when used universally - sound like Microsoft? ? n A component is then a software vehicle for providing access to one or more interfaces n
Universal Interface definitions IDL interface IWarehouse : IDispatch { HRESULT Order. Fulfill( [in] long l. Part. Number, [in] long l. Num. Items, [out] unsigned char * ucp. Result); HRESULT Reset ([in] long Re. Stock. Value); };
The COM picture A Component ‘exposes’ one or more Interfaces n Clients ‘acquire’ a pointer to one or more interfaces n Client uses them to Interfaces call the methods n Component Client
The Interface - more details Client Interface Pointer Object Pointer to method 1 Method 1(…) Pointer to method 2 Method 2(…) Pointer to method 3 Method 3(…) Pointer to method 4 Method 4(…) Pointer to method 5 Method 5(…) “Vtable”
So how DOES COM work? A client needs to get a hold of an interface on a component - key task! n Once that is done, it just calls the methods associated with the interface through the interface pointer! n How easy to do that? n Sample code in VB - next slide n
Code Visual Basic client Dim ICObj As Object …. . Private Sub Command 1_Click() Set ICObj = Create. Object("DCOMDEMO. Inventory. Controller. Server"). . . End Sub …. Call ICObj. Process. Order(l. Part. Number, l. Num. Items, l. Num. Orders, ucp. Result, lp. Num. Orders. Filled)
So how is this not just RPC? Some rules about being “COM” n Must implement the IUnknown Interface with three methods n – Query. Interface – Add. Ref – Release n Rules around maintaining counts of COM instances… vestigial and cumbersome
How to get that interface pointer? ? n The Registry! All servers/components/interfaces register themselves - using globally unique identifiers (GUIDs and CLSIDs) n Clients (through COM library calls) access the registry (by this unique identifier) to n – find out where the server is – get an interface pointer – then just do a “function call” through the ptr!
A quick peek at registry. . . HKEY_CLASSES_ROOT n CLSID key - organized by GUIDs - ugh! n APPID key - organized by names … n Type. Lib key - GUID’s again! n Messy - slow - CRITICAL! n Other tools = e. g. Ole. View - more user friendly! n
What really happens? Client Server COM library Service Control Manager (SCM) Registry Based on GUID, SCM looks up the server, if necessary loads/starts it and obtains a pointer to the requested interface, returns it to the client.
A very COM simple demo - VB! n MS has made VB the environment of choice to quickly build COM applications Let’s make both a server/component and a client n And get them to talk to each other … n It’s “too easy”, especially in relation to VC++! n
What a COM client needs to do. . . Call Co. Init - to init the COM environment n Call Co. Create. Instance - to request access to an interface on a server/component n Use the returned interface pointer to call component’s interface methods n Look at some sample C++ code? ? n – Warehouseclient. cxx
What a COM component or server needs to do. . . n Implement the methods of the interface(s) it supports, including the inherited IUnknown methods – May use C++ objects & methods for COM interface methods Register with the registry as a component (self-registry recommended) n Look at some sample C++ code? ? n – Warehouse. cxx
A more complex demo Developed by Digital/Compaq for MS PDC last October n To demonstrate heterogeneous DCOM on all Compaq’s platforms (plus one) n Simple 3 -tier factory inventory model n Uses COM/DCOM throughout on all the platforms n Actually same code base used for all the servers (not the GUI client!) n
Demo Architecture COM Inventory controller Warehouse COM Client COM Inventory controller COM Warehouse
The methods = the interfaces Inventory Controller (IInventory. Controller) Methods Process Order - try to fill an order from one or more warehouses Get Statistics - tell how well you have been able to service orders Reset Statistics - clean stats out for another recording period Warehouse Methods (IWarehouse) Order. Ful. Fill - can you fill a specific order for a part and quantity? Reset - magically restock the factory
Code Interface definitions // Interface IInventory. Controller [ object, uuid(6 fc 9 d 540 -4 c 46 -11 d 2 -9147 -004005193783), helpstring("IInventory. Controller Interface"), pointer_default(unique), dual, oleautomation ]. . .
Code Interface definitions interface IInventory. Controller : IDispatch { import "oaidl. idl" ; HRESULT Process. Order ( [in] long l. Part. Number, [in] long l. Num. Items, [in] long l. Num. Orders, [out] unsigned char * ucp. Result, [out] long * lp. Num. Orders. Filled); HRESULT Reset. Statistics (); HRESULT Get. Statistics ([out] long * lp. Total. Orders, [out] long * lp. Total. Orders. Filled, [out] long * lp. Total. Backorders); };
Code Interface definitions // Component and type library descriptions [ uuid(70 fe 8120 -4 c 46 -11 d 2 -9147 -004005193783), version(1. 0), helpstring("Compaq DCOM Demo - Inventory Controller Server 1. 0 Type Library") ] library Invctr. Lib { importlib("stdole 2. tlb") ; // Inventory. Controller server/class [ uuid(717738 f 0 -4 c 46 -11 d 2 -9147 -004005193783), helpstring("Inventory Controller Class") ] coclass Inventory. Controller { [default] interface IInventory. Controller ; };
Code Interface definitions interface IWarehouse : IDispatch { HRESULT Order. Fulfill( [in] long l. Part. Number, [in] long l. Num. Items, [out] unsigned char * ucp. Result); HRESULT Reset ([in] long Re. Stock. Value); };
Let’s run it now. . . All processes running on single system n Bring up VC++-based GUI Front End n Creates executing component servers at both back end tiers n Initializes all product stock to 1000 n Awaits client commands to n – Select nodes to participate – Request orders – Check/reset statistics
A Visual Basic GUI Client Using Rapid Development Tools n Accesses same (interface) functionality as VC++ Client n Puts results onto an excel spreadsheet using a macro - displays a bar chart for results - again using COM calls to Excel as a COM object n Has an automatic order feature. . . n
Demo Architecture - Part II COM Inventory controller Client VC++ Warehouse COM Client VB Warehouse COM Excel (stats. xls)
DCOM - a slight enhancement Now in the real world, we want to be able to get services from servers wherever they may be! n So let’s extend COM to be able to call interfaces on components located ON OTHER SYSTEMS! n In windows world, distribute DLLs easily n A natural application/extension of the RPC model between network nodes n
What really happens now? Node A Node B Client Server COM library Service Control Manager (SCM) Registry
DCOM -how does it work? Cooperation at the OS level between platforms n Requires platform OS implementations of n – COM Run. Time services – Registry – SCM (Service Control Manager) , etc. n Several different models for distribution
Two Approaches to Distributing Components n Non-intrusive Distribution – uses existing components and clients n Explicit Distribution – requires client side changes
Non-intrusive Distribution use clients and components as they exist n clients locate component servers through registry settings n registry can be set to point to remote servers n DCOMCNFG utility manages components - let’s see! n
Non-intrusive Distribution Node B Node A Client Server Com Library SCM Service Control Manager registry Remote Server Information SCM Service Control Manager registry
Explicit Distribution clients use COM library calls to create/locate server on specific remote node - I. e. Co. Create. Instance. Ex n COM bypasses local registry and communicates directly to SCM on remote node n Note: remote node server registry entry may itself point to another remote node! n
Explicit Distribution Node B Node A Client Server Com Library SCM Service Control Manager X registry Remote Server SCM Service Control Manager registry
Explicit DCOM Code Visual Basic client Dim ICObj As Object …. . Private Sub Command 1_Click() Set ICObj = Create. Object("DCOMDEMO. Inventory. Controller. Server", node 1) …. Call ICObj. Process. Order(l. Part. Number, l. Num. Items, l. Num. Orders, ucp. Result, lp. Num. Orders. Filled)
Heterogeneous DCOM Demo Architecture DCOM Warehouse Open. VMS Client DCOM Inventory controller DCOM Warehouse Windows Digital UNIX Windows NT Server DCOM Warehouse Solaris Demo built from released COM SDKs on platforms above
Heterogeneous DCOM n Cross platform COM – Demo using shipping COM SDKs on: n Digital UNIX, Open. VMS, Solaris – UNIX platform support from Microsoft n n Ship schedules COM on Digital UNIX and Open. VMS – Developing COM enabled middleware n Architecture, core features, tools – Deploying COM enabled middleware n Support, schedules, resources
COM Platform Support n COM/UNIX and COM/Open. VMS 1. x – Solaris 2. 5 - Microsoft (Shipping today) – Digital UNIX 4. 0 D - Compaq (In beta) – Open. VMS 7. 2 - Compaq (In beta) – IRIX 6. 5 - SGI n COM/UNIX and COM/Open. VMS future – Binary compat with COM 1. 0 – Improvements based on customer feedback on COM 1. 0 – Additional platform support
COM Platform Support n Microsoft COM for UNIX 2. 0 (future) – Solaris 2. 5 and up – HP-UX 11. 0 – AIX 4. 3 Will be available from Microsoft n Technical support from Microsoft n
COM Interoperability n Partnerships with Leading ORB vendors for CORBA interop – Iona and Visual Edge – Source code license agreements – Enable well tested interop products n Native OLEDB provider support – Intersolv
Software Architecture Windows NT Enterprise cluster COM NT COM RPC SSPI Domain Interface Windows NT identity Registry COM APIs Server identity Events NTLM security Security
COM Tools n Digital UNIX – Existing tools for code creation – Enterprise Toolkit available now – ATL in COM V 1. x – Component Monitor Q 1 1999 n Open. VMS – Existing tools for code creation – ATL in COM V 1. x – Debugging/ performance tool from Aver. Star Spring 1999 – Enterprise Toolkit Spring 1999
Benefits of Heterogeneous DCOM n Preservation of platform-dependent legacy applications – through use of wrappers around apps Cooperation between NT-based environments for operator interaction and mature backend systems n Careful design of new apps permit portability across platforms n
COM/DCOM Resources n Books – Inside COM - Rogeson - MS Press - excellent – Essential COM - Box - language focussed – WROX series on COM n Microsoft COM – http: //www. microsoft. com/com n Microsoft COM on UNIX – Program Manager: dbrooks@microsoft. com n Public COM on UNIX mailing list
Use of COM/DCOM: DNA COM is just one piece of the DNA Architecture (Distributed inter. Networking Applications) n Also - MTS, MSMQ, COM+, three tier design methodology with business objects on middle tier, etc. n Goal: Convergence and simplification of technologies over time n Then DNA for Manufacturing, Health, . . . n
Acronyms and Misc. DCOM = OLE = Active. X n – Originally focused solely on developing internet control components – components - act as servers to clients – controls - used to build visual COM components – document - able to be placed on Web pages n Web Technologies also highly integrated – Active Server Pages (ASP) – Dynamic HTML (DHTML)
DNA Model
Two Dimensions of DNA n Cross Industry Support – Infrastructure Tools and Components n Industry Specific Integration – DNA for xxx
Primary DNA Tools and Components COM - Component Object Model n DCOM - Distributed COM n MTS - Microsoft Transaction Server n MSMQ - Microsoft Message Queue System n COM+ - Next generation of DNA support n IIS - Internet Environment n
A Microsoft COM Timeline OLE MTS DCOM ATL COM+ MSMQ o OLE - Object Linking and Embedding - of MS application objects within MS applications o COM - Component Object Model - Generalized infrastructure to improve communications between application components o DCOM - Distributed COM - between components on different systems and Operating Systems o ATL - Active Template Library - Tool that simplifies the creation of DCOM components improves calls to/from other DCOM objects o MTS - Microsoft Transaction Server o MSMQ - Microsoft Message Queue Management o COM+ - Buries DCOM/COM, MTS, and MSMQ structures and methods within Windows NT environment
OLE Object Linking and Embedding n MS 1 st attempt at using application components within other applications especially in support of document integration n Biggest drawback initially n – Different object models for each MS application (Word vs Excel) n OLE 2 - no longer Object … - just “OLE”
COM n n n Component Object Model = MS Application bus Grand Unifying technology on Microsoft Platforms for application component communications Big incremental improvement over OLE Programming infrastructure for components to talk with each other Provides for Interface interactions between components – over IDL (Interface Definition Language) calls, – using GUID (Globally Unique Identifiers) to identify components, and – uses LRPC to communicate between components n Synchronous by design*
COM = Interfaces Collections of Method Definitions to access services from COM servers n Servers may implement one or more Interfaces - and may be DLLs or EXEs n All COM Servers MUST implement the IUnknown Interface n – which allows you to discover/access all the other interfaces on the same server (Query. Interface method)
Types of Interfaces n Custom Interfaces – Application responsible for defining unique callable methods – Clients must know method signatures – Unique call paths between client and server n “Automation” or IDispatch Interfaces – Universal single interface to get at all server services/methods – Single client-side contact - sorta! – Limitation on types of arguments, though
Using COM n Collection of Support Routines (Coxxxxx) – Initialize/shut down the local COM environment – Obtain Access to a COM server’s interfaces n Basic COM Model – Simpler on Client Side – Complicated for Creation/Mgmt of Objects on Server Side Class Factories - additional objects needed n Implementing IUnknown Methods (object and class factory objects!) n Issues around shared server objects, multin
DCOM Distributed COM or COM across a wire n Participating Components may now reside on different systems and use RPC for calls n Support provided for DCOM between non-heterogeneous platforms n – Windows NT – OVMS – Digital UNIX – Sun Solaris
DCOM (cont. ) Clients can operate in ‘locationindependent’ manner with servers n Registry can hold locations of servers and other COM stuff! n Newer Model supports Client accessing server on a specific node n DCOMCNFG and other utilities to help locate and manage the network of COM servers, objects, interfaces, type libraries, etc. n
DCOM Demo SAIE Developed the DCOM Demo of heterogenous interoperability for UNIX and VMS groups n Involved up to 9 systems on 3 different platforms executing almost identical server code n VC++ and VB front ends as clients n Real learning experience - but it worked! n
COM/DCOM (Cont. ) Primary Drawback with COM/DCOM The current Visual C/C++ environment requires lots of cut-and-paste of objects and methods to define the infrastructure needed to support each application component n NOTE: VB and VJ++ bury most of the support infrastructure and are much more simplified environments in dealing with COM
ATL Active Template Library n Tool simplifies the creation of COM/DCOM components in VC++ n Uses Application Wizards to simplify the creation process n – Choose interface model – Choose Locking, Marshalling, . . . – ATL creates bulk of COM support n n COM map and object map macros Unfortunately not supported on other platforms yet
MTS n Microsoft Transaction Server n Delivers needed server services – Runtime environment/infrastructure for application assembly and execution – Simplified application model - single user – Distribution - through packages – Easy drag and drop assembly of packages and monitoring of execution – Transactionalization of components – Load balancing, thread pooling, database connection pooling, etc.
Inside MTS All Current MTS Object/Servers must be DLLS n MTX server is the universal proxy for all MTS components on a given node n Intercepts calls for interface methods and can apply server services and transactional techniques before/after calling component methods n
MTX and MTS Components MTX - MTS controller IMy. Xface My. Comp client calls here MTS interceptor IMy. Xface Your MTS component My. Comp
MSMQ Microsoft Message Queue System n Provides asynchronous between COM/DCOM Components n Typical API for en-queuing and dequeuing messages n Reliability guaranteed - but still a very new product and needs maturation n
COM+ Next generation(s) of building distributed applications using COM components n Support from within Windows 2000 (uncertain about other platforms) n Makes building COM-compliant components much easier n Submerges MTS, MSMQ, and COM services deep within the OS n
DNA Development Tools n Dev. Studio Tools apply across the board – VC++ – VB 6 – VJ++ – Visual. Inter. Dev – Frontpage n Can produce clients, servers, middle tiers, in mixed language systems
More Info? www. microsoft. com/dna n www. microsoft. com/mts n www. microsoft. com/com n MSDN n MS Technical Journal n Dr. Dobbs & C/C++ Journal and VB mags too n
MS/Industry Initiatives based on DNA VCI/CIP - Value Chain Initiative n DNA for MFG/Automotive n OLE for Process Control (OPC) n DNA for Front Office (Trilogy) n DNA for Retail - E-office? n Rumors of n – DNA for Pharmaceutical – DNA for Medical – DNA for Financial –. . .
VCI/CIP Value Chain Initiative - consortium of companies agreeing to use DNA for managing business operations n CIP (Commerce Interchange Protocol) a DNA-based message composition and delivery/receipt system - no workflow tool - yet! n Ongoing negotiations between Compaq and MS re VCI/Business Bus n
DNA for MFG/Automotive First instantiation of DNA for Mfg n Detroit-based Initiative (surprise!) n Recent MS Event n Attempting to define groupings of interfaces to represent information and control data flow within automotive industry n Embraces OPC as core ‘information model’ n
OPC n OLE for Process Control – set of standard OLE/COM interface protocols – based on MS COM technology – foster interoperability in the process control industry between automation/control applications n field systems/devices n business/office applications n
Applications working with OPC Servers/Components Application X Application Y OPC Interface OPC Server A OPC Server B OPC Server C
The DNA Manufacturing Architecture OAG DCS O P C ERP / MRP BB CIP COM DCOM MES Batch HMI/SCADA PC Control O P C device COM C I P process COM DB OPC / OLE DB CE device UI Smart device
OPC Opportunity n Field management - advent of “smart” field devices – provides wealth of field device data device health, config params, materials of construction, . . . n Process management – Distributed Control Systems (DCS) and SCADA monitors and controls the manufacturing process – makes process data available electronically n Business management - integrating process data and financial information related to process
Summary DNA - a rich collection of (interchangeable) tools, technologies and methodologies for building threetiered, distributed applications n Underlying COM models supports universal access to servers/services n Multi-platform support an issue n Some industry initiatives favoring DNAbased solutions n
Questions?
DNA - based components Base. Star(? ) Site Server Shop Floor MES Basestar CIP ERP MES Document Management wrapper Business. Bus MSMQ Site Server wrapper
Business. Bus Technology Layering Application Layer CIP Applications Wrappers API Layer Transport Layer Platforms Integration Manager Business. Bus API MSMQ transport NT Bm. Q, MQSeries transports UNIX, VMS, etc.