Plugin loading, invocation and discovery

Plugin loading, invocation and discovery

This topic is intended as a guide for implementing plugins that are loaded and invoked by the extension framework.

Plugin interface

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:

Extension types

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:

What do you want to do?

Understand what installation methods are available

Install extensions to work on Oracle Policy Modeling Build and Run instances

Register an extension

Understand what installation methods are available

There are two methods of installing extensions:

  1. Auto-discovery
  2. Manual configuration

Auto-discovery

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

Manual configuration

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

Install extensions to work on Oracle Policy Modeling Build and Run instances

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

Register an extension

Regardless of the specific interface implemented, all extensions must conform to the following to be loaded and invoked properly by the extension framework:

Notes about Hot-swapping mode

If Hot-swapping mode is turned on, then:

Plugins and RegisterArgs

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.
  • EngineEventHandler
  • DataAdaptorPlugin
  • DocumentGenerationPlugin 
  • CommentaryProviderPlugin
  • ListProviderPlugin
PlatformSessionRegisterArgs
- The current SessionContext.
  • CustomScreenProvider
  • CustomControlProvider
  • PlatformEventHandler
  • WebDeterminationsFormatter
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

Do's and don'ts