COM / DCOM Xiaolan Lu Mingzhen Wang Dong Xie. Why COM / DCOM?  Challenges facing the software industry  Component software provides a solution  General.

Slides:



Advertisements
Similar presentations
MicroKernel Pattern Presented by Sahibzada Sami ud din Kashif Khurshid.
Advertisements

Fundamentals of COM Mary Kirtland Program Manager COM Team Microsoft Corporation.
COM vs. CORBA.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 9 Distributed Systems Architectures Slide 1 1 Chapter 9 Distributed Systems Architectures.
Remote Procedure Call (RPC)
Intro to COM What is it and how do I use it?. Objectives Teach the fundamentals of COM. Understand the reason for using it. Learn to make a simple in-process.
 Introduction Originally developed by Open Software Foundation (OSF), which is now called The Open Group ( Provides a set of tools and.
OPC - OLE For Process Control Paul C. Shafer Bently Nevada Corp.
Distributed Systems Architectures
Distributed Object Computing Weilie Yi Dec 4, 2001.
Hadar Vorenshtein & Meital Levy Instructor yavgeni Rivkin.
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
University of Genoa Course of Software Engineering II 01-02
1 COM/DCOM n Part of Project Presentation (Concept Outline)
Chapter 9: The Client/Server Database Environment
Object Based Operating Systems1 Learning Objectives Object Orientation and its benefits Controversy over object based operating systems Object based operating.
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
Chapter 10 Application Development. Chapter Goals Describe the application development process and the role of methodologies, models and tools Compare.
1 © Prentice Hall, 2002 The Client/Server Database Environment.
Lecture The Client/Server Database Environment
The Client/Server Database Environment
Microsoft Access Ervin Ha.
.NET, and Service Gateways Group members: Andre Tran, Priyanka Gangishetty, Irena Mao, Wileen Chiu.
Intro to COM What is it and what can it do for me?
1 Modular Software/ Component Software 2 Modular Software Code developed in modules. Modules can then be linked together to produce finished product/program.
Visual Basic: An Object Oriented Approach 12 – Creating and using ActiveX objects.
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
CSC Proprietary 9/11/2015 2:16:16 AM 008_P2_CSC_white 1.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 12 Slide 1 Distributed Systems Architectures.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Other Topics RPC & Middleware.
1 Chapter 38 RPC and Middleware. 2 Middleware  Tools to help programmers  Makes client-server programming  Easier  Faster  Makes resulting software.
Threading Models in Visual Basic Language Student Name: Danyu Xu Student ID:98044.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Lecture 15 Introduction to Web Services Web Service Applications.
DCOM (Overview) by- Jeevan Varma Anga.
COM/DCOM Implementation Basics of: Object creation and access Object Reuse Interface referencing.
Distributed Component Object Model (DCOM)
OLE / COM Helia / Martti Laiho Sources: MSDN Kraig Brockschmidt: Inside OLE Orfali-Harkey-Erwards: Client/Server Survival Guide.
COM and DCOM CS 562 February 27, Motivation Data Analyzer Resource Monitor int compute (…) { } int compute (…) { } Data Analyzer int compute (…)
Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie.
CS 603 DCOM April 5, DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication.
Distributed Processing and Client/Server
COMCOM omponent bject odel After this presentation, you will: Be Able To: Conceptual understanding of COM How it works, What it’s used for Decode Acronyms.
A COM implementation of the KSpace A ‘Knowledge Space prototype’ by Santhosh CST
BLU-ICE and the Distributed Control System Constraints for Software Development Strategies Timothy M. McPhillips Stanford Synchrotron Radiation Laboratory.
Unit – I CLIENT / SERVER ARCHITECTURE. Unit Structure  Evolution of Client/Server Architecture  Client/Server Model  Characteristics of Client/Server.
Introduction to COM and ActiveX Controls. What is an object? In the Fayad sense of the word.
Component Technology. Challenges Facing the Software Industry Today’s applications are large & complex – time consuming to develop, difficult and costly.
CSC 480 Software Engineering Lecture 18 Nov 6, 2002.
Chapter 2 Introduction to Systems Architecture. Chapter goals Discuss the development of automated computing Describe the general capabilities of a computer.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
GAM666 – Introduction To Game Programming ● DirectX is implemented as a collection of COM objects ● To use a DirectX program, the user must have the correct.
Seminarium on Component-based Software Engineering Feraaz Imami LIACS – Leiden University Fall 2005 Component Object Model (COM)
CORBA Antonio Vasquez, John Shelton, Nidia, Ruben.
Distributed Systems Architectures. Topics covered l Client-server architectures l Distributed object architectures l Inter-organisational computing.
Component Object Model(COM)
Chapter 9: The Client/Server Database Environment
The Client/Server Database Environment
Out-of-Process Components
The Client/Server Database Environment
Chapter 9: The Client/Server Database Environment
Interpreter Style Examples
Inventory of Distributed Computing Concepts
Component--based development
Out-of-Process Components
Presented By Justas Raslanas
CORBA and COM TIP Two practical techniques for object composition
Presentation transcript:

COM / DCOM Xiaolan Lu Mingzhen Wang Dong Xie

Why COM / DCOM?  Challenges facing the software industry  Component software provides a solution  General approach of dealing with components  Microsoft’s solution – COM/DCOM Component Object Model Distributed Component Object Model

Challenges for Software Industry  Applications are large and complex  Applications are not modular  Applications are not easily integrated  Operating systems have similar problems

General Approach of Dealing with Challenges Client API Vendor #1’s Component Vendor #2’s Component

Problems with the Traditional Approach  The evolution of an API is a problem.  Advertising and maintaining different versions of the API can be problematic.  Enabling components to communicate with each other is challenging.  The programming language to create components greatly impacts the component communication through an API.

Microsoft’s Solution – COM and DCOM  Component Object Model (COM)  Distributed Component Object Model (DCOM)

Component Software  A component is reusable piece of software in binary form that can be plugged into other components from other vendors with relatively little effort.  Example – spell checker

Features of Component Software  Reusable software components  Components in binary form  Components easy to combine

What’s COM  COM is a standard for the interaction of binary objects.  COM is also an integration technology.  Objects developed independent  Provide standard model

What is COM? (continued) Client Application COM: Established Connection Server Application Object

The Goals of COM?  By providing a binary and network standard, COM enables interoperability among applications of different vendors.  Object-based programming  Promote interoperability  Components cooperate  Allow applications to connect as software objects.  Provide operation

The Goals of COM For example:  Word processor Spreadsheet Mainframe database  Objects support a predefined standard interface for data exchange

The Goals of COM  Because COM is a binary standard, objects can be implemented in a number of different programming languages.  Objects can be used from clients that are written using completely different programming languages

The Goals of COM  Vendor independence ODBC driver Lots of effort to transfer code COM objects export only interface Easily upgrade without recompiling

What is DCOM?  Extension of COM  Client and server on different computers

COM Objects in Same Processes From Same Machine

COM Objects in Different Processes From Same Machine

How DCOM Establishes Connections among COM Objects From Different Machines

Nice Features of DCOM  Location independence Hide the location The way to connect and call methods is identical.  Language neutrality Developers can choose the languages Take advantage of free threading.  Scalability  Fault tolerance  Easy deployment

How COM/DCOM works  Objects and interfaces  The COM Client/Server Model

Object and Interface Interfaces and C++ Class Interface Definitions: IDL How an Interface Works Object Picture

How An Interface Works Interface Pointer pointer Pointer to function1 Pointer to function2 Pointer to function3 …… Interface function table Function1(..) { … } Function2(..) { … } Function3(..) { … } …

Object Picture A and B are interfaces The object implements each member function of the interface and provides pointers to those functions to COM. COM then makes those functions available to any client. object A B

The COM Client/Server Model Relationship between client, COM, and server COM Object and Class Identifiers COM Clients COM Servers Location Transparency

Relationship between client, COM, and server Client Application COM Server Object (1) “Create Object” (2) Locate implementation (3) Get object interface pointer, return to Client (4) Call interface members

COM Object and Class Identifiers A COM class – A particular implementation of certain interfaces – Machine code – to be used by different applications A COM object – Identified by a unique128-bit CLSID that associates an object class A CLSID – GUID like an interface identifier

COM Clients A COM Client asks COM to instantiate objects in two way: – To call the COM function CoCreateInstance – Use a class factory To manufacture an object of a class

COM Clients Client Server Class Factory Object (1)“Create An Object” (2)Manufacture object (3)Return new interface pointer to client

COM Server Two basic kinds of object servers – Dynamic Link library (DLL) Based The server is implemented in a module that can be loaded into and will execute within, a client’s address space – EXE Based The server is implemented as a stand-alone executable module

COM Servers Server Module Server Object Class Factory: creates Object IClassFactory Object Interfaces Implementation identical for any module Implementation differs for DLLs and EXES Exposure for class factory Unloading Mechanism

COM Server Server Flavors: In-Process Server – A server can be loaded into the client’s process and serves “in- process object’ Local Server – A sever runs in a separate process on the same machine as the client and serves “local object” Remote Server – A server runs on a separate machine and therefore always runs in another process as well to serve “remote objects”

Location Transparency A single programming model – Dealing with in-process or remote objects is transparent and identical to dealing with in-process objects

Location Transparency Client Application In-process server In-process object COM Local Object Proxy Remot Object proxy Local Server Process COM Stub Local Server Local Object Remote Machine Remote Server Process Remote Server Remote Object COM Stub

Architecture for Distributed objects Client proxy RPC Runtime Transport stub Object Transport channel COM Library Process Boundary

COM Library COM is a specification for how objects and their clients interact through the binary standard of interfaces. COM is also an implementation contained “COM Library” (such as DLL on Microsoft Windows)

COM Library (continued) COM Library includes: A small number of fundamental API functions: facilitate the creation of COM applications. Implementation locator service: class identifier  server? location? Transparent remote procedure calls Memory management

COM as a Foundation Binary standard of interface: Key to COM’s extensible architecture Foundation upon which is build the rest of and the other systems(OLE etc) 1.COM infrastruction 2.OLE

1) COM Infrastruction Persistent Storage: A set of interface and an implementation of those interfaces that create structured storage, otherwise known as a “file system within a file” Persistent, Intelligent Names (Monikers): The ability to give a specific instantiation of an object a particular name that would allow a client to reconnect to that exact same object instance with the same state at a later time. Uniform Data Transfer : Standard interfaces through which data is exchanged between a client and an object and through which a clent can ask an object to send notification in case of data change

