CORBA Chapter 17 Coulouris text Todays Topics CORBA
CORBA Chapter 17 Coulouris text
Today’s Topics • • CORBA History and goals CORBA RMI CORBA services The Distributed Whiteboard Revisited
CORBA History and Goals • Object Management Group Formed in 1989 • Goals: -- OOP on distributed systems -- heterogeneous hardware -- heterogeneous OS -- different programming languages
History and Goals • OMG Introduced the Object Request Broker (ORB) • The role of the ORB is to help a client find an object, activate the object if necessary, and call a method on the object. • Common Object Request Broker Architecture (CORBA) agreed to by a group of companies in 1991 • CORBA 2. 0 specification released in 1996
History and Goals • CORBA 2. 0 specification defined standards for different implementations of CORBA to communicate with one another • These standards are called the General Inter-ORB protocol (GIOP) and may run over various transports • GIOP over TCP/IP is called the Internet Inter-ORB Protocol
CORBA RMI • Main components -- An Interface Definition language (IDL) that promotes the use of different programming languages, stubs are generated in the client’s language and skeletons are generated in the server’s language -- An architecture -- GIOP defines an external data representation (CDR) as well as message formats and message types -- Message types include request and reply as well as location requests, errors, and request cancellations
CORBA Services • A set of generic services that can be used for distributed application -- Naming Service (location by name) -- Trading Service (location by attribute directory service) -- Event Service -- Security Service (authentication, ACL’s, auditing, nonrepudiation) -- Transaction Service (begin, commit, rollback a series of RMI calls ) -- Persistent Object Service (POS)
The Distributed Whiteboard Example in CORBA
IDL interfaces Shape and Shape. List struct Rectangle{ // no class in IDL 1 long width; long height; long x; long y; }; interface Shape { long get. Version() ; Graphical. Object get. All. State() ; }; struct Graphical. Object { 2 string type; Rectangle enclosing; boolean is. Filled; }; 3 // returns state of the Graphical. Object typedef sequence <Shape, 100> All; // All is a 100 element array 4 interface Shape. List { 5 exception Full. Exception{ }; 6 Shape new. Shape(in Graphical. Object g) raises (Full. Exception); 7 All all. Shapes(); // returns sequence of remote object references 8 long get. Version() ; // parameters are in, out, or both }; // parameters may be primitive, struct or array and // are passed by value // parameters whose type is an IDL interface // is passed by remote reference
idltojava • Run idltojava on the above interface • The command idlj is found in j 2 sdk 1. 4. 2bin • The Java 2 Platform, Standard Edition, v 1. 4, provides an Object Request Broker (ORB) runtime component • The JDK documentation states that its Java ORB has not been tested with ORB’s written in other languages • JDK 1. 4 provides an Orb class with a pluggable architecture
From the JDK Doc OMG specifies a mapping from IDL to several different programming languages, including Java, C, C++, Lisp, Python, Smalltalk, COBOL, and Ada. When mapped, each statement in OMG IDL is translated to a corresponding statement in the programming language of choice.
Java interface Shape. List generated by idltojava from CORBA interface Shape. List public interface Shape. List extends org. omg. CORBA. Object { Shape new. Shape(Graphical. Object g) throws Shape. List. Package. Full. Exception; Shape[] all. Shapes(); int get. Version(); }
Shape. List. Servant class from CORBA interface Shape. List import org. omg. CORBA. *; class Shape. List. Servant extends _Shape. List. Impl. Base { ORB the. Orb; private Shape the. List[]; private int version; private static int n=0; public Shape. List. Servant(ORB orb){ the. Orb = orb; // initialize the other instance variables } public Shape new. Shape(Graphical. Object g) throws Shape. List. Package. Full. Exception { version++; Shape s = new Shape. Servant( g, version); if(n >=100) throw new Shape. List. Package. Full. Exception(); the. List[n++] = s; the. Orb. connect(s); return s; } public Shape[] all. Shapes(){. . . } public int get. Version() {. . . } } 1 2
Java class Shape. List. Server import org. omg. Cos. Naming. *; import org. omg. Cos. Naming. Context. Package. *; import org. omg. CORBA. *; public class Shape. List. Server { public static void main(String args[]) { try{ ORB orb = ORB. init(args, null); Shape. List. Servant shape. Ref = new Shape. List. Servant(orb); orb. connect(shape. Ref); org. omg. CORBA. Object obj. Ref = orb. resolve_initial_references("Name. Service"); Naming. Context nc. Ref = Naming. Context. Helper. narrow(obj. Ref); Name. Component nc = new Name. Component("Shape. List", ""); Name. Component path[] = {nc}; nc. Ref. rebind(path, shape. Ref); java. lang. Object sync = new java. lang. Object(); synchronized (sync) { sync. wait(); } } catch (Exception e) {. . . } } } 1 2 3 4 5 6 7
Java client program for CORBA interfaces Shape and Shape. List import org. omg. Cos. Naming. *; import org. omg. Cos. Naming. Context. Package. *; import org. omg. CORBA. *; public class Shape. List. Client{ public static void main(String args[]) { try{ ORB orb = ORB. init(args, null); 1 org. omg. CORBA. Object obj. Ref = orb. resolve_initial_references("Name. Service"); Naming. Context nc. Ref = Naming. Context. Helper. narrow(obj. Ref); Name. Component nc = new Name. Component("Shape. List", ""); Name. Component path [] = { nc }; Shape. List shape. List. Ref = Shape. List. Helper. narrow(nc. Ref. resolve(path)); 2 Shape[] s. List = shape. List. Ref. all. Shapes(); 3 Graphical. Object g = s. List[0]. get. All. State();
The main components of the CORBA architecture client proxy ORB program for A core or dynamic invocation implementation repository Request Reply server interface repository object skeleton adapter ORB core Servant A or dynamic skeleton
Naming graph in CORBA Naming Service initial naming context B Shape. List initial naming context XX P V C D E R Q S U T
Where are we heading? • Working with J 2 EE using JBoss • Integrating web services with J 2 EE
SOAP and J 2 EE Slide from JAXM/JMS tutorial at Sun Microsystems
Slide from JAXM/JMS tutorial at Sun Microsystems
- Slides: 20