diff options
Diffstat (limited to 'src/Server')
-rw-r--r-- | src/Server/ConnectionManager.cpp | 47 | ||||
-rw-r--r-- | src/Server/ConnectionManager.h | 16 | ||||
-rw-r--r-- | src/Server/RequestHandlers/DaemonListRequestHandler.cpp | 1 | ||||
-rw-r--r-- | src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp | 10 | ||||
-rw-r--r-- | src/Server/RequestHandlers/DaemonRequestHandlerGroup.h | 4 | ||||
-rw-r--r-- | src/Server/RequestHandlers/IdentifyRequestHandler.cpp | 1 | ||||
-rw-r--r-- | src/Server/RequestHandlers/LogRequestHandler.cpp | 9 | ||||
-rw-r--r-- | src/Server/RequestHandlers/UserRequestHandlerGroup.cpp | 2 | ||||
-rw-r--r-- | src/Server/UserBackend.h | 44 | ||||
-rw-r--r-- | src/Server/UserManager.cpp | 80 | ||||
-rw-r--r-- | src/Server/UserManager.h | 22 |
11 files changed, 114 insertions, 122 deletions
diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp index f568f74..a15a516 100644 --- a/src/Server/ConnectionManager.cpp +++ b/src/Server/ConnectionManager.cpp @@ -18,16 +18,13 @@ */ #include "ConnectionManager.h" -#include <Common/ConfigEntry.h> -#include <Common/ConfigManager.h> -#include <Common/Logger.h> +#include <Core/ConfigEntry.h> +#include <Core/ConfigManager.h> +#include <Core/Logger.h> #include <Common/RequestHandlers/FSInfoRequestHandler.h> #include <Common/RequestHandlers/StatusRequestHandler.h> #include "Requests/DaemonStateUpdateRequest.h" -//#include "RequestHandlers/DaemonCommandRequestHandler.h" -//#include "RequestHandlers/DaemonFSInfoRequestHandler.h" #include "RequestHandlers/DaemonListRequestHandler.h" -//#include "RequestHandlers/DaemonStatusRequestHandler.h" //#include "RequestHandlers/GSSAPIAuthRequestHandler.h" #include "RequestHandlers/IdentifyRequestHandler.h" #include "RequestHandlers/LogRequestHandler.h" @@ -89,7 +86,7 @@ void ConnectionManager::updateState(Common::HostInfo *hostInfo, Common::HostInfo } } -bool ConnectionManager::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) { +bool ConnectionManager::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) { if(handled) return false; @@ -97,7 +94,7 @@ bool ConnectionManager::handleConfigEntry(const Common::ConfigEntry &entry, bool try { listenerAddresses.push_back(boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(entry[0][0]), 6666)); } - catch(Net::Exception &e) { + catch(Core::Exception &e) { // TODO Log error } @@ -148,7 +145,7 @@ void ConnectionManager::configFinished() { listener->connectSignalNewConnection(boost::bind(&ConnectionManager::handleNewConnection, this, _1)); listeners.push_back(listener); } - catch(Net::Exception &e) { + catch(Core::Exception &e) { // TODO Log error } } @@ -159,7 +156,7 @@ void ConnectionManager::configFinished() { listener->connectSignalNewConnection(boost::bind(&ConnectionManager::handleNewConnection, this, _1)); listeners.push_back(listener); } - catch(Net::Exception &e) { + catch(Core::Exception &e) { // TODO Log error } } @@ -220,14 +217,14 @@ void ConnectionManager::doDeinit() { Common::RequestManager::get()->unregisterPacketType("Log"); } -boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(const std::string &name) const throw (Net::Exception&) { +boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(const std::string &name) const throw (Core::Exception&) { const Common::HostInfo *hostInfo; try { hostInfo = &daemonInfo.at(name); } catch(std::out_of_range&) { - throw Net::Exception(Net::Exception::UNKNOWN_DAEMON); + throw Core::Exception(Core::Exception::UNKNOWN_DAEMON); } if(hostInfo->getState() != Common::HostInfo::INACTIVE) { @@ -238,56 +235,56 @@ boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(con } } - throw Net::Exception(Net::Exception::NOT_AVAILABLE); + throw Core::Exception(Core::Exception::NOT_AVAILABLE); } -std::string ConnectionManager::getDaemonName(const Common::Connection *con) const throw (Net::Exception&) { +std::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) return connection->getHostInfo()->getName(); - throw Net::Exception(Net::Exception::UNKNOWN_DAEMON); + throw Core::Exception(Core::Exception::UNKNOWN_DAEMON); } -void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Net::Exception&) { +void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception&) { // TODO Logging ServerConnection *connection = dynamic_cast<ServerConnection*>(con); if(!connection) - throw Net::Exception(Net::Exception::INVALID_ACTION); + throw Core::Exception(Core::Exception::INVALID_ACTION); if(connection->isIdentified()) - throw Net::Exception(Net::Exception::ALREADY_IDENTIFIED); + throw Core::Exception(Core::Exception::ALREADY_IDENTIFIED); if(daemonInfo.count(name) == 0) - throw Net::Exception(Net::Exception::UNKNOWN_DAEMON); + throw Core::Exception(Core::Exception::UNKNOWN_DAEMON); Common::HostInfo *hostInfo = &daemonInfo[name]; if(hostInfo->getState() != Common::HostInfo::INACTIVE) { try { getDaemonConnection(name)->disconnect(); - Common::Logger::log(Common::Logger::WARNING, "Disconnecting old connection."); + Core::Logger::log(Core::Logger::WARNING, "Disconnecting old connection."); } - catch(Net::Exception&) {} + catch(Core::Exception&) {} } connection->identify(hostInfo); updateState(hostInfo, Common::HostInfo::RUNNING); - Common::Logger::logf("Identified as '%s'.", name.c_str()); + Core::Logger::logf("Identified as '%s'.", name.c_str()); } -void ConnectionManager::identifyClientConnection(Common::Connection *con) throw (Net::Exception&) { +void ConnectionManager::identifyClientConnection(Common::Connection *con) throw (Core::Exception&) { ServerConnection *connection = dynamic_cast<ServerConnection*>(con); if(!connection) - throw Net::Exception(Net::Exception::INVALID_ACTION); + throw Core::Exception(Core::Exception::INVALID_ACTION); if(connection->isIdentified()) - throw Net::Exception(Net::Exception::ALREADY_IDENTIFIED); + throw Core::Exception(Core::Exception::ALREADY_IDENTIFIED); connection->identify(); } diff --git a/src/Server/ConnectionManager.h b/src/Server/ConnectionManager.h index 6573883..4cc12a5 100644 --- a/src/Server/ConnectionManager.h +++ b/src/Server/ConnectionManager.h @@ -20,9 +20,9 @@ #ifndef MAD_SERVER_CONNECTIONMANAGER_H_ #define MAD_SERVER_CONNECTIONMANAGER_H_ -#include <Common/Configurable.h> +#include <Core/Configurable.h> +#include <Core/Initializable.h> #include <Common/HostInfo.h> -#include <Common/Initializable.h> #include <Common/RequestManager.h> #include <list> @@ -42,7 +42,7 @@ class Packet; namespace Server { -class ConnectionManager : public Common::Configurable, public Common::Initializable, boost::noncopyable { +class ConnectionManager : public Core::Configurable, public Core::Initializable, boost::noncopyable { private: class ServerConnection : public Common::Connection { public: @@ -111,7 +111,7 @@ class ConnectionManager : public Common::Configurable, public Common::Initializa void handleDisconnect(boost::shared_ptr<ServerConnection> con); protected: - virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool handled); + virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool handled); virtual void configFinished(); virtual void doInit(); @@ -122,11 +122,11 @@ class ConnectionManager : public Common::Configurable, public Common::Initializa return &connectionManager; } - boost::shared_ptr<Common::Connection> getDaemonConnection(const std::string &name) const throw (Net::Exception&); - std::string getDaemonName(const Common::Connection *con) const throw (Net::Exception&); + 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&); - void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Net::Exception&); - void identifyClientConnection(Common::Connection *con) throw (Net::Exception&); + void identifyDaemonConnection(Common::Connection *con, const std::string &name) throw (Core::Exception&); + void identifyClientConnection(Common::Connection *con) throw (Core::Exception&); std::vector<Common::HostInfo> getDaemonList() const; }; diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp index 6c17ce1..fc6900c 100644 --- a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp +++ b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp @@ -19,7 +19,6 @@ #include "DaemonListRequestHandler.h" #include "../ConnectionManager.h" -#include <Common/Logger.h> namespace Mad { namespace Server { diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp index 4ff8c40..0e21fdd 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp @@ -21,7 +21,7 @@ #include "../ConnectionManager.h" #include "../Requests/CommandRequest.h" -#include <Common/Logger.h> +#include <Core/Logger.h> #include <Common/Requests/FSInfoRequest.h> #include <Common/Requests/StatusRequest.h> @@ -31,11 +31,11 @@ namespace RequestHandlers { void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) { if(packet->getType() != type) { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); + Core::Logger::log(Core::Logger::ERROR, "Received an unexpected packet."); Common::XmlPacket ret; ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); + ret.add("ErrorCode", Core::Exception::UNEXPECTED_PACKET); sendPacket(ret); @@ -59,7 +59,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared request->connectSignalFinished(boost::bind(&DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished, this, _1, _2)); Common::RequestManager::get()->sendRequest(daemonCon.get(), request); } - catch(Net::Exception &e) { + catch(Core::Exception &e) { Common::XmlPacket ret; ret.setType("Error"); ret.add("ErrorCode", e.getErrorCode()); @@ -72,7 +72,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared } } -void DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error) { +void DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error) { if(error) { Common::XmlPacket ret; ret.setType("Error"); diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h index 7c0b127..7a709f4 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h @@ -21,7 +21,7 @@ #define MAD_SERVER_REQUESTHANDLERS_DAEMONREQUESTHANDLERGROUP_H_ #include <Common/RequestHandlerGroup.h> -#include <Net/Exception.h> +#include <Core/Exception.h> namespace Mad { namespace Server { @@ -33,7 +33,7 @@ class DaemonRequestHandlerGroup : public Common::RequestHandlerGroup { private: std::string type; - void requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error); + void requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Core::Exception error); protected: virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet); diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp index abee878..e48563b 100644 --- a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp +++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp @@ -19,7 +19,6 @@ #include "IdentifyRequestHandler.h" #include "../ConnectionManager.h" -#include <Common/Logger.h> namespace Mad { diff --git a/src/Server/RequestHandlers/LogRequestHandler.cpp b/src/Server/RequestHandlers/LogRequestHandler.cpp index 1e3f5b4..f33aad4 100644 --- a/src/Server/RequestHandlers/LogRequestHandler.cpp +++ b/src/Server/RequestHandlers/LogRequestHandler.cpp @@ -18,8 +18,7 @@ */ #include "LogRequestHandler.h" -#include <Common/Logger.h> -#include <Common/LogManager.h> +#include <Core/LogManager.h> #include "../ConnectionManager.h" namespace Mad { @@ -30,11 +29,11 @@ void LogRequestHandler::handleRequest(boost::shared_ptr<const Common::XmlPacket> // TODO Require authentication try { - Common::LogManager::get()->log((*packet)["category"], (*packet)["level"], (*packet)["timestamp"], (*packet)["message"], + Core::LogManager::get()->log((*packet)["category"], (*packet)["level"], (*packet)["timestamp"], (*packet)["message"], ConnectionManager::get()->getDaemonName(getConnection())); } - catch(Net::Exception &e) { - Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); + catch(Core::Exception &e) { + Core::Logger::logf(Core::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); } ret->setType("OK"); diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp index 1ff8883..7836c34 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -18,8 +18,6 @@ */ #include "UserRequestHandlerGroup.h" - -#include <Common/Logger.h> #include "../UserManager.h" namespace Mad { diff --git a/src/Server/UserBackend.h b/src/Server/UserBackend.h index c2f340e..4688bc7 100644 --- a/src/Server/UserBackend.h +++ b/src/Server/UserBackend.h @@ -22,11 +22,11 @@ #include <config.h> +#include <Core/Exception.h> + #include <Common/UserInfo.h> #include <Common/GroupInfo.h> -#include <Net/Exception.h> - #include <map> #include <set> #include <string> @@ -45,45 +45,45 @@ class UserBackend { UserBackend() {} - virtual boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList() throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList() throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr<Common::UserInfo> getUserInfoByName(const std::string &name _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual boost::shared_ptr<Common::UserInfo> getUserInfoByName(const std::string &name _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr<std::set<unsigned long> > getUserGroupList(unsigned long uid _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual boost::shared_ptr<std::set<unsigned long> > getUserGroupList(unsigned long uid _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > getGroupList() throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > getGroupList() throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual std::string getGroupName(unsigned long gid _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual std::string getGroupName(unsigned long gid _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual unsigned long getGroupId(const std::string &name _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual unsigned long getGroupId(const std::string &name _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr<std::set<unsigned long> > getGroupUserList(unsigned long gid _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual boost::shared_ptr<std::set<unsigned long> > getGroupUserList(unsigned long gid _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual void setPassword(unsigned long uid _UNUSED_PARAMETER_, const std::string &password _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual void setPassword(unsigned long uid _UNUSED_PARAMETER_, const std::string &password _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual void addUser(const Common::UserInfo &userInfo _UNUSED_PARAMETER_) throw(Net::Exception) { - throw(Net::Exception(Net::Exception::NOT_IMPLEMENTED)); + virtual void addUser(const Common::UserInfo &userInfo _UNUSED_PARAMETER_) throw(Core::Exception) { + throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } virtual int getPriority() const { diff --git a/src/Server/UserManager.cpp b/src/Server/UserManager.cpp index 5f30a6b..0c45b78 100644 --- a/src/Server/UserManager.cpp +++ b/src/Server/UserManager.cpp @@ -34,15 +34,15 @@ bool UserManager::Compare::operator() (boost::shared_ptr<UserBackend> b1, boost: } -boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUserList() throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUserList() throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getUserList(); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -50,15 +50,15 @@ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUs throw e; } -boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getUserInfo(uid); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -66,15 +66,15 @@ boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) throw e; } -boost::shared_ptr<Common::UserInfo> UserManager::getUserInfoByName(const std::string &name) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +boost::shared_ptr<Common::UserInfo> UserManager::getUserInfoByName(const std::string &name) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getUserInfoByName(name); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -82,15 +82,15 @@ boost::shared_ptr<Common::UserInfo> UserManager::getUserInfoByName(const std::st throw e; } -boost::shared_ptr<std::set<unsigned long> > UserManager::getUserGroupList(unsigned long uid) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +boost::shared_ptr<std::set<unsigned long> > UserManager::getUserGroupList(unsigned long uid) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getUserGroupList(uid); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -98,15 +98,15 @@ boost::shared_ptr<std::set<unsigned long> > UserManager::getUserGroupList(unsign throw e; } -boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserManager::getGroupList() throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserManager::getGroupList() throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getGroupList(); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -114,15 +114,15 @@ boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserManager::getG throw e; } -std::string UserManager::getGroupName(unsigned long gid) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +std::string UserManager::getGroupName(unsigned long gid) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getGroupName(gid); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -130,15 +130,15 @@ std::string UserManager::getGroupName(unsigned long gid) throw(Net::Exception) { throw e; } -unsigned long UserManager::getGroupId(const std::string &name) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +unsigned long UserManager::getGroupId(const std::string &name) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getGroupId(name); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -146,15 +146,15 @@ unsigned long UserManager::getGroupId(const std::string &name) throw(Net::Except throw e; } -boost::shared_ptr<std::set<unsigned long> > UserManager::getGroupUserList(unsigned long gid) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +boost::shared_ptr<std::set<unsigned long> > UserManager::getGroupUserList(unsigned long gid) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->getGroupUserList(gid); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -162,15 +162,15 @@ boost::shared_ptr<std::set<unsigned long> > UserManager::getGroupUserList(unsign throw e; } -void UserManager::setPassword(unsigned long uid, const std::string &password) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +void UserManager::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->setPassword(uid, password); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } @@ -178,15 +178,15 @@ void UserManager::setPassword(unsigned long uid, const std::string &password) th throw e; } -void UserManager::addUser(const Common::UserInfo &userInfo) throw(Net::Exception) { - Net::Exception e(Net::Exception::NOT_IMPLEMENTED); +void UserManager::addUser(const Common::UserInfo &userInfo) throw(Core::Exception) { + Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { return (*backend)->addUser(userInfo); } - catch(Net::Exception e2) { - if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED) + catch(Core::Exception e2) { + if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) e = e2; } } diff --git a/src/Server/UserManager.h b/src/Server/UserManager.h index 47c7318..31f50d5 100644 --- a/src/Server/UserManager.h +++ b/src/Server/UserManager.h @@ -23,7 +23,7 @@ #include <Common/UserInfo.h> #include <Common/GroupInfo.h> -#include <Net/Exception.h> +#include <Core/Exception.h> #include <map> #include <set> @@ -57,19 +57,19 @@ class UserManager : boost::noncopyable { backends.erase(backend); } - boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList() throw(Net::Exception); - boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid) throw(Net::Exception); - boost::shared_ptr<Common::UserInfo> getUserInfoByName(const std::string &name) throw(Net::Exception); - boost::shared_ptr<std::set<unsigned long> > getUserGroupList(unsigned long uid) throw(Net::Exception); + boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > getUserList() throw(Core::Exception); + boost::shared_ptr<Common::UserInfo> getUserInfo(unsigned long uid) throw(Core::Exception); + boost::shared_ptr<Common::UserInfo> getUserInfoByName(const std::string &name) throw(Core::Exception); + boost::shared_ptr<std::set<unsigned long> > getUserGroupList(unsigned long uid) throw(Core::Exception); - boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > getGroupList() throw(Net::Exception); - std::string getGroupName(unsigned long gid) throw(Net::Exception); - unsigned long getGroupId(const std::string &name) throw(Net::Exception); - boost::shared_ptr<std::set<unsigned long> > getGroupUserList(unsigned long gid) throw(Net::Exception); + boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > getGroupList() throw(Core::Exception); + std::string getGroupName(unsigned long gid) throw(Core::Exception); + unsigned long getGroupId(const std::string &name) throw(Core::Exception); + boost::shared_ptr<std::set<unsigned long> > getGroupUserList(unsigned long gid) throw(Core::Exception); - void setPassword(unsigned long uid, const std::string &password) throw(Net::Exception); + void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception); - void addUser(const Common::UserInfo &userInfo) throw(Net::Exception); + void addUser(const Common::UserInfo &userInfo) throw(Core::Exception); static UserManager *get() { return &userManager; |