Skip to content
Snippets Groups Projects
Commit b8574f23 authored by Stefano Borini's avatar Stefano Borini
Browse files

Added extension point for UI hooks

parent 5a894eff
No related branches found
No related tags found
1 merge request!93UI Hooks
......@@ -9,6 +9,7 @@ from .data_sources.i_data_source_factory import (
IDataSourceFactory)
from .kpi.i_kpi_calculator_factory import IKPICalculatorFactory
from .mco.i_mco_factory import IMCOFactory
from .ui_hooks.i_ui_hooks_factory import IUIHooksFactory
FACTORY_REGISTRY_PLUGIN_ID = "force.bdss.plugins.factory_registry"
......@@ -50,6 +51,11 @@ class FactoryRegistryPlugin(Plugin):
id=ExtensionPointID.NOTIFICATION_LISTENER_FACTORIES
)
ui_hooks_factories = ExtensionPoint(
List(IUIHooksFactory),
id=ExtensionPointID.UI_HOOK_FACTORIES
)
def data_source_factory_by_id(self, id):
"""Finds a given data source factory by means of its id.
The ID is as obtained by the function factory_id() in the
......@@ -140,13 +146,13 @@ class FactoryRegistryPlugin(Plugin):
def notification_listener_factory_by_id(self, id):
"""Finds a given notification listener by means of its id.
The ID is as obtained by the function bundle_id() in the
The ID is as obtained by the function factory_id() in the
plugin api.
Parameters
----------
id: str
The identifier returned by the bundle_id() function.
The identifier returned by the factory_id() function.
Raises
------
......@@ -157,3 +163,24 @@ class FactoryRegistryPlugin(Plugin):
return nl
raise KeyError(id)
def ui_hook_factory_by_id(self, id):
"""Finds a given UI Hook factory by means of its id.
The ID is as obtained by the function factory_id() in the
plugin api.
Parameters
----------
id: str
The identifier returned by the factory_id() function.
Raises
------
KeyError: if the entry is not found.
"""
for hook in self.ui_hooks_factories:
if hook.id == id:
return hook
raise KeyError(id)
......@@ -14,6 +14,7 @@ class ExtensionPointID:
KPI_CALCULATOR_FACTORIES = 'force.bdss.kpi_calculator.factories'
NOTIFICATION_LISTENER_FACTORIES = \
'force.bdss.notification_listener.factories'
UI_HOOK_FACTORIES = 'force.bdss.ui_hook.factories'
def factory_id(producer, identifier):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment