A singleton for managing plugins. More...
#include <PluginManager.h>
Classes | |
| struct | Impl |
Public Member Functions | |
| void | clear () |
| Stop and unload all plugins, then clear the internal list of plugins. More... | |
| bool | exists (const std::string &plugin_name) const |
| Tells if a given plugin is registered or not. More... | |
| std::vector< PluginInfo > | getBrokenPlugins () const |
| Return the list of plugins that could not be loaded. More... | |
| std::vector< std::string > | getDependents (const std::string plugin_name) |
| Return the list of plugins that depends of a given plugin. More... | |
| std::vector< PluginInfo > | getLoadedPlugins () const |
| Return the list of plugins that are loaded. More... | |
| const PluginInfo & | getPluginInfo (const std::string &name) const |
| Return information about a plugin identified by the given name. More... | |
| std::vector< std::string > | getPlugins () const |
| Return the list of plugins managed by PluginManager. More... | |
| std::vector< PluginInfo > | getUnloadedPlugins () const |
| Return the list of plugins that were not loaded. More... | |
| void | insert (const PluginInfo &pinfo) |
| Adds plugin with its plugin information to the list of unloaded plugins. More... | |
| bool | isBroken (const std::string &plugin_name) const |
| Returns true if the plugin is in the broken list of plugins. More... | |
| bool | isFixed (const std::string &plugin_name) |
| Returns true if the plugin has been fixed and moves it to the unloaded list otherwise returns false. More... | |
| bool | isLoaded (const std::string &plugin_name) const |
| Returns true if the plugin is loaded otherwise returns false. More... | |
| bool | isUnloaded (const std::string &plugin_name) const |
| Returns true if the plugin is in the not-loaded list of plugins. More... | |
| void | load (const std::string &plugin_name, const bool start=true) |
| It tries to load the informed plugin. More... | |
| void | recursiveUnload (const std::string &plugin_name) |
| Try to unload a given plugin and its dependents recursively. More... | |
| void | remove (const std::string &plugin_name) |
| Remove plugin from the manager. More... | |
| void | start (const std::string &plugin_name) |
| Start a loaded plugin. More... | |
| void | stop (const std::string &plugin_name) |
| Stop a loaded plugin. More... | |
| void | unload (const std::string &plugin_name) |
| Try to unload a given plugin. More... | |
Static Public Member Functions | |
| static PluginManager & | instance () |
| Access the singleton. More... | |
Private Member Functions | |
| PluginManager & | operator= (const PluginManager &) |
| PluginManager () | |
| Constructor. More... | |
| PluginManager (const PluginManager &) | |
| ~PluginManager () | |
| Destructor. More... | |
Private Attributes | |
| Impl * | m_pimpl |
A singleton for managing plugins.
Definition at line 48 of file src/terralib/core/plugin/PluginManager.h.
|
private |
Constructor.
Definition at line 582 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl.
|
private |
Destructor.
Definition at line 587 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl.
|
private |
| void te::core::PluginManager::clear | ( | ) |
Stop and unload all plugins, then clear the internal list of plugins.
Definition at line 561 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, te::core::PluginManager::Impl::dependency_map, getLoadedPlugins(), m_pimpl, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by BOOST_AUTO_TEST_CASE(), Finalize(), te::qt::af::ApplicationController::finalizePlugins(), te::core::plugin::LoadAll(), main(), and WithPluginManager().
| bool te::core::PluginManager::exists | ( | const std::string & | plugin_name | ) | const |
Tells if a given plugin is registered or not.
Definition at line 206 of file src/terralib/core/plugin/PluginManager.cpp.
References isBroken(), isLoaded(), and isUnloaded().
| std::vector< te::core::PluginInfo > te::core::PluginManager::getBrokenPlugins | ( | ) | const |
Return the list of plugins that could not be loaded.
Definition at line 134 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, and m_pimpl.
Referenced by te::qt::widgets::PluginManagerDialog::fillInstalledPlugins(), te::qt::widgets::PluginManagerDialog::updateBroken(), and te::qt::af::UpdateUserSettings().
| std::vector< std::string > te::core::PluginManager::getDependents | ( | const std::string | plugin_name | ) |
Return the list of plugins that depends of a given plugin.
| plugin_name | Name of the plugin to be search. |
| OutOfRangeException | if the plugin is not found. |
Definition at line 139 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::dependency_map, m_pimpl, and TE_TR.
Referenced by GetDependents(), and recursiveUnload().
| std::vector< te::core::PluginInfo > te::core::PluginManager::getLoadedPlugins | ( | ) | const |
Return the list of plugins that are loaded.
Definition at line 116 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl, p, and te::core::PluginManager::Impl::plugins.
Referenced by BOOST_AUTO_TEST_CASE(), clear(), te::qt::widgets::PluginManagerDialog::fillInstalledPlugins(), te::core::plugin::UnloadAll(), te::qt::af::UpdateUserSettings(), and WithPluginManager().
| const te::core::PluginInfo & te::core::PluginManager::getPluginInfo | ( | const std::string & | name | ) | const |
Return information about a plugin identified by the given name.
| name | The plugin name. |
| te::OutOfRangeException | It throws an exception if there isn't a plugin with the given name in the manager. |
Definition at line 88 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, m_pimpl, te::core::PluginInfo::name, p, te::core::PluginManager::Impl::plugins, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by recursiveUnload(), and te::core::plugin::UnloadPlugin().
| std::vector< std::string > te::core::PluginManager::getPlugins | ( | ) | const |
Return the list of plugins managed by PluginManager.
| plugins | A vector to output the name of plugins managed by this singleton. |
Definition at line 63 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, m_pimpl, te::core::PluginInfo::name, p, te::core::PluginManager::Impl::plugins, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by te::qt::widgets::PluginBuilderWizard::PluginBuilderWizard(), and te::qt::af::InternalSettingsDialog::setPlugins().
| std::vector< te::core::PluginInfo > te::core::PluginManager::getUnloadedPlugins | ( | ) | const |
Return the list of plugins that were not loaded.
Definition at line 128 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by te::qt::widgets::PluginManagerDialog::fillInstalledPlugins(), and te::qt::af::UpdateUserSettings().
| void te::core::PluginManager::insert | ( | const PluginInfo & | pinfo | ) |
Adds plugin with its plugin information to the list of unloaded plugins.
| plugin_already_registered_error | Throw an exception if a plugin with the same name already exists and it is registered in the manager. |
Definition at line 212 of file src/terralib/core/plugin/PluginManager.cpp.
References isBroken(), isLoaded(), isUnloaded(), m_pimpl, te::core::PluginInfo::name, TE_TR, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by BOOST_AUTO_TEST_CASE(), CreateDataSource(), te::qt::af::ApplicationController::initializePlugins(), te::core::plugin::LoadAll(), LoadDrivers(), LoadGDALModule(), LoadModule(), LoadModules(), LoadOGRModule(), main(), te::qt::widgets::PluginManagerDialog::onAddPushButtonClicked(), and WithPluginManager().
|
static |
Access the singleton.
Definition at line 575 of file src/terralib/core/plugin/PluginManager.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), CreateDataSource(), te::qt::widgets::PluginManagerDialog::fillInstalledPlugins(), Finalize(), te::qt::af::ApplicationController::finalizePlugins(), GetDependents(), te::qt::widgets::PluginManagerDialog::getPluginStatus(), te::qt::af::ApplicationController::initializePlugins(), te::core::plugin::LoadAll(), LoadDrivers(), LoadGDALModule(), LoadModule(), LoadModules(), LoadOGRModule(), te::qt::widgets::PluginManagerDialog::loadPlugins(), main(), te::qt::widgets::PluginManagerDialog::onAddPushButtonClicked(), te::qt::widgets::PluginManagerDialog::onApplyPushButtonClicked(), te::qt::widgets::PluginBuilderWizard::PluginBuilderWizard(), te::qt::widgets::PluginManagerDialog::removeEntries(), te::qt::af::InternalSettingsDialog::setPlugins(), te::core::plugin::UnloadAll(), te::core::plugin::UnloadPlugin(), te::qt::widgets::PluginManagerDialog::unloadPlugins(), te::qt::widgets::PluginManagerDialog::updateBroken(), te::qt::af::UpdateUserSettings(), and WithPluginManager().
| bool te::core::PluginManager::isBroken | ( | const std::string & | plugin_name | ) | const |
Returns true if the plugin is in the broken list of plugins.
Definition at line 153 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, m_pimpl, and p.
Referenced by exists(), insert(), isFixed(), load(), and remove().
| bool te::core::PluginManager::isFixed | ( | const std::string & | plugin_name | ) |
Returns true if the plugin has been fixed and moves it to the unloaded list otherwise returns false.
Definition at line 178 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, te::core::PluginInfo::dependencies, isBroken(), isLoaded(), m_pimpl, and te::core::PluginManager::Impl::move_from_broken_to_unloaded_list().
| bool te::core::PluginManager::isLoaded | ( | const std::string & | plugin_name | ) | const |
Returns true if the plugin is loaded otherwise returns false.
Definition at line 171 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl, p, and te::core::PluginManager::Impl::plugins.
Referenced by exists(), te::qt::widgets::PluginManagerDialog::getPluginStatus(), insert(), isFixed(), load(), and remove().
| bool te::core::PluginManager::isUnloaded | ( | const std::string & | plugin_name | ) | const |
Returns true if the plugin is in the not-loaded list of plugins.
Definition at line 162 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl, p, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by exists(), te::qt::widgets::PluginManagerDialog::getPluginStatus(), insert(), load(), recursiveUnload(), and remove().
| void te::core::PluginManager::load | ( | const std::string & | plugin_name, |
| const bool | start = true |
||
| ) |
It tries to load the informed plugin.
The manager will check the plugin's dependencies before trying to load it.
This method can be used to retry loading a broken plugin.
| plugin_name | The plugin to be loaded |
| start | If true it will try to startup the plugin if false it doesn't automatically call plugin startup method. |
| te::plugin::exception | It throws an exception if any plugin can not be loaded or started. |
Definition at line 291 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, d, te::core::PluginInfo::dependencies, te::core::PluginManager::Impl::dependency_map, te::core::PluginInfo::engine, te::core::PluginEngineManager::get(), te::core::PluginEngineManager::instance(), isBroken(), isLoaded(), isUnloaded(), te::core::AbstractPluginEngine::load(), m_pimpl, te::core::PluginManager::Impl::move_from_unload_to_broken_list(), te::core::PluginInfo::name, te::core::PluginManager::Impl::plugins, TE_LOG_TRACE, TE_TR, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by BOOST_AUTO_TEST_CASE(), CreateDataSource(), te::qt::af::ApplicationController::initializePlugins(), te::core::plugin::LoadAll(), LoadDrivers(), LoadGDALModule(), LoadModule(), LoadModules(), LoadOGRModule(), te::qt::widgets::PluginManagerDialog::loadPlugins(), main(), and WithPluginManager().
|
private |
| void te::core::PluginManager::recursiveUnload | ( | const std::string & | plugin_name | ) |
Try to unload a given plugin and its dependents recursively.
This method will call plugin's shutdown method if needed.
| plugin_name | The plugin to be unloaded. |
Definition at line 547 of file src/terralib/core/plugin/PluginManager.cpp.
References getDependents(), getPluginInfo(), isUnloaded(), stop(), and unload().
Referenced by te::qt::widgets::PluginManagerDialog::unloadPlugins().
| void te::core::PluginManager::remove | ( | const std::string & | plugin_name | ) |
Remove plugin from the manager.
This method removes the plugin from the manager. If the plugin was loaded, unload it and remove it from the manager. If it was unloaded or broked, just removes it from the correct list. Note that all its dependents will be moved to the broken list.
| plugin_name | Name of the plugin to be removed. |
| te::InvalidArgumentException | If the plugin can not be removed an exception is raised. |
Definition at line 247 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::broken_plugins, isBroken(), isLoaded(), isUnloaded(), m_pimpl, stop(), TE_TR, unload(), and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by te::qt::widgets::PluginManagerDialog::removeEntries().
| void te::core::PluginManager::start | ( | const std::string & | plugin_name | ) |
Start a loaded plugin.
| te::core::PluginStartupException | It throws an exception if any plugin can not be started. |
Definition at line 453 of file src/terralib/core/plugin/PluginManager.cpp.
References m_pimpl, p, te::core::PluginManager::Impl::plugins, TE_LOG_TRACE, and TE_TR.
| void te::core::PluginManager::stop | ( | const std::string & | plugin_name | ) |
Stop a loaded plugin.
| te::core::PluginShutdownException | throws an exception if any plugin can not be stoped. |
Definition at line 472 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::dependency_map, m_pimpl, p, te::core::PluginManager::Impl::plugins, TE_LOG_TRACE, and TE_TR.
Referenced by recursiveUnload(), remove(), te::core::plugin::UnloadAll(), te::core::plugin::UnloadPlugin(), te::qt::widgets::PluginManagerDialog::unloadPlugins(), and WithPluginManager().
| void te::core::PluginManager::unload | ( | const std::string & | plugin_name | ) |
Try to unload a given plugin.
| plugin_name | The plugin to be unloaded. |
| PluginUnloadException | It will raise an exception if plugin's code is not unloaded, if it is started or if the plugin's is not managed by PluginManager. |
Definition at line 507 of file src/terralib/core/plugin/PluginManager.cpp.
References te::core::PluginManager::Impl::dependency_map, m_pimpl, te::core::PluginManager::Impl::plugins, TE_LOG_TRACE, TE_TR, and te::core::PluginManager::Impl::unloaded_plugins.
Referenced by recursiveUnload(), remove(), te::core::plugin::UnloadAll(), te::core::plugin::UnloadPlugin(), te::qt::widgets::PluginManagerDialog::unloadPlugins(), and WithPluginManager().
|
private |
Definition at line 227 of file src/terralib/core/plugin/PluginManager.h.
Referenced by clear(), getBrokenPlugins(), getDependents(), getLoadedPlugins(), getPluginInfo(), getPlugins(), getUnloadedPlugins(), insert(), isBroken(), isFixed(), isLoaded(), isUnloaded(), load(), PluginManager(), remove(), start(), stop(), unload(), and ~PluginManager().