Class PluginManager

Show UML class diagram
  extended by de.deepamehta.core.impl.PluginManager

 class PluginManager
extends Object

Activates and deactivates plugins and keeps a pool of activated plugins. The pool of activated plugins is a shared resource. All access to it is synchronized.

A PluginManager singleton is hold by the EmbeddedService and is accessed concurrently by all bundle activation threads (as created e.g. by the File Install bundle).

Field Summary
private  Map<String,PluginImpl> activatedPlugins
          The pool of activated plugins.
private  EmbeddedService dms
private  Logger logger
Constructor Summary
PluginManager(EmbeddedService dms)
Method Summary
private  void _activatePlugin(PluginImpl plugin)
          Activates a plugin.
private  boolean _isPluginActivated(String pluginUri)
(package private)  void activatePlugin(PluginImpl plugin)
          Activates a plugin and fires activation events.
private  void addToActivatedPlugins(PluginImpl plugin)
private  boolean checkAllPluginsActivated()
          Checks if all plugins are activated.
(package private)  void deactivatePlugin(PluginImpl plugin)
(package private)  PluginImpl getPlugin(String pluginUri)
(package private)  List<PluginInfo> getPluginInfo()
private  boolean isDeepaMehtaPlugin(Bundle bundle)
          Plugin detection: checks if an arbitrary bundle is a DeepaMehta plugin.
(package private)  boolean isPluginActivated(String pluginUri)
private  void removeFromActivatedPlugins(String pluginUri)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private Map<String,PluginImpl> activatedPlugins
The pool of activated plugins. Hashed by plugin bundle's symbolic name, e.g. "de.deepamehta.topicmaps".


private EmbeddedService dms


private Logger logger
Constructor Detail


PluginManager(EmbeddedService dms)
Method Detail


void activatePlugin(PluginImpl plugin)
Activates a plugin and fires activation events. Called once the plugin's requirements are met (see PluginImpl.checkRequirementsForActivation()).

After activation posts the PLUGIN_ACTIVATED OSGi event. Then checks if all installed plugins are active, and if so, fires the CoreEvent.ALL_PLUGINS_ACTIVE core event.

If the plugin is already activated, performs nothing. This happens e.g. when a dependent plugin is redeployed.

Note: this method is synchronized. While a plugin is activated no other plugin must be activated. Otherwise the "type introduction" mechanism might miss some types. Consider this unsynchronized scenario: plugin B starts running its migrations just in the moment between plugin A's type introduction and event listener registration. Plugin A might miss some of the types created by plugin B.


void deactivatePlugin(PluginImpl plugin)


boolean isPluginActivated(String pluginUri)


PluginImpl getPlugin(String pluginUri)


List<PluginInfo> getPluginInfo()


private void _activatePlugin(PluginImpl plugin)
Activates a plugin. Activation comprises: - install the plugin in the database (includes migrations, post-install event, type introduction) - initialize the plugin - register the plugin's event listeners - register the plugin's OSGi service - add the plugin to the pool of activated plugins


private boolean checkAllPluginsActivated()
Checks if all plugins are activated.


private boolean isDeepaMehtaPlugin(Bundle bundle)
Plugin detection: checks if an arbitrary bundle is a DeepaMehta plugin.


private void addToActivatedPlugins(PluginImpl plugin)


private void removeFromActivatedPlugins(String pluginUri)


private boolean _isPluginActivated(String pluginUri)

Copyright © 2014. All Rights Reserved.