Changes in the Java API
The IPC Java API provides now a helper class which can be used for
publishing CORBA objects to IPC naming service. The new class is called
ipc.Servant and can be used as described below.
- Let's assume that we have the fllowing OMG IDL declaration:
#include <ipc/ipc.idl>
module ipc
{
interface test : ipc::servant
{
string ping_s(in string bytes);
oneway void ping_a(in string bytes);
};
};
- Then the TestServant.java file, which implements the CORBA object
shall look like:
import ipc.*;
class TestServant extends ipc.Servant<ipc.test>
implements ipc.testOperations
{
TestServant( Partition partition, String name )
{
super( partition, name );
}
public java.lang.String ping_s( java.lang.String in )
{
return in;
}
public void ping_a( java.lang.String in )
{
return ;
}
}
- In order to publish an instance of the TestServant class to IPC,
one can write:
TestServant t = new TestServant( new Partition( partition_name ), object_name );
t.publish();
This makes the new object registered in
IPC naming service, so any application can get a reference to that
object via the ipc.Partition.lookup(
object_name ) function and call methods which are delcared in
the IDL file.