106 IBM WebSphere Everyplace Access V5, Volume IV: Advanced Topics
3.4.2 Deploying a trigger handler
To deploy a trigger handler:
1. Go to Intelligent Notification Services applications directory and create a new
directory or choose an existing directory in which to place the new trigger
handler. The Intelligent Notification Services applications directory is located
in ins_home\insapps, where ins_home is the example directory (C:\Program
Files\WebSphere\INS).
This example uses the existing directory samples in C:\Program
Files\WebSphere\INS\insapps\samples.
2. Create the ./classes subdirectory, and place the class file for the new trigger
handler in this subdirectory as shown in Figure 3-5. Be sure you include the
appropriate directory structure according to the package of this class.
Figure 3-5 Location of Monitoringandler.class file
Chapter 3. Subscription-based notifications 107
3. Define information about trigger handlers, such as name, description, class
file, URL pattern, and other parameters, in an XML file named triglets.xml.
The URL pattern allows the subscription portlet to reference a trigger handler
inside the triglets.xml file.
Depending where the trigger handler is located, you must compose a new
triglets.xml file or modify the existing file. (A single triglets.xml file can
reference multiple trigger handlers.) All trigger handlers must be specified in a
triglets.xml file.
The triglets.xml file is located in each directory that contains a trigger handler
and requires a triglets.dtd file. Open the triglets.dtd file located in
ins_home\insapps\samples for more information (Figure 3-6).
Figure 3-6 Location of file.triglets.dtd and triglets.xml files
108 IBM WebSphere Everyplace Access V5, Volume IV: Advanced Topics
This example modifies the triglets.xml file that is located in the sample
directory to include information of the MonitoringHandler trigger. The
properties of this new trigger handler are highlighted in Example 3-33.
Example 3-33 Properties of the new trigger handler
<?xml version='1.0'?>
<!DOCTYPE triglet-app SYSTEM "./triglets.dtd">
<triglet-app>
<triglet>
<triglet-name>StockHandler Sample for WAS</triglet-name>
<description>Sample handler for a stock subscription</description>
<triglet-class>com.ibm.pvc.ins.sm.handler.StockHandler</triglet-class>
<init-param>
<param-name>SubscriptionsPerTriglet</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>TrigletTimeToLiveMillis</param-name>
<param-value>1209600000</param-value>
</init-param>
</triglet>
<triglet>
<triglet-name>WeatherHandler Sample for WAS</triglet-name>
<description>Sample handler for a weather subscription</description>
<triglet-class>com.ibm.pvc.ins.sm.handler.WeatherHandler</triglet-class>
<init-param>
<param-name>SubscriptionsPerTriglet</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>TrigletTimeToLiveMillis</param-name>
<param-value>1209600000</param-value>
</init-param>
</triglet>
<triglet>
<triglet-name>MonitoringHandler Sample for WAS</triglet-name>
<description>Sample handler for a monitoring subscription</description>
<triglet-class>com.ibm.pvc.ins.sm.handler.MonitoringHandler
</triglet-class>
<init-param>
<param-name>SubscriptionsPerTriglet</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>TrigletTimeToLiveMillis</param-name>
<param-value>1209600000</param-value>
</init-param>
</triglet>

Get IBM WebSphere Everyplace Access V5 Handbook for Developers and Administrators Volume IV: Advanced Topics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.