






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







CORBA
CORBA
ORB and IIOP
The Internet Inter-ORB Protocol ( IIOP) is a protocol by which ORBs communicate (Similar to JRMP in RMI)
Stub & Skeleton Creation
In RMI we had an RMI compiler run on the .class file we wanted to be remote. It’s different under CORBA
The interface is written in Interface Definition Language, IDL. IDL is language-neutral (by being a different language than anything else) though highly reminiscent of C++ (multiple inheritance, similar syntax, etc.)
IDL has a set of primitive data types similar to most languages—integer, float, string, byte, etc.
CORBA Development Process
distributed object.
that implements the stub and the skeleton
naming service and wait for requests)
Interface Definition Language (IDL)
Compile the IDL code with idlj. This creates java
source code files in the Tracker package. Note the use of the IDL primitive type “string”
module Tracker { interface Time { string getTime(); }; };
Interface Definition Language (IDL) (Contd.)
A pure description language.
enables developers to describe an interface they wish
Language specific compiler required for each participating language (e.g., idlj for Java).
creates files required by each language for CORBA
Client-side Code
Get reference to remote object
Cast it to what you want
Call methods on the object via the local proxy object
On the other hand, there are more annoyances due to CORBAs multi-language background
package ex1; import Tracker.; // The package containing our stubs. import org.omg.CosNaming.; // Client will use the naming service. import org.omg.CORBA.*; // All CORBA applications need these classes.
public class Client { public static void main (String args[]) { try { // Create and initialize the ORB ORB orb = ORB.init (args, null); // Get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references ("NameService"); NamingContext ncRef = NamingContextHelper.narrow (objRef); // Resolve the object reference in naming NameComponent nc = new NameComponent ("TimeServer", ""); NameComponent path[] = {nc}; Time timeRef = TimeHelper.narrow (ncRef.resolve (path)); // Call the time server object and print results String time = "Time on the Server is " + timeRef.getTime (); System.out.println (time); } catch (Exception e) { e.printStackTrace (); } } }
Server-side Code
The servant Code
package ex1 ; // The package containing our stubs. import Tracker. * ; // Server will use the naming service. import org. omg. CosNaming. * ; // The package containing special exceptions thrown by the name service. import org. omg. CosNaming. NamingContextPackage. * ; // All CORBA applications need these classes. import org. omg. CORBA. * ; import java. util. * ; import java. text. * ;
class TimeServer extends _TimeImplBase { public String getTime () { SimpleDateFormat formatter = new SimpleDateFormat ("MMMMM dd, yyyyy GGG, hh:mm:ss:SSS aaa"); Date date = new Date (); return formatter.format ( date ); } }
Service Interface -Implements Remote- (Written in Java)
Service Implementation (Extends UnicastRemoteObject Implements Service Interface)
Generated Stub (^) Generated Skeleton
Server: •Create Service Instance •Register Service with rmiregistry
Client:: •Lookup Service by name from rmiregistry •Use remote reference to access service
rmic
lookup (^) rmiregistry
bind
Server needs
Client needs