Java Reference
In-Depth Information
distributed computing concepts should already be understood from Chapter 18,
we do not need to go into as much detail as earlier. For example, CORBA uses the
same stubs and skeletons framework as in RMI, so we don't have to rehash that
concept. The Java 2 SDK provides tools to automatically generate the CORBA
stubs and skeletons, similar to that provided with RMI. CORBA includes its own
highly developed language-independent exception mechanism similar to Java
exceptions. When using the Java language to implement a CORBA application,
the exception mechanism maps very cleanly to Java's exception system. In fact,
one will find that almost all CORBA concepts map well to the Java language and
much better than other programming languages.
19.2 CORBA IDL
Perhaps the biggest difference between CORBA and RMI is that the CORBA
interfaces must be defined in a language independent fashion. This is done using
the CORBA Interface Definition Language (IDL) rather than a Java interface file.
IDL is a limited C-like language whose only purpose is to define interfaces. There
are absolutely no implementation features in the IDL language. The IDL file is
processed with an IDL-to-language-of-choice “compiler” for the language cho-
sen to generate the language-specific stubs along with numerous other support
files for that language. Then the developer provides the implementation of the
server code using those support files. There must be an IDL compiler for what-
ever programming language is used for the implementations. The Java 2 SDK
includes an IDL-to-Java compiler. If one were developing in C
or Smalltalk,
for example, one would need a CORBA environment for that language, including
an IDL-to-C
++
++
or IDL-to-Smalltalk compiler. Running such an IDL compiler
would produce the required stubs and support files for that language, and, depend-
ing on the language, they could look very different from the files created by the
IDL-to-Java compiler.
The first step in developing a CORBA application is to define the server
interfaces in an IDL file, a task that requires learning the IDL syntax. Learning
the syntax is not particularly difficult, as we demonstrate shortly, but doing so
does represent an additional step. In fact, Java now provides a way to generate an
IDL file directly from a Java interface file, relieving the developer from needing to
learn IDL. However, since CORBA cannot support some features that are easily
supported in RMI, one must be careful to restrict the Java interface file to only
those features supported by CORBA. This subset of RMI is referred to as RMI
over IIOP, and is fully documented in the online Java documentation. Further
discussion of RMI over IIOP is beyond the scope of this topic.
We introduce IDL here with an example that duplicates the functionality of
the RMI server developed in Chapter 18, but we do not go into all the features
available in IDL. The online Java documentation includes a complete description
of IDL for those interested in the details.
Search WWH ::




Custom Search