The channel driver functions as the adapter that enables a channel to be used for a given device, business distribution channel, and communication protocol to connect with the transaction services of the toolkit. The channel driver is the access point to the application toolkit on the server side. A channel driver has the following responsibilities:
1 Establishes the unique channel session.
2 Breaks the channel request into a keyed collection of request data and header data that can be handled by the request handler.
3 Builds the channel context, which will be used to manage the state of the channel-specific data throughout the lifetime of the request.
4 Determines the channel handler the first time that the device accesses a specific channel and is registered in the handler registry.
5 Invokes the request handler to process the request.
The toolkit provides the ChannelDriver interface, which is intended to be implemented and used as a template to develop device drivers for additional channels and protocols. The toolkit also provides concrete implementations of channel drivers for devices using the HTTP communication protocol. The servlets com.ibm.btt.cs.servlet.CSEstablishSessionServlet and com.ibm.btt.cs.servlet.CSReqServlet are intended to be used as references when developing a new channel.
A request handler processes requests from a specific channel driver, and determines the request data to construct the operations from the channel context. A request handler is instantiated by the channel handler the first time the device accesses the specific channel and is registered in the handler registry. A request handler has the following responsibilities:
1 Processes the request to establish the session should the particular channel require any integration with the application.
2 Processes the request to perform an application operation for the specific channel.
3 Determines the appropriate presentation handler from the channel handler in the handler registry in order to render the results back on the client.
The abstract class com.ibm.btt.clientserver.DSERequestHandler, which implements the com.ibm.btt.clientserver.RequestHandler interface, provides the base functionality of a request handler to use with the toolkit, and is intended to be extended for new channel implementations.
A presentation handler processes a reply from a specific request handler for the operation result or exception, and renders output appropriate for a specific channel driver. A presentation handler is instantiated by the channel handler the first time the device accesses the specific channel and is registered in the handler registry.
The abstract class com.ibm.btt.clientserver.DSEPresentationHandler, which implements the com.ibm.btt.clientserver.PresentationHandler interface, provides the base functionality of a presentation handler and is intended to be extended for new channel implementations.
A channel handler contains a cache of all channel-specific data to reduce the overhead of object creation and ensure concurrency during the request. One channel handler for each channel is created and added to the handler registry the first time the device accesses the specific channel driver. The channel handler uses the server configuration file, btt.xml, to retrieve the channel-specific request and presentation handlers for a given device. Request handlers and presentation handlers are defined externally as attributes of a channel handler. The external definition of a channel handler has mandatory attribute values for requestHandler and presentationHandler fields. All other data in the definition is optional, specific to the device, and is maintained in a hash table by the channel handler. For example, the cookies field, an optional parameter for devices using the HTTP communication protocol, defaults to false if unspecified. Specialized exceptions pertaining to retrieving these handlers from the server configuration file are provided with the toolkit.
The handler registry is a singleton object that manages the channel handler objects that are created per device the first time that the device accesses a specific channel. This guarantees that each channel handler instance is thread-safe and that only one process can access a handler at a given time. The handler registry also reduces the overhead of object creation for each request.
A channel context is an object that maintains the state of all of the data pertaining to a channel-specific request as it is passed among the registered request and presentation handlers during the lifetime of the request. The channel context object is part of the thread safety built into the design, and does not require other objects to maintain the state during the request. The toolkit provides the concrete class com.ibm.btt.clientserver.DSEChannelContext, which implements the com.ibm.btt.clientserver.ChannelContext interface, and contains references to the following interfaces:
▪ Channel request
▪ Channel response
▪ Channel driver
▪ Channel session
▪ Request data keyed collection, which consists of a header and a keyed collection of data
A channel session is an object that is used to maintain the state of a particular channel between a client and server. When a channel does not provide its own session management, the com.ibm.btt.clientserver.DSEChannelSession class provides a generic mechanism for creating a channel session with a unique session ID. The toolkit provides both the interface and a concrete implementation class, com.ibm.btt.clientserver.DSEChannelSession. The default constructor creates a ChannelSession instance with a unique session ID. The single-parameter (of type string) constructor creates an instance with a specific session ID.