In this class you
are required to produce a client and sever program based on the CORBA static
invocation mechanism. The client application should be implemented in Java,
whilst the server application must be implemented in C++. This will give you an
experience of language interoperability within CORBA.
1. Server-side:
You can use the same interface and implementation classes in C++ from the
“Account” example in the previous static/dynamic invocation class. The object
reference should be written to a file rather than use the naming service.
2. Client side:
As mico ( the CORBA
implementation you have been using) does not have a Java binding, we will use
the jdk CORBA implementation to create the client
stubs. First you should generate the client stubs using the jdk
idl compiler idlj.
idlj account.idl
Next write a
client class to access an account object and perform some operations such as
deposit, withdraw and balance.
To do this, first
initialise the ORB as follows:
org.omg.CORBA.ORB
orb = org.omg.CORBA.ORB.init( args,
null );
Next read the
object reference from a file (created by the C++ server) and convert the String
to an object reference as follows:
org.omg.CORBA.Object obj = orb.string_to_object( ref );
Account account = AccountHelper.narrow( obj );