CORBA 2.6.1 Programmer's Guide for C++

8. After all work is completed, invoke the disconnect() method to shut down the connection.
Calling Other Types of Legacy Servers
You can write a server wrapper to call on the services of a context-sensitive Pathsend server (nowait) or a Guardian file-system server (nowait).
However, doing so is more complex than the cases described in this manual, and therefore it is not recommended that you do so without
assistance. If you need to integrate one of these types of servers into your NonStop CORBA application, HP recommends that you contact your
service provider.
Managing Transactions in Server Wrappers
Requirements for transaction management in a server wrapper depend on whether an OMG Transaction Service transaction exists between the
CORBA client and the server wrapper—that is, whether the wrapper is a CORBA transactional server.
If the wrapper is a transactional server, the transaction is propagated by the Transaction Service.
If no Transaction Service transaction exists, and the legacy server expects the file system to propagate the transaction, the server wrapper must
begin the transaction. HP recommends that the wrapper begin the transaction with the SPT_BEGIN_TRANSACTION_ procedure.
SPT_BEGIN_TRANSACTION_ will suspend the transaction for you while the thread is out of play, and resume the transaction when the thread
is back in play again.
The server wrapper should then perform jacketed (pthreads T1248) or waited I/O calls to the legacy server. The NonStop CORBA event
framework does not propagate transactions.
For further information about SPT_BEGIN_TRANSACTION_ and other pthread procedures, refer to the OSS System ServicesProgrammer's
Guide.
Caution:
Although you should refer to the Open System Services Programmer's Guide for information about the
SPT_BEGIN_TRANSACTION_ procedure, do not use the libraries provided by the product; doing so may
interfere with the operation of the NonStop CORBA ORB. Instead, use the version of the
spthread.h header file
provided in the
$NSD_ROOT/include directory, which includes the pthreads procedures and all necessary
underlying routines.
Writing a Wrapper for a Legacy Client
A legacy client wrapper accepts requests from a non-CORBA client and forwards them to a CORBA server. The wrapper transforms
legacy-system requests into CORBA operation invocations and CORBA completions into legacy-system replies.
From the client's perspective, the wrapper is a legacy server. From the CORBA server's perspective, the wrapper is a CORBA client. Thus, the
client wrapper acts as a bridge between a legacy client and a CORBA server, as shown in
Figure 12–2.
Figure 12.2. Legacy Client Wrapper
Basic Structure of a Client Wrapper
The basic programming mechanism you use in a client wrapper is the same regardless of the transport mechanism and regardless of whether
you use waited or nowait communication. Client wrappers must use the object-oriented interfaces (APIs) to the NonStop CORBA event
framework. If you are writing a client wrapper, you should refer to
The NonStop CORBA Event Framework APIs for background information.
A NonStop CORBA server acting as a client wrapper receives requests from legacy clients in the form of I/O events from the underlying NonStop
CORBA event framework. The client wrapper uses object interfaces provided by the event framework to retrieve the data and to reply to the
client's messages. Using the event framework APIs, the client wrapper provides two functions: listener event handler and server event handler.
A listener event handler establishes and maintains connections between legacy clients and NonStop CORBA servers. A server event
handler transfers data across such a connection after the connection is established.
NonStop CORBA provides various types of listener and server event-handler objects to support transport functions such as I/O completions and
error handling. If possible, your client wrapper should use these event handlers, thus acting as a listener event-handler user and a
server event-handler user. In some cases, however, the semantics used by your legacy client may require that you implement your own
event handler.
Writing a Client Wrapper for a Context-Free Pathsend Requester
Note:
In documentation for TS/MP and related products, Pathsend clients are referred to as Pathsend requesters.
The client wrapper must cooperate with the NonStop CORBA event framework to perform its tasks. It uses two objects, a factory and a servant
(worker), for this cooperative processing. The factory is a listener event-handler user, and the worker is a server event-handler user.
A client wrapper operates as follows:
Fw Listener EH User