Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

OpenNMS-Archives/osgi-plugin-manager

Repository files navigation

osgi-plugin-manager

This repository contains a suit of projects which together provide a full stand alone plugin management system for OSGi features hosted in Apache Karaf (http://karaf.apache.org/). An adaption of this system is also provided to provide a plugin management solution for OpenNMS.

Use Cases

Many open source platform projects benefit from enabling an eco-system of plugins which can be independently developed and deployed into a known version of the core platform. This allows a distributed community of developers to market extensions to the core project. Wordpress and Eclipse offer good examples of platforms where many extensions are available, some paid for and some free. In order to enable such a community it is essential to provide mechanisms for end users to discover, install and potentially apply a paid for licence to enable plugins.

Karaf is an OSGi container platform used as the foundation for many open and closed source java products. It provides a sophisticated 'Features' mechanism for managing the lifecycle of multiple OSGi bundles as components of a 'Feature' installed in a running system. However in its basic state, Karaf does not provide a mechanism for choosing which feature to install and for controlling the enabling of features based upon a licence. There are many examples of such systems but we are not aware of an open source solution for use with Karaf. The nearest solution would be to adopt the OSGi based plugin management system used by the Eclipse project but this is complex and uses the Eclipse UI to manage feature installation.

Therefore in order to provide a plugin management mechanism for OpenNMS, we have created a stand alone solution for Karaf which OpenNMS can use. The solution uses the concept of a Product, also known as a Plugin. A Plugin is a deployable Karaf Feature which has additional product metadata to allow users to understand what they are installing or have already installed. The product metadata can be used by shopping carts to enable a catalog of available plugins to be documented on line. The product metadata may also used by plugins installed in Karaf to describe the features they provide in human readable form.

Products/Plugins may also have associated licences, which may be generated by a shopping cart and installed in named Karaf instances. The system prevents licenced plugins from starting in a Karaf instance unless they also have a local valid licence installed. Each karaf instance is given a system id which is used as a key to determine what software or licences apply to that instance.

The core functionality for managing the lifecycle of licences and plugins is provided by the Licence Manager and Feature Manager modules. On installation, these modules register with the Karaf HTTP-Whiteboard in order to provide a ReST interfaces and a web accessible HTTP diagnostic pages.

The Licence Manager module provides a library for generating, installing and validating plugin product metadata and if required, product licences. Licences may be installed or manipulated using Karaf SSH consol commands or over a ReST interface. The Licence Manager stores the local karaf system Id and installed licences locally in an XML file held in the karaf /etc directory. Product Metadata is generated dynamically based upon which plugins are installed and have registered with the Licence Manager.

The Feature Manager module provides a ReST interface for managing the lifecycle of Karaf features. This simply reflects existing Karaf SSH consol feature commands over the ReST interface.

The Plugin Manager provided centralised management of the featues and liscnes installed in remote Karaf systems. We envisage that many solutions will use a distributed cluster of Karaf instances each of which will host different aspects of the solution. Indeed the forthcoming distributed OpenNMS will use a master OpenNMS to communicate with OpenNMS data collectors hosted in remote Karaf instances. This points to the need for a solution to allow a master system to determine what software is installed and potentially licenced in remote Karaf instances. A local CMDB is required to keep a manifest of the software already installed or to be installed at the next opportunity. The Plugin Manager provides such a solution. It keeps a local 'manifest' of the software and licences for each remote system as referenced by their system Id. The Plugin Manager provides a rich Vaadin web UI for communicating using ReST with the Licence Manager and Feature Manager modules installed in local and remote Karaf instances.

A key requirement for the Plugin Manager use case is that the remote systems may not always be activated or accessible over the web. The Plugin Manager keeps a local record of installation data from the last time it communicated with each remote system. The Plugin Manager stores the remote configuration manifests locally in an XML file held in the Karaf /etc directory.

A second requirement is that remote systems can operate behind firewalls and thus cannot be accessed using real time ReST commands. In this case each remote system is given the address of the master plugin manager and periodically contacts the system for updates to apply to their local feature set as determined by their systemId and manifest. Remote systems can also ask for licences based upon their systemId

Finally an example shopping cart module is provided in the form of an extension to the Wordpress Easy Digital Downloads shopping cart. This provides a working solution for marketing modules and generating licences. The shopping cart uses the rest API provided by the Licence Manager to discover access product metadata and generate licences. The solution is not tied to this shopping cart, other shopping carts could be adapted toi use hte API for the same purpose.

When a developer creates a new plugin, they need also to generate product metadata and also generate seeds and authenticators for the licences which will be generated by hte shopping cart to activate the module. A maven archetype is provided to generate an example plugin in order to get developers started with this process.

More information on this project is provided on the project wiki.

Issues and features are managed at http://issues.opennms.org/browse/OPM/

sub-projects

org.opennms.plugin.pluginmanager

This contains a stand alone plugin management system for use with OSGi plugins in a Karaf instance. This project is licenced under the Apache 2 licence to provide a widely reusable library.

edd-downloads-as-osgi

This project, written as a PHP plugin for Wordpress is an extension to the Wordpress Easy Digital Downloads shopping cart (https://easydigitaldownloads.com/). It adds the ability to sell/purchase and generate licences for licenced plugins. This project is licenced under the GPL to match the licence regime of Wordpress and Easy Digital Downloads

vaadin-opennms-pluginmanager

This is a project which integrates the plugin management system into OpenNMS. This module is hosted within the OpenNMS build under opennms/features/vaadin-opennms-pluginmanager