Java Reference
In-Depth Information
CORBA predated the invention of Java, but the Java language structure maps
closely to the features provided in CORBA. Java packages, for instance, map
closely to IDL modules ,which, like Java packages, provide a way to avoid names-
pace collisions. To correspond to the package structure we've already become
familiar with in Chapter 18, we create a javatech module and nest within it a
cor19 module and a server module. Within the server module, we define an
IDL interface that corresponds to the RMIExampleInterface used with RMI.
We also included a few other IDL features. The IDL interface is very similar in
concept to a Java interface. It declares the remotely callable methods that you
wish to provide in the CORBA server, including the method name, parameter
types, return types, and any possible exceptions. We emphasize again that the
IDL file defines the interfaces only; the implementations of those methods must
be provided elsewhere. The IDL file we use for this simple example is shown
here. We describe each feature below.
// server.idl
module javatech {
module cor19 {
const string COR19 - CONSTANT ="Chapter 19";
module server {
const string SERVER - CONSTANT ="JavaTech Book";
exception Cor19UserException {
string message;
};//exception Cor19UserException
struct CustomData {
float someFloatValue;
long someIntegerValue;
} ;//struct CustomData
interface Cor19Example {
const long COR19 - EXAMPLE - CONSTANT = 19;
attribute long huh;
readonly attribute float hah;
void method1 (in string s);
long add (in long a, in long b);
void demo (inout CustomData cd) raises
(Cor19UserException);
};//interface Cor19Server
};
};
};
 
Search WWH ::




Custom Search