summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-08-06 15:49:21 +0200
committerJiri Moskovcak <jmoskovc@redhat.com>2009-08-06 15:49:21 +0200
commit9a3268d970142f0dfb4e3e77c66c9637bf87fbda (patch)
treee5626fd3a9fd086abf3a1790a67bc708b8de94b8
parent53cec748dd575298de6cf3e47afe5736c61bfe21 (diff)
downloadabrt-9a3268d970142f0dfb4e3e77c66c9637bf87fbda.tar.gz
abrt-9a3268d970142f0dfb4e3e77c66c9637bf87fbda.tar.xz
abrt-9a3268d970142f0dfb4e3e77c66c9637bf87fbda.zip
DBUS: added method GetPluginsInfo()
-rw-r--r--lib/CommLayer/CommLayerServerDBus.cpp14
-rw-r--r--lib/CommLayer/CommLayerServerDBus.h1
-rw-r--r--lib/CommLayer/DBusCommon.h2
-rw-r--r--lib/CommLayer/DBusServerProxy.h13
-rw-r--r--lib/CommLayer/Observer.h4
-rw-r--r--src/Daemon/CrashWatcher.cpp16
-rw-r--r--src/Daemon/CrashWatcher.h1
7 files changed, 48 insertions, 3 deletions
diff --git a/lib/CommLayer/CommLayerServerDBus.cpp b/lib/CommLayer/CommLayerServerDBus.cpp
index ad3c2db7..029cc91c 100644
--- a/lib/CommLayer/CommLayerServerDBus.cpp
+++ b/lib/CommLayer/CommLayerServerDBus.cpp
@@ -22,7 +22,11 @@ CCommLayerServerDBus::CCommLayerServerDBus()
}
catch(DBus::Error err)
{
- throw CABRTException(EXCEP_FATAL, "CCommLayerServerDBus::CCommLayerServerDBus(): Error while requesting dbus name - have you reloaded the dbus settings?");
+ throw CABRTException(EXCEP_FATAL, std::string(__func__) +
+ "\nPlease check if:\n"
+ + " * abrt is being run with root permissions\n"
+ + " * you have reloaded the dbus\n"+
+ + "Original exception was:\n " + err.what());
}
}
@@ -103,3 +107,11 @@ void CCommLayerServerDBus::JobDone(const std::string &pDest, uint64_t pJobID)
{
CDBusServer_adaptor::JobDone(pDest, pJobID);
}
+
+vector_map_string_string_t CCommLayerServerDBus::GetPluginsInfo()
+{
+ //FIXME: simplify?
+ vector_map_string_string_t plugins_info;
+ plugins_info = m_pObserver->GetPluginsInfo();
+ return plugins_info;
+}
diff --git a/lib/CommLayer/CommLayerServerDBus.h b/lib/CommLayer/CommLayerServerDBus.h
index df5d93d5..9301a10a 100644
--- a/lib/CommLayer/CommLayerServerDBus.h
+++ b/lib/CommLayer/CommLayerServerDBus.h
@@ -26,6 +26,7 @@ class CCommLayerServerDBus
virtual bool Report(map_crash_report_t pReport,const std::string &pSender);
virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender);
virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pSender);
+ virtual vector_map_string_string_t GetPluginsInfo();
virtual void Crash(const std::string& arg1);
virtual void AnalyzeComplete(map_crash_report_t arg1);
diff --git a/lib/CommLayer/DBusCommon.h b/lib/CommLayer/DBusCommon.h
index 0ea94d3b..cdf30751 100644
--- a/lib/CommLayer/DBusCommon.h
+++ b/lib/CommLayer/DBusCommon.h
@@ -22,3 +22,5 @@
#define CC_DBUS_IFACE "com.redhat.abrt"
#include "CrashTypes.h"
+typedef std::map<std::string, std::string> map_string_string_t;
+typedef std::vector<map_string_string_t> vector_map_string_string_t;
diff --git a/lib/CommLayer/DBusServerProxy.h b/lib/CommLayer/DBusServerProxy.h
index 1b8159b6..157a95f9 100644
--- a/lib/CommLayer/DBusServerProxy.h
+++ b/lib/CommLayer/DBusServerProxy.h
@@ -36,6 +36,7 @@ public:
register_method(CDBusServer_adaptor, Report, _Report_stub);
register_method(CDBusServer_adaptor, DeleteDebugDump, _DeleteDebugDump_stub);
register_method(CDBusServer_adaptor, GetJobResult, _GetJobResult_stub);
+ register_method(CDBusServer_adaptor, GetPluginsInfo, _GetPluginsInfo_stub);
}
/* reveal Interface introspection when we stabilize the API */
/*
@@ -95,7 +96,7 @@ public:
virtual bool Report(map_crash_report_t pReport, const std::string &pDBusSender) = 0;
virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pDBusSender) = 0;
virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pDBusSender) = 0;
-
+ virtual vector_map_string_string_t GetPluginsInfo() = 0;
public:
/* signal emitters for this interface
@@ -216,5 +217,15 @@ private:
wi << report;
return reply;
}
+
+ DBus::Message _GetPluginsInfo_stub(const DBus::CallMessage &call)
+ {
+ vector_map_string_string_t plugins_info;
+ plugins_info = GetPluginsInfo();
+ DBus::ReturnMessage reply(call);
+ DBus::MessageIter wi = reply.writer();
+ wi << plugins_info;
+ return reply;
+ }
};
diff --git a/lib/CommLayer/Observer.h b/lib/CommLayer/Observer.h
index 880a7923..81e7695e 100644
--- a/lib/CommLayer/Observer.h
+++ b/lib/CommLayer/Observer.h
@@ -1,7 +1,8 @@
#ifndef OBSERVER_H_
#define OBSERVER_H_
-#include "CrashTypes.h"
+//FIXME: move all common types to AbrtTypes.h ??
+#include "DBusCommon.h"
#include <string>
#include <stdint.h>
@@ -19,6 +20,7 @@ class CObserver {
virtual bool Report(map_crash_report_t pReport, const std::string &pSender) = 0;
virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender) = 0;
virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string &pSender) = 0;
+ virtual vector_map_string_string_t GetPluginsInfo() = 0;
};
#endif /* OBSERVER_H_ */
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index 1dc99dfa..108db19c 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -870,3 +870,19 @@ map_crash_report_t CCrashWatcher::GetJobResult(uint64_t pJobID, const std::strin
*/
return pending_jobs[pSender][pJobID];
}
+
+vector_map_string_string_t CCrashWatcher::GetPluginsInfo()
+{
+ try
+ {
+ return m_pMW->GetPluginsInfo();
+ }
+ catch(CABRTException &e)
+ {
+ if (e.type() == EXCEP_FATAL)
+ {
+ throw e;
+ }
+ Warning(e.what());
+ }
+}
diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h
index 66ca71f0..71ed014f 100644
--- a/src/Daemon/CrashWatcher.h
+++ b/src/Daemon/CrashWatcher.h
@@ -131,6 +131,7 @@ class CCrashWatcher
virtual bool Report(map_crash_report_t pReport, const std::string &pUID);
virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pUID);
virtual map_crash_report_t GetJobResult(uint64_t pJobID, const std::string& pSender);
+ virtual vector_map_string_string_t GetPluginsInfo();
/* Observer methods */
void Status(const std::string& pMessage,const std::string& pDest="0");