COM is built in progressively higher level technologies that depend upon lower level technologies.

2) OLE Microsoft’s OLE technology: a collection of additional higher-level technologies that build upon COM and its infrastruction. OLE 2 –includes mostly user-interface oriented features based on usability, application integration, and automation of tasks. –All of these features are implemented by means of specific interfaces on different objects and defined sequences of operation in both clients and servers and their relationships and dependencies on the lower level infrastructure of COM

OLE builds its features on COM.

OLE(Continued) Drag & Drop : The ability to exchange data by picking up a selection with the mouse and visibly dropping it onto another window. Automation : The ability to create “programmable” applications that can be driven externally from a script running in another application to automate common end user tasks. Automation enables cross-application macro programming. Compound Documents : The ability to embed or link information in a central document encouraging a more document-centric user interface.

How to create a Client 1.Initializing the COM Libraries 2.Getting the CLSID of an Object 3.Creating an instance of an Object 4.Using a COM Object 5.Uninitializing the COM Libraries

1) Initializing the COM Libraries { HRESULT hr; hr = CoInitialize(NULL); if (FAILED(hr)) return FALSE … }

2) Getting the CLSID of an Object CLSIDs: a unique class name with a 128-bit number ProgIDs: CLSID  ProgIDs (readable) { … CLSID clsid; hr = CLSIDFromProgID(OLESTR(“Simple.Object”), &clsid); if (FAILED(hr)) return FALSE; … }

