From 7234fe326d16d6bf9f4374a09ddc6ef790e6723f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 18 Jun 2009 22:03:02 +0200 Subject: Globale Variablen durch Application-Klasse ersetzt --- .../RequestHandlers/DaemonRequestHandlerGroup.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp') 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 +#include #include #include @@ -31,7 +32,7 @@ namespace RequestHandlers { void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared_ptr 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 daemonCon = ConnectionManager::get()->getDaemonConnection((*packet)["daemon"]); + boost::shared_ptr daemonCon = dynamic_cast(*getApplication()).getConnectionManager()->getDaemonConnection((*packet)["daemon"]); boost::shared_ptr 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 DaemonRequestHandlerGroup::createRequestHandler(const std::string &type) { +boost::shared_ptr DaemonRequestHandlerGroup::createRequestHandler(Common::Application *application, const std::string &type) { if(types.find(type) == types.end()) return boost::shared_ptr(); else - return boost::shared_ptr(new DaemonRequestHandler(type)); + return boost::shared_ptr(new DaemonRequestHandler(application, type)); } } -- cgit v1.2.3