General

Download

Overview
Project History
People

Use Cases Scenarios
Use Case Requirements
Bugs and Known Limitations
LHA

User Manuals Getting Started
General Tour
Configuration Options
Logging Tool Tour
Administration Tool Tour

Developers Architecture
Analysis of Design
Creating Plugins
Future Enhancements

Plugin Framework

CST supports a plugin framework that allows projects to supplement the generic functionality of generated software tools with features from customised software components. Three types of plugins are supported in the Logging Tool: Plugin are described in the plugins tag of the configuration file. CST uses the configuration file to create plugins and advertise them through specific menus. Please refer to Model Driven Development in the Presentation Layer for more information about how plugin attributes in the configuration file influence the generation of forms in the Logging Tool. This section of the design manual describes how plugins are supported in the architecture. Developers make plugin classes that implement either the GeneralPurposePluginAPI interface or the SubjectInformationServiceAPI interface.

Examples of the three types of plugins are included in the package cst.loggingTool.plugins.examples. The APIs allow plugins to access parts of the application through a SessionProperties object. The plugin examples show how the SessionProperties can be used to provide information to plugin code.

When developers finish making their plugin classes , they can package them in a jar file and put them in the ./lib/plugins directory of the CST release.

Developers can choose how plugins are discovered by the application. They can set the method setScanPlugins(...) in the class StartupOptions to achieve one of two actions:

When the new instances of the tools are created, StartupOptions calls the ConfigurationManager to parse the configuration file. ConfigurationManager delegates the task of parsing plugin definitions to PluginManager. This class uses the plugin descriptions to create plugin instances. It achieves this through the following steps:

  1. parse the class_name property from a plugin description
  2. obtain the class for the class name using either the system class loader or the PluginClassLoader
  3. use Java reflection to create an instance of the class using a constructor with no parameters.
  4. initialise the plugin through a call to the initialise(...) method of GeneralPurposePluginAPI

The PluginManager maintains a collection of plugin objects that are later used to populate the Database, Filters and Reports menus in the Logging Tool. Each plugin is wrapped within an instance of GeneralPluginMenuItem. The class listens for when its own menu item is pressed. When users select the menu item, GeneralPurposeMenuItem calls the execute() method of GeneralPurposePluginAPI.

Author: Kevin Garwood


(c)2010 Medical Research Council. Licensed under Apache 2.0.