Defines a framework for objectoriented distributed applications. Allows distributed programs in different languages and different platforms to interact as though they were in a single programming language on one computer. Brings advantages of OO to distributed systems. Allows you design a distributed application as a set of cooperating objects and to reuse existing objects. A software component that mediates transfer of messages from a program to an object located on a remote host. Hides underlying network communications from a programmer. ORB allows you to create software objects whose member functions can be invoked by client programs located anywhere. A server program contains instances of CORBA objects.
The Common Object Request Broker Architecture (CORBA) 09/18/19 CORBA Defines a framework for object-oriented distributed applications Allows distributed programs in different languages and different platforms to interact as though they were in a single programming language on one computer Brings advantages of OO to distributed systems Allows you design a distributed application as a set of cooperating objects and to reuse existing objects 09/18/19 The Basic Architecture n a m in g lo o k u p n a m in g s e r v ic e o b je c t c lie n t o b je c t im p le m e n ta tio n stu b s k e le t o n O R B O R B n e tw o rk n e tw o rk o p e r a t in g sy ste m o p e r a tin g sy ste m lo g ic a l d a ta flo w p h y s ic a l d a t a f lo w 09/18/19 Object Request Broker (ORB) A software component that mediates transfer of messages from a program to an object located on a remote host Hides underlying network communications from a programmer ORB allows you to create software objects whose member functions can be invoked by client programs located anywhere A server program contains instances of CORBA objects 09/18/19 Object Request Broker (ORB) 1) When a client invokes a member function on a CORBA object, the ORB intercepts the function call 2) ORB directs the function call across the network to the target object 3) The ORB then collects the results from the function call returns these to the function call 09/18/19 Implementation Detail 09/18/19 Cross-language CORBA application o b je c t c lie n t w r it t e n in J a v a s tu b in J a va g e n e te d b y co m p ilin g th e C O R B A o b je c t in te r fa c e O R B w r itte n in J a v a 09/18/19 o b je c t im p le m e n t a t io n w r it t e n in C + + s k e le to n in C + + g e n e te d b y co m p ilin g th e C O R B A o b je ct in te rfa ce O R B w r it t e n in C + + CORBA: A “Software Bus” 09/18/19 CORBA Object Interface A distributed object is defined using a software file similar to the remote interface file in Java RMI Since CORBA is language independent, the interface is defined using a universal language with a distinct syntax, known as the CORBA Interface Definition Language (IDL) The syntax of CORBA IDL is similar to Java and C++ However, object defined in a CORBA IDL file can be implemented in a large number of diverse programming languages, including C, C++, Java, COBOL, Smalltalk, Ada, Lisp, Python, and IDLScript For each of these languages, OMG has a standardized mapping from CORBA IDL to the programming language, so that a compiler can be used to process a CORBA interface to generate the proxy files needed to interface with an object implementation or an object client written in any of the CORBA-compatible languages 09/18/19 CORBA Application Diagram An ORB compatible with the IOR protocol will allow an object reference to be registered with and retrieved from any IOR-compliant directory service CORBA object references represented in this protocol are called Interoperable Object References (IORs) 09/18/19 10 Understanding HelloClient.java Importing Required Packages import HelloApp.*; // the package containing our stubs // HelloClient will use the Naming Service import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; // All CORBA applications need these classes import org.omg.CORBA.*; 09/18/19 58 Creating an ORB Object The ORB variable is declared and initialized inside the try-catch block ORB orb = ORB.init(args, null); 09/18/19 59 Obtaining the Initial Naming Context Call orb.resolve_initial_references() to get an object reference to the name server: org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); 09/18/19 60 Narrowing the Object Reference As with all CORBA object references, objRef is a generic CORBA object To use it as a NamingContextExt object, you must narrow it to its proper type NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); 09/18/19 61 Resolve the Object Reference in Naming To publish a reference in the Naming Service to the Hello object implementing the Hello interface, you first need an identifying string for the Hello object String name = "Hello"; Finally, we pass name to the naming service's resolve_str() method to get an object reference to the Hello server and narrow it to a Hello object: helloImpl = HelloHelper.narrow(ncRef.resolve-str(name)); System.out.println("Obtained a handle on server object: " + helloImpl); 09/18/19 62 Invoking the sayHello() Operation System.out.println(helloImpl.sayHello()); 09/18/19 63 // A sample object client application import HelloApp.*; import org.omg.CosNaming.*; … public class HelloClient{ static Hello helloImpl; public static void main(String args[]){ try{ ORB orb = ORB.init(args, null); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); helloImpl = HelloHelper.narrow(ncRef.resolve_str(“Hello”)); System.out.println(helloImpl.sayHello()); 09/18/19 64 Compiling and Running a Java IDL application Create and compile the Hello.idl file on the server machine: idlj -fall Hello.idl Copy the directory containing Hello.idl (including the subdirectory generated by idlj) to the client machine In the HelloApp directory on the client machine: create HelloClient.java Compile the *.java files, including the stubs and skeletons (which are in the directory HelloApp): javac *.java HelloApp/*.java 09/18/19 65 Compiling and Running a Java IDL application In the HelloApp directory on the server machine: Create HelloServer.java Compile the java files: javac *.java HelloApp/*.java On the server machine: Start the Java Object Request Broker Daemon, orbd, which includes a Naming Service To this on Unix: orbd -ORBInitialPort 1050 -ORBInitialHost servermachinename& To this on Windows: start orbd -ORBInitialPort 1050 -ORBInitialHost servermachinename 09/18/19 66 Compiling and Running a Java IDL application On the server machine, start the Hello server, as follows: java HelloServer –ORBInitialHost -ORBInitialPort 1050 On the client machine, run the Hello application client From a DOS prompt or shell, type: java HelloClient -ORBInitialHost nameserverhost -ORBInitialPort 1050 all on one line Note that nameserverhost is the host on which the IDL name server is running In this case, it is the server machine 09/18/19 67 Compiling and Running a Java IDL application Kill or stop orbd when finished The name server will continue to wait for invocations until it is explicitly stopped 8. Stop the object server 09/18/19 68 http://download.oracle.com/javase/1.4.2/docs/gui de/idl/jidlExample.html 09/18/19 69 Summary-1 You have been introduced to the Common Object Request Broker Architecture (CORBA), and a specific CORBA facility based on the architecture: Java IDL 09/18/19 70 Summary-2 The key topics introduced with CORBA are: The basic CORBA architecture and its emphasis on object interoperability and platform independence Object Request Broker (ORB) and its functionalities The Inter-ORB Protocol (IIOP) and its significance CORBA object reference and the Interoperable Object Reference (IOR) protocol CORBA Naming Service and the Interoperable Naming Service (INS) Standard CORBA object services and how they are provided Object adapters, portable object Adapters (POA) and their significance 09/18/19 71 Summary-3 The key topics introduced with Java IDL are: It is part of the Java TM Platform, Standard Edition (J2SE) Java packages are provided which contain interfaces and classes for CORBA support Tools provided for developing a CORBA application include idlj (the IDL compiler) and orbd (the ORB and name server) An example application Hello Steps for compiling and running an application Client callback is achievable CORBA tookits and Java RMI are comparable and alternative technologies that provide distributed objects An applicaton may be implemented using either technology However, there are tradeoffs between the two 09/18/19 72