CORBA Case Study: IDL, Objects, Services, Interoperability, Study notes of Operating Systems

A lecture note from cs 5523, focusing on corba, a middleware that enables communication between programs independently of language, os, hardware, and network. It covers corba objects, idl interfaces, corba services, and interoperability. The document also includes a case study of the shapelist example in corba and a discussion on corba versus java rmi.

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-zfv
koofers-user-zfv 🇺🇸

10 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CS 5523 Lecture 21:
A CORBA Case Study
CORBA overview
CORBA objects and IDL
The ShapeList exampl e in CORBA
CORBA naming service
Other CORBA services
Recommended read ing
CORBA overview:
Middleware that allows communication between programs
independent of language, OS, hardware, and network
Applications are built from CORBA objects
CORBA objects imple ment interfaces defi ned in IDL
Clients access metho ds in the IDL interfac es by RMI
RMI is implemented by a n 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.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CORBA Case Study: IDL, Objects, Services, Interoperability 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

CORBA IDL interfaces:

❚ specify a name and a set of methods

❚ parameters are marked with keywords in, out, or inout

❚ parameters can be of a primitive type or constructed type

❚ allows exceptions to be defined in interfaces and thrown by

methods

❚ invocation is at-most-once by default (can also specify oneway)

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

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 Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000

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 Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000

Figure 17.

Java interface ShapeList generated by idltojava from CORBA interface ShapeList

public interface ShapeList extends org.omg.CORBA.Object {

Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException;

Shape[] allShapes();

int getVersion();

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

Figure 17.

ShapeListServant class of the Java server program for CORBA interface ShapeList

import org.omg.CORBA.*; class ShapeListServant extends _ShapeListImplBase { ORB theOrb; private Shape theList[]; private int version; private static int n=0; public ShapeListServant(ORB orb){ theOrb = orb; // initialize the other instance variables } public Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException { 1 version++; Shape s = new ShapeServant( g, version); if(n >=100) throw new ShapeListPackage.FullException(); theList[n++] = s; 2 theOrb.connect(s); return s; } public Shape[] allShapes(){ ... } public int getVersion() { ... } }

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

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 Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000

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 Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000

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

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 Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000

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 Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000

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 naming service (contined):

❚ initial naming context – provides a root for a set of bindings

❚ clients and servers request initial naming context

❚ an object of type NamingContext is returned and names are

relative to it

❚ an object is either a remote object or a NamingContext

❚ names are of type NameComponents and have a name and a

kind.

❚ a Name type is a sequence of NameComponents

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

Figure 17.

Part of the CORBA Naming Service NamingContext interface in IDL

struct NameComponent { string id; string kind; };

typedef sequence Name;

interface NamingContext {

void bind (in Name n, in Object obj);

binds the given name and remote object reference in my context.

void unbind (in Name n);

removes an existing binding with the given name.

void bind_new_context(in Name n);

creates a new naming context and binds it to a given name in my context.

Object resolve (in Name n);

looks up the name in my context and returns its remote object reference.

void list (in unsigned long how_many, out BindingList bl, out BindingIterator bi);

returns the names in the bindings in my context.

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

CORBA security services:

We’ll talk about at the end of the course….

CORBA recommended reading:

The October 1998 Issue of the Communications of the ACM was

devoted to new developments in CORBA. It contains many

excellent articles.

For next time:

❚ Read CDK 8.1-8.