aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/mic/plugin.py')
-rw-r--r--scripts/lib/mic/plugin.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/lib/mic/plugin.py b/scripts/lib/mic/plugin.py
index 7c296e9765..df03c15081 100644
--- a/scripts/lib/mic/plugin.py
+++ b/scripts/lib/mic/plugin.py
@@ -19,13 +19,12 @@ import os, sys
from mic import msger
from mic import pluginbase
-from mic.conf import configmgr
from mic.utils import errors
__ALL__ = ['PluginMgr', 'pluginmgr']
-PLUGIN_TYPES = ["imager", "backend"] # TODO "hook"
+PLUGIN_TYPES = ["imager", "source"] # TODO "hook"
class PluginMgr(object):
@@ -99,4 +98,24 @@ class PluginMgr(object):
return pluginbase.get_plugins(ptype)
+ def get_source_plugin_methods(self, source_name, methods):
+ """
+ The methods param is a dict with the method names to find. On
+ return, the dict values will be filled in with pointers to the
+ corresponding methods. If one or more methods are not found,
+ None is returned.
+ """
+ return_methods = None
+ for _source_name, klass in self.get_plugins('source').iteritems():
+ if _source_name == source_name:
+ for _method_name in methods.keys():
+ if not hasattr(klass, _method_name):
+ msger.warning("Unimplemented %s source interface for: %s"\
+ % (_method_name, _source_name))
+ return None
+ func = getattr(klass, _method_name)
+ methods[_method_name] = func
+ return_methods = methods
+ return return_methods
+
pluginmgr = PluginMgr()