Modify the behavior of Web Determinations
Implement a rulebase-specific look and feel
Oracle Web Determinations allows you to deploy Oracle Policy Modeling rulebases into a configurable and extendable web application out of the box.
There is a comprehensive extension architecture available to technical consultants/system integrators with extension points to accommodate specific project implementation needs.
Web Determinations extensions are custom Java or .Net classes/packages that are developed by system integrators and deployed onto a Web Determinations web application.
There are two main types of interactive extensions:
When extending Web Determinations, both of these extension types do not need to be used exclusively. They both provide complementing extension points, so it is most likely that both plugins and Event Handlers will be used to achieve the desired project-specific behavior.
In the context of Oracle Web Determinations, the word plugin is ambiguous as it can mean either a single class that implements an exported interface, or the compiled JAR or DLL containing multiple class definitions; from this point on, these are referred to as plugin class and plugin archive respectively, and the interface they implement is a plugin interface.
Plugins are constructed in two stages:
There are several varieties of plugin interface:
Some examples:
To create a plugin:
When deploying Oracle Web Determinations, plugin archives must be placed in a specific location within the deployed web application (classes/plugins). This location cannot be changed by configuration. In Java, plugin classes must be archived into a JAR (no naked .class files). Other non-plugin files, such as dependencies or configuration files for the plugin classes, may also be placed in the plugins directory; they will be ignored by Oracle Web Determinations.
On application servers which allow us to search the plugins directory (such as Tomcat and IIS) every JAR (for Java platforms) or DLL (for .NET platforms) in the plugins directory will be examined to determine if it is a plugin archive. For the convenience of the systems administrator who may wish to deploy large numbers of plugin dependencies without incurring extra delay at startup, subdirectories of the plugins directory will not be searched.
On application servers which do not allow us to search the plugins directory (such as WebLogic and WebSphere) plugin archives must be named explicitly in the Oracle Web Determinations configuration file.
On any application server, even if the plugins directory can otherwise be searched, when plugins are specified in the configuration file, no other unnamed plugins will be loaded. This allows for consistent behavior when the same Oracle Web Determinations deployment is moved between application servers. It also allows an Oracle plugin archive to be overridden by a customer plugin archive while still being available for the customer plugin archive to use.
Plugins are initialized in batches, according to the interfaces they implement. Note that within each batch, the order of initialization is not specified:
- all Engine Singleton plugins
- all Platform Singleton plugins
- all Engine Session plugins
- all Platform Session plugins
Oracle Web Determinations is heavily multithreaded, and attention must be paid to threading issues to produce correct behavior.
The following provides a discussion of the steps required and the available options for implementing a rulebase-specific interview look and feel in Web Determinations.
Oracle Policy Modeling provides a way to attach key/value property pairs to individual screens and controls at rulebase authoring time. These are then exposed to the templates that render the Web Determinations user interface through the platform's screen and controls API.
Take for example, a rulebase in which some controls have a custom property called 'template', which maps onto the path of a template to be used instead of the default template to render that particular control. Additionally, in this example, this functionality is to only be available to this one rulebase, perhaps because access to this rulebase is only granted to a small group of trusted rulebase engineers. Call this rulebase 'alternative'.
The following is a fragment of the default template for cycling through the controls on a screen and calling the template for each control type to render the specific control:
#set( $controlList = ${screen.getControls()} )
#foreach( $control in $controlList )
<div class="control-item">
#parse( "controls/${control.getControlType()}.vm" )
</div>
<span class="control-clear"></span>
#end
The name of the template used to render a particular control is retrieved through the getControlType method on the control object. This is the logic that will be altered for this example:
#set( $rulebase = ${screen.getInterviewSession().getRulebase().getName()} )
#set( $controlList = ${screen.getControls()} )
#foreach( $control in $controlList )
<div class="control-item">
#if( $rulebase == "alternative" && ${control.hasProperty("template")} )
#set( $alternativeTemplate = ${control.getProperty("template")} )
#parse( "${alternativeTemplate}" )
#else
#parse( "controls/${control.getControlType()}.vm" )
#end
</div>
<span class="control-clear"></span>
#end
Templates can be modified to check for a specific rulebase or set of rulebases, and to alter the functionality and/or look and feel of the application for that particular session. This is what we have done above using the specific case of custom properties attached to controls. Another option would be to parse an alternative/extra CSS template for particular rulebase(s) and not for others. There are, however, a couple of things to bear in mind about rulebase-specific configuration:
The following describes rulebase management in terms of deploying Oracle Determinations Server for Apache Tomcat V6.x or WebSphere Application Server V6.1.
You can only manage individual rulebases for a determinations-server web application on application servers that deploy web applications in expanded form. Apache Tomcat and IBM WebSphere Application Server do deploy their web applications in expanded form, while Oracle WebLogic does not deploy a web application in expanded form by default.
In order to add, update, or remove a rulebase you need to locate the rulebases directory of the determinations-server web application. By default, this is located at: WEBROOT/WEB-INF/classes/rulebases/. See below for the WEBROOT depending on the different application server.
If you have specified a custom rulebases directory, you can add, update or remove a rulebase at the location of the specified rulebases directory.
Using Oracle Policy Modeling, open and build the rulebase. The rulebase archive, <rulebase name>.zip will be built in the output directory of the rulebase project.
Copy the rulebase archive to Oracle Determinations Server’s rulebase directory. By default, Oracle Determinations Server will automatically add the rulebase.
Note: In addition to building a rulebase by using Oracle Policy Modeling, it can be done from the command line; for information on how to do this, see the topic Build the rulebase from the command line, in the Reference section of the Oracle Policy Modeling User's Guide.
Using Oracle Policy Modeling, open and build the rulebase. The rulebase archive, <rulebase name>.zip will be built in the output directory of the Rulebase project.
Copy the rulebase archive to Oracle Determinations Server’s rulebase directory. By default, Oracle Determinations Server will automatically update the rulebase.
Delete the rulebase archive from Oracle Determinations Server’s rulebase directory. By default, Oracle Determinations Server will automatically remove the rulebase, and its operations will no longer be available
The following terminology applies:
Term Definition WAS Refers to the directory to which the WebSphere Application Server has been installed. CATALINA_HOME The Apache Tomcat install directory. WEBROOT The path to the determinations-server root directory on the deployed server. By default this is:
- Apache Tomcat (all versions):
CATALINA_HOME/WebApps/determinations-server.- WebSphere Application Server 6.1:
WAS/profiles/<profile name>/InstalledApps/<node>/determinations-server.war
Where:
- <profile name> is the name of the application server instance profile determinations-server is installed to (default is AppSvr01).
- <node> the node that HDS is installed to (default is <hostname>Node01Cell).
Term |
Definition |
WAS |
Refers to the directory that the WebSphere Application Server has been installed to. |
CATALINA_HOME |
The Apache Tomcat Install Directory |
WEBROOT |
The path to the HDS root directory on the deployed server. By default this is:
Where:
Note: After a new Rulebase is deployed or deleted, you should Update the haley-determinations-server web application (from the WebLogic console) or restart the server. |