Java Reference
In-Depth Information
Simple Example
This fi rst example application simply displays a greeting to any client that uses the
appropriate interface registered with the Java IDL ORB to invoke the associated
method implementation on the server. The steps will be numbered as above…
1. Create the IDL fi le.
The fi le will be called Hello.idl and will hold a module called Simple-
CORBAExample . This module will contain a single interface called Hello that
holds the signature for operation getGreeting . The contents of this fi le are shown
module SimpleCORBAExample
interface Hello
string getGreeting();
2. Compile the IDL fi le.
The idlj compiler defaults to generating only the client-side bindings. To vary
this default behaviour, the -f option may be used. This is followed by one of
three possible specifi ers: client , server and all . If client and server are to be run
on the same machine, then all is appropriate and the following command line
should be entered:
idlj -fall Hello.idl
This causes a sub-directory with the same name as the module (i.e., Simple-
CORBAExample ) to be created, holding the six fi les listed below.
Contains the Java version of our IDL interface. It extends interface
HelloOperations [See below], as well as org .omg.CORBA.Object (providing
standard CORBA object functionality) and org.omg.CORBA.portable.IDLEntity .
Provides auxiliary functionality, notably the narrow method required to cast
CORBA object references into Hello references.
Holds a public instance member of type Hello . If there were any out or inout
arguments (which CORBA allows, but which do not map easily onto Java), this
fi le would also provide operations for them.
Contains the Java method signatures for all operations in our IDL fi le. In this
application, it contains the single method getGreeting .
Search WWH ::

Custom Search