summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
diff options
context:
space:
mode:
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));
}
}