Presentation is loading. Please wait.

Presentation is loading. Please wait.

Qisheng Hong Yani Mulyani Paul Visokey

Similar presentations


Presentation on theme: "Qisheng Hong Yani Mulyani Paul Visokey"— Presentation transcript:

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

2 Outline The Component Object Model - COM DCOM COM+

3 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

4 Isn’t 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 9

5 COM Architecture The Model The “ORB” The Services

6 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

7 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() IUnknown IDispatch COM Object IRobot

8 The Component Object Model (COM)
Standard API Binary structure for the interface between client and object Compilers support Microsoft’s 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

9 OOD and COM Differences in design considerations between OOD and COM
Table 1: Differences in design considerations between OOD and COM Differences in design considerations between OOD and COM Object-Oriented Design Assumptions Added 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) inheritance Interface inheritance (no implementation inheritance) Single interface per object (the object's class definition) Multiple interfaces per object Single client per object Multiple simultaneous clients per object 1:1 relationships between clients and objects typical Many:Many relationships between clients and objects is common

10 The COM Object Request Broker
The “model” is about how the technology is used The “ORB” is how it’s 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

11 Structure of the COM “ORB”
Components and Applications The COM Runtime Core Services (Automation, Monikers, Storage, ComCat, Data Transfer, IR) COM and Distributed COM Registry Pluggable Security (SSPI) MS-RPC Pluggable Transports NTLM DCE Kerberos ETC. TCP UDP IPX SPX HTTP ETC.

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

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

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

15 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 Component

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

17 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.

18 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.

19 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

20 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)) { ... }

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

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

23 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).

24 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().

25 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.

26 Marshalling - Example Client Process Local Server Process Client
In-Proc Server COM Local Server Stub Client COM Remote Server Process COM Remote Server Stub

27 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.

28 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

29 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

30 DCOM: Multiple Network Transports
TCP, UDP IPX, SPX COM Object Clients HTTP Queued Client Machine Server Machine

31 DCOM: Flexible Security
NT4 Security SSL/ Certificates Kerberos IPSEC C O M TCP, UDP IPX, SPX COM Object Clients HTTP Queued Queued Client Machine Server Machine

32 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) Microsoft’s set of components / framework that uses COM. Provides plugin-type components for GUI applications, etc.

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

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

35 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 Web Producers End Users

36 ActiveX Builds on COM COM’s 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

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

38 What’s 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 Main point: The next evolutionary step is COM+. COM+ is designed to make it even easier to write and use software components. All of the above benefits speak for themselves. Key insights: COM+ preserves your current investment in COM based technology. Applications written under COM will continue to work under COM+. Most importantly, the benefits provided by COM+ extend across languages and tools.

39 COM +

40 COM+ Strategy Services Runtime COM Transactions Data Binding
Persistence Load Balancing Security In Memory Database Event Infrastructure Services Ubiquitous Type Description Dynamic Invocation “No-Leak” Memory Mgmt Interception Runtime Tools Ubiquity Market Binary Standard COM Main point: The strategy for COM+ is to build on the tremendous success of COM, while providing the ability to develop more productively. This is accomplished by putting more of the infrastructure in the system, so that developers will have to write less object infrastructure code themselves. Providing a rich runtime environment which optionally hides tricky issues such as reference counting from developers essentially provides the best of all possible worlds.

41 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.

42 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. Main Point: It has been estimated that up to 30 percent of the effort in writing component based software is spent writing “object housekeeping” software. COM+ will handle this task for developers by providing implementations of most of the code which deals with the object infrastructure, leaving the developer free to write logic which deals with the problem they are trying to solve.

43 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.

44 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 Main Point: COM+ introduces the concept of attribute based programming. A developer (or an administrator for that matter) sets attributes on an object which tell the system essentially how to treat it, for example, as a transactional object. Key insight: Interceptors deal with the object based on the attributes which are set on the object. Different interceptors will provide different extensible services at runtime.

45 “COM +” Easier Components
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 Clients Auto * Interception Network Server Thread Pool Queue Connections Context Security Shared Data Receiver Synchronization Service Logic Configuration Management Receiver Queue Connections Context Security Management Main point: A developer in a COM+ world will usually just provide the Meta data which is needed and provide the methods. Most of the other code dealing with things such as registering components, reference counting for memory management etc. will be handled by the system. Configuration Thread Pool Service Logic Synchronization Shared Data Server

46 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 Main point: A key concept of COM+ is that of interception. Interceptors provide services based on attributes which have been previously set on an object by a developer. These interceptors provide automatic behavior at runtime based on the attribute set. A list of interceptable events is provided above.

47 COM+ and Windows DNA For building next generation applications
The Web Easy to Deploy Graphical UI Dynamic 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 The Windows PC Rich application services Familiar UI for users Consistent management Main Point: We’ve talked quite a bit about the features which COM+ provides. It is important to note that COM+ essentially is one of the key unifying elements for Windows DNA, as it allows for the development of applications which are flexible and powerful enough to deal with the spectrum of environments found today, from three tier client server environments to web based.

48 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 COM+ is the next evolutionary step for the Component Object Model. It will expand on Microsoft’s lead in object technology by enabling next generation application development.

49 3 Tier Client/Server “Desktop” - Compound Documents, Controls, Scripting C O M H T T P Mid-Tier - HTTP, Biz Objects, Active Server Pages, Scripting C O M SNA etc... CORBA Third-Tier - Databases, Legacy Data

50 Questions?


Download ppt "Qisheng Hong Yani Mulyani Paul Visokey"

Similar presentations


Ads by Google