summaryrefslogtreecommitdiffstats
path: root/lib/MiddleWare
diff options
context:
space:
mode:
authorZdenek Prikryl <zprikryl@redhat.com>2009-07-31 13:12:48 +0200
committerZdenek Prikryl <zprikryl@redhat.com>2009-07-31 13:12:48 +0200
commit919f52da59965f2493ca94ffb5bd11c7ef6835f9 (patch)
treec39326017e53795e708af156c602747253c7a6e3 /lib/MiddleWare
parentf246abe47b3a4920516fef3f160b688a28bafd80 (diff)
downloadabrt-919f52da59965f2493ca94ffb5bd11c7ef6835f9.tar.gz
abrt-919f52da59965f2493ca94ffb5bd11c7ef6835f9.tar.xz
abrt-919f52da59965f2493ca94ffb5bd11c7ef6835f9.zip
New iface for getting plugins' infos
Diffstat (limited to 'lib/MiddleWare')
-rw-r--r--lib/MiddleWare/MiddleWare.cpp4
-rw-r--r--lib/MiddleWare/MiddleWare.h10
-rw-r--r--lib/MiddleWare/MiddleWareTypes.h1
-rw-r--r--lib/MiddleWare/PluginManager.cpp25
-rw-r--r--lib/MiddleWare/PluginManager.h10
-rw-r--r--lib/MiddleWare/test.cpp15
6 files changed, 42 insertions, 23 deletions
diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp
index 34b4391e..91777556 100644
--- a/lib/MiddleWare/MiddleWare.cpp
+++ b/lib/MiddleWare/MiddleWare.cpp
@@ -566,9 +566,9 @@ vector_pair_string_string_t CMiddleWare::GetUUIDsOfCrash(const std::string& pUID
return UUIDsUIDs;
}
-map_string_string_t CMiddleWare::GetPluginInfo(const std::string& pName)
+vector_map_string_string_t CMiddleWare::GetPluginsInfo()
{
- return m_pPluginManager->GetPluginInfo(pName);
+ return m_pPluginManager->GetPluginsInfo();
}
void CMiddleWare::SetOpenGPGCheck(const bool& pCheck)
diff --git a/lib/MiddleWare/MiddleWare.h b/lib/MiddleWare/MiddleWare.h
index 625e037e..2144bbaf 100644
--- a/lib/MiddleWare/MiddleWare.h
+++ b/lib/MiddleWare/MiddleWare.h
@@ -288,12 +288,12 @@ class CMiddleWare
*/
vector_pair_string_string_t GetUUIDsOfCrash(const std::string& pUID);
/**
- * A method, which gets all needed plugin info. It can be send via DBus
- * to GUI and displayed to an user.
- * @param pName A Name of plugin.
- * @return A map <key, vaule>
+ * A method, which gets all plugins info (event those plugins which are
+ * disabled). It can be send via DBus to GUI and displayed to an user.
+ * Then a user can fill all needed informations like URLs etc.
+ * @return A vector of maps <key, vaule>
*/
- map_string_string_t GetPluginInfo(const std::string& pName);
+ vector_map_string_string_t GetPluginsInfo();
/**
* A method, which set a GPG finger print check.
* @param pCheck Is it enabled?
diff --git a/lib/MiddleWare/MiddleWareTypes.h b/lib/MiddleWare/MiddleWareTypes.h
index 12e10315..a79b12b4 100644
--- a/lib/MiddleWare/MiddleWareTypes.h
+++ b/lib/MiddleWare/MiddleWareTypes.h
@@ -10,6 +10,7 @@ typedef std::vector<std::string> vector_strings_t;
typedef std::pair<std::string, std::string> pair_string_string_t;
typedef std::vector<pair_string_string_t> vector_pair_string_string_t;
typedef std::map<std::string, std::string> map_string_string_t;
+typedef std::vector<map_string_string_t> vector_map_string_string_t;
typedef std::set<std::string> set_strings_t;
#endif /* MIDDLEWARETYPES_H_ */
diff --git a/lib/MiddleWare/PluginManager.cpp b/lib/MiddleWare/PluginManager.cpp
index 9f8857a8..916eabe9 100644
--- a/lib/MiddleWare/PluginManager.cpp
+++ b/lib/MiddleWare/PluginManager.cpp
@@ -226,18 +226,23 @@ plugin_type_t CPluginManager::GetPluginType(const std::string& pName)
return m_mapABRTPlugins[pName]->GetType();
}
-map_string_string_t CPluginManager::GetPluginInfo(const std::string& pName)
+vector_map_string_string_t CPluginManager::GetPluginsInfo()
{
- map_string_string_t ret;
- if (m_mapABRTPlugins.find(pName) != m_mapABRTPlugins.end())
+ vector_map_string_string_t ret;
+ map_abrt_plugins_t::iterator it_abrt_plugin;
+ for (it_abrt_plugin = m_mapABRTPlugins.begin(); it_abrt_plugin != m_mapABRTPlugins.end(); it_abrt_plugin++)
{
- ret["Type"] = plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()];
- ret["Name"] = m_mapABRTPlugins[pName]->GetName();
- ret["Version"] = m_mapABRTPlugins[pName]->GetVersion();
- ret["Description"] = m_mapABRTPlugins[pName]->GetDescription();
- ret["Email"] = m_mapABRTPlugins[pName]->GetEmail();
- ret["WWW"] = m_mapABRTPlugins[pName]->GetWWW();
- ret["GTKBuilder"] = m_mapABRTPlugins[pName]->GetGTKBuilder();
+ map_string_string_t plugin_info;
+
+ plugin_info["Type"] = plugin_type_str_t[it_abrt_plugin->second->GetType()];
+ plugin_info["Name"] = it_abrt_plugin->second->GetName();
+ plugin_info["Version"] = it_abrt_plugin->second->GetVersion();
+ plugin_info["Description"] = it_abrt_plugin->second->GetDescription();
+ plugin_info["Email"] = it_abrt_plugin->second->GetEmail();
+ plugin_info["WWW"] = it_abrt_plugin->second->GetWWW();
+ plugin_info["GTKBuilder"] = it_abrt_plugin->second->GetGTKBuilder();
+ ret.push_back(plugin_info);
+
}
return ret;
}
diff --git a/lib/MiddleWare/PluginManager.h b/lib/MiddleWare/PluginManager.h
index 574c9ff7..4883a107 100644
--- a/lib/MiddleWare/PluginManager.h
+++ b/lib/MiddleWare/PluginManager.h
@@ -132,12 +132,12 @@ class CPluginManager
*/
plugin_type_t GetPluginType(const std::string& pName);
/**
- * A method, which gets all needed plugin info. It can be send via DBus
- * to GUI and displayed to an user.
- * @param pName A Name of plugin.
- * @return A map <key, vaule>
+ * A method, which gets all plugins info (event those plugins which are
+ * disabled). It can be send via DBus to GUI and displayed to an user.
+ * Then a user can fill all needed informations like URLs etc.
+ * @return A vector of maps <key, vaule>
*/
- map_string_string_t GetPluginInfo(const std::string& pName);
+ vector_map_string_string_t GetPluginsInfo();
};
#endif /*PLUGINMANAGER_H_*/
diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp
index 94ea5cc4..5a3519cc 100644
--- a/lib/MiddleWare/test.cpp
+++ b/lib/MiddleWare/test.cpp
@@ -40,6 +40,7 @@ int main(int argc, char** argv)
{
CMiddleWare middleWare(PLUGINS_CONF_DIR,
PLUGINS_LIB_DIR);
+ vector_map_string_string_t loaded_plugins;
middleWare.RegisterPlugin("CCpp");
middleWare.RegisterPlugin("Mailx");
middleWare.RegisterPlugin("Logger");
@@ -51,7 +52,19 @@ int main(int argc, char** argv)
middleWare.AddAnalyzerActionOrReporter("CCpp", "Mailx", "");
middleWare.AddAnalyzerActionOrReporter("CCpp", "RunApp", "date");
- std::cout << "Mailx GTKBuilder path: " << middleWare.GetPluginInfo("Mailx")["GTKBuilder"];
+ loaded_plugins = middleWare.GetPluginsInfo();
+ std::cout << "Loaded plugins" << std::endl;
+ int ii;
+ for ( ii = 0; ii < loaded_plugins.size(); ii++)
+ {
+ std::cout << "Type: " << loaded_plugins[ii]["Type"] << std::endl;
+ std::cout << "Name: " << loaded_plugins[ii]["Name"] << std::endl;
+ std::cout << "Version: " << loaded_plugins[ii]["Version"] << std::endl;
+ std::cout << "Description: " << loaded_plugins[ii]["Description"] << std::endl;
+ std::cout << "Email: " << loaded_plugins[ii]["Email"] << std::endl;
+ std::cout << "WWW: " << loaded_plugins[ii]["WWW"] << std::endl;
+ std::cout << "GTKBuilder: " << loaded_plugins[ii]["GTKBuilder"] << std::endl;
+ }
/* Try to save it into DB */
map_crash_info_t crashInfo;
if (middleWare.SaveDebugDump(argv[1], crashInfo))