IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.channel
Class BTTChannelDriver

java.lang.Object
  extended by com.ibm.btt.channel.BTTChannelDriver
All Implemented Interfaces:
ChannelDriver, java.io.Serializable
Direct Known Subclasses:
RemoteChannelDriver, RestChannelDriver, SMSChannelDriver

public class BTTChannelDriver
extends java.lang.Object
implements ChannelDriver, java.io.Serializable

The ChannelDriver interface This is the interface to be used as a template for all new device types that are to use the Multichannel Interface This interface should also detail the extension points for all channel drivers.

Any object implementing this interface will have to provide:

  1. - Create the ChannelContext
  2. - Create the ChannelHandler
  3. - Parse the channel specific request header into request data
  4. - Parse the channel specific request data into request data
  5. - Perform any pre pocessing (Session Management)
  6. - Handle any exceptions thrown by the interface

See Also:
Serialized Form

Constructor Summary
BTTChannelDriver()
           
 
Method Summary
 ChannelContext createChannelContext(ChannelRequest req, ChannelResponse res)
          Creates a ChannelContext object with the req, res, and driver attributes.
 void createChannelHandler(ChannelContext channelContext)
          Creates a BTTChannelHandler object with the channelContext attribute and caches the BTTChannelHandler into the HandlerRegistry singleton.
protected  void handleException(ChannelContext channelContext, java.lang.Exception ex)
          Invokes the presentation handler to pass the exception to the client.
protected  void handleException(java.lang.Throwable ex)
          Logs the exception with the framework trace facility.
 void init(ChannelContext aChannelCtxt)
          Initialize the device type and create the channel handler for the channel context
protected  void initDeviceType(ChannelContext channelContext)
          Determines the device type for the handler and adds to the ChannelContext object.
 void parseRequestData(ChannelContext channelContext)
          Parse the request data of the request object
 void parseRequestHeader(ChannelContext channelContext)
          Parse the request header of the request object
 void preProcessRequest(ChannelContext channelContext)
          Pre-processing the request object, this can be used to check the session is established or not
 void service(ChannelContext channelContext)
          Process the request and generate the reponse
protected  void updateChannelHandler(ChannelHandler aChannelHandler, java.lang.String key, java.lang.Object value)
          Update the channel handler using the value configured in btt.xml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTTChannelDriver

public BTTChannelDriver()
Method Detail

createChannelContext

public ChannelContext createChannelContext(ChannelRequest req,
                                           ChannelResponse res)
Creates a ChannelContext object with the req, res, and driver attributes. The parameters are passed as objects to support all potential channel drivers.

Specified by:
createChannelContext in interface ChannelDriver
Parameters:
req - java.lang.Object
res - java.lang.Object
driver - java.lang.Object
Returns:
com.ibm.btt.clientserver.ChannelContext - An instance of ChannelContext.

createChannelHandler

public void createChannelHandler(ChannelContext channelContext)
                          throws java.lang.Exception
Creates a BTTChannelHandler object with the channelContext attribute and caches the BTTChannelHandler into the HandlerRegistry singleton. This method instantiates the RequestHandler, PresentationHandler, and a Hashtable to contain all variable parameters located in the btt.xml file. This should only be performed the first time that the channel is accessed.

Specified by:
createChannelHandler in interface ChannelDriver
Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Throws:
java.lang.Exception

parseRequestData

public void parseRequestData(ChannelContext channelContext)
                      throws java.lang.Exception
Parse the request data of the request object

Specified by:
parseRequestData in interface ChannelDriver
Parameters:
channelContext - the channel context object
Throws:
java.lang.Exception - if error occur during parsing

parseRequestHeader

public void parseRequestHeader(ChannelContext channelContext)
                        throws java.lang.Exception
Parse the request header of the request object

Specified by:
parseRequestHeader in interface ChannelDriver
Parameters:
channelContext - the channel context object
Throws:
java.lang.Exception - if error occur during parsing

preProcessRequest

public void preProcessRequest(ChannelContext channelContext)
                       throws DSECSSessionNotEstablishedException
Pre-processing the request object, this can be used to check the session is established or not

Specified by:
preProcessRequest in interface ChannelDriver
Parameters:
channelContext - the channel context object
Throws:
DSECSSessionNotEstablishedException - if the session isn't established

initDeviceType

protected void initDeviceType(ChannelContext channelContext)
                       throws DSENoRegisteredDeviceTypeException,
                              DSEObjectNotFoundException
Determines the device type for the handler and adds to the ChannelContext object. The default implementation uses the "User-Agent" tag in the Http request header to identify the handler used for this kind of client device. A section named "devices" in btt.xml file maps the relationship between the "User-Agent" and the channel handler.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Throws:
DSENoRegisteredDeviceTypeException - throw error
DSEObjectNotFoundException - throw error

updateChannelHandler

protected void updateChannelHandler(ChannelHandler aChannelHandler,
                                    java.lang.String key,
                                    java.lang.Object value)
                             throws java.lang.Exception
Update the channel handler using the value configured in btt.xml

Parameters:
aChannelHandler - the channel handler
key - the key that used to register in the channel handler
value - the value that will register in the channel handler
Throws:
java.lang.Exception - if error occur

handleException

protected void handleException(ChannelContext channelContext,
                               java.lang.Exception ex)
Invokes the presentation handler to pass the exception to the client. This method tests to ensure that the server is started and the channel context has a device type.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
ex - java.lang.Exception Thrown if the server is unable to process a response

handleException

protected void handleException(java.lang.Throwable ex)
Logs the exception with the framework trace facility.

Parameters:
ex - java.lang.Exception

init

public void init(ChannelContext aChannelCtxt)
          throws java.lang.Exception
Initialize the device type and create the channel handler for the channel context

Parameters:
aChannelCtxt - the channel context
Throws:
java.lang.Exception - if any error occur

service

public void service(ChannelContext channelContext)
Process the request and generate the reponse

Specified by:
service in interface ChannelDriver
Parameters:
request - the channel request object, If the protocal is http, the request is a HttpServletRequest
response - the channel request object, If the protocal is http, the request is a HttpServletResponse

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011