CORBA Distributed Polymorphism

38
Software Architecture CORBA distributed Polymorphism

description

 

Transcript of CORBA Distributed Polymorphism

Page 1: CORBA Distributed Polymorphism

Software Architecture

CORBA distributed Polymorphism

Page 2: 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

Page 3: 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++

Page 4: CORBA Distributed Polymorphism

4

31/0

3/0 3

Changes example : the printer

Client Printing Server

Page 5: CORBA Distributed Polymorphism

5

31/0

3/0 3

Changes example : the printer

Old Client Printing Server

New Client

Page 6: CORBA Distributed Polymorphism

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

Page 7: 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

Page 8: CORBA Distributed Polymorphism

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

Page 9: CORBA Distributed Polymorphism

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

Page 10: CORBA Distributed Polymorphism

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

Page 11: 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

Page 12: CORBA Distributed Polymorphism

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

Page 13: 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.

Page 14: CORBA Distributed Polymorphism

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

Page 15: CORBA Distributed Polymorphism

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

Page 16: 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++

Page 17: CORBA Distributed Polymorphism

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();

};};};};

Page 18: CORBA Distributed Polymorphism

18

31/0

3/0 3

printer

Printer

print()

ClientPrint()

Colour

set_color()

Page 19: CORBA Distributed Polymorphism

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

Page 20: CORBA Distributed Polymorphism

20

31/0

3/0 3

printer

Printer

print()

ClientPrint()

Page 21: CORBA Distributed Polymorphism

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

Page 22: CORBA Distributed Polymorphism

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

Page 23: 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.

Page 24: CORBA Distributed Polymorphism

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

Page 25: CORBA Distributed Polymorphism

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.

Page 26: CORBA Distributed Polymorphism

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

Page 27: 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

Page 28: CORBA Distributed Polymorphism

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

Page 29: CORBA Distributed Polymorphism

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

Page 30: 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

Page 31: CORBA Distributed Polymorphism

31

31/0

3/0 3

printer

Printer

print()

ClientPrint()

Colour

set_color()

Page 32: CORBA Distributed Polymorphism

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

Page 33: CORBA Distributed Polymorphism

33

31/0

3/0 3

Factory And Code Generation

Printer

+print()

Black & White

+ print()

ClientPrint()

Page 34: CORBA Distributed Polymorphism

34

31/0

3/0 3

Factory And Code Generation

Printer

+print()

ClientPrint()

Black & White

+ print()

Colour

+ print()

Page 35: CORBA Distributed Polymorphism

35

31/0

3/0 3

Factory And Code Generation

Printer

+print()

Black & White

+ print()

Print()Client

Colour

+ print()

FAX

+ print()

Page 36: CORBA Distributed Polymorphism

36

31/0

3/0 3

Factory And Code Generation

Printer

+print()

Black & White

+ print()

Print()Client

Colour

+ print()

FAX

+ print()

Strip

+ print()

Page 37: CORBA Distributed Polymorphism

37

31/0

3/0 3

Factory And Code Generation

<<Interface>>Printer

+print()

Black & White

+ print()

Print()Client

Colour

+ print()

FAX

+ print()

Strip

+ print()

Page 38: CORBA Distributed Polymorphism

38

31/0

3/0 3

Factory And Code Generation

<<Interface>>Printer Factory

Black & WhiteFactory

CreateClient

Generated Printer Factory

ColourFactory

FAXFactory

StripFactory