summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-18 22:03:02 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-18 22:03:02 +0200
commit7234fe326d16d6bf9f4374a09ddc6ef790e6723f (patch)
tree437d4c40eeb1e9b34b369e4b82064a1572c7dac9 /src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
parentbf561f8226e97f4ace4f04bddf198175e91ee7f0 (diff)
downloadmad-7234fe326d16d6bf9f4374a09ddc6ef790e6723f.tar
mad-7234fe326d16d6bf9f4374a09ddc6ef790e6723f.zip
Globale Variablen durch Application-Klasse ersetzt
Diffstat (limited to 'src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp')
-rw-r--r--src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
index 0e21fdd..344cf4c 100644
--- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
@@ -18,10 +18,11 @@
*/
#include "DaemonRequestHandlerGroup.h"
+#include "../Application.h"
#include "../ConnectionManager.h"
#include "../Requests/CommandRequest.h"
-#include <Core/Logger.h>
+#include <Common/RequestManager.h>
#include <Common/Requests/FSInfoRequest.h>
#include <Common/Requests/StatusRequest.h>
@@ -31,7 +32,7 @@ namespace RequestHandlers {
void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
if(packet->getType() != type) {
- Core::Logger::log(Core::Logger::ERROR, "Received an unexpected packet.");
+ getApplication()->log(Core::LoggerBase::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
ret.setType("Error");
@@ -46,18 +47,18 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared
// TODO Require authentication
try {
- boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection((*packet)["daemon"]);
+ boost::shared_ptr<Common::Connection> daemonCon = dynamic_cast<Application&>(*getApplication()).getConnectionManager()->getDaemonConnection((*packet)["daemon"]);
boost::shared_ptr<Common::Request> request;
if(type == "DaemonCommand")
- request.reset(new Requests::CommandRequest((std::string&)((*packet)["command"]) == "reboot"));
+ request.reset(new Requests::CommandRequest(getApplication(), (std::string&)((*packet)["command"]) == "reboot"));
else if(type == "DaemonFSInfo")
- request.reset(new Common::Requests::FSInfoRequest);
+ request.reset(new Common::Requests::FSInfoRequest(getApplication()));
else // type == "GetDaemonStatus"
- request.reset(new Common::Requests::StatusRequest);
+ request.reset(new Common::Requests::StatusRequest(getApplication()));
request->connectSignalFinished(boost::bind(&DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished, this, _1, _2));
- Common::RequestManager::get()->sendRequest(daemonCon.get(), request);
+ getRequestManager()->sendRequest(daemonCon.get(), request);
}
catch(Core::Exception &e) {
Common::XmlPacket ret;
@@ -97,11 +98,11 @@ DaemonRequestHandlerGroup::DaemonRequestHandlerGroup() {
types.insert("GetDaemonStatus");
}
-boost::shared_ptr<Common::RequestHandler> DaemonRequestHandlerGroup::createRequestHandler(const std::string &type) {
+boost::shared_ptr<Common::RequestHandler> DaemonRequestHandlerGroup::createRequestHandler(Common::Application *application, const std::string &type) {
if(types.find(type) == types.end())
return boost::shared_ptr<Common::RequestHandler>();
else
- return boost::shared_ptr<DaemonRequestHandler>(new DaemonRequestHandler(type));
+ return boost::shared_ptr<DaemonRequestHandler>(new DaemonRequestHandler(application, type));
}
}