Implementing the channel policy handler

IBM® WebSphere® Multichannel Bank Transformation Toolkit provides an abstract channel policy handler, com.ibm.btt.channel.AbstractChannelPolicy, to handle policy in the channel level.

The doCheck method in the AbstractChannelPolicy class provides a default implementation to use the defined rule service to do channel level policy management. Technical developers can override the method as needed.

Technical developers should override the following two methods in their handler implementation:
protected Map<String, Object> getInputParameter(ChannelContext ctx)
Is used to construct the input parameters for the doCheck method using the data from channel context.
protected PolicyResult processResult(Map<String, Object> result)
Is used to parse the results returned from rule provider service.

com.ibm.btt.channel.PolicyResult is the return type of the processResult method. It includes the execution result of policy check. If the policy check has been passed, the WebSphere Multichannel Bank Transformation Toolkit channel provider will continue the request processing. Otherwise, the WebSphere Multichannel Bank Transformation Toolkitchannel driver will throw the com.ibm.btt.channel.ChannelPolicyException exception. The messages in PolicyResult are used to keep the messages generated during the rule check.

Figure 1 is sample policy handler implementation.
Figure 1. A sample policy handler implementation.