|
Plugin SDK |
Top Previous Next |
|
AggreGate Platform has a rich set of build in data processing tools, such as alerts, event filters, widgets, or trackers. AggreGate Plugin SDK is designed for creating customized instances of existing tools (e.g. building widgets on-the-fly based on current state of the system) and creating completely new tools (e.g. Access Policies for the physical access control industry). These tools are added to the AggreGate Server core in the form of plugins.
Technically speaking, AggreGate Server plugin can:
Some examples of AggreGate Server plugins:
Structure of AggreGate Server Plugin AggreGate Server plugin has two mandatory components:
These components must be packed in the Java Archive (JAR). Plugin descriptor (plugin.xml) must be located in the root folder of the archive. Creating New AggreGate Server Plugin To create new AggreGate Server plugin from scratch, create new Java class inherited from AbstractContextPlugin. You will need to override at least some of the methods to provide plugin functionality.
Global Configuration Certain plugins may have global configuration settings. To add global implement globalInit() method. Its implementations should call createGlobalConfigContext() and provide VariableDefinition's of global settings. These settings will be exposed to system administrators, their values get persisted in the database. To access setting values from any method of the plugin, retrieve global config context using getGlobalConfigContext(), then call Context.getVariable() to fetch instances of DataTable representing setting values. Hooking Up to the Server Context Tree ContextPlugin interface provides several groups of methods to attach some new elements to the AggreGate Server context tree. Every group has two methods: one "startup" method called at server startup or context creation and one "shutdown" method called at server shutdown or context destruction. 1. Plugin initialization/deininialization When a new context plugin is created, server calls its initialize() method that may contain some generic initialization code. When the plugin going to be destroyed, server calls its deinitialize() method. 2. Context-based setup Every time when new context is created or re-created on server startup, server calls install(Context context) method of the plugin. Its implementation may:
3. Context tree-based setup The install(ContextManager contextManager) method is called once right after server context tree finishes loading and all contexts were created. Its implementation may retrieve certain server contexts using ContextManager.get() method and add variable/function/event/action definitions and/or event listeners to them. 4. Plugin launch launch() method of the plugin is called in the very end of server startup, when all server contexts and facilities are up and running. It should be implemented only if some code fails to work properly from any of the methods described above. Modifying Plugin Descriptor To create a plugin descriptor for your plugin, make a copy of demo plugin's plugin.xml file and edit the following in it:
Building and Deploying Plugin Archive
|