diff --git a/force_bdss/factory_registry_plugin.py b/force_bdss/factory_registry_plugin.py index 67e785173c9986a4dccbd98a8d6aaa124dcaf250..3042d07373b431eba2ca030b3fcc6e1c0c750086 100644 --- a/force_bdss/factory_registry_plugin.py +++ b/force_bdss/factory_registry_plugin.py @@ -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) + diff --git a/force_bdss/ids.py b/force_bdss/ids.py index 336b64a90e0ee2a5b7be42e5d8b471a5d3c85915..d8657fd1f5bbde88c2a574f68e72cbb9fdaec4df 100644 --- a/force_bdss/ids.py +++ b/force_bdss/ids.py @@ -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):