PROFESSOR: DR.JALILI BY: MAHDI ESHAGHI 1
2 Overview Distributed OZ Java RMI CORBA IDL IDL VS C++ CORBA VS RMI
3 Distributed OZ Oz Language Multi paradigm language, strong support for compositionality and concurrency Simple formal semantics and efficient implementation Strengths Concurrency Distribution (transparent, open, ) Flexibility Distributed garbage collection
Kernel language <s> ::= skip <x> 1 =<x> 2 <x>=<v> <s> 1 <s> 2 local <x> in <s> end Empty statement Variable-variable binding Variable-value binding Sequential composition Variable creation if <x> then <s> 1 else <s> 2 end case <x> of <p> then <s> 1 else <s> 2 end {<x> <y> 1 <y> n } thread <s> end {ByNeed <x> 1 <x> 2 } Conditional Pattern matching Procedure invocation Thread creation Trigger creation {NewName <x>} try <s> 1 catch <x> then <s> 2 end raise <x> end {NewCell <x> 1 <x> 2 } {Exchange <x> 1 <x> 2 <x> 3 } <space> Name creation Exception context Raise exception Cell creation Cell exchange Encapsulated search
Access structure in the distribution graph 5
6 Binding a logic variable 1- Proxy requests binding 2- Thread initiates binding and blocks 3- Manager grants binding & multicasts to all proxies 4- Proxy informs thread, allowing thread to continue
An object with one attribute and two methods 7
A local object 8
A global object with one remote reference 9
The object is invoked remotely (1) 10
The object is invoked remotely (2) 11
The object is invoked remotely (3) 12
The object moves back to Site 1 13
Site 1 has sent the state pointer to Site 14
Site 2 has the state pointer 15
16 What about RMI? Though RMI is an ORB in the generic sense that it supports making method invocations on remote objects. RMI is native to Java. RMI has some limitations, objects or applications written in any other language. it's a viable alternative to CORBA for some applications.
Programming or Integration? 17
Java and RMI 18
19 RMI Architecture There are three layers that comprise the basic remoteobject communication facilities in RMI: 1. The stub/skeleton layer 2. The remote reference layer 3. The transport protocol layer
The RMI runtime architecture 20
CORBA 21
CORBA ORB ARCHITECTURE 22
23 CORBA ORB ARCHITECTURE Object : Entity that consists of an identity, an interface, and an implementation, which is known as a Servant. Client : Entity that invokes an operation on an object implementation. Accessing the services of a remote object should be transparent to the caller. Ideally, it should be as simple as calling a method on an object, obj->op(args).
24 CORBA ORB ARCHITECTURE Object Request Broker (ORB) The ORB provides a mechanism for transparently communicating client requests. This makes client requests appear to be local procedure calls. ORB Interface The CORBA specification defines an abstract interface for an ORB. This interface provides various helper functions such as converting object references to strings and vice versa.
25 CORBA ORB ARCHITECTURE CORBA IDL stubs and skeletons CORBA IDL stubs and skeletons serve as the ``glue'' between the client and server applications, respectively, and the ORB. The use of a compiler reduces the potential for inconsistencies and increases opportunities for automated compiler optimizations. Object Adapter An object adapter associates object implementations with the ORB.
26 CORBA ORB ARCHITECTURE Dynamic Skeleton Interface (DSI) The DSI allows an ORB to deliver requests to an object implementation that does not have compile-time knowledge of the type of the object it is implementing. Dynamic Invocation Interface (DII) This interface allows a client to directly access the underlying request mechanisms provided by an ORB.
CORBA ORB ARCHITAECTURE 27
28 Why IDL? First, note that IDL is an extremely simple language. Second, having a single descriptive language as the basis for agreeing on interfaces is extremely important.
29 IDL Supports: Modules (for partitioning the namespace) Constants Enumerations Typedef (aliasing) Exceptions, which may be thrown by operations Interfaces, which may extend other interfaces. Attributes, operation return values and parameters have data types Parameters also have "directions": in: value sent from client to object out: value sent from object to client inout: both of the above ("value-result" parameter)
30 IDL Data Types: boolean: always either true or false. char: an ASCII or ISO Latin-1 character. octet: an 8-bit value not interpreted in any way. short: a 16-bit integer whose MSB represents its sign. unsigned short: a 16-bit integer. long: a 32-bit integer whose most significant bit represents its sign. unsigned long: a 32-bit integer. float, double: 32-bit, 64-bit IEEE floating-point numbers. string: a sequence of char's. void: for operations returning nothing.
31 IDL vs. C++ No "private", "protected" - everything is public No pointers No explicit constructors or destructors No overloaded methods No "int" data type Must specify parameter passing mode (in, out, inout) No templates No control structures
IDL Programming Language Mappings 32 IDL C++ Java module <name> { namespace <name> { package <name> const <type> <name> = <value> const <type> <name> = <value> static final <type> <name> = <value> typedef <target> <name> typedef <target> <name> compiler looks up target interface <name> { (class) <name>_var, (class) <name>_ptr public interface <name> readonly attribute <type> <name> <type> <name>() <type> <name>() attribute <type> <name> + void <name>(<type>) + void <name>(<type>) <type> <name>( [<params>]) [raises <excs>] [context <ctxs>] <type> <name>( [<params>] [,<ctxs>] ) [throw <excs>] <type> <name>( [<params>] [,<ctxs>] ) [throws <excs>] long CORBA::Long int string CORBA::char * String array array array struct struct class with public fields param: in <type> <type> <type> param: out <type> <type>& <type>holder param: inout <type> <type>& <type>holder
33 The source IDL file: stack.idl struct s { long l; string s; }; interface stack { void push(in s val); s pop(); };
34 stack.c, oe_stack.h void push (stack oe_obj, s val, CORBA_Environment* oe_env) {... } s* pop (stack oe_obj, CORBA_Environment* oe_env) {... } #ifndef OE_STACK_H #define OE_STACK_H typedef struct { long l; char *s; } s; #endif
35 Generating the Client Stubs and the Skeletons The interface specification defined in OMG IDL is used by the IDL compiler to generate client stubs for the client application and skeletons for the server application. The client stubs are used by the client application for all operation invocations. You use the skeleton, along with the code you write, to create the server application that implements the CORBA objects.
CORBA 36
37 CORBA vs. RMI CORBA interfaces are defined in IDL and RMI interfaces are defined in Java CORBA supports in and out parameters. CORBA was designed with language independence in mind. CORBA objects are not garbage collected
38 Reference [1]E. Aharon-Shalom and A. Heller, Implementation of a Distributed Application Using JAVA-RMI, Journal of the Electrochemical Society, vol. 129, 1982, p. 2865. [2] Mary Champione, KathyWalrath, Java Tutorial, Addisson-Wesley, 1998 [3] Henning, M. and S. Vinoski, Advanced CORBA Programming with C++, Addison Wesley Longman, Inc., 1999. [4] S.P. Ahuja, R. Eggen, and C. Daucher, Performance Evaluation of Java And C ++ Distributed Applications In A CORBA Environment, Information Sciences, 2002. [5] S. Haridi, P. Roy, P. Brand, and C. Schulte, Programming languages for distributed applications, New Generation Computing, vol. 16, Sep. 1998, pp. 223-261. [6] Peter Van Roy, Seif Haridi, Per Brand, Gert Smolka, Michael Mehl, and Ralf Scheidhauer.Mobile objects in Distributed Oz. ACMTransactions on Programming Languages and Systems, 19(5):804 851, September 1997. http://download.oracle.com/javase/1.4.2/docs/guide/idl/ http://www1.cse.wustl.edu/~schmidt/corba-overview.html http://www-cdfonline.fnal.gov/daq/corbaxxx/tutorial.html http://www.info.ucl.ac.be/people/pvr/book.html
39