Presentation is loading. Please wait.

Presentation is loading. Please wait.

COM/DCOM & COM+ Qisheng Hong Yani Mulyani Paul Visokey.

Similar presentations

Presentation on theme: "COM/DCOM & COM+ Qisheng Hong Yani Mulyani Paul Visokey."— Presentation transcript:


2 COM/DCOM & COM+ Qisheng Hong Yani Mulyani Paul Visokey

3 Outline The Component Object Model - COM DCOM COM+

4 What is COM? Build software from parts, not from scratch A framework for creating and using components Both a specification and an implementation Makes software easier to write and reuse Provides widest choice in services, tools, languages, and applications Evolved from Object Linking and Embedding technology Foundation in OLE Version 2, 1995

5 Isnt COM about Objects? No … COM sets out to solve system software problems that arise when hooking up randomly evolving combinations of binaries Benefits stem from its design an an integration and deployment architecture for software components Yes … from the perspective of these new kinds of objects, also called components COM is about clients communicating with objects COM based applications can be constructed using language- independent components

6 COM Architecture The Model The ORB The Services

7 COM Fundamental Principles What the designers of COM were striving for... Binary components Any programming language Any location (in-process, cross-process, cross- machine) No centralized authority Object orientation Interoperability Reusability Simplest model possible Enable extensibility, maintainability and adaptability Multi-tier architecture

8 The Component Object Model (COM) Components, Components, Components Code reuse and off-the-shelf components Language independent notion of an object Rigorous Encapsulation at the binary level Black box -- no leakage of implementation details All object manipulation through strict interfaces Polymorphism Define several different behaviors for a single object via multiple interfaces per class Discoverable: QueryInterface() COM Object IUnknown IRobot IDispatch

9 The Component Object Model (COM) Standard API Binary structure for the interface between client and object Compilers support Microsofts COM binary structure - language independence The point of contact is the run-time binary representation OS acts as central registry for objects Applications only know the function of the object Wire-level standard for location transparency

