Rate book preload plugin

The preload Rating Management components feature and precompile rate routines JAR feature use the RateBookPreloadPlugin plugin.

The default plugin implementation is in the RateBookPreloadPluginImpl class. You can use this implementation as an example for creating your own plugin implementation.

You can use the default implementation, RateBookPreloadPluginImpl, as an example for creating your own plugin implementation.
  • Preload Rating Management components – You may decide to preload one set of rate books, and compile a different set of rate books into the JAR file.
  • Precompile rate routines JAR file – In the default implementation, the RateBooksToExportToJar getter returns the list of rate books that are in Active status. Your implementation can update the rate routines JAR file for other rate book events.

Preload Rating Management components feature

The preload Rating Management components feature calls the RateBooksToPreload getter to get the list of rate books to preload on system startup.
In the default implementation, the RateBooksToPreload getter returns the list of rate books that are in Active status. The rate books must meet the following criteria:
  • For all Active rate books with the same code, the rate book with the most recent effective date.
  • All Active rate books with effective date in the future. The assumption is that the rate book will soon be in use.

Precompile rate routines JAR file feature

The precompile rate routines JAR file feature calls the RateBooksToExportToJar getter to get the list of rate books whose rate routines will be included in the JAR file. PolicyCenter calls this getter when you generate the rate routines JAR file by clicking Generate JAR file on the Rate Books screen. PolicyCenter then compiles the rate routines in the list of rate books into the JAR file.
Note:

All rate routines used in rating must be in one of the rate books returned by RateRoutinesToExportToJAR getter of the rate book preload plugin. PolicyCenter throws an exception when it attempts to use a rate routine that is not in the list of rate books.

For example, rate book R contains rate routine X, and rate book R is not in the list of rate books returned by the plugin. If rating attempts to use rate routine X, PolicyCenter throws an exception, even if R is in Active status. PolicyCenter relies on the list of rate book returned by the RateRoutinesToExportToJAR getter.

In the default implementation, the RateBooksToExportToJar getter returns the list of rate books that are in Active status.

Important: Including rate books whose status is not Active may have undesirable results.

Rate routines in non-Active rate books are editable. You have a rate routine in a non-Active rate book. You generate the JAR and the rate routine is in it. You start the server and the rate routine is preloaded. Now you edit the rate routine, and promote the rate book to Active, or you reimport the rate book with the modified rate routine. This causes a problem because the JAR file cannot be updated with the modified rate routine.

This feature calls the update method when PolicyCenter needs to update the rate routines JAR file. The update method uses the RateBooksToExportToJar getter.

In the default implementation, the JAR file is updated when:
  • A rate book is promoted to Active status
  • A rate book is imported
The input parameter to the update method is an event as defined by RateBookEvent enumerated list:
Activate
Rate book changed to Active status
Create
Rate book created with Draft status
Approve
Rate book changed to Approved status
Export
Rate book exported to XML
Import
Rate book imported from XML
Stage
Rate book changed to Stage status

Creating your own plugin implementation

You can use the default implementation, RateBookPreloadPluginImpl, as an example for creating your own plugin implementation. In your implementation, you may decide to preload one set of rate books, and compile a different set of rate books into the JAR file. Your implementation can update the JAR file for other rate book events.

Use case for precompiling rate books in Approved status

The precompile rate routines JAR feature is designed to work with Active rate books, where rate routines are not editable. If you include rate books in other statuses, and you edit rate routines in those books, rating may not work as expected.

With this in mind, there is a use case for including rate books in Approved status provided that the rate routines remain unchanged.

There are Approved rate books in the stage environment that you plan to move to production and make Active there. In addition to Active rate books, you wish to include Approved rate books in the JAR file. When the rate book is made Active on production, all rate routines are already in the JAR file. If you do not include Approved rate books in the return list, then the JAR will not contain the routines included in those rate books. When you make those books Active in production, the server needs to update the JAR file by compiling and adding the rate routines in the promoted rate books to the JAR file.

You can make this change in the getRateBooksToExportToJar method. Modify the list of rate books returned to include rate books in Approved status, in addition to Active status. The result is that rate routines in Active and Approved status rate books are compiled into the rate routines JAR file.

Important: Including rate books whose status is not Active may have undesirable results.

Rate routines in non-Active rate books are editable. You have a rate routine in a non-Active rate book. You generate the JAR and the rate routine is in it. You start the server and the rate routine is preloaded. Now you edit the rate routine, and promote the rate book to Active, or you reimport the rate book with the modified rate routine. This causes a problem because the JAR file cannot be updated with the modified rate routine.