27 #include "../common/Translator.h"
28 #include "../xml/Reader.h"
29 #include "../xml/ReaderFactory.h"
37 #include <boost/filesystem.hpp>
38 #include <boost/format.hpp>
42 std::vector<std::string> plugins = PluginManager::getInstance().getPlugins();
44 std::vector<std::string>::reverse_iterator it = plugins.rbegin();
45 std::vector<std::string>::reverse_iterator itend = plugins.rend();
50 if(!PluginManager::getInstance().isLoaded(*it))
57 const PluginInfo& plugin = PluginManager::getInstance().getPlugin(*it);
69 std::vector<std::string> pdependents = PluginManager::getInstance().getDependents(plugin);
71 for(std::size_t i = 0; i < pdependents.size(); ++i)
74 if(!PluginManager::getInstance().isLoaded(plugin))
77 PluginManager::getInstance().unload(plugin);
82 boost::filesystem::path pluginFileName(pluginFilePath);
89 if(!boost::filesystem::is_regular_file(pluginFileName))
90 throw Exception((boost::format(
TE_TR(
"The informed plugin file is not valid: %1%.")) % pluginFileName).str());
94 xmlReader->read(pluginFileName.string());
96 if(!xmlReader->next())
97 throw Exception(
TE_TR(
"Could not read plugin information!"));
100 throw Exception(
TE_TR(
"The document has problems!"));
102 if(xmlReader->getElementLocalName() !=
"PluginInfo")
103 throw Exception(
TE_TR(
"The first tag in the document is not 'PluginInfo'!"));
105 std::auto_ptr<PluginInfo> pInfo(
new PluginInfo);
106 *pInfo << *xmlReader;
108 return pInfo.release();
An exception class for the Plugin module.
static te::xml::Reader * make()
It creates a new XML reader using the dafault implementation.
#define TE_TR(message)
It marks a string in order to get translated.
TEPLUGINEXPORT void Unload(const std::string &plugin)
It recursively unload the plugin and any dependent plugins.
An abstract class for TerraLib Plugins.
std::string m_engine
The type of plugin execution engine: C++, JAVA.
Utility functions for dealing with plugins.
TEPLUGINEXPORT void UnloadAllPluginsFromEngine(const std::string &engine)
It unloads all plugins from a given engine.
A singleton for managing plugins.
The basic information about a plugin.
The basic information about a plugin.
TEPLUGINEXPORT PluginInfo * GetInstalledPlugin(const std::string &pluginFilePath)
It returns information about a given plugin provided its plugin configuration file name or dir...