3) Creating an instance of an Object { … IStream * pStream; hr = CoCreateInstance( clsid, NULL, CLSCTX_LOCAL_SERVER, IID_Istream, (LPVOID *) &pStream); … }

4) Using a COM Object { … if (SUCCEEDED(hr)) { //Use the interface pointer pStream->Read(…); pStream->Release(); … }

5) Uninitializing the COM Libraries { … CoUninitialize(); … }

How to create a COM Object Deriving a C++ Class from an Interface Implementing the Methods of an Interface Controlling the life time of a COM Object

Deriving a C++ Class from an Interface In C++, interface is defined as a structure that contains only pure virtual functions. Class Csimple : public Istream { // IUnknown methods // IStream methods };

Implementing the Methods of an Interface Examples: AddRef and Release Methods AddRef: ULONG _stdcall CSimpleObject::AddRef(void) { return ++m_cRef; //return InterlockedIncrement(&m_cRef); }

Implementing the Methods of an Interface (continued) Release ULONG _stdcall CSimpleObject::Release(void) { if (0 == --m_cRef) { delete this; return 0; } return m_cRef; }

Controlling the life time of a COM Object 1.Simplest strategy (Object server – one object): object – central reference count if (reference count == 0) delete itself 2.COM object server – more than one object Reference counter of all object == 0 Server shut down

Costs and Limitations Low cost development tools from Microsoft (such as VC++ and VB) Construction of clients and servers is straightforward Initial price for COM/DCOM is low on Windows platforms. Unclear about other platforms Beyond basic costs to produce the technology, any serious software development using COM/DCOM requires substantial programmer expertise. However, Microsoft has strong organization to assist individuals developing COM clients and objects

References Book: Mastering COM Development Web site:

Questions?