This topic is intended as a guide for implementing plugins that are loaded and invoked by the extension framework.
All extension implementations must implement an interface that is descended from the super plugin interface known as Plugin. Typically, you are required to implement the most specific interface in the hierarchy, according to the type of plugin that you are writing; for example, if you wanted to implement a plugin that was an event handler for the OnSessionCreatedEvent engine event, you would implement the OnSessionCreatedEventHandler, NOT the generic EngineEventHandler interface.
Regardless of the specific interface implemented, all plugin implementations must conform to the following to be loaded and invoked properly by the extension framework:
The point at which an extension is registered and the registration arguments that are passed to it, is determined by its type. There are several types of plugins:
Understand what installation methods are available
Install extensions to work on Oracle Policy Modeling Build and Run instances
There are two methods of installing extensions:
It is possible to automatically discover and register extensions when the applications start. Using this method, plugin installation is simply a matter of compiling the plugin libraries (.jar in Java or .dll in .NET) and deploying them to the plugins folder and restarting the application. The plugins folder is located in <web root>/WEB-INF/classes/plugins in Java or <web root>/bin/plugins in .NET.
Multiple plugins can be compiled into a single library or multiple plugin libraries can be used. Any third party dependencies must be copied into a location that will cause them to be automatically loaded when the applications starts such as <web root>/WEB-INF/lib in Java or <web root>/bin/ in .NET.
Note for Java Deployments:
Because the Auto-discovery mechanism requires the ability to introspect the class path, this method may not be available in certain application servers such as Oracle WebLogic Application server, when running the war file unexpanded. In such cases, plugins must be loaded using the manual configuration option
Manually configuring which plugins to load involves deploying the extensions, and any third party dependencies to a location that will automatically be loaded when the application starts such as <web root>/WEB-INF/lib in Java or <web root>/bin/ in .NET. The list of plugin classes to be loaded must then be manually specified using the plugin.libraries property in application.properties
Installing extensions to enable Oracle Policy Modeling Build and Run instances to use those extensions, is the same process as installing either onto the Determinations Server or onto a Web Determinations server.
The Oracle Policy Modeling Build and Run command invokes a Java web server as well, and its plugin folder can be found in the 'Release' folder directly in the project folder; for example, if we have a rulebase named 'MyRulebase', located in C:\projects\MyRulebase, the plugins folder will be located in the path:
C:\projects\MyRulebase\Release\web-determinations\WEB-INF\classes\plugins
Regardless of the specific interface implemented, all extensions must conform to the following to be loaded and invoked properly by the extension framework:
Code Sample - Sample Plugin - RulebaseSpecificDataAdaptorpublic class RulebaseSpecificDataAdaptor implements DataAdaptorPlugin { //TIP: Each Plugin implements a Plugin Interface
/**
* Only provide this plugin if the Web Determinations session's rulebase is the 'SpecialRulebase' rulebase.
* The specific RegisterArgs object we get here is an instance of InterviewSessionRegisterArgs.
*/
public Plugin getInstance(InterviewSessionRegisterArgs args) { //TIP: Each Plugin interface implemented have different getInstance() argument
if (args.getSession().getRulebase().getIdentifier().equals("SpecialRulebase")){
return new RulebaseSpecificDataAdaptor ();
} else {
return null;
}
}
/**
* Parameterless constructor to conform to the plugin requirements
*/
public RulebaseSpecificDataAdaptor (){
}
...
If Hot-swapping mode is turned on, then:
The following table indicates which specific RegisterArgs implementation objects may passed to the getInstance method of descendant interfaces of the base Plugin interface.
REGISTERARGS implementation |
Encapsulated objects |
Plugin Descendent interface(s) |
---|---|---|
InterviewEngineRegisterArgs |
- The Interview Engine in use. |
|
InterviewSessionRegisterArgs |
- The current InterviewSession. |
|
PlatformSessionRegisterArgs |
- The current SessionContext. |
|
InterviewServletRegisterArgs | - The InterviewServletContext object in use. |
Plugin type |
Interface |
Ancestor interface |
---|---|---|
Data Adaptor |
DataAdaptorPlugin |
EnginePlugin |
Document Generator |
DocumentGenerationPlugin |
EnginePlugin |
Commentary Provider |
CommentaryProviderPlugin |
EnginePlugin |
List Provider |
ListProviderPlugin |
EnginePlugin |
Custom Screen Provider |
CustomScreenProvider | PlatformPlugin |
Custom Control Provider |
CustomControlProvider | PlatformPlugin |
Web Determinations Formatter |
WebDeterminationsFormatter |
PlatformPlugin |