Wednesday, August 30, 2006

IDL to Java Mapping


Common Concepts

All the IDL types when mapped to Java, output two classes
  • Holder
  • Helper

Holder classes are used to simulate the C++ reference passing style. Consider for example, some generated method as below

void foo(Bar b) {
b = new Bar();
b.init(...); // probably reading from nw
return b;

Now, in this scenario, the calling function can never get the reference to the created Bar object.
In CORBA, the above scenario could be using network to read the value of a new Bar object and then make available the value to the calling function - typical out or inout parameters. To take care of this, Holder objects are used. For every Bar object there will be a BarHolder object which can read the Bar object from the wire (as it implements org.omg.CORBA.portable.Streamable interface). A typical scenario could be like -

void callingFunction() {
BarHolder holder = new BarHolder();
Bar b = holder.value;
void foo(BarHolder holder, InputStream is) {
holder._read(is); // read from nw; part of Streamable interface
return holder;


Helpers have some common functionality for all IDL mapped types (but for Boxed Valuetypes). These are

  • Provide read functionality from org.omg.CORBA.portable.InputStream. Infact holders finally call this for the contents they are holding.
  • Provide write functionality to the org.omg.CORBA.portable.OutputSteam
  • Return the typecode of the IDL type
  • Return the repository Id of the IDL type
For interfaces, they have further functionality to provide the following

  • Repository Id and typecode of the IDL type
  • Extraction and Insertion operators to CORBA Any
  • Narrow and safe narrows from base types. Please note that for Abstract interfaces, the narrow and safe narrow functionality is provided from java.lang.object. For those interfaces which inherit from abstract interfaces, narrow and safe narrow allow from both java.lang.object and org.omg.CORBA.Object and for pure interfaces, only org.omg.CORBA.Object is allowed
  • VisiBroker prorpritory bind operations are provided for both abstact and interfaces (but not for local interfaces)
  • Convinience factory operations for Valuetypes

All the main java mapping classes for IDL types implement or extend from this class. This class is used in for the reverse mapping (Java to IDL mapping) while marshaling. Typically, the marshal engine will detect that an entity is an instance of this interface and call the helper classes to marshal and unmarshal.

This class inherits from

Mapping from IDL basic types to Java

boolean -> boolean
char -> char
wchar -> char
octet ->byte
string -> java.lang.String
wstring -> java.lang.String
short and unsigned short -> short
long and unsigned long -> int
long long and unsigned long long -> long
float -> float
double -> double
fixed -> java.math.BigDecimal


Constants can be defined either in the module scope or an interface scope. Mapping for these both is different in Java.

Constants in Module namespace

These are mapped to public interface with the same name as the constant and containing a field named "value" holding the constants value.

Constants in Interface namespace

The mapping is to fields in either the Java operations interface for non-abstract or the sole Java interface for the abstract interface.


// IDL
module Bar {
interface Foo {
const long FooLong = 1;
const long BarLong = 2;

// Java
package Example;
public interface FooOperations {
int FooLong = 1;
public interface BarLong {
int value = 2;

Mapping for Structs and Unions

Structs are mapped to a final Java class with the same name as the IDL struct with the following charecteristics

  • Implements org.omg.CORBA.portable.IDLEntity interface
  • All the IDL struct members are public fields in the mapped class.
  • All value and null constructors are also provided. Strings are given "" as default value.
Helpers and Holders are also generated

Unions are also mapped to a final Java class with the same name as the IDL union with the following characteristics

  • Implements org.omg.CORBA.portable.IDLEntity interface
  • accessor method for the descriminator with the name discriminator(). No modifier
  • accessor and modifier for each branch
  • modifier for each branch with more than one case label
  • modifier for the branch corresponding to the default case label if present
  • default modifier if needed
Helpers and Holders are also generated.


// IDL
struct StructType {
long field1;
string field2;

enum EnumType { first, second, third, fourth, fifth};
union UnionType switch(EnumType) {
case first: long win;
case second: short place;
case third:
case fourth: octet show;
default: boolean other;

final public class StructType implements org.omg.CORBA.portable.IDLEntity {
public int field1;
public string field2 = "";
public StructType() {}
public StructType(int f1, string f2) {...}

final public class UnionType implements org.omg.CORBA.portable.IDLEntity {
public UnionType() {...}
public EnumType descriminator() {...}
public int win() {...}
public void win(int i) {...}
public short place() {...}
public void place(short s) {...}
public byte show() {...}
public void show(byte b) {...}
public void show(EnumType d, byte value) {...}
public boolean other() {...}
public void other(boolean b) {...}
public void other(EnumType e, boolean b) {...}


An enum is mapped to a Java final class implementing IDLEntity interface as below. Helper and Holder classes are generated.

// IDL
enum EnumType {first, second}

// Java
public final class EnumType implements org.omg.CORBA.portable.IDLEntity {
protected EnumType(int i) { ...}
public int value() {...}
public static EnumType from_int(int v) {...}

public static final int FIRST = 0;
public static final EnumType first = new EnumType(FIRST);

public static final int SECOND = 0;
public static final EnumType second = new EnumType(SECOND);

Sequence and Arrays

An IDL sequence is mapped to a Java array with the same name. In the mapping, everywhere the sequence type is needed, an array of the sequence type is used. Bounds checking is done at the time of marshalling CORBA::MARSHAL exception will be raised.

An array is mapped just like bound sequence.

Helper and Holder classes are generated.


Their mapping is similar to structs. All CORBA user exceptions inherit from org.omg.CORBA.UserException which is a checked exception and implements org.omg.CORBA.portable.IDLEntity. Helper and Holder classes are also generated.

System exceptions are unchecked exceptions which inherits from java.lang.SystemException.


Apart from a Helper and a Holder class, an Interface is mapped to -
  • Operations interface with the same name as the IDL interface suffixed by "Operations"
  • Signature interface inheriting the operations interface, org.omg.CORBA.portable.IDLEntity and org.omg.CORBA.Object interfaces.
VisiBroker in total generates 7 classes for an interface. These are (1) Helper (2) Holder (3) Operations Interface (4) Signature Interace (5) Stub (6) Skeleton (7) Tie


Since java code is often downloaded over the web and used with ORBs that are different from where it was developed, a need for portability layer which the generated stubs and skeletons can use arises. If the stubs and skeletons were coupled with the ORB, then for the downloaded code to work, the entire ORB aswell will also be needed to be downloaded.

To achieve this approach, two styles can be implemented by the ORB vendors -
  • Streaming style Stubs and Skeletons - Uses the various stream classes
  • DII/DSI style Stubs and Skeletons - Uses the DII/DSI Request objects and anys.
Portability Architecture

Tha major components to this architecture are -
  • Portable Streamable layer - provided by org.omg.CORBA.portable.Streamable interface. This interface helps in providing the notion of complex streamable objects are implemented in the helper classes.
  • Portable Stream classes - org.omg.CORBA.portable.OutputStream wraps the logic of outputting CORBA IDL types to a stream. This object can be got by using ORB.create_output_stream() method. From this object, org.omg.CORBA.portable.InputStream object can be got which allows to read CORBA data from a stream. These two classes inherit from and Package org.omg.CORBA_2_3.portable provides two more input and output classes.
  • Portable Skeletons and Stubs
  • Portable Stub and Servant Delegate

Client Side Mapping

  • Stub inherits from org.omg.CORBA.portable.ObjectImpl and implements the Signature interface.
  • Signature interface inherits from the Operations interface and org.omg.CORBA.portable.Object
  • org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.Object
  • org.omg.CORBA.portable.ObjectImpl uses org.omg.CORBA.portable.Delegate
In VisiBroker,
  • Stub inherits from com.inprise.vbroker.CORBA.portable.ObjectImpl and implements the Signature interface.
  • Signature interface inherits from the Operations interface and org.omg.CORBA.portable.Object
  • com.inprise.vbroker.CORBA.portable.ObjectImpl extends org.omg.CORBA_2_3.portable.ObjectImpl and implements com.inprise.vbroker.CORBA.Object
  • com.inprise.vbroker.CORBA.Object extends org.omg.CORBA.Object
  • org.omg.CORBA_2_3.portable.ObjectImpl extends org.omg.CORBA.portable.Object
  • com.inprise.vbroker.CORBA.portable.ObjectImpl uses com.inprise.vbroker.orb.DelegateImpl which inherits from com.inprise.vbroker.CORBA.portable.Delegate which inturn extends org.omg.CORBA_2_3.portable.Delegate further extending org.omg.CORBA.portable.Delegate
Stubs could be either Stream based or DII based. If they are stream based, they would use the Steam classes. Otherwise, they would use DII. All the operations are generally delegated to the Delegate objects internally. Stubs make calls on their super classes which at some point get delegated to the delegate objects.

Server Side Mapping

On the server side, an implementation can be provided either by using
  • Inheritance
  • Delegation
For this purpose, classes named and are created. is the actual skeleton class and inherits from org.omg.PortableServer.Servant class. This is the mapping of the native Servant defined in PortableServer.idl.

If a Stream based skeleton is being used, then the skeleton inherits from org.omg.PortableServer.Servant and futher implements org.omg.CORBA.portable.InvokeHandler. This class then uses the various stream classes for reading and writing data. Otherwise, org.omg.CORBA.DynamicImplementation is the base class.

org.omg.PortableServer.portable.Servant uses org.omg.PortableServer.Delegate to delegate all its functionality. Generally, this is initialized by calling ORB.set_delegate() which then creates a delegate object and calls back setting the delegate on this servant. In VisiBroker, this delegate object is com.inprise.vbroker.poa.ServantDelegate.


Blogger M said...

hi Sandesh,

I have read your blog, it is very informatiive. I am currently facing one problem with Visibroker, just thought to check if you can help.

How can I enable japanese chars (UTF-8) in my Visibroker layer (server in C++ and client in Java) without changing IDL. We are trying to change string to wstring, but changes lot of C++ code and increase our work. So is there any workaround in Visibroker as mentioned in following link:

java.util.Properties p = new java.util.Properties();
p.setProperty("com.sun.CORBA.codeset.charsets", "0x05010001, 0x00010109"); // UTF-8, UTF-16
p.setProperty("com.sun.CORBA.codeset.wcharsets", "0x00010109, 0x05010001"); // UTF-16, UTF-8
orb = org.omg.CORBA_2_3.ORB.init(args, p);

would appreciate if you can provide some pointers.

9:51 PM  
Blogger ninest123 Ninest said...

ninest123 10.27
tiffany jewelry, michael kors outlet, oakley sunglasses wholesale, ugg boots, louis vuitton, jordan shoes, nike air max, burberry outlet, uggs outlet, prada outlet, louis vuitton, ugg boots, louis vuitton outlet, michael kors outlet store, ray ban sunglasses, louis vuitton outlet, replica watches, replica watches, uggs outlet, michael kors outlet, polo ralph lauren outlet online, nike free, ray ban sunglasses, oakley sunglasses, christian louboutin outlet, michael kors outlet online, longchamp outlet, louis vuitton outlet, christian louboutin, tiffany and co, prada handbags, cheap oakley sunglasses, polo outlet, longchamp outlet, tory burch outlet, longchamp outlet, nike outlet, oakley sunglasses, oakley sunglasses, ray ban sunglasses, christian louboutin shoes, christian louboutin uk, chanel handbags, uggs on sale, burberry handbags, nike air max, kate spade outlet, michael kors outlet online

9:46 AM  
Blogger ninest123 Ninest said...

hollister uk, nike roshe run uk, sac longchamp pas cher, nike air max uk, north face, vans pas cher, michael kors, kate spade, nike blazer pas cher, longchamp pas cher, ray ban uk, nike free run, abercrombie and fitch uk, louboutin pas cher, coach outlet store online, timberland pas cher, nike roshe, north face uk, polo ralph lauren, oakley pas cher, nike air max, sac vanessa bruno, hollister pas cher, polo lacoste, true religion outlet, ralph lauren uk, nike tn, sac hermes, ray ban pas cher, coach outlet, jordan pas cher, michael kors, coach purses, nike air force, true religion jeans, lululemon canada, michael kors pas cher, mulberry uk, nike air max uk, true religion outlet, burberry pas cher, michael kors outlet, nike free uk, converse pas cher, coach outlet, hogan outlet, new balance, guess pas cher, true religion outlet, air max

9:47 AM  
Blogger ninest123 Ninest said...

bottega veneta, new balance shoes, nike air max, soccer jerseys, louboutin, giuseppe zanotti outlet, lululemon, mac cosmetics, vans, nike trainers uk, vans outlet, abercrombie and fitch, reebok outlet, nike air max, converse, iphone 6 cases, insanity workout, ghd hair, hollister clothing, converse outlet, oakley, nfl jerseys, baseball bats, herve leger, gucci, nike huaraches, mont blanc pens, north face outlet, ferragamo shoes, valentino shoes, north face outlet, p90x workout, longchamp uk, nike roshe run, soccer shoes, wedding dresses, timberland boots, hollister, hermes belt, hollister, ralph lauren, jimmy choo outlet, chi flat iron, asics running shoes, ray ban, instyler, mcm handbags, beats by dre, celine handbags, babyliss, gucci handbags, michael kors outlet online

9:48 AM  
Blogger ninest123 Ninest said...

toms shoes, ugg, ugg uk, moncler, moncler, juicy couture outlet, hollister, ugg,uggs,uggs canada, michael kors outlet online, canada goose outlet, lancel, wedding dresses, moncler outlet, canada goose, swarovski, barbour uk, moncler, canada goose outlet, louis vuitton, ugg,ugg australia,ugg italia, louis vuitton, moncler uk, louis vuitton, ugg pas cher, louis vuitton, montre pas cher, links of london, marc jacobs, barbour, louis vuitton, canada goose uk, michael kors handbags, canada goose outlet, pandora charms, supra shoes, replica watches, canada goose, juicy couture outlet, coach outlet, karen millen uk, moncler outlet, moncler, pandora uk, doudoune moncler, thomas sabo, swarovski crystal, pandora jewelry, canada goose jackets, michael kors outlet, canada goose, doke gabbana, pandora jewelry
ninest123 10.27

9:49 AM  
Blogger chenlina said...

louis vuitton outlet
louis vuitton
nike store outlet
michael kors outlet
cheap oakley sunglasses
true religion
rolex watches
kate spade outlet
michael kors handbags
coach outlet
cheap jordan shoes
michael kors handbags
basketball shoes
marc jacobs handbags
coach factory outlet
ray bans
michael kors outlet
tod's shoes
michael kors outlet
michael kors outlet
supra shoes
louis vuitton outlet
louis vuitton bags
kate spade handbags
adidas uk
adidas nmd
nike free run
true religion outlet
kate spade
coach outlet
abercrombie and fitch new york
hollister clothing
cheap oakley sunglasses
rolex submariner
tory burch handbags
vans shoes sale
ray bans
nike air max 90
adidas outlet
air huarache

10:48 AM  
Blogger oakleyses said...

christian louboutin uk, louis vuitton outlet, christian louboutin shoes, michael kors pas cher, louis vuitton outlet, sac longchamp pas cher, prada handbags, gucci handbags, tiffany and co, polo ralph lauren outlet online, christian louboutin outlet, cheap oakley sunglasses, longchamp outlet, uggs on sale, polo outlet, louis vuitton, nike air max, oakley sunglasses, longchamp outlet, nike free, nike outlet, longchamp outlet, longchamp pas cher, chanel handbags, nike air max, oakley sunglasses, nike free run, tiffany jewelry, oakley sunglasses wholesale, louboutin pas cher, ray ban sunglasses, ugg boots, replica watches, air max, louis vuitton outlet, oakley sunglasses, nike roshe, louis vuitton, tory burch outlet, ray ban sunglasses, jordan shoes, christian louboutin, prada outlet, polo ralph lauren, burberry pas cher, ugg boots, jordan pas cher, kate spade outlet, ray ban sunglasses

8:38 AM  
Blogger oakleyses said...

nike blazer pas cher, mulberry uk, burberry handbags, michael kors, timberland pas cher, oakley pas cher, ray ban uk, vans pas cher, coach purses, north face, nike free uk, new balance, ray ban pas cher, sac hermes, michael kors, nike air force, ralph lauren uk, nike air max, kate spade, nike roshe run uk, true religion jeans, north face uk, hogan outlet, michael kors outlet online, nike air max uk, uggs outlet, nike tn, burberry outlet, hollister uk, coach outlet store online, replica handbags, lululemon canada, michael kors outlet online, michael kors outlet online, michael kors outlet, michael kors outlet online, converse pas cher, michael kors outlet, true religion outlet, true religion outlet, polo lacoste, hollister pas cher, coach outlet, guess pas cher, true religion outlet, abercrombie and fitch uk, nike air max uk, sac vanessa bruno, michael kors outlet

8:41 AM  
Blogger oakleyses said...

hollister, oakley, celine handbags, instyler, nike trainers uk, ghd hair, converse outlet, hollister clothing, hermes belt, beats by dre, ray ban, lancel, herve leger, timberland boots, nike air max, chi flat iron, longchamp uk, asics running shoes, vans, nike air max, insanity workout, reebok outlet, giuseppe zanotti outlet, abercrombie and fitch, nike roshe run, north face outlet, louboutin, jimmy choo outlet, iphone cases, gucci, mcm handbags, north face outlet, valentino shoes, soccer shoes, hollister, wedding dresses, babyliss, bottega veneta, baseball bats, p90x workout, nfl jerseys, nike huaraches, new balance shoes, soccer jerseys, mont blanc pens, ralph lauren, vans outlet, mac cosmetics, ferragamo shoes, lululemon

8:44 AM  
Blogger oakleyses said...

hollister, louis vuitton, moncler outlet, pandora uk, moncler, canada goose outlet, ugg,ugg australia,ugg italia, marc jacobs, toms shoes, moncler outlet, louis vuitton, canada goose, swarovski crystal, supra shoes, moncler, ugg, juicy couture outlet, wedding dresses, thomas sabo, karen millen uk, ugg pas cher, canada goose jackets, pandora jewelry, louis vuitton, moncler, swarovski, pandora jewelry, links of london, moncler uk, louis vuitton, coach outlet, ugg uk, canada goose uk, ugg,uggs,uggs canada, canada goose, doudoune moncler, louis vuitton, pandora charms, juicy couture outlet, canada goose outlet, canada goose outlet, canada goose, moncler, replica watches, montre pas cher

8:47 AM  
Blogger Liu Liu said...

Nick Saban’s relatively brief time as head coach of the Miami Dolphins is not looked upon fondly by most fans of the team. He went 15-17 christian louboutin shoes in his two seasons, but basically quit on the nfl jerseys store team in the final weeks Nike Air Max 90 of the 2006 season, focused more on his next job, at the University of Alabama, instead of the one he christian louboutin uk was under contract for.And at least one player who played – or at Christian Louboutin Women Flat least practiced – under Saban during those ill-fated christian louboutin men flat final weeks Nike Roshe Run hasn’t forgotten NFL Jerseys how Nike Free Run he was louboutin outlet treated. According to Nike Air Max 2015 Shoes receiver P.K. Sam, a journeyman cheap nfl jerseys who spent time with five NFL teams as well as two CFL clubs, Saban cut wholesale nfl jerseys him after he left the team christian louboutin Panettone spiked leather wallet briefly to see his dying father

2:51 PM  
Anonymous Obat Tradisional Iritasi Lambung said...

The article was very nice and very interesting to read. Thank you for sharing the information

Obat Untuk Mengatasi Perut Kembung
Obat Ulu Hati Terasa Sesak
Obat Pendarahan Usus
Obat Maag Ringan
Obat Ginjal Berkista
Pengobatan Alternatif Radang Sendi

4:56 PM  

Post a Comment

<< Home