Write a custom filter using the extension kit

Note   The following sections refer to jabber sample code that is no longer included in the code samples supplied with API Gateway. We recommend that you use this section only as a general guide for writing a custom filter using the extension kit.

In this approach, you write your custom filter using the API Gateway developer extension kit. This section details how to write a custom message filter, called the Jabber Filter (API Gateway runtime component and Policy Studio configuration component). It also shows how to configure it as part of a policy in Policy Studio and then demonstrates how the filter sends an instant message to an account on Google Talk.

The steps required to build, integrate, configure, and test the supplied JabberFilter and JabberProcessor sample classes are as follows:

Step Description

Create the TypeDoc

Every filter has an associated XML-based TypeDoc description file that contains the entity type definition. It defines the configuration field names for that filter and the corresponding data types for that filter.

Create the Filter class

Every message filter returns its corresponding Processor and Policy Studio classes.

Create the Processor class

The Processor class is the API Gateway runtime component that is responsible for processing the message. Every message filter has an associated Processor and Filter class.

Create the declarative UI XML file

The declarative XML file is used to define the user interface for filters and dialogs.

Create the Policy Studio classes

All filters are configured using Policy Studio. Every filter has a configuration wizard that enables you to set each of the fields defined in the entity that corresponds to that filter. You can then add the filter to a policy to process messages.

Build the classes

When the classes are written, you must build them and add them to the API Gateway and client CLASSPATH. Example classes are included in the DEVELOPER_SAMPLES/jabber directory.

Load the TypeDocs

You must register the TypeDoc created for the filter with the entity store.

Construct a policy

Construct a policy that sends an instant message to an account on Google Talk and echoes a message back to the client. Use the GUI component of the newly added filter to specify its configuration and test the functionality of the filter (and its configuration).

Related Links