Package elisa :: Package core :: Module plugin_registry :: Class PluginRegistry
[hide private]
[frames] | no frames]

Class PluginRegistry

source code


The PluginRegistry is responsible to find all the Plugins. Plugins enabled in the Application config file will be loaded by instantiating their class.

The registry can create components by first searching them by name in Plugins component registries and instantiating them directly. Component instances are not handled by the PluginRegistry.

Nested Classes [hide private]
  __metaclass__
Instance Methods [hide private]
 
__init__(self, application_config)
Initialize the PluginRegistry instance variables and the local plugin directory.
source code
 
_init_local_plugins_dir(self)
Register the local plugins directory in pkg_resources.
source code
 
plugins__get(self) source code
 
plugin_classes__get(self) source code
 
register_plugin(self, plugin_class)
Add the given plugin class to our internal plugins list.
source code
 
unregister_plugin(self, plugin_class)
Remove the given plugin class from our internal plugins list.
source code
elisa.core.plugin.Plugin
get_plugin_with_name(self, name)
Look for the plugin with given name, if it's not found, instantiate it and return it.
source code
 
load_plugins(self)
Find and register all Plugin classes found by setuptools and in the plugins directory.
source code
 
_check_plugin_dependencies(self) source code
 
check_interplugin_dependencies(self, plugin_class)
Check that all the plugins that plugin_class depends on are loaded.
source code
 
check_intercomponent_dependencies(self, plugin, component_name)
Check that all the components that component depends on are available.
source code
 
_load_eggs(self) source code
 
_load_packages(self) source code
 
_load_modules(self) source code
 
_load_by_config(self) source code
 
unload_plugins(self) source code
elisa.core.component.Component
create_component(self, component_path)
Use the PluginRegistry to to create a Component.
source code
(elisa.core.component.Component, elisa.core.plugin.Plugin, tuple)
_get_component_infos(self, component_path)
Get information about a component given its path.
source code
 
_import_component(self, plugin, component_name) source code
elisa.core.component.Component class
get_component_class(self, component_path)
Retrieve the class of a Component given its path.
source code
 
_split_component_path(self, component_path)
split the component path:...
source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]
 
__classinit__(cls, new_attrs)
Given a class and a new set of attributes (as passed in by __classinit__), create or modify properties based on functions with special names ending in __get, __set, and __del.
source code
Class Variables [hide private]
  name = 'plugin_registry'

Inherited from extern.log.log.Loggable: logCategory

Instance Variables [hide private]
elisa.core.config.Config _app_config
Application's config
dict mapping Plugin names to Plugin classes _plugin_classes
Plugin classes found by the Registry
elisa.core.plugin.Plugin list _plugin_instances
Plugins currently instantiated
Properties [hide private]
  plugin_classes
  plugins

Inherited from object: __class__

Method Details [hide private]

__init__(self, application_config)
(Constructor)

source code 
Initialize the PluginRegistry instance variables and the local plugin directory.
Parameters:
Overrides: log.Loggable.__init__

_init_local_plugins_dir(self)

source code 
Register the local plugins directory in pkg_resources. The directory name is found in the application's config in 'plugins_dir' option which is in the 'general' section

register_plugin(self, plugin_class)

source code 
Add the given plugin class to our internal plugins list.
Parameters:
  • plugin_class (class) - Plugin's class

unregister_plugin(self, plugin_class)

source code 
Remove the given plugin class from our internal plugins list.
Parameters:
  • plugin_class (class) - Plugin's class

get_plugin_with_name(self, name)

source code 
Look for the plugin with given name, if it's not found, instantiate it and return it. If no plugin with such name is found, raise an exception PluginNotFound.
Parameters:
  • name (string) - name of the Plugin to look for
Returns: elisa.core.plugin.Plugin
Raises:

check_interplugin_dependencies(self, plugin_class)

source code 
Check that all the plugins that plugin_class depends on are loaded.
Parameters:
  • plugin_class (class) - Plugin's class

check_intercomponent_dependencies(self, plugin, component_name)

source code 
Check that all the components that component depends on are available.
Parameters:
  • plugin (Plugin) - plugin containing the tested component
  • component_name (string) - component which dependencies are to be checked

create_component(self, component_path)

source code 

Use the PluginRegistry to to create a Component.

component_path format should be like this:
 plugin_name:component_name[:instance_id]

The plugin_name is the name of the plugin sub-class to load. See elisa.core.plugin.Plugin.name.

The component_name is the name of the Component sub-class to load. See elisa.core.component.Component.name.
Parameters:
  • component_path (string) - information to locate the Component to load
Returns: elisa.core.component.Component
Raises:

_get_component_infos(self, component_path)

source code 
Get information about a component given its path. This method doesn't instantiate Components, it just looks for Component classes.
Parameters:
  • component_path (string) - information to locate the Component to load
Returns: (elisa.core.component.Component, elisa.core.plugin.Plugin, tuple)

get_component_class(self, component_path)

source code 
Retrieve the class of a Component given its path.
Parameters:
  • component_path (string) - information to locate the Component
Returns: elisa.core.component.Component class

_split_component_path(self, component_path)

source code 
split the component path:
    plugin_name:component_name[:instance_id]

add default instance_id (0) if missing

@param component_path: information to locate the Component to load
@type component_path:  string
@returns:              tuple of 4 elements :
                       (plugin_name, component_name, instance_id, adjusted_component_path)
                       return empty tuple if the intance is not valid
@rtype:                tuple


Property Details [hide private]

plugin_classes

Get Method:
elisa.core.plugin_registry.PluginRegistry.plugin_classes__get(self)
Set Method:
'frontend'
Delete Method:
'frontend'

plugins

Get Method:
elisa.core.plugin_registry.PluginRegistry.plugins__get(self)
Set Method:
'frontend'
Delete Method:
'frontend'