10 OOD and COM Table 1: Differences in design considerations between OOD and COM Differences in design considerations between OOD and COM Object-Oriented Design AssumptionsAdded COM Considerations Objects typically packaged in the same application (module) as client code Objects and clients typically in separate modules, both.EXEs and.DLLs Objects and clients run in a single process Objects and clients may run in different processes and on different machines Class (implementation) inheritanceInterface inheritance (no implementation inheritance) Single interface per object (the object's class definition) Multiple interfaces per object Single client per objectMultiple simultaneous clients per object 1:1 relationships between clients and objects typical Many:Many relationships between clients and objects is common

11 The COM Object Request Broker The model is about how the technology is used The ORB is how its implemented Microsoft calls it the COM Runtime Secure Security is designed and built in. Not an option. Inherently Distributed Pluggable Security Transports Free! (Built-into Win32 Platforms) No separate client access license or expensive developer version

12 Structure of the COM ORB The COM Runtime COM and Distributed COM Registry Pluggable Security (SSPI) NTLM Kerberos Pluggable Transports DCE MS-RPC TCPUDPIPXSPXHTTPETC. Core Services (Automation, Monikers, Storage, ComCat, Data Transfer, IR) Components and Applications

13 Pluggable Transports COM Client COM Runtime Architecture Flexible and extensible Component COM Runtime Server MachineClient Machine TCP, UDP SPX,IPX Net BUI HTTP COM Runtime Proxy Other Component ORB

14 Pluggable Security Providers COM Client COM Runtime Architecture Flexible and extensible Component COM Runtime Server MachineClient Machine DCE NT Kerberos SSL, Certs. NTLM COM Runtime Proxy Other Component ORB

15 COM Runtime Architecture Client Component Inprocess COM run time provider Security RPC RPC COM run time Security provider RPC RPC Local LPC Protocol stack DCOM network- protocol Remote

16 Accessing COM Services Client Component In the same process Fast, direct links to server library Client Component COM Client Process Server Process On the same machine Fast, secure lightweight RPC Across machines Secure, reliable and flexible DCE-RPC based DCOM protocol COM DCE RPC Client Server Machine Client Machine COM Component

17 COM Features IDL Object Activation Object Instances QueryInterface() Object Lifetimes Apartments Marshalling

18 IDL - Interface Definition Language Language-independent means of defining interfaces. Disambiguates parameter passing, pointers, etc. Each interface is identified by a GUID. Functions are broken up into: Properties - single values with get/set calls. Methods - more complex functions Interfaces are logically immutable.

19 Object Activation Client wishes to create and use a COM object. It invokes the COM API to instantiate a new COM object. COM locates the object implementation and initiates a server process for the object. The server process creates the object, and returns an interface pointer at the object. The client can then interact with the newly instantiated COM object through the interface pointer.

20 QueryInterface Multiple interfaces for objects instead of multiple inheritances Different roles for different simultaneous clients Each client uses a different set of interfaces Method to navigate among interfaces Client proxy dynamically loads multiple server stubs

21 Creating Object Instances In C++, use CoCreateInstance() IService *pService = NULL; HRESULT hr = CoCreateInstance( CLSID_MusicService, // clsid of object NULL, CLSCTX_LOCAL_SERVER, // server type (inproc, local, remote) &IID_IService, // id of desired interface (LPVOID*)&pService); if (SUCCEEDED(hr)) {... }

22 CoCreateInstance – In Process { CLSID, Server.dll } Registry Client Process Client COM Runtime SCM

23 CoCreateInstanceEx - Remote Client Machine Server Machine Client Client Process COM Runtime SCM Registry { AppID, RemoteServer } Registry { AppID, Surrogate DLL } { CLSID, Server.dll } COM Runtime SCM Surrogate Process

24 Object Lifetime COM uses reference counting. Initial reference count causes object creation. To increment reference count: QI on an interface. AddRef() - implemented on IUnknown To decrement reference count: Release() - implemented on Iunknown Final release causes object destruction (Garbage Collection).

25 Apartments Abstraction for dealing with threads / processes. Single-threaded apartments (STA) At most one thread executing at one time. Possibly multiple STAs per process. Objects can store state between calls safely. Multi-threaded apartments (MTA) Many threads processing concurrently. Only one per process (at most). Specify apartment with CoInitialize().

26 Marshalling Abstraction for inter-apartment communication. Same abstraction for in-process, local, and remote communication. Uses RPC for communication between servers. Converts an interface pointer to a stream.

27 Marshalling - Example In-Proc Server Client Local Server Process COM Client Process Stub COMLocal Server Remote Server Process Stub COMRemote Server

28 COM Limitations Lack of a common type system, each language involved in COM had its own type system. Architecture does not have perfect knowledge of the types. COM is hard to use. Reference counting, Microsoft IDL, Global Unique Identifiers (GUID), etc. require deep knowledge of COM specification from developers. COM is not robust enough for enterprise deployments. Services such as secure transactions, reliable communications, and load balancing are not integrated in COM.

29 What is DCOM? An extension to COM allowing network based component interaction A framework for creating and using distributed components Just COM used over a longer wire Component interaction across heterogeneous networks Wider choice in services, tools, languages, applications and server components from variety of vendors All COM components communicate in the same way- ORPC on the same machine In-process, Out-of-process across a Local Area Network across a Wide Area Network across the Internet

30 DCOM Features Services used in a standard way, regardless of location Any Programming Language Integrated with Development Tools Flexible Security Internet certificate-based security Multiple Network Transports Connection oriented Connectionless Mature specification and reference implementation Ubiquitous

31 DCOM: Multiple Network Transports TCP, UDP IPX, SPX HTTP Server Machine Client Machine COMCOM Queued Clients COMCOM COMObject

32 Queued DCOM: Flexible Security TCP, UDP IPX, SPX HTTP Server Machine Client Machine COMCOM Clients NT4 Security SSL/Certificates Kerberos IPSEC COMCOM COMObject

33 What is ActiveX? A marketing name for a set of technologies and services, all based on the Component Object Model (COM) (the model, the ORB, and the core services) Microsofts set of components / framework that uses COM. Provides plugin-type components for GUI applications, etc.

34 ActiveX Bridges the Islands Makes it easy to integrate and reuse any component Java Applet JavaScript VBScript ActiveX Control HTML Document Non-HTML Document

35 Internet Explorer 5 & 6 HTML content (text and images) HTTP server HTTP ActiveX Control or Java applet download ActiveX Control or Java applet COM objects or ActiveX Controls (D)COM ActiveX Script User Experience: How It Works

36 Motivation For ActiveX Bring Component-based Development to the Internet Software Developers - want to easily create, reuse and integrate software components Web Producers - want to build rich, engaging Web sites quickly and easily End Users - want an intriguing, exciting experience Developers WebProducers End Users

37 ActiveX Builds on COM COMs initial thrust: integrating desktop applications with OLE COM technology is generically useful, being applied to a range of other areas Inherently distributed ActiveX Controls Are COM components with design-time UI Can be written in C++, Java, VB, Delphi,... Self-registering Optimized for download and execute Work on both Active Client or Server Can talk indirectly over HTTP or directly over COM

38 Elements Of ActiveX Component Object Model (COM) Standard component packaging Windows®UNIX®Macintosh® Distributed COM Internet/distributed computing Components and Services URLs, hyperlinking, browser frame, HTML, Java VM, etc. Controls and Applets C++, Delphi®, Java, Visual Basic®, etc. Scripting Visual Basic, Scripting Edition, JScript, Tck/Tk, etc. Web Pages, Documents, and Applications/Containers

39 Whats next? COM+ Evolutionary step, making it even easier to build and use components Infrastructure in the system, not in the application Extensible services Preserves current investments in COM Provides benefits across languages and tools Less coding, more productivity

40 COM +

41 COM+ Strategy Transactions Data Binding Persistence Load Balancing Security In Memory Database Event Infrastructure Ubiquitous Type Description Description Dynamic Invocation No-Leak Memory Mgmt Interception Tools Ubiquity Market Binary Standard

42 The COM+ MODEL COM+ is the next step in the evolution of the Microsoft® Component Object Model and Microsoft Transaction Server (MTS). COM+ handles many of the resource management tasks such as thread allocation and security. COM+ automatically makes applications more scalable by providing thread pooling, object pooling, and just-in-time object activation. COM+ protects data integrity by providing transaction support, even if a transaction spans multiple databases over a network.

43 The COM+ MODEL COM+ still provides a standard library, and objects and their clients still use it. COM+ hides calls to this library beneath the equivalent native functions in the programming language. C++ programmers can use the standard new operator rather than CoCreateInstance() to create a COM+ object. COM+ developers no longer need to define interfaces using IDL. Object's interfaces defined using their programming language's syntax.

44 The COM+MODEL COM+ addresses another important but challenging problem in creating a language- independent object model: data types. Different languages support different data types, which causes problems when passing parameters between objects written in different languages. COM+ allows implementation inheritance between COM+ objects running in the same process. COM objects do not support constructors, but COM+ objects do. COM+ constructors even allow passing parameters, better integrating COM+ objects and the objects used by today's most popular object-oriented languages.

45 COM+ Philosophy Attribute-based Programming Write your Logic Set Attributes Runtime Does all the grungy stuff Interceptors deal with the object based on the Attributes Different Interceptors provide different extensible services at Runtime

46 COM + Easier Components Clients Server Network Thread Pool Queue Connections ContextSecurity Shared Data Receiver Synchronization Service Logic ConfigurationManagement Server Thread Pool Queue Connections ContextSecurity Shared Data Receiver Synchronization Service Logic ConfigurationManagement Component Type Info DLL Register RefCounting Query Interface Methods Class Factory Connection Points IDispatch Component Meta Data DLL Register RefCounting Query Interface Methods Class Factory Connection Points IDispatch Interception Auto *

47 The key to extensible services: Interception Key concept in COM + run-time Interceptors provide automatic behavior at runtime based on the attribute set Interceptors assure that when a transactional object attempts to change data either all succeed or all fail and rollback Interception Events Instance creation Method call and return, field access Force fail pre and post call Binding an instance to a reference Dynamically (re)define method

48 The Web Easy to Deploy Graphical UI Dynamic COM+ and Windows DNA For building next generation applications The Windows PC Rich application services Familiar UI for users Consistent management Windows DNA Integrates client/server and the web Services that work together Open protocols and published interfaces COM+ Applications Component-based Flexible and dynamic Built-in scalability Preserve current investments Extensible services

49 Summary COM is the most widely adopted object model in the world COM+ builds on the success of the Component Object Model Provides benefits across languages and tools Less code, more productivity Extensible services enabled by interception Provides the backbone to Windows DNA

50 3 Tier Client/Server Third-Tier - Databases, Legacy Data COMCOM SNA etc... CORBA Mid-Tier - HTTP, Biz Objects, Active Server Pages, Scripting COMCOM HTTPHTTP Desktop - Compound Documents, Controls, Scripting

51 Questions?

Download ppt "COM/DCOM & COM+ Qisheng Hong Yani Mulyani Paul Visokey."

Similar presentations

Ads by Google