520 likes | 529 Views
University of Genoa Course of Software Engineering II 01-02. Elisabetta Parodi. Summary 1/2. Introduction Walking towards COM COM Introducing COM Terminology COM Binary Standard Interface Component Object Library COM Server COM Object COM Technologies Example.
E N D
University of Genoa Course of Software Engineering II 01-02 Elisabetta Parodi
Summary 1/2 • Introduction • Walking towards COM • COM • Introducing COM • Terminology • COM Binary Standard • Interface • Component Object Library • COM Server • COM Object • COM Technologies • Example
Summary 2/2 • DCOM • Introducing DCOM • DCOM Architecture • Location Independence • Connection Management • Security • Global Overview • Weaknesses of COM/DCOM • Comparison of DCOM, CORBA, RMI • References
COM OLE DDE clipboard Introduction : walking towards COM 1/2 Windows purpose : moving integration between applicative functions to O.S. level it needs effective communication mechanisms between applications
2/2 Introduction : walking towards COM • DLLs are a good starting point for modularity • problems : • physical location dependency • version management we need a better communication mechanism. An object-based and synchronous client-server technology facilitates: • robustness • API’s homogeneity • physical location independency • splitting into components
Introducing COM • COM : Component Object Model (1992) • component software architecture that allows applications and systems to be built from components supplied by different software vendors supports : interoperability and reusability benefits : maintainability and adaptability however, in order to interact, components must adhere to a binary structure specified by Microsoft
COM Terminology • Interface a group of related functions that specifies a contract • Class • named, concrete implementation of one or more interfaces • Object • an instance of a COM class • Component • binary unit of code that creates COM objects
COM Binary Standard A standard way to : • lay out virtual function tables (vtables) in memory • call functions through the vtables any language that can call functions via pointers (C, C++, Small Talk, Ada, and even Basic) can be usedto write components that can interoperate with other components written into the same binary standard
Interface 1/3 • collection of functions by which applications interact with each other and with the system • strongly typed contract between software components to provide a small but useful set of semantically related operations (methods) : Component Object Design • definition of an expected behavior and expected responsabilities
Interface 2/3 remember : • considered logically immutable reason : removing the potential for version incompatibility new functionality : can be exposed through a different interface • is not a class • is not a component object • denotes behavior only, not state • component objects can implement multiple interfaces • is strongly typed
simple reference counting methods Interface 3/3 • one special interface to implement some essential functions: all component objects are required to implement it • three methods : • identified by an IID • must derive from Iunknown : • QueryInterface allows clients to dynamically discover whether or not an interface is supported by a component object; if so, it returns an interface pointer from a component object • AddRef • Release
Component Object Library A system component that provides the mechanics of COM: • provides the ability to make IUnknown calls across processes • encapsulates all the “legwork” associated with launching components and establishing connections between components
CLSID .EXE CLSID DLL Creating a component object Application Component Object Library Registration DB CLSID
COM server In general : some piece of code that implements some component object such that the Component Object Library and its services can run that code and have it create component objects Three ways in which a client can access COM objects provided by a server: • In-Process Server • Local Object Proxy • Remote Object Proxy
Local Server Process Client Process In-Process Object Local Object Stub Cient Application In-Process Server Local Server COM RPC Local Object Proxy Remote Machine Remote Server Process COM Remote Object Remote Object Proxy Stub RPC Remote Server COM
COM object In general : some function that produces a defined output, given tah the input meets predefined parameters. COM encapsulates the function, only giving the client of an object acces to the object interface(s). • All COM objects : • are registered with a component database • have no identity
4) Call interface members 3) Get object interface pointer return to client 2) Locate Implementation 1) Create Object Client Application Object Server COM What happens when a client wishes to create and use a COM object?
1) initializes the system : CoInitialize 2) calls CoCreateInstance (exported by COMPOBJ.DLL) passing the CLSID of the used object; CoCreateInstance : When an application uses a COM object: uses the registry to discover which server implements the desidered class asks the server to create an instance receives from the server a pointer to the IUnknown interface 3) uses IUnknown.QueryInterface to access the wanted interface 4) uses Addrefand Release to manage the object lifecycle 5) in the end calls CoUninitialize
COM Technologies Interfaces and API functions that expose operating system services, as well as other mechanisms necessary for a distributed environment : • Type Information • Structured Storage and Persistence • Monikers • Uniform Data Transfer • Connectable Objects
Example : AMF Bowling Center System 1/6 In 1998 AMF Bowling rearchitected their international bowling center operations software using ActiveX controls and COM components. We’ll see : the container supporting the AMF BOSS System, version 1.0
Example : AMF Bowling Center System 2/6 The AMF container
Example : AMF Bowling Center System 3/6 Building blocks : • Microsoft ActiveX controls • implement user interface for each primary functional area • Component Object Model objects used by the controls to perform processing
Example : AMF Bowling Center System 4/6 The container : • needs to know enough about any ActiveX control • offers its services via interfaces • communicates with each control by using an agreed upon COM interface • manages all ActiveX controls and their relationships • supports add-in COM objects
Example : AMF Bowling Center System 5/6 • Architectural requirements : • ability for customers to upgrade their system • isolated development of new modules • Solution : • COM deployed in a traditional client/server environment
Example : AMF Bowling Center System 6/6 CContainer Handles Messages for Creates/Destroys CDynDlgbar CCentralManageActiveXControls Manages uses Creates/Destroys Creates/Destroys CCentralManageDlgbars uses uses IManageDlgbars IManageActiveXControls
Introducing DCOM An extension to COM that allows network-based component interaction COM : processes can run on the same machine but in different address spaces DCOM extension : allows processes to be spread across a network DCOM (1995) is a seamless evolution of COM you can take advantage of your existing investment in COM-based applications, components, tools and knowledge
Component COM Object COM Object Security Provider Security Provider DCE RPC DCE RPC Protocol Stack Protocol Stack DCOM network- protocol DCOM Architecture Component DCOM sits right in the middle of the components fo your application; it provides the invisible glue that ties things together.
Location Independence … with DCOM are easy to work around, because the details of deployment are not specified in the source code : DCOM completely hides the location of a component Conflicting design constraints… • in practice, however, applications need to consider the two primary constraints of a network connection: • bandwidth • latency preferred transport protocol : UDP
Connection Management DCOM : • manages connections to components that are dedicated to a single client, as well as components that are shared by multiple clients, by mantaining a reference count on each component • uses an efficient pinging protocol to detect if clients are still active • takes advantage of Windows NT support for multiprocessing for enhancing applications’ scalability
Security by Configuration 4) Fail or allow call 3) Is user in the list? 2) Authenticate user • DCOM obtains user name
Security on the Internet DCOM uses the security framework provided by Windows NT , this supports multiple security providers including : • Windows NT NTLM authentication protocol • the Kerberos Version 5 authentication protocol • distributed password authentication • secure channel security services • a DCE-compliant security provider
Weaknesses of COM/DCOM • COM/DCOM is hard to use • COM is not robust enough for enterprise deployments Microsoft is walking to turn COM and the MTS into one programming model that will simplify the lives of developers building distributed, enterprise-wide COM applications • COM/DCOM are best supported on Windows 95 and NT platforms • low cost development tools provide the ability to build and access COM components for Windows platforms, for other platforms the prices are considerably more expensive
Comparison of DCOM, CORBA, RMI Java RMI comes from JavaSoft CORBA is a specification resulting from OMG DCOM comes from Microsoft Their main goal : to provide an infrastructure to enable writing distributed applications with relative ease, although they do so in different ways
Callbacks are blocked in synchronized methods • Not always intuitive • Not available to other languages • There are limited development tools • Performance can be slow as you scale Java RMI • Very easy to use • Remoteable interfaces have a special exception • Supports object-by-value • Versioning is built into serialization
CORBA 1/2 • Architecture for system composition • Has a standard terminology for concepts • Declarative interfaces separate the interface from the implementation • Provides mappings from IDL to C, C++, SmallTalk and Java • Supports : • evolvable and marshallable data • design portability • standard interoperability protocols • Scalable for large systems
CORBA 2/2 • No inheritance for Exceptions • Objects cannot support two versions of the same interface • IDL is not internationalized • Divergent security mechanisms (Kerberos, SSL) • Few advanced services • C++ mapping has complicated memory management rules • Limited developer tools (usually just an IDL compiler) • Limited concurrency model
Minimal support on non-Microsoft platforms • Hard to keep registry consistent • Reference counting is a problem • Client has to choose the interaction model DCOM • Lots of tools, books and developers • Separates interface from implementation • Good integration of automation objects with VisualBasic and Java • Good set of compound document interfaces • Microsoft depends on it working
So, What Shall I Use? 1/2 • Requirement : no recompilation moving applications to various platforms the Java/CORBA solution may be more appropriate then COM • Requirement : interaction with DCOM objects pure DCOM solution
So, What Shall I Use? 2/2 • Requirement : distributed application written entirely in Java RMI for its ease of programming • Requirement: plug-in components created by third parties components may be based around a DCOM or CORBA interface
References 1/2 • http://www.microsoft.com/ • Main source : terminology, technical documentation, example from official Microsoft site • www. sei.cmu.edu/str/descriptions/com_body.html • The Software Engineering Institute (SEI) is a federally funded research and development center sponsored by the U.S. Department of Defense. I found some interesting documentation in their Software Technology Review • www2.umassd.edu/coursepages/SoftwareArchitecture/paul-com/ • University of Massachussets, lessons of the module of Software Architecture about COM.
References 2/2 • http://www.whatis.techtarget.com/ • An IT company which offers targeted industry-specific search engines that deliver access to relevant information on the Web. I found here useful explanation about DDE, OLE, MTS, ActiveX. • http://www.webopedia.com/ • Online dictionary and search engine for computer and Internet technology. • Introduzione a COM – seminario di E. Lodolo • From a lesson at University of Genoa : introduction about COM and Windows fundamentals
THE END T H E E N D
Clipboard • The simplest mechanism available to exchange data between applications running in hte Windows environment • A section of computer memory that temporarily stores data especially to facilitate its movement or duplication back
DDE : Dynamic Data Exchange • An asynchronous message-based communication protocol • An interprocess communication (IPC) system built into the Macintosh, Windows, and OS/2 operating systems • Enables two running applications to share the same data • Example : DDE makes it possible to insert a spreadsheet chart into a document created with a word processor. Whenever the spreadsheet data changes, the chart in the document changes accordingly. • Still used by many applications • Supplanted by OLE provides greater control over shared data.back
OLE : Object Linking & Embedding • A compound document standard developed by Microsoft Corporation • Enables you to create objects with one application and then link or embed them in a second application. Embedded objects retain their original format and links to the application that created them. • back
DLL : Dynamic Link Library Two kinds of executables in Windows: • EXE • DLL Functions exported from a DLL are linked at runtime, not during compilation. • We have two linking modalities for a DLL: • static link : when application is loaded • dynamic link : at any time by API’s LoadLibrary, GetProcAddress, FreeLibrary Advantages: modularity, code sharing,substitutability. back
VMT : Virtual Method Table 1/2 Virtual methods can be redefined in derived classes. Virtual methods calls are solved at execution time (late binding) indirect jump (small) overhead In compiled object languages virtual methods are implemented by VMT : a function pointer table • one VMT for each class • instance : data structure holding an object state • its first field is a pointer to the VMT of the class to which the object owns • all instances of the same class point to the same VMT
I1 : C1 implementations VMT : Virtual Method Table 2/2 Pointer to VMT Attribute 1 Attribute 2 Attribute 3 …………………… VMT of class C1 Pointer to function 1 Pointer to function 2 Pointer to function 3 I2 : C1 Pointer to function 4 Pointer to VMT Attribute 1 Attribute 2 Attribute 3 …………………… back
MTS : Microsoft transaction Server 1/2 A container for in-process server side components. A component-based programming model. An MTS component is a type of COM component that executes in the MTS run-time environment. What does it do? • Allows you to define and use transactions within COM objects • Enforces modelling based on components – just as COM
MTS : Microsoft transaction Server 2/2 • Handles communication between components through DCOM and HTTP protocols • Uses roles and packages • Uses Just In TIME (JIT) Activation • Surrogate Process (MTS.EXE) • Microsoft Distributed • Transaction • Coordinator (MS DCT) • Run-time divided into three parts : • MTS Explorer back