+ # provide default for importer_class
+ def importer_class (self):
+ return None
+
+ # in the simplest case these can be redefined to the class/module objects to be used
+ # see pl.py for an example
+ # some descendant of SfaApi
+ def api_class (self) : pass
+ # the python classes to use to build up the context
+ def registry_class (self) : pass
+ def slicemgr_class (self) : pass
+ def aggregate_class (self) : pass
+ def component_class (self) : pass
+
+
+ # build an API object
+ # insert a manager instance
+ def make_api (self, *args, **kwargs):
+ # interface is a required arg
+ if not 'interface' in kwargs:
+ logger.critical("Generic.make_api: no interface found")
+ api = self.api_class()(*args, **kwargs)
+ # xxx can probably drop support for managers implemented as modules
+ # which makes it a bit awkward
+ manager_class_or_module = self.make_manager(api.interface)
+ driver = self.make_driver (api.config, api.interface)
+ ### arrange stuff together
+ # add a manager wrapper
+ manager_wrap = ManagerWrapper(manager_class_or_module,api.interface,api.config)
+ api.manager=manager_wrap
+ # insert driver in manager
+ logger.debug("Setting manager.driver, manager=%s"%manager_class_or_module)
+ # xxx this should go into the object and not the class !?!
+ manager_class_or_module.driver=driver
+ # add it in api as well for convenience
+ api.driver=driver
+ return api