summaryrefslogtreecommitdiffstats
path: root/src/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server')
-rw-r--r--src/Server/ConnectionManager.cpp22
-rw-r--r--src/Server/ConnectionManager.h16
-rw-r--r--src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp26
-rw-r--r--src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp10
-rw-r--r--src/Server/RequestHandlers/DaemonRequestHandlerGroup.h10
-rw-r--r--src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp8
-rw-r--r--src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h2
-rw-r--r--src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp24
-rw-r--r--src/Server/RequestHandlers/UserListUploadRequestHandler.cpp8
-rw-r--r--src/Server/RequestHandlers/UserListUploadRequestHandler.h2
-rw-r--r--src/Server/RequestHandlers/UserRequestHandlerGroup.cpp80
-rw-r--r--src/Server/Requests/DaemonStateUpdateRequest.h4
-rw-r--r--src/Server/UserListManager.cpp28
-rw-r--r--src/Server/UserListManager.h33
14 files changed, 137 insertions, 136 deletions
diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp
index 5836b32..f09f9e3 100644
--- a/src/Server/ConnectionManager.cpp
+++ b/src/Server/ConnectionManager.cpp
@@ -57,8 +57,8 @@ bool ConnectionManager::ServerConnection::disconnect() {
return true;
}
-boost::shared_ptr<const Common::AuthContext> ConnectionManager::ServerConnection::authenticate(const std::string &method,
- const std::string &subMethod, const std::string &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response) {
+boost::shared_ptr<const Common::AuthContext> ConnectionManager::ServerConnection::authenticate(const Core::String &method,
+ const Core::String &subMethod, const Core::String &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response) {
if(!isIdentified())
type = CLIENT;
@@ -151,12 +151,12 @@ bool ConnectionManager::handleConfigEntry(const Core::ConfigEntry &entry, bool h
else if(entry[0].getKey().matches("Daemon")) {
if(entry[0].getSize() == 1) {
if(entry[1].isEmpty()) {
- daemonInfo.insert(std::make_pair(entry[0][0].extract(), Common::HostInfo(entry[0][0].extract())));
+ daemonInfo.insert(std::make_pair(entry[0][0], Common::HostInfo(entry[0][0])));
return true;
}
else if(entry[1].getKey().matches("IpAddress") && entry[2].isEmpty()) {
- daemonInfo[entry[0][0].extract()].setIP(entry[1][0].extract());
+ daemonInfo[entry[0][0]].setIP(entry[1][0].extract());
return true;
}
@@ -231,10 +231,10 @@ ConnectionManager::~ConnectionManager() {
application->getRequestManager()->unregisterPacketType("GetStatus");
}
-boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(const std::string &name) const throw (Core::Exception) {
+boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(const Core::String &name) const throw (Core::Exception) {
- std::map<std::string, Common::HostInfo>::const_iterator hostIt = daemonInfo.find(name);
+ std::map<Core::String, Common::HostInfo>::const_iterator hostIt = daemonInfo.find(name);
if(hostIt == daemonInfo.end())
throw Core::Exception(Core::Exception::UNKNOWN_DAEMON);
@@ -251,7 +251,7 @@ boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(con
throw Core::Exception(Core::Exception::NOT_AVAILABLE);
}
-std::string ConnectionManager::getDaemonName(const Common::Connection *con) const throw (Core::Exception) {
+Core::String ConnectionManager::getDaemonName(const Common::Connection *con) const throw (Core::Exception) {
const ServerConnection *connection = dynamic_cast<const ServerConnection*>(con);
if(connection && connection->getConnectionType() == ServerConnection::DAEMON)
@@ -260,7 +260,7 @@ std::string ConnectionManager::getDaemonName(const Common::Connection *con) cons
throw Core::Exception(Core::Exception::UNKNOWN_DAEMON);
}
-void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception) {
+void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const Core::String &name) throw (Core::Exception) {
// TODO Logging
ServerConnection *connection = dynamic_cast<ServerConnection*>(con);
@@ -288,8 +288,8 @@ void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const
updateState(hostInfo, Common::HostInfo::RUNNING);
}
-boost::shared_ptr<const Common::AuthContext> ConnectionManager::authenticateConnection(Common::Connection *con, const std::string &method,
- const std::string &subMethod, const std::string &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response) {
+boost::shared_ptr<const Common::AuthContext> ConnectionManager::authenticateConnection(Common::Connection *con, const Core::String &method,
+ const Core::String &subMethod, const Core::String &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response) {
// TODO Logging
ServerConnection *connection = dynamic_cast<ServerConnection*>(con);
@@ -306,7 +306,7 @@ boost::shared_ptr<const Common::AuthContext> ConnectionManager::authenticateConn
std::vector<Common::HostInfo> ConnectionManager::getDaemonList() const {
std::vector<Common::HostInfo> ret;
- for(std::map<std::string,Common::HostInfo>::const_iterator daemon = daemonInfo.begin(); daemon != daemonInfo.end(); ++daemon) {
+ for(std::map<Core::String,Common::HostInfo>::const_iterator daemon = daemonInfo.begin(); daemon != daemonInfo.end(); ++daemon) {
ret.push_back(daemon->second);
}
diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h
index 8c989b9..dab1892 100644
--- a/src/Server/ConnectionManager.h
+++ b/src/Server/ConnectionManager.h
@@ -99,8 +99,8 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
return (authContext.get() != 0 && authContext->isAuthenticated());
}
- boost::shared_ptr<const Common::AuthContext> authenticate(const std::string &method, const std::string &subMethod,
- const std::string &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response);
+ boost::shared_ptr<const Common::AuthContext> authenticate(const Core::String &method, const Core::String &subMethod,
+ const Core::String &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response);
};
friend class Application;
@@ -114,7 +114,7 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
std::set<boost::shared_ptr<ServerConnection> > connections;
- std::map<std::string, Common::HostInfo> daemonInfo;
+ std::map<Core::String, Common::HostInfo> daemonInfo;
boost::shared_ptr<Common::RequestHandlerGroup> connectionRequestHandlerGroup;
boost::shared_ptr<Common::RequestHandlerGroup> daemonRequestHandlerGroup;
@@ -135,13 +135,13 @@ class MAD_SERVER_EXPORT ConnectionManager : public Core::Configurable, private b
virtual void configFinished();
public:
- boost::shared_ptr<Common::Connection> getDaemonConnection(const std::string &name) const throw (Core::Exception);
- std::string getDaemonName(const Common::Connection *con) const throw (Core::Exception);
+ boost::shared_ptr<Common::Connection> getDaemonConnection(const Core::String &name) const throw (Core::Exception);
+ Core::String getDaemonName(const Common::Connection *con) const throw (Core::Exception);
- void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception);
+ void identifyDaemonConnection(Common::Connection *con, const Core::String &name) throw (Core::Exception);
- boost::shared_ptr<const Common::AuthContext> authenticateConnection(Common::Connection *con, const std::string &method, const std::string &subMethod,
- const std::string &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response);
+ boost::shared_ptr<const Common::AuthContext> authenticateConnection(Common::Connection *con, const Core::String &method, const Core::String &subMethod,
+ const Core::String &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response);
std::vector<Common::HostInfo> getDaemonList() const;
};
diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
index 1348541..d446485 100644
--- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp
@@ -37,17 +37,17 @@ void ConnectionRequestHandlerGroup::handleAuthMethodRequest(boost::shared_ptr<co
Common::XmlData::List *list = ret->createList("methods");
- std::set<std::string> methods = application->getAuthManager()->getMethods();
+ std::set<Core::String> methods = application->getAuthManager()->getMethods();
- for(std::set<std::string>::iterator method = methods.begin(); method != methods.end(); ++method) {
+ for(std::set<Core::String>::iterator method = methods.begin(); method != methods.end(); ++method) {
Common::XmlData::List::iterator entry = list->addEntry();
entry->set("name", *method);
Common::XmlData::List *subList = entry->createList("subMethods");
- std::vector<std::string> subMethods = application->getAuthManager()->getSubMethods(*method);
+ std::vector<Core::String> subMethods = application->getAuthManager()->getSubMethods(*method);
- for(std::vector<std::string>::iterator subMethod = subMethods.begin(); subMethod != subMethods.end(); ++subMethod) {
+ for(std::vector<Core::String>::iterator subMethod = subMethods.begin(); subMethod != subMethods.end(); ++subMethod) {
Common::XmlData::List::iterator subEntry = subList->addEntry();
subEntry->set("name", *subMethod);
@@ -59,8 +59,8 @@ void ConnectionRequestHandlerGroup::handleAuthRequest(boost::shared_ptr<const Co
std::vector<boost::uint8_t> response;
boost::shared_ptr<const Common::AuthContext> authContext = application->getConnectionManager()->authenticateConnection(connection,
- packet->get<const std::string&>("method"), packet->get<const std::string&>("subMethod"),
- packet->get<const std::string&>("user"), packet->get<const std::vector<boost::uint8_t>&>("data"),
+ packet->get<const Core::String&>("method"), packet->get<const Core::String&>("subMethod"),
+ packet->get<const Core::String&>("user"), packet->get<const std::vector<boost::uint8_t>&>("data"),
response);
if(!response.empty())
@@ -86,13 +86,13 @@ void ConnectionRequestHandlerGroup::handleDaemonListRequest(boost::shared_ptr<co
Common::XmlData::List::iterator entry = list->addEntry();
entry->set("name", daemon->getName());
- entry->set("address", daemon->getIP());
+ entry->set("address", daemon->getIP().c_str());
entry->set("state", daemon->getState());
}
}
void ConnectionRequestHandlerGroup::handleIdentifyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
- application->getConnectionManager()->identifyDaemonConnection(connection, packet->get<const std::string&>("hostname"));
+ application->getConnectionManager()->identifyDaemonConnection(connection, packet->get<const Core::String&>("hostname"));
ret->setType("OK");
}
@@ -102,10 +102,10 @@ void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Com
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -115,8 +115,8 @@ void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Com
static_cast<Core::Logger::MessageCategory>(packet->get<long>("category")),
static_cast<Core::Logger::MessageLevel>(packet->get<long>("level")),
timestamp,
- packet->get<const std::string&>("message"),
- application->getConnectionManager()->getDaemonName(connection));
+ packet->get<const Core::String&>("message").extract(),
+ application->getConnectionManager()->getDaemonName(connection).extract());
}
catch(Core::Exception &e) {
application->logf(Core::Logger::LOG_ERROR, "Can't determine daemon name: %s", e.what());
diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
index e258b89..8f6909e 100644
--- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp
@@ -50,11 +50,11 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared
try {
ConnectionManager *connectionManager = dynamic_cast<Application&>(*getApplication()).getConnectionManager();
- boost::shared_ptr<Common::Connection> daemonCon = connectionManager->getDaemonConnection(packet->get<const std::string&>("daemon"));
+ boost::shared_ptr<Common::Connection> daemonCon = connectionManager->getDaemonConnection(packet->get<const Core::String&>("daemon"));
boost::shared_ptr<Common::Request> request;
if(type == "DaemonCommand")
- request.reset(new Requests::CommandRequest(getApplication(), (packet->get<const std::string&>("command") == "reboot")));
+ request.reset(new Requests::CommandRequest(getApplication(), packet->get<const Core::String&>("command").matches("reboot")));
else if(type == "DaemonFSInfo")
request.reset(new Common::Requests::FSInfoRequest(getApplication()));
else // type == "GetDaemonStatus"
@@ -69,7 +69,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared
ret.set("ErrorCode", e.getErrorCode());
ret.set("SubCode", e.getSubCode());
ret.set("SubSubCode", e.getSubSubCode());
- ret.set("Where", e.getWhere());
+ ret.set("Where", e.getWhere().c_str());
sendPacket(ret);
signalFinished();
@@ -83,7 +83,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished(boost::sha
ret.set("ErrorCode", error.getErrorCode());
ret.set("SubCode", error.getSubCode());
ret.set("SubSubCode", error.getSubSubCode());
- ret.set("Where", error.getWhere());
+ ret.set("Where", error.getWhere().c_str());
sendPacket(ret);
}
@@ -101,7 +101,7 @@ DaemonRequestHandlerGroup::DaemonRequestHandlerGroup() {
types.insert("GetDaemonStatus");
}
-boost::shared_ptr<Common::RequestHandler> DaemonRequestHandlerGroup::createRequestHandler(Common::Application *application, const std::string &type) {
+boost::shared_ptr<Common::RequestHandler> DaemonRequestHandlerGroup::createRequestHandler(Common::Application *application, const Core::String &type) {
if(types.find(type) == types.end())
return boost::shared_ptr<Common::RequestHandler>();
else
diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h
index 48d8e2c..613e8f3 100644
--- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h
+++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h
@@ -35,7 +35,7 @@ class MAD_SERVER_EXPORT DaemonRequestHandlerGroup : public Common::RequestHandle
private:
class DaemonRequestHandler : public Common::RequestHandler {
private:
- std::string type;
+ Core::String type;
void requestFinished(boost::shared_ptr<const Common::XmlData> packet, Core::Exception error);
@@ -43,20 +43,20 @@ class MAD_SERVER_EXPORT DaemonRequestHandlerGroup : public Common::RequestHandle
virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
public:
- DaemonRequestHandler(Common::Application *application, const std::string &type0)
+ DaemonRequestHandler(Common::Application *application, const Core::String &type0)
: Common::RequestHandler(application), type(type0) {}
};
- std::set<std::string> types;
+ std::set<Core::String> types;
public:
DaemonRequestHandlerGroup();
- virtual const std::set<std::string>& getPacketTypes() {
+ virtual const std::set<Core::String>& getPacketTypes() {
return types;
}
- virtual boost::shared_ptr<Common::RequestHandler> createRequestHandler(Common::Application *application, const std::string &type);
+ virtual boost::shared_ptr<Common::RequestHandler> createRequestHandler(Common::Application *application, const Core::String &type);
};
}
diff --git a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp
index 05aadf8..be9cc58 100644
--- a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp
@@ -56,11 +56,11 @@ void UserListDiffUploadRequestHandler::handlePacket(boost::shared_ptr<const Comm
UserListManager *userListManager = dynamic_cast<Application*>(getApplication())->getUserListManager();
- if(name.empty()) { // Request
- name = packet->get<const std::string&>("name");
+ if(name.isEmpty()) { // Request
+ name = packet->get<const Core::String&>("name");
- if(name.empty())
- name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time());
+ if(name.isEmpty())
+ name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time()).c_str();
Common::XmlData ret;
ret.setType("Continue");
diff --git a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h
index 3d74253..15196b5 100644
--- a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h
+++ b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h
@@ -31,7 +31,7 @@ namespace RequestHandlers {
class UserListDiffUploadRequestHandler : public Common::RequestHandler {
private:
- std::string name;
+ Core::String name;
protected:
virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
diff --git a/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp
index bb18194..cfe2a28 100644
--- a/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp
@@ -31,12 +31,12 @@ void UserListRequestHandlerGroup::handleUserListListRequest(boost::shared_ptr<co
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- const std::set<std::string> &userLists = application->getUserListManager()->getUserLists();
+ const std::set<Core::String> &userLists = application->getUserListManager()->getUserLists();
ret->setType("OK");
Common::XmlData::List *list = ret->createList("userLists");
- for(std::set<std::string>::const_iterator userList = userLists.begin(); userList != userLists.end(); ++userList) {
+ for(std::set<Core::String>::const_iterator userList = userLists.begin(); userList != userLists.end(); ++userList) {
Common::XmlData::List::iterator entry = list->addEntry();
entry->set("name", *userList);
@@ -48,7 +48,7 @@ void UserListRequestHandlerGroup::handleUserListDownloadRequest(boost::shared_pt
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- boost::shared_ptr<Common::UserLists::UserList> userList = application->getUserListManager()->loadUserList(packet->get<const std::string&>("name"));
+ boost::shared_ptr<Common::UserLists::UserList> userList = application->getUserListManager()->loadUserList(packet->get<const Core::String&>("name"));
if(!userList)
throw(Core::Exception(Core::Exception::NOT_FOUND));
@@ -60,7 +60,7 @@ void UserListRequestHandlerGroup::handleUserListCopyRequest(boost::shared_ptr<co
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserListManager()->copyUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+ application->getUserListManager()->copyUserList(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName"));
ret->setType("OK");
}
@@ -69,7 +69,7 @@ void UserListRequestHandlerGroup::handleUserListRenameRequest(boost::shared_ptr<
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserListManager()->renameUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+ application->getUserListManager()->renameUserList(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName"));
ret->setType("OK");
}
@@ -78,7 +78,7 @@ void UserListRequestHandlerGroup::handleUserListRemoveRequest(boost::shared_ptr<
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserListManager()->removeUserList(packet->get<const std::string&>("name"));
+ application->getUserListManager()->removeUserList(packet->get<const Core::String&>("name"));
ret->setType("OK");
}
@@ -88,12 +88,12 @@ void UserListRequestHandlerGroup::handleUserListDiffListRequest(boost::shared_pt
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- const std::set<std::string> &userListDiffs = application->getUserListManager()->getUserListDiffs();
+ const std::set<Core::String> &userListDiffs = application->getUserListManager()->getUserListDiffs();
ret->setType("OK");
Common::XmlData::List *list = ret->createList("userListDiffs");
- for(std::set<std::string>::const_iterator diff = userListDiffs.begin(); diff != userListDiffs.end(); ++diff) {
+ for(std::set<Core::String>::const_iterator diff = userListDiffs.begin(); diff != userListDiffs.end(); ++diff) {
Common::XmlData::List::iterator entry = list->addEntry();
entry->set("name", *diff);
@@ -105,7 +105,7 @@ void UserListRequestHandlerGroup::handleUserListDiffDownloadRequest(boost::share
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- boost::shared_ptr<Common::UserLists::UserListDiff> diff = application->getUserListManager()->loadUserListDiff(packet->get<const std::string&>("name"));
+ boost::shared_ptr<Common::UserLists::UserListDiff> diff = application->getUserListManager()->loadUserListDiff(packet->get<const Core::String&>("name"));
if(!diff)
throw(Core::Exception(Core::Exception::NOT_FOUND));
@@ -117,7 +117,7 @@ void UserListRequestHandlerGroup::handleUserListDiffCopyRequest(boost::shared_pt
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserListManager()->copyUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+ application->getUserListManager()->copyUserListDiff(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName"));
ret->setType("OK");
}
@@ -126,7 +126,7 @@ void UserListRequestHandlerGroup::handleUserListDiffRenameRequest(boost::shared_
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserListManager()->renameUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+ application->getUserListManager()->renameUserListDiff(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName"));
ret->setType("OK");
}
@@ -135,7 +135,7 @@ void UserListRequestHandlerGroup::handleUserListDiffRemoveRequest(boost::shared_
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserListManager()->removeUserListDiff(packet->get<const std::string&>("name"));
+ application->getUserListManager()->removeUserListDiff(packet->get<const Core::String&>("name"));
ret->setType("OK");
}
diff --git a/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp b/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp
index 307863a..9de6257 100644
--- a/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp
@@ -57,11 +57,11 @@ void UserListUploadRequestHandler::handlePacket(boost::shared_ptr<const Common::
UserListManager *userListManager = dynamic_cast<Application*>(getApplication())->getUserListManager();
- if(name.empty()) { // Request
- name = packet->get<const std::string&>("name");
+ if(name.isEmpty()) { // Request
+ name = packet->get<const Core::String&>("name");
- if(name.empty())
- name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time());
+ if(name.isEmpty())
+ name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time()).c_str();
Common::XmlData ret;
ret.setType("Continue");
diff --git a/src/Server/RequestHandlers/UserListUploadRequestHandler.h b/src/Server/RequestHandlers/UserListUploadRequestHandler.h
index 4a20a4c..46672a5 100644
--- a/src/Server/RequestHandlers/UserListUploadRequestHandler.h
+++ b/src/Server/RequestHandlers/UserListUploadRequestHandler.h
@@ -31,7 +31,7 @@ namespace RequestHandlers {
class UserListUploadRequestHandler : public Common::RequestHandler {
private:
- std::string name;
+ Core::String name;
protected:
virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
index 1d99c2e..f43ec86 100644
--- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
@@ -36,10 +36,10 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -49,7 +49,7 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
if(users) {
Common::XmlData::List *list = ret->createList("users");
@@ -72,10 +72,10 @@ void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Comm
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -86,12 +86,12 @@ void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Comm
if(uid)
info = application->getUserManager()->getUserInfo(uid, &timestamp);
else
- info = application->getUserManager()->getUserInfoByName(packet->get<const std::string&>("name"), &timestamp);
+ info = application->getUserManager()->getUserInfoByName(packet->get<const Core::String&>("name"), &timestamp);
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
if(info) {
ret->set("uid", info->getUid());
@@ -108,10 +108,10 @@ void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -121,7 +121,7 @@ void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
if(groups) {
Common::XmlData::List *list = ret->createList("groups");
@@ -141,10 +141,10 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -154,7 +154,7 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
if(groups) {
Common::XmlData::List *list = ret->createList("groups");
@@ -175,10 +175,10 @@ void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Com
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -189,12 +189,12 @@ void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Com
if(gid)
info = application->getUserManager()->getGroupInfo(gid, &timestamp);
else
- info = application->getUserManager()->getGroupInfoByName(packet->get<const std::string&>("name"), &timestamp);
+ info = application->getUserManager()->getGroupInfoByName(packet->get<const Core::String&>("name"), &timestamp);
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
if(info) {
ret->set("gid", info->getGid());
@@ -209,10 +209,10 @@ void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -222,7 +222,7 @@ void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
Common::XmlData::List *list = ret->createList("users");
@@ -240,10 +240,10 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c
boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time);
- const std::string &timestr = packet->get<const std::string&>("timestamp");
- if(!timestr.empty()) {
+ const Core::String &timestr = packet->get<const Core::String&>("timestamp");
+ if(!timestr.isEmpty()) {
try {
- timestamp = boost::posix_time::from_iso_string(timestr);
+ timestamp = boost::posix_time::from_iso_string(timestr.extract());
}
catch(...) {}
}
@@ -253,7 +253,7 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c
ret->setType("OK");
if(!timestamp.is_not_a_date_time())
- ret->set("timestamp", boost::posix_time::to_iso_string(timestamp));
+ ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str());
if(userGroups) {
Common::XmlData::List *list = ret->createList("userGroupList");
@@ -273,9 +273,9 @@ void UserRequestHandlerGroup::handleUserInfoCheckRequest(boost::shared_ptr<const
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username"));
+ Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("username"));
userInfo.setGid(packet->get<unsigned long>("gid"));
- userInfo.setFullName(packet->get<const std::string&>("fullName"));
+ userInfo.setFullName(packet->get<const Core::String&>("fullName"));
application->getUserManager()->checkUserInfo(userInfo);
@@ -287,9 +287,9 @@ void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Commo
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username"));
+ Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("username"));
userInfo.setGid(packet->get<unsigned long>("gid"));
- userInfo.setFullName(packet->get<const std::string&>("fullName"));
+ userInfo.setFullName(packet->get<const Core::String&>("fullName"));
application->getUserManager()->addUser(userInfo);
@@ -301,9 +301,9 @@ void UserRequestHandlerGroup::handleUserUpdateRequest(boost::shared_ptr<const Co
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username"));
+ Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("username"));
userInfo.setGid(packet->get<unsigned long>("gid"));
- userInfo.setFullName(packet->get<const std::string&>("fullName"));
+ userInfo.setFullName(packet->get<const Core::String&>("fullName"));
application->getUserManager()->updateUser(packet->get<unsigned long>("origUid"), userInfo);
@@ -326,7 +326,7 @@ void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr<cons
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserManager()->checkGroupInfo(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name")));
+ application->getUserManager()->checkGroupInfo(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const Core::String&>("name")));
ret->setType("OK");
}
@@ -336,7 +336,7 @@ void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr<const Comm
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserManager()->addGroup(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name")));
+ application->getUserManager()->addGroup(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const Core::String&>("name")));
ret->setType("OK");
}
@@ -347,7 +347,7 @@ void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr<const C
throw(Core::Exception(Core::Exception::PERMISSION));
application->getUserManager()->updateGroup(packet->get<unsigned long>("origGid"),
- Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name")));
+ Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const Core::String&>("name")));
ret->setType("OK");
}
@@ -388,7 +388,7 @@ void UserRequestHandlerGroup::handlePasswordSetRequest(boost::shared_ptr<const C
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
- application->getUserManager()->setPassword(packet->get<unsigned long>("uid"), packet->get<const std::string&>("password"));
+ application->getUserManager()->setPassword(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("password"));
ret->setType("OK");
}
diff --git a/src/Server/Requests/DaemonStateUpdateRequest.h b/src/Server/Requests/DaemonStateUpdateRequest.h
index 862e8ac..2fd3242 100644
--- a/src/Server/Requests/DaemonStateUpdateRequest.h
+++ b/src/Server/Requests/DaemonStateUpdateRequest.h
@@ -31,14 +31,14 @@ namespace Requests {
class MAD_SERVER_EXPORT DaemonStateUpdateRequest : public Common::Request {
private:
- std::string name;
+ Core::String name;
Common::HostInfo::State state;
protected:
virtual void sendRequest();
public:
- DaemonStateUpdateRequest(Common::Application *application, const std::string &name0, Common::HostInfo::State state0)
+ DaemonStateUpdateRequest(Common::Application *application, const Core::String &name0, Common::HostInfo::State state0)
: Common::Request(application), name(name0), state(state0) {}
};
diff --git a/src/Server/UserListManager.cpp b/src/Server/UserListManager.cpp
index d520c96..a8794fe 100644
--- a/src/Server/UserListManager.cpp
+++ b/src/Server/UserListManager.cpp
@@ -54,11 +54,11 @@ void UserListManager::configFinished() {
application->getRequestManager()->registerPacketType<RequestHandlers::UserListDiffUploadRequestHandler>("UploadUserListDiff");
}
-bool UserListManager::existsUserList(const std::string &name) {
+bool UserListManager::existsUserList(const Core::String &name) {
return application->getStorageManager()->exists("UserList", name);
}
-boost::shared_ptr<Common::UserLists::UserList> UserListManager::loadUserList(const std::string &name) {
+boost::shared_ptr<Common::UserLists::UserList> UserListManager::loadUserList(const Core::String &name) {
boost::shared_ptr<Common::XmlData> data = application->getStorageManager()->load("UserList", name);
if(!data)
@@ -67,31 +67,31 @@ boost::shared_ptr<Common::UserLists::UserList> UserListManager::loadUserList(con
return Common::UserLists::Util::deserializeUserList(data.get());
}
-void UserListManager::storeUserList(const std::string &name, const Common::UserLists::UserList *list) {
+void UserListManager::storeUserList(const Core::String &name, const Common::UserLists::UserList *list) {
Common::XmlData data;
Common::UserLists::Util::serializeUserList(list, &data);
application->getStorageManager()->store("UserList", name, &data);
}
-void UserListManager::copyUserList(const std::string &fromName, const std::string &toName) {
+void UserListManager::copyUserList(const Core::String &fromName, const Core::String &toName) {
application->getStorageManager()->copy("UserList", fromName, toName);
}
-void UserListManager::renameUserList(const std::string &fromName, const std::string &toName) {
+void UserListManager::renameUserList(const Core::String &fromName, const Core::String &toName) {
application->getStorageManager()->rename("UserList", fromName, toName);
}
-void UserListManager::removeUserList(const std::string &name) {
+void UserListManager::removeUserList(const Core::String &name) {
application->getStorageManager()->remove("UserList", name);
}
-bool UserListManager::existsUserListDiff(const std::string &name) {
+bool UserListManager::existsUserListDiff(const Core::String &name) {
return application->getStorageManager()->exists("UserListDiff", name);
}
-boost::shared_ptr<Common::UserLists::UserListDiff> UserListManager::loadUserListDiff(const std::string &name) {
+boost::shared_ptr<Common::UserLists::UserListDiff> UserListManager::loadUserListDiff(const Core::String &name) {
boost::shared_ptr<Common::XmlData> data = application->getStorageManager()->load("UserListDiff", name);
if(!data)
@@ -100,22 +100,22 @@ boost::shared_ptr<Common::UserLists::UserListDiff> UserListManager::loadUserList
return Common::UserLists::Util::deserializeUserListDiff(data.get());
}
-void UserListManager::storeUserListDiff(const std::string &name, const Common::UserLists::UserListDiff *list) {
+void UserListManager::storeUserListDiff(const Core::String &name, const Common::UserLists::UserListDiff *list) {
Common::XmlData data;
Common::UserLists::Util::serializeUserListDiff(list, &data);
application->getStorageManager()->store("UserListDiff", name, &data);
}
-void UserListManager::copyUserListDiff(const std::string &fromName, const std::string &toName) {
+void UserListManager::copyUserListDiff(const Core::String &fromName, const Core::String &toName) {
application->getStorageManager()->copy("UserListDiff", fromName, toName);
}
-void UserListManager::renameUserListDiff(const std::string &fromName, const std::string &toName) {
+void UserListManager::renameUserListDiff(const Core::String &fromName, const Core::String &toName) {
application->getStorageManager()->rename("UserListDiff", fromName, toName);
}
-void UserListManager::removeUserListDiff(const std::string &name) {
+void UserListManager::removeUserListDiff(const Core::String &name) {
application->getStorageManager()->remove("UserListDiff", name);
}
@@ -127,7 +127,7 @@ boost::shared_ptr<Common::UserLists::UserList> UserListManager::getCurrentUserLi
for(std::map<unsigned long, Common::UserInfo>::const_iterator user = userList->begin(); user != userList->end(); ++user) {
std::map<unsigned long, Common::GroupInfo>::const_iterator group = groupList->find(user->second.getGid());
- std::string groupname;
+ Core::String groupname;
if(group != groupList->end()) {
groupname = group->second.getName();
@@ -135,7 +135,7 @@ boost::shared_ptr<Common::UserLists::UserList> UserListManager::getCurrentUserLi
else {
std::ostringstream stream;
stream << user->second.getGid();
- groupname = stream.str();
+ groupname = stream.str().c_str();
}
Common::UserLists::UserListEntry entry(user->second.getUsername(), groupname);
diff --git a/src/Server/UserListManager.h b/src/Server/UserListManager.h
index 1651d42..65e8fdf 100644
--- a/src/Server/UserListManager.h
+++ b/src/Server/UserListManager.h
@@ -23,6 +23,7 @@
#include "export.h"
#include <Core/Configurable.h>
+#include <Core/String.h>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
@@ -52,8 +53,8 @@ class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private bo
boost::shared_ptr<RequestHandlers::UserListRequestHandlerGroup> requestHandlerGroup;
- std::set<std::string> userLists;
- std::set<std::string> userListDiffs;
+ std::set<Core::String> userLists;
+ std::set<Core::String> userListDiffs;
protected:
virtual void configFinished();
@@ -64,27 +65,27 @@ class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private bo
UserListManager(Application *application0);
virtual ~UserListManager();
- const std::set<std::string>& getUserLists() const {
+ const std::set<Core::String>& getUserLists() const {
return userLists;
}
- bool existsUserList(const std::string &name);
- boost::shared_ptr<Common::UserLists::UserList> loadUserList(const std::string &name);
- void storeUserList(const std::string &name, const Common::UserLists::UserList *list);
- void copyUserList(const std::string &fromName, const std::string &toName);
- void renameUserList(const std::string &fromName, const std::string &toName);
- void removeUserList(const std::string &name);
+ bool existsUserList(const Core::String &name);
+ boost::shared_ptr<Common::UserLists::UserList> loadUserList(const Core::String &name);
+ void storeUserList(const Core::String &name, const Common::UserLists::UserList *list);
+ void copyUserList(const Core::String &fromName, const Core::String &toName);
+ void renameUserList(const Core::String &fromName, const Core::String &toName);
+ void removeUserList(const Core::String &name);
- const std::set<std::string>& getUserListDiffs() const {
+ const std::set<Core::String>& getUserListDiffs() const {
return userListDiffs;
}
- bool existsUserListDiff(const std::string &name);
- boost::shared_ptr<Common::UserLists::UserListDiff> loadUserListDiff(const std::string &name);
- void storeUserListDiff(const std::string &name, const Common::UserLists::UserListDiff *list);
- void copyUserListDiff(const std::string &fromName, const std::string &toName);
- void renameUserListDiff(const std::string &fromName, const std::string &toName);
- void removeUserListDiff(const std::string &name);
+ bool existsUserListDiff(const Core::String &name);
+ boost::shared_ptr<Common::UserLists::UserListDiff> loadUserListDiff(const Core::String &name);
+ void storeUserListDiff(const Core::String &name, const Common::UserLists::UserListDiff *list);
+ void copyUserListDiff(const Core::String &fromName, const Core::String &toName);
+ void renameUserListDiff(const Core::String &fromName, const Core::String &toName);
+ void removeUserListDiff(const Core::String &name);
boost::shared_ptr<Common::UserLists::UserList> getCurrentUserList();
};