Now that we have a better understanding of the various components of the CORBA architecture, let’s walk through the creation of CORBA objects using Java IDL. In order to distribute a Java object over the network using CORBA, you have to define your own CORBA-enabled interface and its implementation. This involves doing the following:
Writing an interface in the CORBA IDL
Generating a Java base interface, plus a Java stub and skeleton class, using an IDL-to-Java compiler
Writing a server-side implementation of the Java base interface
We’ll walk through these steps one by one, starting with a quick primer on CORBA IDL, followed by the requirements for creating a Java implementation of an IDL-defined remote object. A full reference for IDL syntax is provided in Appendix G. The following primer covers the basics needed to follow the rest of this chapter.
The syntax of both Java and IDL were modeled to some extent on C++, so there are a lot of similarities between the two in terms of syntax. Interfaces in IDL are declared much like classes in C++ and, thus, classes or interfaces in Java. The major differences between IDL and Java are:
IDL is a declaration language . In IDL, you declare only the names and types for interfaces, data members, methods, method parameters, and the like. Method implementations are created in the implementation language you choose (in this case Java), after you’ve used an IDL compiler to convert your IDL interface to your ...