An Oracle Web Determinations implementation can handle more than one rulebase. When there are two or more rulebases for the Oracle Web Determinations, the user is given the choice to select which rulebase to run. Therefore, an Oracle Web Determinations implementation needs to be able to list the available rulebases that the user can access,and be able to retrieve a specific rulebase when the user selects one to run. These and other internal rulebase functions are provided by a 'Rulebase Service' object in the Oracle Web Determinations.
The default Oracle Web Determinations Rulebase Service retrieves rulebases as zip files from a pre-defined location/path in the Oracle Web Determinations webapp; for example, for a default installation the path <oracle web determinations webapp>/WEB-INF/classes/rulebases is read and monitored for rulebases. The user can store/manage the rulebase zip files in the path, and also access them to list or load a specific rulebase.
There are situations where rulebases of an Oracle Web Determinations implementation need to be stored and accessed from a custom datasource. The Rulebase Service Plugin is an Interview Engine plugin that allows usage of custom datasources to store and retrieve rulebases from. Also it lets the implementer customize the rulebase service functionality.
A client may have invested in a good database architecture to manage their IT solutions. They want to store the rulebases and rulebase metadata in their database to allow existing systems to manage the rulebases. As a result, the Oracle Web Determinations would need to be able to retrieve the list of rulebases, and also retrieve a specific rulebase from the database. The Oracle Web Determinations System Integrator can develop his/her own Rulebase Service via the RulebaseServicePlugin to connect and retrieve rulebases from the database.
An Oracle Web Determinations implementation may require that only certain rulebases should be accessible based on user credentials. The Oracle Web Determinations System Integrator can create a custom RulebaseService via the RulebaseServicePlugin that uses the default Rulebase Service to retrieve the list of rulebases available, then based on the SecurityToken provided prune the list of rulebases before returning it to be displayed.
The information in this section details how the Rulebase Service fits into the Web Determinations Architecture, and how to use it in the Web Determinations environment..
Web Determinations loads and uses the default Rulebase Service, unless there is a Rulebase Service Plugin available. Only one Rulebase Service can be used at a time.
To access the Rulebase Service plugin from other Web Determinations Extensions the Extension must have access to the SessionContext object. There is only one RulebaseServicePlugin loaded per InterviewEngine (and hence Oracle Web Determinations runtime).
RulebaseServicePlugin rsPlugin = sessionContext.getServletContext().getInterviewEngine().getRulebaseService();
Rulebase ruleabse = rsPlugin.getRulebase(securityToken, rulebaseName);
A Rulebase Service plugin implements the RulebaseServicePlugin interface.
The RulebaseServicePlugin in turn extends the Rulebase Service interface and also the InterviewSessionPlugin interface.
The RulebaseServicePlugin interface requires the following when implemented:
Method | Description |
---|---|
listRulebases(token : SecurityToken) : InterviewRulebase[]
|
This method is called by the InterviewEngine against which this rulebase service plugin is registered. Given the security token, this method returns the list of available rulebases, filtered by the provided security token. |
getRulebase(token : SecurityToken, identifier : String) : InterviewRulebase
|
This method is called by the InterviewEngine against which this rulebase service plugin is registered. Given the security token and the identifier of the desired rulebase, this method returns the requested rulebase if the security token allows it. Otherwise, returns null. |
getRulebaseListVersion() : long |
Used by clients of the rulebase service to determine when the list of rulebases (and the rulebases themselves) managed by this rulebase service have changed. This could be due to rulebase addition, deletion and/or update. This method will return an arbitrary long value which changes every time such a modification to the rulebases occurs. Note: This method has been deprecated as of V10.2 |
loadRulebase() : rulebase | Used by clients of the rulebase to manually load the specified rulebase |
getInstance(args : InterviewEngineRegisterArgs) : InterviewEnginePlugin
|
Standard plugin registration method. This method is called by the InterviewEngine during initialization of its plugins. If the specific rulebase service plugin implementation is able to serve rulebases to the interview engine (given through the InterviewEngineRegisterArgs encapsulation object) then this method returns an initialised instance of the rulebase service object. Otherwise, null is returned. |
The information in this section explains the various approaches on designing and developing a Rulebase Service plugin for a specific project/implementation.
When designing a Rulebase Service plugin, keep in mind the following:
The Rulebase Service Plugin provides both the flexibility to allow rulebases to be loaded from any source but also decide whether the list of available rulebases itself is dynamic or static. Note that if the rulebase service plugin does use a dynamic list of rulebases, then that service must notify the Interview Engine if any rulebase has been added, removed or updated by calling the Interview Engine's rulebaseAdded, rulebaseRemoved and rulebaseUpdate methods respectively.
See Rulebase service Plug-in Sample Code (DerbyRulebaseService) for a worked example of implementing a rulebase service plugin.