Docsity

CORBA Case Study - Lecture Slides | CS 5523, Study notes of Operating Systems

Toggle sidebar
bg1
1
CS 5523 Lecture 21:
A CORBA Case Study
❚CORBA overview
❚CORBA objects and IDL
❚The ShapeList example in CORBA
❚CORBA naming service
❚Other CORBA services
❚Recommended reading
CORBA overview:
❚Middleware that allows communication between programs
independent of language, OS, hardware, and network
❚Applications are built from CORBA objects
❚CORBA objects implement interfaces defined in IDL
❚Clients access methods in the IDL interfaces by RMI
❚RMI is implemented by an ORB (Object Request Broker)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download CORBA Case Study - Lecture Slides | CS 5523 and more Study notes Operating Systems in PDF only on Docsity!

CS 5523 Lecture 21:

A CORBA Case Study

❚ CORBA overview

❚ CORBA objects and IDL

❚ The ShapeList example in CORBA

❚ CORBA naming service

❚ Other CORBA services

❚ Recommended reading

CORBA overview:

❚ Middleware that allows communication between programs

independent of language, OS, hardware, and network

❚ Applications are built from CORBA objects

❚ CORBA objects implement interfaces defined in IDL

❚ Clients access methods in the IDL interfaces by RMI

❚ RMI is implemented by an ORB (Object Request Broker)

Remote interfaces – Java RMI versus CORBA:

❚ CORBA – uses IDL to specify remote interfaces

❚ JAVA – uses ordinary interfaces that are extended by the

keyword remote.

CORBA objects versus Java RMI objects:

CORBA objects:

❚ implement an IDL interface

❚ have a remote object reference

❚ can respond to invocations of methods in the IDL interface

How does this differ from Java RMI?

❚ CORBA objects can be implemented in non-OO languages

❚ clients don’t have to be objects

❚ classes cannot be implemented in IDL – so no objects can be

passed, only data structures

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 4.

CORBA CDR for constructed types

Type Representation sequence length (unsigned long) followed by elements in order string length (unsigned long) followed by characters in order (can also can have wide characters) array array elements in order (no length specified because it is fixed) struct in the order of declaration of the components enumerated unsigned long (the values are specified by the order declared) union type tag followed by the selected member

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 4.

CORBA CDR message

The flattened form represents a Person struct with value: {‘Smith’, ‘London’, 1934}

"Smit" "h___" 6 "Lond" "on__" 1934

index in sequence of bytes 4 bytes

notes on representation length of string ‘Smith’

length of string ‘London’

unsigned long

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 5.

CORBA IDL example

// In file Person.idl struct Person { string name; string place; long year; } ; interface PersonList { readonly attribute string listname; void addPerson(in Person p) ; void getPerson(in string name, out Person p); long number(); };

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

IDL interfaces Shape and ShapeList

struct Rectangle{ 1 long width; long height; long x; long y; } ;

struct GraphicalObject { 2 string type; Rectangle enclosing; boolean isFilled; };

interface Shape { 3 long getVersion() ; GraphicalObject getAllState() ; // returns state of the GraphicalObject };

typedef sequence <Shape, 100> All; 4 interface ShapeList { 5 exception FullException{ }; 6 Shape newShape(in GraphicalObject g) raises (FullException); 7 All allShapes(); // returns sequence of remote object references 8 long getVersion() ; };

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

Java class ShapeListServer

import org.omg.CosNaming.; import org.omg.CosNaming.NamingContextPackage.; import org.omg.CORBA.*; public class ShapeListServer { public static void main(String args[]) { try{ ORB orb = ORB.init(args, null); 1 ShapeListServant shapeRef = new ShapeListServant(orb); 2 orb.connect(shapeRef); 3 org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); 4 NamingContext ncRef = NamingContextHelper.narrow(objRef); NameComponent nc = new NameComponent("ShapeList", ""); 5 NameComponent path[] = {nc}; 6 ncRef.rebind(path, shapeRef); 7 java.lang.Object sync = new java.lang.Object(); synchronized (sync) { sync.wait();} } catch (Exception e) { ... } } }

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

Java client program for CORBA interfaces Shape and ShapeList

import org.omg.CosNaming.; import org.omg.CosNaming.NamingContextPackage.; import org.omg.CORBA.*; public class ShapeListClient{ public static void main(String args[]) { try{ ORB orb = ORB.init(args, null); 1 org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); NameComponent nc = new NameComponent("ShapeList", ""); NameComponent path [] = { nc }; ShapeList shapeListRef = ShapeListHelper.narrow(ncRef.resolve(path)); 2 Shape[] sList = shapeListRef.allShapes(); 3 GraphicalObject g = sList[0].getAllState(); 4 } catch(org.omg.CORBA.SystemException e) {...} }

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

The main components of the CORBA architecture

client server

proxy

or dynamic invocation

implementation repository (^) object adapter

ORB ORB

skeleton

or dynamic skeleton

client program

interface repository

Request

Reply

for A core core

Servant A

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

IDL module Whiteboard

module Whiteboard { struct Rectangle{ ...} ; struct GraphicalObject { ...}; interface Shape { ...}; typedef sequence <Shape, 100> All; interface ShapeList { ...}; };

CORBA pseudo objects:

❚ provide interfaces to the functionality of the ORB

❚ have IDL interfaces, but cannot be passed as remote references

❚ examples:

❙ init – method to initialize the ORB

❙ connect – method used to register objects with the ORB

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Page 684

CORBA interoperable object references

IOR format

IDL interface type name Protocol and address details Object key interface repository identifier

IIOP host domain name

port number adapter name object name

CORBA naming service:

❚ binder providing facilities for servers to register remote objects

❚ provides facilities for clients to resolve names by name

❚ names are structured hierarchically

❚ each name in a path is inside a structure NameComponent

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

Naming graph in CORBA Naming Service

initial naming context

ShapeList C D E

B

initial naming context

P

R S^ T

V

Q U

initial naming context

XX

CORBA services:

❚ trading service – allows location of CORBA objects by attribute

❚ transaction service –

❙ implements transactions with two-phase commit

❙ start with a begin and terminate with commit or rollback

❙ give all or nothing semantics

❚ concurrency service – allows lock on an object

❚ persistent object service – allows objects to store themselves

CORBA event services:

❚ suppliers (objects of interest) can communiation notifications to

subscribers (consumers)

❚ notifications can either be pushed or pulled (PushConsumer

interface versus PullSupplier interface)

❚ event channels –

❙ allow multiple suppliers to communicate with multiple consumers

asynchronously

❙ suppliers get proxy consumers from the event channel

❙ consumers get proxy suppliers from the event channel

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 17.

CORBA event channels

supplier consumer

proxy consumer

notification proxy supplier

event channel

notification notification

CORBA notification services:

❚ extends the event server

❚ notifications may be data structures

❚ event consumers may use filters

❚ event suppliers can discover which events consumers are

interested in

❚ channel properties can be configured

❚ an event repository is provided

For next time:

❚ Read CDK 8.1-8.