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):

CorbaImageRepJava.gif

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.

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 Mon Jan 27 15:20:57 2003 for CorbaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001