Horus Doc ||
Corba Reference ||
Corba
Client Server
Stubs C++
Stubs Java
Servant Generator
Stubs and servants in Java
As an example, we show the stubs and servants for the ImageRep IDL definition. Given the IDL interface definitions of RefCountBase, ImageData and ImageRep (where ImageRep inherits from both RefCountBase and ImageData) we use the idl compiler to generate the following Java binding (RefCountBase related stuff has been omitted for clarity):
IDL Binding in Java
The classes org.omg.CORBA.Object and org.omg.PortableServer.Servant are part of the Corba definition and are implemented by the ORB. The other classes are generated by the IDL compiler. The generated files are located in $HXSRC/HxCorba/idl/HxCorba.
- The common interfaces HxCorba.ImageDataOperations and HxCorba.ImageRepOperations are defined in ImageDataOperations.java and ImageRepOperations.java
- Stubs HxCorba.ImageData and HxCorba.ImageRep are defined in ImageData.java and ImageRep.java
- Skeletons HxCorba.ImageDataPOA and HxCorba.ImageRepPOA are defined in ImageDataPOA.java and ImageRepPOA.java
- Ties HxCorba.ImageDataPOATie and HxCorba.ImageRepPOATie are defined in ImageDataPOATie.java and ImageRepPOATie.java
In the tie approach the tied object is derived from the "Operations" class and a servant is created by putting the tied object in the "POATie" class. For example, an ImageData servant is created by instantiating an HxCorba.ImageDataPOATie with a JavaImageData, a class derived from HxCorba.ImageDataOperations.
In the inheritance approach a servant is derived from the "POA" class. For example, a RgbBufferServant is derived from HxCorba.RgbBufferPOA.
Note that implementation of servants for IDL interfaces that use multiple inheritance is not possible using the inheritance approach since Java does not support multiple inheritance. Such servants have to be implemented using the tie approach.
Go to the next section or
return to the index.
Generated on Tue Feb 3 14:20:17 2004 for CorbaReference by
1.2.12 written by Dimitri van Heesch,
© 1997-2001