hornet.plugin – HORNET Plugin
Module author: John Paulett <john.paulett -at- vanderbilt.edu>
Plugin Interface
-
class hornet.plugin.Plugin
Abstract class for plugins. Plugins must subclass this class in order
to be properly loaded and executed by HORNET.
-
listen_to
- List of instances of hornet.plugin.Plugin which this plugin
needs to listen to. For each plugin instance in the list, this
plugin will register as a listener to that plugin and receive
events from that plugin.
-
notify(event)
- Method of running the plugin, Called by the plugins
which are set in hornet.plugin.Plugin.listen_to.
-
accepted_events()
- Returns the set of hornet.event.Event subclasses that the
hornet.plugin.Plugin.notify() method with accept. The passing of
Events of any other type to the notify method could potentially
raise an exception. Can return either a single class or a tuple
of classes.
-
setup()
- Method that is called prior to the start of the plugin.
Subclasses should override this method if they which to have certain
actions performed upon initialization of the object.
-
teardown()
- Method that is called when HORNET is stopping a plugin.
Plugins that hold onto resources or large data items should implement
the code necessary to close these resources and delete anything.
Any exceptions that occur within this method will be caught and logged
but will not be rethrown. However, care should be given to ensure
that an exception does not prevent other resources from being freed.
-
register(listener)
- Add listener to the list of listeners of this plugin.
-
unregister(listener)
- Removes listener from the list of listeners of this plugin.
-
output(filename)
- Returns the location to which to save filename based upon
the output_dir defined in hornet.application.Config.
-
notify_listeners(event)
- Method for notifying all the listeners of an event. Should be
called at any point which the plugin should inform other plugins of its
changes.
-
id
- A unique identifier for the plugin instance. Typically set by
HORNET based upon the configuration of
the plugin.
-
type
- Type of the plugin instance, which is simply the module and
class name of the type of the plugin in a tuple.
-
parent
- Reference to the main hornet.application.Hornet. Useful
in select contexts.
Exceptions
-
exception hornet.plugin.InvalidPlugin
- The plugin is not a proper implementation of
hornet.plugin.Plugin