CORBA Distributed Polymorphism

Post on 12-Jan-2015

1.274 views 0 download

Tags:

description

 

Transcript of CORBA Distributed Polymorphism

Software Architecture

CORBA distributed Polymorphism

2

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

3

31/0

3/0 3

Changes example : the printer

Client Printing Server

From The CORBA BibleMichi HenningSteve VinoskiAdvanced CORBA Programming with C++

4

31/0

3/0 3

Changes example : the printer

Client Printing Server

5

31/0

3/0 3

Changes example : the printer

Old Client Printing Server

New Client

6

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

7

31/0

3/0 3

Change management with OOD reuse

� At the beginning we had only a black and white line printer.

Current Code Current Code

Black And White Printer

Client Printing Server

8

31/0

3/0 3

Change management with OOD reuse

� Hardware technology evolve “quicker” than software technology we can now use a brand new colour printer.

Old Code New Code

Colour Printer

Client Printing Server

9

31/0

3/0 3

Change management and code reuse before OOD

� The problem is that our application has to be changed because the new printer server interface changed.

Old Code New Code

Colour Printer

10

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

11

31/0

3/0 3

Change management with OOD reuse

� By using an “object” interface and polymorphism we can change the printer server interface transparently.

Old Code New Code

Colour Printer

Printer

12

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

13

31/0

3/0 3

Object properties

� “Object” means the following properties of our system entities:

� Encapsulation.

� Interfaces.

� Inheritance.

� Polymorphism.

� Exception handling.

� Polymorphism based an interface inheritancelet compilers and middleware managed the changes.

14

31/0

3/0 3

CORBA = Distributed Polymorphism

� In Object Oriented Programming the compiler manages the polymorphism

�With CORBA the ORB manages the distributedpolymorphism

�CORBA Common Object Services (COS) enable distributed polymorphism and distributed patterns

15

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

16

31/0

3/0 3

Example UML Diagram

Strip

Strip : string

Print()

Strip : string

Print()

Printer

Print()Print()

Print

1

ColorPrinter

Setcolor()Setcolor()

From The CORBA BibleMichi HenningSteve VinoskiAdvanced CORBA Programming with C++

17

31/0

3/0 3

Example Interface Inheritance (IDL)

interface interface interface interface ColorPrinterColorPrinterColorPrinterColorPrinter : Printer {: Printer {: Printer {: Printer {

enumenumenumenum ColorModeColorModeColorModeColorMode { { { { BlackAndWhiteBlackAndWhiteBlackAndWhiteBlackAndWhite, , , , FullColorFullColorFullColorFullColor};};};};

VoidVoidVoidVoid set_colorset_colorset_colorset_color (in (in (in (in ColorMOdeColorMOdeColorMOdeColorMOde mode);mode);mode);mode);

};};};};

Printer

ColorPrinter

interface Printer {interface Printer {interface Printer {interface Printer {

VoidVoidVoidVoid print();print();print();print();

};};};};

18

31/0

3/0 3

printer

Printer

print()

ClientPrint()

Colour

set_color()

19

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

20

31/0

3/0 3

printer

Printer

print()

ClientPrint()

21

31/0

3/0 3

Printer IOR

CORBA Distributed Polymorphism example 1

Client PrinterPrinter.Print

Printer IOR

foo Bar IOR

Waldo Fred IOR

quux

NamingService

Printer

22

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

23

31/0

3/0 3

CORBA = Distributed Polymorphism

� CORBA “naming service” enables printer to publish its interface reference.

� Clients use the naming service to get a logical access to printer.

� Distributed Naming Service provides a low couplingbetween clients and printing service.

24

31/0

3/0 3

Objet Reference and Naming

Client NamingService

Server

Server exportsIOR

Client lookup for Interface IOR

Client submits request to server

25

31/0

3/0 3

CORBA = Distributed Polymorphism

� Client makes no assumption on the printer implementation

� Thus when the old server is replaced the change is transparent for the old clients.

� New clients can used the printer new functionality without modifications in old clients.

26

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

27

31/0

3/0 3

Printer IOR

CORBA Distributed Polymorphism

Client PrinterPrinter.Print

Printer IOR

foo Bar IOR

Waldo Fred IOR

quux

NamingService

Printer

28

31/0

3/0 3

Printer Color IOR

CORBA = Distributed Polymorphism

Client Printer

Printer IOR

foo Bar IOR

Waldo Fred IOR

quux

NamingService

Printer.Print

ColorPrinter

Printer

Black And WhiteClient

29

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

30

31/0

3/0 3

Printer Color IOR

CORBA Distributed Polymorphism

Client Printer

Printer IOR

foo Bar IOR

Waldo Fred IOR

quux

NamingService

Printer.Print

ColorPrinter

PrinterSecure Down casting

ColourClient

31

31/0

3/0 3

printer

Printer

print()

ClientPrint()

Colour

set_color()

32

31/0

3/0 3

1

3 1/0

3/03

Thales Air Traffic Management

CORBA Distributed Polymorphism

� The Printer Example� Without OOD� With OOD� Object Properties� Printer IDL� B&W printer� CORBA Naming� Colour printer� CORBA Secure Downcasting� CORBA distributed Polymorphism

33

31/0

3/0 3

Factory And Code Generation

Printer

+print()

Black & White

+ print()

ClientPrint()

34

31/0

3/0 3

Factory And Code Generation

Printer

+print()

ClientPrint()

Black & White

+ print()

Colour

+ print()

35

31/0

3/0 3

Factory And Code Generation

Printer

+print()

Black & White

+ print()

Print()Client

Colour

+ print()

FAX

+ print()

36

31/0

3/0 3

Factory And Code Generation

Printer

+print()

Black & White

+ print()

Print()Client

Colour

+ print()

FAX

+ print()

Strip

+ print()

37

31/0

3/0 3

Factory And Code Generation

<<Interface>>Printer

+print()

Black & White

+ print()

Print()Client

Colour

+ print()

FAX

+ print()

Strip

+ print()

38

31/0

3/0 3

Factory And Code Generation

<<Interface>>Printer Factory

Black & WhiteFactory

CreateClient

Generated Printer Factory

ColourFactory

FAXFactory

StripFactory