CORBA 2.3.7 Programmer's Guide for C++
A client wrapper operates as follows:
Creates a factory object, inheriting from Fw_Listener_EH_User.1.
The factory object creates a listener event-handler object and associates with that event-handler object as its user.2.
The factory object invokes the start_listening() method on the event handler to register interest in
incoming connect indications.
3.
When a connect indication arrives from the legacy client (such as a Pathsend requester), the factory creates a new
worker object (Fw_Server_EH_User) to handle the connection.
4.
Acting as the server event-handler user, the new worker object creates a server event-handler object and associates
itself with the event-handler object as its user.
5.
When a request arrives from the legacy client, the server event handler passes the request data to the worker in a
data_in() upcall.
6.
The worker decodes the request and interacts with the CORBA server, using CORBA requests (containing legacy
request data as parameters) to perform the actual work of the application.
7.
The worker translates replies from the server into replies to the legacy client and sends the replies by invoking the
NSDEFw_GFS::Server::Event::reply() method for a file-system or TS/MP client, or the
Fw_Sock_Server_EH::send_message() method for a TCP/IP client.
8.
When it is ready to shut down, the factory invokes the stop_listening() method.9.
A client wrapper for a context-free Pathsend requester uses the NSDEFw_GFS class to perform Guardian file-system I/O.
The following steps are required in the client wrapper program:
Call ORB_init(). This method initializes the event-framework internals, including an event thread and a single
instance of the $RECEIVE event handler (NSDEFw_GFS::Receive_EH).
1.
Create a client-wrapper factory object at startup time. The client-wrapper factory is a Guardian file-system listener
event-handler user (Fw_Listener_EH_User).
2.
The client-wrapper factory associates itself with a new listener event-handler object
(NSDEFw_GFS::Listener::EH) that it creates. This listener event handler listens at the null subdevice
(necessary because the Guardian file system expects a subdevice number, but the TS/MP protocol opens a process
rather than a subdevice).
The constructor is as follows:
// Constructor: create a new listener event handler object
// and begin listening for events.
Client_Wrapper::Factory::Factory()
{
ip_EH = new NSDEFw_GFS::Listener::EH;
ip_EH->ip_user = this;
ip_EH->start_listening( "" );
}
3.
Use the signal_completion() and the wait_for_completion() methods.
When the factory object determines that it is no longer required (on the last close by the LINKMON process), it
uses the signal_completion() method to allow the main thread to continue to completion:
void
Client_Wrapper::Factory::signal_completion()
{
4.