summaryrefslogtreecommitdiffstats
path: root/src/Common/RequestHandlers
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-23 18:54:46 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-23 18:54:46 +0200
commit02b9e16833acbdaa820bd3b8b64d652a41a8ff58 (patch)
tree092b9dd423c6c52812f3978770b87417abe69b9b /src/Common/RequestHandlers
parent37c8bed9a5f2ae9141c461202fec5baa6fa21389 (diff)
downloadmad-02b9e16833acbdaa820bd3b8b64d652a41a8ff58.tar
mad-02b9e16833acbdaa820bd3b8b64d652a41a8ff58.zip
XmlPacket-Klasse ?berarbeitet
Diffstat (limited to 'src/Common/RequestHandlers')
-rw-r--r--src/Common/RequestHandlers/DisconnectRequestHandler.cpp2
-rw-r--r--src/Common/RequestHandlers/FSInfoRequestHandler.cpp17
-rw-r--r--src/Common/RequestHandlers/SimpleRequestHandler.cpp10
-rw-r--r--src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp10
-rw-r--r--src/Common/RequestHandlers/StatusRequestHandler.cpp22
5 files changed, 30 insertions, 31 deletions
diff --git a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp
index 11256b1..234591f 100644
--- a/src/Common/RequestHandlers/DisconnectRequestHandler.cpp
+++ b/src/Common/RequestHandlers/DisconnectRequestHandler.cpp
@@ -30,7 +30,7 @@ void DisconnectRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> p
XmlPacket ret;
ret.setType("Error");
- ret.add("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
+ ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
sendPacket(ret);
diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp
index c036f7b..c381ab1 100644
--- a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp
+++ b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp
@@ -31,17 +31,16 @@ void FSInfoRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPack
getApplication()->getSystemManager()->getFSInfo(&fsInfo);
ret->setType("OK");
- ret->addList("filesystems");
+ XmlPacket::List *list = ret->createList("filesystems");
for(std::vector<SystemManager::FSInfo>::const_iterator fs = fsInfo.begin(); fs != fsInfo.end(); ++fs) {
- (*ret)["filesystems"].addEntry();
- XmlPacket::Entry &entry = (*ret)["filesystems"].back();
-
- entry.add("name", fs->fsName);
- entry.add("mountedOn", fs->mountedOn);
- entry.add("totalSize", fs->total);
- entry.add("usedSize", fs->used);
- entry.add("availableSize", fs->available);
+ XmlPacket::List::iterator entry = list->addEntry();
+
+ entry->set("name", fs->fsName);
+ entry->set("mountedOn", fs->mountedOn);
+ entry->set("totalSize", fs->total);
+ entry->set("usedSize", fs->used);
+ entry->set("availableSize", fs->available);
}
}
diff --git a/src/Common/RequestHandlers/SimpleRequestHandler.cpp b/src/Common/RequestHandlers/SimpleRequestHandler.cpp
index b6a22bf..bf72a80 100644
--- a/src/Common/RequestHandlers/SimpleRequestHandler.cpp
+++ b/src/Common/RequestHandlers/SimpleRequestHandler.cpp
@@ -31,7 +31,7 @@ void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packe
XmlPacket ret;
ret.setType("Error");
- ret.add("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
+ ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
sendPacket(ret);
@@ -48,10 +48,10 @@ void SimpleRequestHandler::handlePacket(boost::shared_ptr<const XmlPacket> packe
}
catch(Core::Exception e) {
ret.setType("Error");
- ret.add("ErrorCode", e.getErrorCode());
- ret.add("SubCode", e.getSubCode());
- ret.add("SubSubCode", e.getSubSubCode());
- ret.add("Where", e.getWhere());
+ ret.set("ErrorCode", e.getErrorCode());
+ ret.set("SubCode", e.getSubCode());
+ ret.set("SubSubCode", e.getSubSubCode());
+ ret.set("Where", e.getWhere());
}
sendPacket(ret);
diff --git a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp
index 845021d..6546ce5 100644
--- a/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp
+++ b/src/Common/RequestHandlers/SimpleRequestHandlerGroup.cpp
@@ -32,7 +32,7 @@ void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_
XmlPacket ret;
ret.setType("Error");
- ret.add("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
+ ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
sendPacket(ret);
@@ -49,10 +49,10 @@ void SimpleRequestHandlerGroup::GroupRequestHandler::handlePacket(boost::shared_
}
catch(Core::Exception e) {
ret.setType("Error");
- ret.add("ErrorCode", e.getErrorCode());
- ret.add("SubCode", e.getSubCode());
- ret.add("SubSubCode", e.getSubSubCode());
- ret.add("Where", e.getWhere());
+ ret.set("ErrorCode", e.getErrorCode());
+ ret.set("SubCode", e.getSubCode());
+ ret.set("SubSubCode", e.getSubSubCode());
+ ret.set("Where", e.getWhere());
}
sendPacket(ret);
diff --git a/src/Common/RequestHandlers/StatusRequestHandler.cpp b/src/Common/RequestHandlers/StatusRequestHandler.cpp
index 50dbe11..d6cdc1e 100644
--- a/src/Common/RequestHandlers/StatusRequestHandler.cpp
+++ b/src/Common/RequestHandlers/StatusRequestHandler.cpp
@@ -34,8 +34,8 @@ void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPack
getApplication()->getSystemManager()->getUptimeInfo(&uptime, &idleTime);
- ret->add("uptime", uptime);
- ret->add("idleTime", idleTime);
+ ret->set("uptime", uptime);
+ ret->set("idleTime", idleTime);
}
catch(Core::Exception e) {}
@@ -44,10 +44,10 @@ void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPack
getApplication()->getSystemManager()->getMemoryInfo(&totalMem, &freeMem, &totalSwap, &freeSwap);
- ret->add("totalMem", totalMem);
- ret->add("freeMem", freeMem);
- ret->add("totalSwap", totalSwap);
- ret->add("freeSwap", freeSwap);
+ ret->set("totalMem", totalMem);
+ ret->set("freeMem", freeMem);
+ ret->set("totalSwap", totalSwap);
+ ret->set("freeSwap", freeSwap);
}
catch(Core::Exception e) {}
@@ -57,11 +57,11 @@ void StatusRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPack
getApplication()->getSystemManager()->getLoadInfo(&currentLoad, &nProcesses, &loadAvg1, &loadAvg5, &loadAvg15);
- ret->add("currentLoad", currentLoad);
- ret->add("nProcesses", nProcesses);
- ret->add("loadAvg1", loadAvg1);
- ret->add("loadAvg5", loadAvg5);
- ret->add("loadAvg15", loadAvg15);
+ ret->set("currentLoad", currentLoad);
+ ret->set("nProcesses", nProcesses);
+ ret->set("loadAvg1", loadAvg1);
+ ret->set("loadAvg5", loadAvg5);
+ ret->set("loadAvg15", loadAvg15);
}
catch(Core::Exception e) {}
}