Writing a Client/Server Talk Application using CORBA
Write a client/server ``Talk'' application using BlackWidow (now
called VisiBroker for Java), a CORBA implementation for java. Write an
interface in IDL (Interface Definition Language) for the layout
described in the RMI assignment. That is, a client requests a
connection from a server on a remote machine and the server spawns a
talk window, enabling the two talk windows to communicate with each
other. There will be two interfaces, one for the two talk windows to
communicate with each other and one for the client to communicate with
the server. Once the interface is written, use the 'idl2java'
compiler to generate stubs and interfaces for the CORBA objects. The
servers' implementation must extend the skeleton generated by the
idl2java compiler. Skeleton classes are prepended with a '_sk_', for
example '_sk_TalkServer.' Each machine participating runs an 'osagent'
that manages the connections between the clients and servers. To
notify the osagent that the server is ready to accept connections,
invoke the obj_is_ready() method on the BOA (Basic Object Adapter):
CORBA.ORB orb = CORBA.ORB.init();
CORBA.BOA boa = orb.BOA_init();
TalkServer talk_server = new TalkServer();
boa.obj_is_ready(talk_Server);
Once the servers have been registered with the ORB (Object Request
Broker), clients can successfully bind to remote objects as follows
for the TalkServer interface in module Talk:
Talk.TalkServer talk_server = Talk.TalkServer_var.bind(SERVER_NAME, hostname);
The client may then make method calls on talk_server as defined by the
Talk.TalkServer interface. The marshalling features of CORBA allow
the passing and returning of object references from interface
methods. Therefore, the server can return an object reference to the
talk window to the client who requested the connection.
Added Sophistication
Use the pomoco.iiop.GateKeeper to make the TalkClient an applet. The
applet should be able to make connections to arbitrary hosts through
the GateKeeper, although this doesn't always work. A workaround is to
use Internet Object References (IORs) created by using the ORB method
object_to_string(). To reverse the process string_to_object() can be
used.
Script to run the corba demo
References
Read thoroughly the online docs for VisiBroker for
Java (this product was formerly known as BlackWidow).