fawkes::PluginManager Class Reference
Fawkes Plugin Manager. More...
#include <plugin/manager.h>

Public Member Functions | |
| PluginManager (ThreadCollector *thread_collector, Configuration *config, const char *meta_plugin_prefix) | |
| Constructor. | |
| ~PluginManager () | |
| Destructor. | |
| virtual void | config_tag_changed (const char *new_tag) |
| Called whenever the tag has changed. | |
| virtual void | config_value_changed (const char *path, bool is_default, int value) |
| Called whenever an int value has changed. | |
| virtual void | config_value_changed (const char *path, bool is_default, unsigned int value) |
| Called whenever an unsigned int value has changed. | |
| virtual void | config_value_changed (const char *path, bool is_default, float value) |
| Called whenever an float value has changed. | |
| virtual void | config_value_changed (const char *path, bool is_default, bool value) |
| Called whenever an boolean value has changed. | |
| virtual void | config_value_changed (const char *path, bool is_default, const char *value) |
| Called whenever a string value has changed. | |
| virtual void | config_comment_changed (const char *path, bool is_default, const char *comment) |
| Called whenever a comment has changed. | |
| virtual void | config_value_erased (const char *path, bool is_default) |
| Called whenever a value has been erased from the config. | |
| virtual void | fam_event (const char *filename, unsigned int mask) |
| Event has been raised. | |
| void | load (const char *plugin_list) |
| Load plugin. | |
| void | unload (const char *plugin_name) |
| Unload plugin. | |
| bool | is_loaded (const char *plugin_name) |
| Check if plugin is loaded. | |
| std::list< std::string > | get_loaded_plugins () |
| Get list of loaded plugins. | |
| std::list< std::pair < std::string, std::string > > | get_available_plugins () |
| Generate list of all available plugins. | |
| void | add_listener (PluginManagerListener *listener) |
| Add listener. | |
| void | remove_listener (PluginManagerListener *listener) |
| Remove listener. | |
Detailed Description
Fawkes Plugin Manager.This class provides a manager for the plugins used in fawkes. It can load and unload modules.
Definition at line 52 of file manager.h.
Constructor & Destructor Documentation
| fawkes::PluginManager::PluginManager | ( | ThreadCollector * | thread_collector, | |
| Configuration * | config, | |||
| const char * | meta_plugin_prefix | |||
| ) |
Constructor.
- Parameters:
-
thread_collector thread manager plugin threads will be added to and removed from appropriately. config Fawkes configuration meta_plugin_prefix Path prefix for meta plugins
Definition at line 65 of file manager.cpp.
References fawkes::Configuration::add_change_handler(), and fawkes::LibLogger::log_warn().
| fawkes::PluginManager::~PluginManager | ( | ) |
Destructor.
Definition at line 96 of file manager.cpp.
References fawkes::ThreadCollector::force_remove(), fawkes::LockList< Type >::lock(), fawkes::Configuration::rem_change_handler(), fawkes::PluginLoader::unload(), and fawkes::LockList< Type >::unlock().
Member Function Documentation
| void fawkes::PluginManager::add_listener | ( | PluginManagerListener * | listener | ) |
Add listener.
Listeners are notified of plugin load and unloda events.
- Parameters:
-
listener listener to add
Definition at line 528 of file manager.cpp.
References fawkes::LockList< Type >::lock(), and fawkes::LockList< Type >::unlock().
Referenced by fawkes::PluginNetworkHandler::PluginNetworkHandler().
| void fawkes::PluginManager::config_comment_changed | ( | const char * | path, | |
| bool | is_default, | |||
| const char * | comment | |||
| ) | [virtual] |
Called whenever a comment has changed.
- Parameters:
-
path path of value is_default true if modified comment is of a default value, false otherwise comment new comment
Implements fawkes::ConfigurationChangeHandler.
Definition at line 426 of file manager.cpp.
| void fawkes::PluginManager::config_tag_changed | ( | const char * | new_tag | ) | [virtual] |
Called whenever the tag has changed.
This function can be used to detect when data from another tag has been loaded.
- Parameters:
-
new_tag new tag
Implements fawkes::ConfigurationChangeHandler.
Definition at line 393 of file manager.cpp.
| void fawkes::PluginManager::config_value_changed | ( | const char * | path, | |
| bool | is_default, | |||
| const char * | value | |||
| ) | [virtual] |
Called whenever a string value has changed.
- Parameters:
-
path path of value is_default true if modified value is a default value, false otherwise value new value
Implements fawkes::ConfigurationChangeHandler.
Definition at line 432 of file manager.cpp.
References fawkes::LockList< Type >::lock(), and fawkes::LockList< Type >::unlock().
| void fawkes::PluginManager::config_value_changed | ( | const char * | path, | |
| bool | is_default, | |||
| bool | value | |||
| ) | [virtual] |
Called whenever an boolean value has changed.
- Parameters:
-
path path of value is_default true if modified value is a default value, false otherwise value new value
Implements fawkes::ConfigurationChangeHandler.
Definition at line 419 of file manager.cpp.
References fawkes::LibLogger::log_warn().
| void fawkes::PluginManager::config_value_changed | ( | const char * | path, | |
| bool | is_default, | |||
| float | value | |||
| ) | [virtual] |
Called whenever an float value has changed.
- Parameters:
-
path path of value is_default true if modified value is a default value, false otherwise value new value
Implements fawkes::ConfigurationChangeHandler.
Definition at line 412 of file manager.cpp.
References fawkes::LibLogger::log_warn().
| void fawkes::PluginManager::config_value_changed | ( | const char * | path, | |
| bool | is_default, | |||
| unsigned int | value | |||
| ) | [virtual] |
Called whenever an unsigned int value has changed.
- Parameters:
-
path path of value is_default true if modified value is a default value, false otherwise value new value
Implements fawkes::ConfigurationChangeHandler.
Definition at line 405 of file manager.cpp.
References fawkes::LibLogger::log_warn().
| void fawkes::PluginManager::config_value_changed | ( | const char * | path, | |
| bool | is_default, | |||
| int | value | |||
| ) | [virtual] |
Called whenever an int value has changed.
- Parameters:
-
path path of value is_default true if modified value is a default value, false otherwise value new value
Implements fawkes::ConfigurationChangeHandler.
Definition at line 398 of file manager.cpp.
References fawkes::LibLogger::log_warn().
| void fawkes::PluginManager::config_value_erased | ( | const char * | path, | |
| bool | is_default | |||
| ) | [virtual] |
Called whenever a value has been erased from the config.
- Parameters:
-
path path of value is_default true if erased value was a default value, false otherwise
Implements fawkes::ConfigurationChangeHandler.
Definition at line 453 of file manager.cpp.
References fawkes::LockList< Type >::lock(), and fawkes::LockList< Type >::unlock().
| void fawkes::PluginManager::fam_event | ( | const char * | filename, | |
| unsigned int | mask | |||
| ) | [virtual] |
Event has been raised.
- Parameters:
-
filename name of the file that triggered the event mask mask indicating the event. Currently inotify event flags are used, see inotify.h.
Implements fawkes::FamListener.
Definition at line 469 of file manager.cpp.
References fawkes::FamListener::FAM_CREATE, fawkes::FamListener::FAM_DELETE, fawkes::FamListener::FAM_ISDIR, fawkes::FamListener::FAM_MODIFY, fawkes::FamListener::FAM_MOVED_FROM, fawkes::FamListener::FAM_MOVED_TO, fawkes::PluginLoader::get_description(), fawkes::PluginLoader::is_loaded(), fawkes::LockList< Type >::lock(), fawkes::LibLogger::log_info(), fawkes::LibLogger::log_warn(), and fawkes::LockList< Type >::unlock().
| std::list< std::pair< std::string, std::string > > fawkes::PluginManager::get_available_plugins | ( | ) |
Generate list of all available plugins.
- Returns:
- list of plugins that are available, each plugin is represented by a pair of strings. The first string is the plugin name, the second is its description.
Definition at line 174 of file manager.cpp.
Referenced by WebPluginsRequestProcessor::process_request().
| std::list< std::string > fawkes::PluginManager::get_loaded_plugins | ( | ) |
Get list of loaded plugins.
- Returns:
- list of names of real and meta plugins currently loaded
Definition at line 190 of file manager.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
| bool fawkes::PluginManager::is_loaded | ( | const char * | plugin_name | ) |
Check if plugin is loaded.
- Parameters:
-
plugin_name plugin to check if it is loaded
- Returns:
- true if the plugin is currently loaded, false otherwise
Definition at line 212 of file manager.cpp.
References fawkes::PluginLoader::is_loaded().
Referenced by fawkes::PluginNetworkHandler::loop(), and WebPluginsRequestProcessor::process_request().
| void fawkes::PluginManager::load | ( | const char * | plugin_list | ) |
Load plugin.
The loading is interrupted if any of the plugins does not load properly. The already loaded plugins are *not* unloaded, but kept.
- Parameters:
-
plugin_list string containing a comma-separated list of plugins to load. The plugin list can contain meta plugins.
Definition at line 256 of file manager.cpp.
References fawkes::ThreadCollector::add(), fawkes::Exception::append(), fawkes::Configuration::get_string(), fawkes::PluginLoader::load(), fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), fawkes::LibLogger::log_info(), fawkes::Exception::prepend(), fawkes::Plugin::threads(), fawkes::PluginLoader::unload(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by FawkesMainThread::once(), and WebPluginsRequestProcessor::process_request().
| void fawkes::PluginManager::remove_listener | ( | PluginManagerListener * | listener | ) |
Remove listener.
- Parameters:
-
listener listener to remove
Definition at line 541 of file manager.cpp.
References fawkes::LockList< Type >::remove_locked().
Referenced by fawkes::PluginNetworkHandler::~PluginNetworkHandler().
| void fawkes::PluginManager::unload | ( | const char * | plugin_name | ) |
Unload plugin.
Note that this method does not allow to pass a list of plugins, but it will only accept a single plugin at a time.
- Parameters:
-
plugin_name plugin to unload, can be a meta plugin.
Definition at line 331 of file manager.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), fawkes::LibLogger::log_error(), fawkes::LibLogger::log_info(), fawkes::ThreadCollector::remove(), fawkes::PluginLoader::unload(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by WebPluginsRequestProcessor::process_request().
The documentation for this class was generated from the following files:
- src/libs/plugin/manager.h
- src/libs/plugin/manager.cpp

