Change notification sample details
You can run and rebuild the sample. You can also look at source files to understand how the sample works.
Running the sample
- Open the Samples Console (see Running samples from the Samples Console).
-
In the Samples Commands tab, expand .
-
Double-click the run command. It creates a project with packages and two rules in the Decision Center Business console. It also creates a notification that you can see on the RSS page.
Note:The sample handles the ActionRule element only.
The console displays the RSS data in XML format.
-
Log in to the Decision Center Business console at
http://localhost:<PORT>/decisioncenter. The port number can be 9090. It might differ on your computer. Use Paul as the username and password. Then, open the following link:http://localhost:<PORT>/decisioncenter/RSSRawProvider.jspNote:-
You can also configure notification for your RSS reader each time a user modifies a rule.
-
Certain browser versions might not recognize the RSS format. In this case, the tree is shown as XML.
Look at the changes that you made by using the run command.

-
To use permanent links:
-
In the RSS reader, you can click the name of a rule to open the Business console and edit the rule.
The link has the format http://localhost:<PORT>/decisioncenter/t/library/editor?id=<LINK to the rule>.
-
In the Samples Console, double-click the resetrss command to reset the RSS data on the server. Refresh your browser to see how recent changes are cleared.
Rebuilding the sample
To rebuild the sample:
- Open the Samples Console.
-
In the Samples Commands tab, navigate to .
-
Double-click the build command to recompile the code.
-
In the Sample Server view, click Restore the Sample Server to return the sample server to its initial state.
How the sample works
When you create or update an element, the NotificationController.onCommitElement() method is called when you enter the IlrSession.commit method, just before you commit an element. An event that contains all relevant data is created and stored in a thread-local storage. The NotificationController.elementCommitted() is called just after an element is committed. The event is retrieved from a thread-local storage and an RSS item is created in memory.

When you delete an element, the NotificationController.onDeleteElement() method is called when you enter the IlrSession.delete() method, just before you delete an element. The NotificationController.elementDeleted() method is called just after an element is deleted.

To make RSS data available, you use an HTTP request. Whenever an RSS reader requests RSS data, the JSP script is run and an RSS-formatted string is returned. All RSS items are generated by creating, updating, or deleting are stored in memory, as shown above. When the application server shuts down, items are persisted in a file and when the application server is restarted, items are read from the file and loaded into memory.

To configure Decision Center to use the new controller, you implement a custom session controller, specify it in a preferences.properties file (decisioncenter.controller.class=ilog.rules.rts.samples.notification.model.NotificationController), and store it in a JAR file.
Included are three additional JAR files that contain the sample code and an RSS library.
You do the customization in the build.xml file. The repack command calls a predefined target that is named repackage-war, which repackages the Decision Center EAR. The command uses the following parameters:
-
sourceWar, the initial WAR file.
-
targetWar, the customized WAR file.
-
additionalJars, the additional JAR files required by the sample:
- sample-controller.jar: This file contains the sample code, the preference.properties file, and the messages.properties file.
- rome-0.8.jar — ROME is an open source (Apache license) set of Atom and RSS Java™ utilities that make it easy to work in Java with most syndication formats, including RSS 0.90, RSS 0.91 Netscape, RSS 0.91 Userland, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, and Atom 1.0.
-
webResourcesDir, a directory that includes the .jsp files.
To get a permanent link for the modified element, you build a link by using a standard
parameter. See the getPermalink method of the
ilog.rules.rts.samples.notification.model.NotificationController class.
Source files
The sample is located in <InstallDir>/teamserver/samples/serveractionnotification.
You can also view and modify the sample source files in Rule Designer. To import the sample into your workspace, click the Import projects link in the Samples and Tutorials view, and switch to the Java perspective.