52
1 University of Genoa Course of Software Engineering II 01-02 Elisabetta Parodi

Download It

  • Upload
    sammy17

  • View
    351

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Download It

1

University of GenoaCourse of Software Engineering II 01-02

Elisabetta Parodi

Page 2: Download It

2

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

Page 3: Download It

3

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

Page 4: Download It

4

Introduction : walking towards COM

Windows purpose : moving integration between applicative functions to O.S. level

it needs effective communication mechanisms between applications

clipboard

DDE

OLE

COM

1/2

Page 5: Download It

5

2/2

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

Introduction : walking towards COM

Page 6: Download It

6

Introducing COM

• 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 : Component Object Model (1992)

Page 7: Download It

7

COM Terminology

• Interfacea 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

Page 8: Download It

8

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 used to write components that can interoperate with other components written into the same binary standard

Page 9: Download It

9

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

Page 10: Download It

10

• considered logically immutable

reason : removing the potential for version incompatibilitynew functionality : can be exposed through a different interface

remember :

• is not a class• is not a component object• denotes behavior only, not state• component objects can implement multiple interfaces• is strongly typed

Interface 2/3

Page 11: Download It

11

Interface 3/3• identified by an IID• must derive from Iunknown :

one special interface to implement some essential functions: all component objects are required to implement it

three methods :

• 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

simple reference counting methods

Page 12: Download It

12

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

Page 13: Download It

13

Component Object Library

RegistrationDB

Application

CLSID

CLSIDDLL

.EXE

Creating a component object

CLSID

Page 14: Download It

14

COM serverIn 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

Page 15: Download It

15

Cient Application

In-ProcessObject

Local Object Proxy

Client Process

In-Process Server

RemoteObject Proxy

Stub

Local Object

Local Server Process

COMLocal

ServerRPC

Remote Machine

Stub

COM

RemoteObject

Remote Server

Remote Server Process

RPC

COM

Page 16: Download It

16

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

Page 17: Download It

17

Client Applicatio

n

COM

Object

Server

1) Create Object

2) Locate Implementation

4) Call interface members3) Get object interface pointer return to client

What happens when a client wishes to create and use a COM object?

Page 18: Download It

18

When an application uses a COM object:

2) calls CoCreateInstance (exported by COMPOBJ.DLL) passing the CLSID of the used object; CoCreateInstance : 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

1) initializes the system : CoInitialize

3) uses IUnknown.QueryInterface to access the wanted interface4) uses Addref and Release to manage the object lifecycle5) in the end calls CoUninitialize

Page 19: Download It

19

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

Page 20: Download It

20

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

Page 21: Download It

21

Example : AMF Bowling Center System 2/6

The AMF container

Page 22: Download It

22

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

Page 23: Download It

23

Example : AMF Bowling Center System

4/6The 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

Page 24: Download It

24

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

Page 25: Download It

25

Example : AMF Bowling Center System

6/6CContainer

CCentralManageDlgbars

CCentralManageActiveXControlsCDynDlgbar

Creates/DestroysHandles Messages for

Creates/Destroys uses

IManageDlgbars IManageActiveXControls

uses

Creates/Destroys

uses

Manages

Page 26: Download It

26

Introducing DCOM

DCOM (1995) is a seamless evolution of COM

you can take advantage of your existing investment in COM-based applications, components, tools and knowledge

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

Page 27: Download It

27

DCOM Architecture

DCOM sits right in the middle of the components fo your application; it provides the invisible glue that ties things together.

COMObject

Component

SecurityProvider

DCE RPC

Protocol Stack

SecurityProvider

DCE RPC

Protocol Stack

DCOM network-protocol

COMObject

Component

Page 28: Download It

28

Location IndependenceConflicting design constraints…

… 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

in practice, however, applications need to consider the two primary constraints of a network connection:

• bandwidth

• latency preferred transport protocol : UDP

Page 29: Download It

29

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

Page 30: Download It

30

Security by Configuration

1) DCOM obtains user name

2) Authenticate user

3) Is user in the list?

4) Fail or allow call

Page 31: Download It

31

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

Page 32: Download It

32

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

Page 33: Download It

33

Comparison of DCOM, CORBA, RMI

Their main goal : to provide an infrastructure to enable writing distributed applications with relative ease, although they do so in different ways

Java RMI comes from JavaSoft

CORBA is a specification resulting from OMG

DCOM comes from Microsoft

Page 34: Download It

34

Java RMI

• Very easy to use• Remoteable interfaces have a special exception• Supports object-by-value• Versioning is built into serialization

• 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

Page 35: Download It

35

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

Page 36: Download It

36

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

Page 37: Download It

37

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

• Minimal support on non-Microsoft platforms

• Hard to keep registry consistent

• Reference counting is a problem

• Client has to choose the interaction model

Page 38: Download It

38

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

Page 39: Download It

39

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

Page 40: Download It

40

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.

Page 41: Download It

41

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

Page 42: Download It

42

THE ENDT H E E N D

Page 43: Download It

43

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

Page 44: Download It

44

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

Page 45: Download It

45

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

Page 46: Download It

46

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

Page 47: Download It

47

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

VMT : Virtual Method Table 1/2

Page 48: Download It

48

I1 : C1

Pointer to VMT

Attribute 1

Attribute 2

Attribute 3

……………………

I2 : C1

Pointer to VMT

Attribute 1

Attribute 2

Attribute 3

……………………

Pointer to function 1 Pointer to function 2 Pointer to function 3 Pointer to function 4

VMT of class C1

implementations

back

VMT : Virtual Method Table 2/2

Page 49: Download It

49

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.

• Allows you to define and use transactions within COM objects

What does it do?

• Enforces modelling based on components – just as COM

Page 50: Download It

50

• Uses roles and packages

• Uses Just In TIME (JIT) Activation

• Run-time divided into three parts :

• Surrogate Process (MTS.EXE)

• Microsoft Distributed Transaction Coordinator (MS DCT)

• MTS Explorerback

• Handles communication between components through DCOM and HTTP protocols

MTS : Microsoft transaction Server 2/2

Page 51: Download It

51

ActiveX 1/2

• Technology developed by Microsoft for sharing information among different applications

• Outgrowth of OLE and COM supports new features that enable it to take advantage of the Internet

• Not a programming language but a set of rules for how applications should share information

Page 52: Download It

52

ActiveX 2/2

• ActiveX control • similar to Java applet but :

– full access to the Windows operating system

– limitated to Windows environments• can be developed in a variety of languages

back