28 #include "../core/filesystem/FileSystem.h" 29 #include "../core/translator/Translator.h" 30 #include "../xml/Reader.h" 31 #include "../xml/ReaderFactory.h" 38 #include <boost/filesystem.hpp> 39 #include <boost/format.hpp> 43 std::vector<std::string> plugins = PluginManager::getInstance().getPlugins();
45 std::vector<std::string>::reverse_iterator it = plugins.rbegin();
46 std::vector<std::string>::reverse_iterator itend = plugins.rend();
51 if(!PluginManager::getInstance().isLoaded(*it))
58 const PluginInfo& plugin = PluginManager::getInstance().getPlugin(*it);
70 std::vector<std::string> pdependents = PluginManager::getInstance().getDependents(plugin);
72 for(std::size_t i = 0; i < pdependents.size(); ++i)
75 if(!PluginManager::getInstance().isLoaded(plugin))
78 PluginManager::getInstance().unload(plugin);
83 boost::filesystem::path pluginFileName(pluginFilePath);
91 throw Exception((boost::format(
TE_TR(
"The informed plugin file is not valid: %1%.")) % pluginFileName).str());
95 xmlReader->read(pluginFileName.string());
97 if(!xmlReader->next())
103 if(xmlReader->getElementLocalName() !=
"PluginInfo")
104 throw Exception(
TE_TR(
"The first tag in the document is not 'PluginInfo'!"));
106 std::auto_ptr<PluginInfo> pInfo(
new PluginInfo);
107 *pInfo << *xmlReader;
109 return pInfo.release();
Base exception class for 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.
std::string m_engine
The type of plugin execution engine: C++, JAVA.
TEPLUGINEXPORT void UnloadAllPluginsFromEngine(const std::string &engine)
It unloads all plugins from a given engine.
The basic information about a plugin.
static bool isRegularFile(const std::string &path)
Checks if a given path in UTF-8 is a regular file.
TEPLUGINEXPORT PluginInfo * GetInstalledPlugin(const std::string &pluginFilePath)
It returns information about a given plugin provided its plugin configuration file name or dir...