Extending : Channel policy management and extension : Channel level policy management : Implementing the channel policy handler
  
Implementing the channel policy handler
UNICOM® Digital Transformation Toolkit (UDTT™) 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 UDTT channel provider will continue the request processing. Otherwise, the UDTT channel 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.
A sample policy handler implementation
This graphic is described in the surrounding text.
See also
Channel level policy management