Package elisa :: Package core :: Module plugin :: Class Plugin
[hide private]
[frames] | no frames]

Class Plugin

source code


Plugin Base Class

This class acts as a elisa.core.component.Component factory. All the Plugin's class variables can be stored in a plugin.conf file which has the following syntax:
   [general]
   name="base"
   version="0.1"
   plugin_dependencies=["foo"]
   external_dependencies=["pgm"]
   description="base elisa components"

   # that's a component!
   [media_providers.local_media:LocalMedia]
   description="To access file:// media"
   platforms=["linux", "posix"]
   external_dependencies=["gnomevfs",]
   component_dependencies = ["base:coherence_service"]
Each option of the "general" section will be mapped to it's corresponding class variable in the Plugin.

Nested Classes [hide private]
  __metaclass__
Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
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__

Class Methods [hide private]
 
initialize(cls)
Check the components class attribute is a dictionary and that none of the components of the plugin have the same name as the plugin itself.
source code
 
check_dependencies(cls)
Check plugin's python dependencies
source code
 
check_component_dependencies(cls, component_name)
Check the supported platforms and external dependencies of the Component identified by its name.
source code
 
load_config(cls)
Load the config_file if defined
source code
 
load_translations(cls, translator)
Load the translation files supported by the Plugin into a translator, usually the Application's translator.
source code
string
get_resource_file(cls, path)
Retrieve a data file stored and managed by the plugin.
source code
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]
elisa.core.config.Config config = 'frontend'
Config generated by reading config_file
string config_file = 'frontend'
Plugin's directory relative path to plugin.conf
string directory = ''
absolute path to the directory storing the Plugin's source code file (or Egg)
dict mapping elisa.core.component.Component names to elisa.core.component.Component instances components = {}
Component implementations provided by the Plugin
string name = 'plugin'
plugin's name.
list plugin_dependencies = []
Elisa plugins dependencies specified using colon-syntax
list external_dependencies = []
external Python dependencies specified using dot-syntax
string version = ''
Plugin's version as a dot-syntax string
string description = ''
one line Plugin's description
  checked = True
  deps_error = 'frontend'

Inherited from extern.log.log.Loggable: logCategory

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: log.Loggable.__init__

initialize(cls)
Class Method

source code 
Check the components class attribute is a dictionary and that none of the components of the plugin have the same name as the plugin itself.
Raises:

check_dependencies(cls)
Class Method

source code 

Check plugin's python dependencies

This check is performed at most once.

check_component_dependencies(cls, component_name)
Class Method

source code 

Check the supported platforms and external dependencies of the Component identified by its name.

This check is performed at most once.

load_config(cls)
Class Method

source code 

Load the config_file if defined

Fill config class variable if config_file points to a valid config filename. Also fill name, version, description, plugin_dependencies, external_dependencies and components.

load_translations(cls, translator)
Class Method

source code 
Load the translation files supported by the Plugin into a translator, usually the Application's translator. This method uses the config class attribute, so be sure to have called load_config before calling this method. Translation files are loaded from the i18n plugin.conf section (inside general section).
Parameters:

get_resource_file(cls, path)
Class Method

source code 

Retrieve a data file stored and managed by the plugin.

If the plugin is stored in a flat directory we build an absolute filesystem path of the data file relative to the plugin's directory. If the plugin is an egg (most of the time zipped), we use pkg_resources which extract the file to a temporary directory and use that temporary file.
Parameters:
  • path (string) - relative path (to the plugin namespace) of the data file
Returns: string
absolute path to the data file

Class Variable Details [hide private]

name

plugin's name. Should be unique
Type:
string
Value:
'plugin'