introduction to com and dcom organizational communications and technologies prithvi n. rao h. john...
TRANSCRIPT
![Page 1: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/1.jpg)
Introduction to COM and DCOM
Organizational Communications and Technologies
Prithvi N. RaoH. John Heinz III School of Public
Policy and ManagementCarnegie Mellon University
![Page 2: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/2.jpg)
Readings
Posting on the Class Web Site
![Page 3: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/3.jpg)
Objectives Present the basic features of COM and DCOM
![Page 4: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/4.jpg)
What is COM? Binary protocol by which software components
can connect and communicate Language independent Platform independent Philosophy for architecting software components Programming discipline for component development
Microsoft’s object technology Originally referred to as OLE
![Page 5: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/5.jpg)
What is COM? COM is a specification COM is a set of services COM supports modular programming COM is object-oriented (?) COM enables easy customization and
upgrades to your application (?) COM supports distributed applications COM components can be written in a variety of
languages
![Page 6: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/6.jpg)
Activex, OLE and COM
COM
OLE ActiveX
Automation
Uniform data transferPersistent storagemonikers
EmbeddingLinkingDrag-and-dropCompound documents
DocumentsControlsScripting
![Page 7: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/7.jpg)
Role of COM in the Model COM services provide foundations
UDT is language and program independent data transfer
Persistence provides for machine-independent standardized object persistence
Monikers facilitate file namespace object identification across machines
Automation facilitates COM object access from scripting clients
![Page 8: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/8.jpg)
The Role of COM in the Model
Automation
Uniform Data Transfer
Persistent Storage
Monikers
Component Object Model
COM
![Page 9: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/9.jpg)
Object-Linking-and-Embedding OLE services allow off-the-shelf app data
interoperability Host (client/container) can edit/store foreign
application (server) data via pre-defined set of COM interfaces
Can be user initiated End-user-drag-drop of data between applications
![Page 10: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/10.jpg)
Object-Linking-and-Embedding
In Place Activation(visual editing)
Linking
Embedding
Drag and Drop
![Page 11: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/11.jpg)
ActiveX Services Binary packaging of in-proc components
Deployed in windows/dialogs or in web pages Dynamically downloaded with page
Web-based distribution pf documents
IIS-aware Automation-aware pages (ASP)
![Page 12: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/12.jpg)
Component Object Model
Client (Container)
Client (Container) Object
Server
Interface Pointer
Interface
![Page 13: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/13.jpg)
Distributed COM
Client(DLL or
EXE)
ProcessBoundary
Network Boundary
RemoteObject(EXE)
LocalObject(EXE)
In-ProcObject(DLL)
![Page 14: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/14.jpg)
COM and DCOM DCOM is now a standard part of 32-bit Windows
NT 4.0+, Win98, Win95 with IE4 DCOM being propagated to other platforms as
well Solaris HPUX Digital’s VMS (in beta)
Provides transparency for remote interfaces, parameters and return values
![Page 15: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/15.jpg)
COM and DCOM Reusable code is difficult to create even in C+
+
Traditional static link libraries have dependency deficiencies
Windows dlls have their own set of limitations
Need for a vendor independent strata for building reusable components
![Page 16: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/16.jpg)
Lack of Reusability Static Libraries
Duplicated code on disk Duplicated code in memory No way to replace library without relinking and/or
recompiling
Dynamic Link Libraries (a better solution) Code resides only on one system Code only needs to be loaded once in memory Field replacement of implementation is possible
![Page 17: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/17.jpg)
COM Benefits Component based suggests more code re-use
Smaller distributable components Replaceable components
Binary compatibility and encapsulation
Thin layers of abstraction Decoupling interface from implementation Decoupling object identity from implementation
Dependency reduction in large projects
![Page 18: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/18.jpg)
COM Fundamentals COM defines
What constitutes a COM object How com objects expose features for other
components to use How this works across processes and across networks When objects are destroyed
No specification about implementation Only describes behavior/characteristics pertinent to
connecting/communicating with other objects Allows flexibility Permits implementation stay lightweight and
language-independent
![Page 19: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/19.jpg)
COM Principles Object services are accessed via interfaces
Interfaces have identity
Objects consist of interface implementation
Objects have identity
Objects must be registered
![Page 20: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/20.jpg)
COM Principles Objects have location independence
Objects have implementation transparency
Object services can be published via a type library
![Page 21: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/21.jpg)
Key COM Concepts Interfaces
Objects
Identity
Registration
Type Libraries
![Page 22: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/22.jpg)
What’s an Interface? An abstract data type containing pointers to a
group of related function Contract between client and object
Features/functionality only available via interfaces Object’s features expressed by the interface it
implements Once published never changes
Existing interfaces may be extended Contract between COM and object author
Object implements all methods in interface
![Page 23: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/23.jpg)
What’s an Interface? A pointer to a table of pointers to methods
No limit to the number of methods in an interface
Strongly typed
Transparency for DCOM implementation
![Page 24: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/24.jpg)
COM Identity COM components are associated with a unique ID
Interface (IID) Objects (CLSID) Type libraries (TLID) Features/service groups of categories (CATID)
Components defined by COM have pre-assigned Ids
Each ID distinguishes a component from another Prevents collisions Supports versioning Accessed via ID
![Page 25: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/25.jpg)
Component IDs Generated by component author via
development tools Guaranteed to be unique Uses machine ID, NIC date and time information
to create 128 bit long integer id Referred to as GUID
Guaranteed to be unique on all systems on the planet
Can be created in multiple ways ::CoCreateGuid from COM API function GUIDGEN command line tool Development tools do this automatically
![Page 26: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/26.jpg)
Registration System registry
Database of information about available objects in system
May contain configuration information Updated when object is installed Entries organized by IDs
Each COM object registry entry must specify Object’s CLSID Path to object’s server
Object registry entries may also specify Human readable name
![Page 27: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/27.jpg)
Type Libraries Binary language-independent file
Describes COM objects, interfaces, methods, data types and Ids of components in a server
Created by component author during development
Used by client authors during client development Compiled form a script written in DCE Interface
Definition Language (IDL) TLB provide all essential details required for
clients to invoke objects described
![Page 28: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/28.jpg)
COM Principles Objects accessed via Interfaces
Interfaces have identity
Objects composed of interface implementations
Objects have identity
Objects have location independence
![Page 29: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/29.jpg)
COM Principles Objects have implementation transparency
Object services can be published via a type library
![Page 30: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/30.jpg)
COM Interface Rules Interface methods are abstract
Interfaces never expose data
All methods in an interface must be implemented
Interface methods must return HRESULT
![Page 31: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/31.jpg)
Instantiating a COM Object Client calls a COM API function with object
CLSID CoCreateInstance CoGetClassObject
COM looks up object’s CLSID in registry COM finds the server pathname in the registry COM invokes the object’s server Server requests an object instance from the
object’s class factory Server instantiates object
![Page 32: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/32.jpg)
Instantiating a COM Object Server returns pointer to object’s default
interface to COM
COM returns interface pointer to client
![Page 33: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/33.jpg)
Interoperability Issues CORBA/RMI?
CORBA/DCOM?
RMI/DCOM?
Multiple Inheritance (CORBA) maps to Multiple Interfaces in DCOM
![Page 34: Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie](https://reader033.vdocument.in/reader033/viewer/2022051416/56649ea15503460f94ba4ec5/html5/thumbnails/34.jpg)
Summary Examined relationship between COM, OLE and
ActiveX
Examined the features of COM
Examined the principles of COM
Presented the activation of COM objects
Presented issues in interoperability