-
Notifications
You must be signed in to change notification settings - Fork 1
Plugin loaders and plugins
The classes responsible for loading the plugins that hook into the extension points are NonEntailmentExplanationPlugin and 'NonEntailmentExplanationPluginLoader' for the explanation services and NonEntailmentPreferencesPanelPlugin and NonEntailmentPreferencesPanelPluginLoader for the preferences. We will only cover the case of the non-entailment service plugin and plugin loader here, since the actual implementations are fairly similar for the preferences plugin and plugin loader:
The plugin loader extends the abstract generic Protégé class AbstractProtegePlugin<T> and needs to implement the method createInstance, which should return an object of the plugin related to that loader. That object, on the other hand, needs to be of the type T referenced by the plugin loader, and it needs to extend the abstract generic Protégé class AbstractProtegePlugin<U>. Here, the type U refers to a class that extends the Protégé class 'ProtegePluginInstance'. For example, the method createInstance of the class NonEntailmentExplanationPluginLoader returns an object of the class NonEntailmentExplanationPlugin, which extends the class AbstractProtegePlugin<INonEntailmentExplanationService>.
Note that an object of the plugin loader class needs to specify two strings during construction: The pluginId and the extensionPointId. The pluginId needs to correspond to the Bundle-SymbolicName of the java bundle containing the plugin loader. Both the pluginId and the extensionPointId are then referenced by any class providing a plugin for that loader. For example, the Evee class NonEntailmentExplanationPluginLoader uses the pluginId de.tu_dresden.inf.lat.evee and the extensionPointId nonEntailment_explanation_service. The classes NonEntailmentExplanationPluginLoader and NonEntailmentExplanationPlugin are contained in the bundle evee-protege-core, which has the bundle symbolic name de.tu_dresden.inf.lat.evee. Any plugin that wants to hook into the extension point provided by this plugin loader needs to reference de.tu_dresden.inf.lat.evee.nonEntailment_explanation_service in the extension tag of its plugin.xml.
An object of the class NonEntailmentExplanationPluginLoader is used in the view (see Non Entailment View) to load the plugins upon initialisation of the view by Protégé. The loader searches for the plugins available through Protégé and creates a new instance of each. The class NonEntailmentExplainerManager is used to keep track of all the non-entailment explanation services that were loaded by the plugin loader and of the explanation service that is currently selected by the user.