Create Custom Assertions
Custom Assertions are modules that are added to a gateway to add functionality to be executed in a service policy. They typically implement proprietary business logic, as opposed to standard-compliant mechanisms supported by CA Technologies.
gateway92
Custom Assertions are modules that are added to a
CA API Gateway
to add functionality to be executed in a service policy. They typically implement proprietary business logic, as opposed to standard-compliant mechanisms supported by CA Technologies.This document describes how to create and install Custom Assertions on a
CA API Gateway
.Target Audience
This section is intended for experienced Java developers familiar with the concept of “beans” and how to create Java applications. It also assumes some basic knowledge of the UNIX command line and file permissions and ownership.
The Traffic Logger sample custom assertion requires less Java coding experience. Use it to understand how custom assertions work and how they are implemented in the Gateway.
The Salesforce Connector custom assertion is more detailed and is intended for intermediate to advanced users.
The Custom Assertions API Javadoc provides technical content about the custom assertions application interface, in web format. The Javadoc is packaged within the Custom Assertions SDK and is intended for the experienced Java coder.
Overview
Creating your own custom assertion involves implementing the
com.l7tech.policy.assertion.ext.CustomAssertion
interface and extending the com.l7tech.policy.assertion.ext.ServiceInvocation
class.Both of these interfaces and other dependencies are included in the
layer7-api-8.2.0.jar
file, which is located in the Custom Assertion SDK.- The class implementing theCustomAssertioninterface uses the bean pattern to describe the data, configured by the administrator in the Policy Manager when the policy is being authored. Adding bean-style getter and setter methods enables these properties to be edited in the Policy Manager.
- TheServiceInvocationimplementation is instantiated by theCA API Gatewayand is invoked at policy runtime execution.
When the
CA API Gateway
instantiates the ServiceInvocation
implementing class, the CustomAssertion
implementing object is passed along with the data edited by the administrator.