summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Client/CommandManager.h2
-rw-r--r--src/Client/CommandParser.cpp32
-rw-r--r--src/Client/CommandParser.h7
-rw-r--r--src/Client/InformationManager.cpp8
-rw-r--r--src/Client/InformationManager.h2
-rw-r--r--src/Common/ConfigManager.h2
-rw-r--r--src/Common/Initializable.cpp8
-rw-r--r--src/Common/LogManager.h2
-rw-r--r--src/Common/Logger.cpp2
-rw-r--r--src/Common/RequestManager.h2
-rw-r--r--src/Core/ConnectionManager.cpp32
-rw-r--r--src/Core/ConnectionManager.h2
-rw-r--r--src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp4
-rw-r--r--src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp4
-rw-r--r--src/Core/RequestHandlers/DaemonListRequestHandler.cpp2
-rw-r--r--src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp4
-rw-r--r--src/Core/RequestHandlers/IdentifyRequestHandler.cpp2
-rw-r--r--src/Core/RequestHandlers/LogRequestHandler.cpp4
-rw-r--r--src/Daemon/Backends/NetworkLogger.h2
-rw-r--r--src/mad-core.cpp8
-rw-r--r--src/mad.cpp24
-rw-r--r--src/madc.cpp28
22 files changed, 89 insertions, 94 deletions
diff --git a/src/Client/CommandManager.h b/src/Client/CommandManager.h
index 25b3f2e..ef20e8a 100644
--- a/src/Client/CommandManager.h
+++ b/src/Client/CommandManager.h
@@ -65,7 +65,7 @@ class CommandManager {
CommandManager() : activeRequests(0), disconnect(false) {}
public:
- static CommandManager *getCommandManager() {
+ static CommandManager *get() {
return &commandManager;
}
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index c0c8d7f..efc9c4b 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -74,7 +74,7 @@ void CommandParser::printUsage(const std::string& command) {
std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std::vector<std::string> &args, bool mustBeActive) {
- const std::map<std::string, Common::HostInfo>& hosts = InformationManager::getInformationManager()->getDaemons();
+ const std::map<std::string, Common::HostInfo>& hosts = InformationManager::get()->getDaemons();
std::map<std::string, Common::HostInfo> ret;
for(std::vector<std::string>::const_iterator arg = args.begin(); arg != args.end(); ++arg) {
@@ -110,16 +110,16 @@ std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std::
void CommandParser::fsinfoCommand(const std::vector<std::string> &args) {
if(args.size() == 1)
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::FSInfoRequest(sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::fsInfoRequestFinished))));
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::FSInfoRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::fsInfoRequestFinished))));
else if(args.size() == 2)
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Requests::DaemonFSInfoRequest(args[1], sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::daemonFSInfoRequestFinished))));
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Requests::DaemonFSInfoRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonFSInfoRequestFinished))));
else {
Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("fsinfo");
return;
}
- ++CommandManager::getCommandManager()->activeRequests;
+ ++CommandManager::get()->activeRequests;
}
void CommandParser::helpCommand(const std::vector<std::string> &args) {
@@ -152,7 +152,7 @@ void CommandParser::helpCommand(const std::vector<std::string> &args) {
}
void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
- const std::map<std::string, Common::HostInfo>& hosts = InformationManager::getInformationManager()->getDaemons();
+ const std::map<std::string, Common::HostInfo>& hosts = InformationManager::get()->getDaemons();
if(args.size() == 1) {
if(hosts.empty()) {
@@ -213,11 +213,11 @@ void CommandParser::rebootCommand(const std::vector<std::string> &args) {
std::map<std::string, Common::HostInfo> hosts = parseHostList(std::vector<std::string>(args.begin()+1, args.end()), true);
for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) {
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(
- new Requests::DaemonCommandRequest(host->first, true, sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::daemonCommandRequestFinished))
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(
+ new Requests::DaemonCommandRequest(host->first, true, sigc::mem_fun(CommandManager::get(), &CommandManager::daemonCommandRequestFinished))
));
- ++CommandManager::getCommandManager()->activeRequests;
+ ++CommandManager::get()->activeRequests;
}
}
@@ -231,32 +231,32 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) {
std::map<std::string, Common::HostInfo> hosts = parseHostList(std::vector<std::string>(args.begin()+1, args.end()), true);
for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) {
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(
- new Requests::DaemonCommandRequest(host->first, false, sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::daemonCommandRequestFinished))
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(
+ new Requests::DaemonCommandRequest(host->first, false, sigc::mem_fun(CommandManager::get(), &CommandManager::daemonCommandRequestFinished))
));
- ++CommandManager::getCommandManager()->activeRequests;
+ ++CommandManager::get()->activeRequests;
}
}
void CommandParser::statusCommand(const std::vector<std::string> &args) {
if(args.size() == 1)
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::StatusRequest(sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::statusRequestFinished))));
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::StatusRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::statusRequestFinished))));
else if(args.size() == 2)
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::daemonStatusRequestFinished))));
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(CommandManager::get(), &CommandManager::daemonStatusRequestFinished))));
else {
Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("status");
return;
}
- ++CommandManager::getCommandManager()->activeRequests;
+ ++CommandManager::get()->activeRequests;
}
void CommandParser::exitCommand(const std::vector<std::string>&) {
- ++CommandManager::getCommandManager()->activeRequests;
+ ++CommandManager::get()->activeRequests;
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::DisconnectRequest(sigc::mem_fun(CommandManager::getCommandManager(), &CommandManager::disconnectRequestFinished))));
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Common::Requests::DisconnectRequest(sigc::mem_fun(CommandManager::get(), &CommandManager::disconnectRequestFinished))));
}
bool CommandParser::split(const std::string &str, std::vector<std::string> &ret) {
diff --git a/src/Client/CommandParser.h b/src/Client/CommandParser.h
index e08c775..e01449a 100644
--- a/src/Client/CommandParser.h
+++ b/src/Client/CommandParser.h
@@ -71,7 +71,7 @@ class CommandParser {
CommandParser() : connection(0) {}
public:
- static CommandParser *getCommandParser() {
+ static CommandParser *get() {
return &commandParser;
}
@@ -83,11 +83,6 @@ class CommandParser {
connection = con;
}
- bool requestsActive() {return CommandManager::getCommandManager()->requestsActive();}
- bool willDisconnect() {return CommandManager::getCommandManager()->willDisconnect();}
-
- sigc::signal<void> signalFinished() const {return CommandManager::getCommandManager()->signalFinished();}
-
bool parse(const std::string &cmd);
void requestDisconnect() {
diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp
index 1d54498..37835c1 100644
--- a/src/Client/InformationManager.cpp
+++ b/src/Client/InformationManager.cpp
@@ -57,20 +57,20 @@ void InformationManager::DaemonStateUpdateRequest::handlePacket(Net::Connection
void InformationManager::doInit() {
- Common::RequestManager::getRequestManager()->init();
+ Common::RequestManager::get()->init();
- Common::RequestManager::getRequestManager()->registerPacketType<DaemonStateUpdateRequest>(Net::Packet::DAEMON_STATE_UPDATE);
+ Common::RequestManager::get()->registerPacketType<DaemonStateUpdateRequest>(Net::Packet::DAEMON_STATE_UPDATE);
}
void InformationManager::doUninit() {
- Common::RequestManager::getRequestManager()->unregisterPacketType(Net::Packet::DAEMON_STATE_UPDATE);
+ Common::RequestManager::get()->unregisterPacketType(Net::Packet::DAEMON_STATE_UPDATE);
}
void InformationManager::updateDaemonList(Net::Connection *con) {
if(updating)
return;
- Common::RequestManager::getRequestManager()->sendRequest(con,
+ Common::RequestManager::get()->sendRequest(con,
std::auto_ptr<Common::RequestBase>(
new Requests::DaemonListRequest(sigc::mem_fun(this, &InformationManager::daemonListRequestFinished))
)
diff --git a/src/Client/InformationManager.h b/src/Client/InformationManager.h
index 739c359..4acde37 100644
--- a/src/Client/InformationManager.h
+++ b/src/Client/InformationManager.h
@@ -69,7 +69,7 @@ class InformationManager : public Common::Initializable {
virtual void doUninit();
public:
- static InformationManager* getInformationManager() {
+ static InformationManager* get() {
return &informationManager;
}
diff --git a/src/Common/ConfigManager.h b/src/Common/ConfigManager.h
index b4264d5..036eed7 100644
--- a/src/Common/ConfigManager.h
+++ b/src/Common/ConfigManager.h
@@ -57,7 +57,7 @@ class ConfigManager {
configurables.erase(c);
}
- static ConfigManager *getConfigManager() {
+ static ConfigManager *get() {
return &configManager;
}
};
diff --git a/src/Common/Initializable.cpp b/src/Common/Initializable.cpp
index adcb0fa..9e7a49e 100644
--- a/src/Common/Initializable.cpp
+++ b/src/Common/Initializable.cpp
@@ -41,14 +41,14 @@ void Initializable::init() {
initializing = true;
- if(!(LogManager::getLogManager()->isInitialized() || LogManager::getLogManager()->isInitializing()))
- LogManager::getLogManager()->init();
+ if(!(LogManager::get()->isInitialized() || LogManager::get()->isInitializing()))
+ LogManager::get()->init();
doInit();
Configurable *c = dynamic_cast<Configurable*>(this);
if(c)
- ConfigManager::getConfigManager()->registerConfigurable(c);
+ ConfigManager::get()->registerConfigurable(c);
initializing = false;
initialized = true;
@@ -61,7 +61,7 @@ void Initializable::deinit() {
Configurable *c = dynamic_cast<Configurable*>(in);
if(c)
- ConfigManager::getConfigManager()->unregisterConfigurable(c);
+ ConfigManager::get()->unregisterConfigurable(c);
in->doDeinit();
in->initialized = false;
diff --git a/src/Common/LogManager.h b/src/Common/LogManager.h
index 65fcf19..22a8c75 100644
--- a/src/Common/LogManager.h
+++ b/src/Common/LogManager.h
@@ -86,7 +86,7 @@ class LogManager : public Configurable {
remoteLoggers.erase(logger);
}
- static LogManager *getLogManager() {
+ static LogManager *get() {
return &logManager;
}
};
diff --git a/src/Common/Logger.cpp b/src/Common/Logger.cpp
index 8586fa9..e746faf 100644
--- a/src/Common/Logger.cpp
+++ b/src/Common/Logger.cpp
@@ -54,7 +54,7 @@ void Logger::logfv(MessageCategory category, MessageLevel level, const char *for
}
void Logger::log(MessageCategory category, MessageLevel level, const std::string &message) {
- LogManager::getLogManager()->log(category, level, std::time(0), message);
+ LogManager::get()->log(category, level, std::time(0), message);
}
void Logger::logf(MessageCategory category, MessageLevel level, const char *format, ...) {
diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h
index b0002d0..723e619 100644
--- a/src/Common/RequestManager.h
+++ b/src/Common/RequestManager.h
@@ -86,7 +86,7 @@ class RequestManager : public Initializable {
void receiveHandler(Net::Connection *connection, const Net::Packet &packet);
public:
- static RequestManager* getRequestManager() {
+ static RequestManager* get() {
return &requestManager;
}
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp
index 3d69165..7df9e8b 100644
--- a/src/Core/ConnectionManager.cpp
+++ b/src/Core/ConnectionManager.cpp
@@ -49,7 +49,7 @@ void ConnectionManager::updateState(const std::string &name, Common::HostInfo::S
daemonInfo[name].setState(state);
for(std::list<Net::ServerConnection*>::iterator con = clientConnections.begin(); con != clientConnections.end(); ++con) {
- Common::RequestManager::getRequestManager()->sendRequest(*con, std::auto_ptr<Common::RequestBase>(
+ Common::RequestManager::get()->sendRequest(*con, std::auto_ptr<Common::RequestBase>(
new Requests::DaemonStateUpdateRequest(name, state)
));
}
@@ -130,19 +130,19 @@ void ConnectionManager::configFinished() {
}
void ConnectionManager::doInit() {
- Common::RequestManager::getRequestManager()->setCore(true);
- Common::RequestManager::getRequestManager()->init();
-
- Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
- Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_REBOOT);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_SHUTDOWN);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonFSInfoRequestHandler>(Net::Packet::DAEMON_FS_INFO);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonListRequestHandler>(Net::Packet::LIST_DAEMONS);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::DaemonStatusRequestHandler>(Net::Packet::DAEMON_STATUS);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::GSSAPIAuthRequestHandler>(Net::Packet::GSSAPI_AUTH);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::IdentifyRequestHandler>(Net::Packet::IDENTIFY);
- Common::RequestManager::getRequestManager()->registerPacketType<RequestHandlers::LogRequestHandler>(Net::Packet::LOG);
+ Common::RequestManager::get()->setCore(true);
+ Common::RequestManager::get()->init();
+
+ Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
+ Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_REBOOT);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonCommandRequestHandler>(Net::Packet::DAEMON_COMMAND_SHUTDOWN);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonFSInfoRequestHandler>(Net::Packet::DAEMON_FS_INFO);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonListRequestHandler>(Net::Packet::LIST_DAEMONS);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonStatusRequestHandler>(Net::Packet::DAEMON_STATUS);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::GSSAPIAuthRequestHandler>(Net::Packet::GSSAPI_AUTH);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::IdentifyRequestHandler>(Net::Packet::IDENTIFY);
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::LogRequestHandler>(Net::Packet::LOG);
Net::Connection::init();
}
@@ -171,7 +171,7 @@ void ConnectionManager::handleConnections(std::list<Net::ServerConnection*>& con
}
}
- Common::RequestManager::getRequestManager()->unregisterConnection(*con);
+ Common::RequestManager::get()->unregisterConnection(*con);
delete *con;
connections.erase(con++);
}
@@ -193,7 +193,7 @@ void ConnectionManager::run() {
while((con = (*listener)->getConnection()) != 0) {
(con->isDaemonConnection() ? daemonConnections : clientConnections).push_back(con);
- Common::RequestManager::getRequestManager()->registerConnection(con);
+ Common::RequestManager::get()->registerConnection(con);
}
}
}
diff --git a/src/Core/ConnectionManager.h b/src/Core/ConnectionManager.h
index 888255a..c17bae5 100644
--- a/src/Core/ConnectionManager.h
+++ b/src/Core/ConnectionManager.h
@@ -76,7 +76,7 @@ class ConnectionManager : public Common::Configurable {
virtual void configFinished();
public:
- static ConnectionManager* getConnectionManager() {
+ static ConnectionManager* get() {
return &connectionManager;
}
diff --git a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp
index 9ae0bdd..6782b8d 100644
--- a/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonCommandRequestHandler.cpp
@@ -44,8 +44,8 @@ void DaemonCommandRequestHandler::handlePacket(Net::Connection *connection, cons
std::string daemonName((char*)packet.getData(), packet.getLength());
try {
- Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(
+ Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(
new Requests::CommandRequest(packet.getType() == Net::Packet::DAEMON_COMMAND_REBOOT, sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished))
));
}
diff --git a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp
index 1267520..3d371a9 100644
--- a/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonFSInfoRequestHandler.cpp
@@ -46,8 +46,8 @@ void DaemonFSInfoRequestHandler::handlePacket(Net::Connection *connection, const
std::string daemonName((char*)packet.getData(), packet.getLength());
try {
- Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::FSInfoRequest(sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished))));
+ Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::FSInfoRequest(sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished))));
}
catch(Common::Exception &e) {
connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), e));
diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
index cec1c5a..dcf9f53 100644
--- a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
@@ -39,7 +39,7 @@ void DaemonListRequestHandler::handlePacket(Net::Connection *connection, const N
// TODO Require authentication
- connection->send(Net::Packets::HostListPacket(Net::Packet::OK, packet.getRequestId(), ConnectionManager::getConnectionManager()->getDaemonList()));
+ connection->send(Net::Packets::HostListPacket(Net::Packet::OK, packet.getRequestId(), ConnectionManager::get()->getDaemonList()));
signalFinished().emit();
}
diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
index 4add098..80b61ba 100644
--- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp
@@ -46,8 +46,8 @@ void DaemonStatusRequestHandler::handlePacket(Net::Connection *connection, const
std::string daemonName((char*)packet.getData(), packet.getLength());
try {
- Net::Connection *daemonCon = ConnectionManager::getConnectionManager()->getDaemonConnection(daemonName);
- Common::RequestManager::getRequestManager()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::StatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished))));
+ Net::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest(daemonCon, std::auto_ptr<Common::RequestBase>(new Common::Requests::StatusRequest(sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished))));
}
catch(Common::Exception &e) {
connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), e));
diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp
index 0d4f25d..9666f7e 100644
--- a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp
+++ b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp
@@ -39,7 +39,7 @@ void IdentifyRequestHandler::handlePacket(Net::Connection *connection, const Net
// TODO Require authentication
try {
- ConnectionManager::getConnectionManager()->identifyDaemonConnection(connection, std::string((const char*)packet.getData(), packet.getLength()));
+ ConnectionManager::get()->identifyDaemonConnection(connection, std::string((const char*)packet.getData(), packet.getLength()));
connection->send(Net::Packet(Net::Packet::OK, packet.getRequestId()));
}
diff --git a/src/Core/RequestHandlers/LogRequestHandler.cpp b/src/Core/RequestHandlers/LogRequestHandler.cpp
index c2b2fde..e28ac8e 100644
--- a/src/Core/RequestHandlers/LogRequestHandler.cpp
+++ b/src/Core/RequestHandlers/LogRequestHandler.cpp
@@ -43,8 +43,8 @@ void LogRequestHandler::handlePacket(Net::Connection *connection, const Net::Pac
Net::Packets::LogPacket logPacket(packet);
try {
- Common::LogManager::getLogManager()->log(logPacket.getCategory(), logPacket.getLevel(), logPacket.getTimestamp(), logPacket.getMessage().c_str(),
- ConnectionManager::getConnectionManager()->getDaemonName(connection));
+ Common::LogManager::get()->log(logPacket.getCategory(), logPacket.getLevel(), logPacket.getTimestamp(), logPacket.getMessage().c_str(),
+ ConnectionManager::get()->getDaemonName(connection));
}
catch(Common::Exception &e) {
Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str());
diff --git a/src/Daemon/Backends/NetworkLogger.h b/src/Daemon/Backends/NetworkLogger.h
index f1989bb..b33f180 100644
--- a/src/Daemon/Backends/NetworkLogger.h
+++ b/src/Daemon/Backends/NetworkLogger.h
@@ -36,7 +36,7 @@ class NetworkLogger : public Common::Logger {
protected:
virtual void logMessage(Common::Logger::MessageCategory category, Common::Logger::MessageLevel level, time_t messageTimestamp, const std::string &message) {
- Common::RequestManager::getRequestManager()->sendRequest(connection,
+ Common::RequestManager::get()->sendRequest(connection,
std::auto_ptr<Common::RequestBase>(new Requests::LogRequest(category, level, messageTimestamp, message, Requests::LogRequest::slot_type()))
);
}
diff --git a/src/mad-core.cpp b/src/mad-core.cpp
index 359abb3..257f310 100644
--- a/src/mad-core.cpp
+++ b/src/mad-core.cpp
@@ -36,16 +36,16 @@ int main() {
sigaddset(&signals, SIGPIPE);
sigprocmask(SIG_BLOCK, &signals, 0);
- Core::ConnectionManager::getConnectionManager()->init();
+ Core::ConnectionManager::get()->init();
- Common::ConfigManager::getConfigManager()->loadFile("mad-core.conf");
- Common::ConfigManager::getConfigManager()->finish();
+ Common::ConfigManager::get()->loadFile("mad-core.conf");
+ Common::ConfigManager::get()->finish();
Common::Backends::SystemBackendPosix::registerBackend();
Common::Backends::SystemBackendProc::registerBackend();
while(true)
- Core::ConnectionManager::getConnectionManager()->run();
+ Core::ConnectionManager::get()->run();
Common::Initializable::deinit();
diff --git a/src/mad.cpp b/src/mad.cpp
index d2315f1..54b25d0 100644
--- a/src/mad.cpp
+++ b/src/mad.cpp
@@ -45,13 +45,13 @@ static void requestFinished(const Common::Request<>&) {
int main() {
Net::Connection::init();
- Common::ConfigManager::getConfigManager()->finish();
+ Common::ConfigManager::get()->finish();
- Common::RequestManager::getRequestManager()->init();
- Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
- Common::RequestManager::getRequestManager()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
- Common::RequestManager::getRequestManager()->registerPacketType<Daemon::RequestHandlers::CommandRequestHandler>(Net::Packet::COMMAND_REBOOT);
- Common::RequestManager::getRequestManager()->registerPacketType<Daemon::RequestHandlers::CommandRequestHandler>(Net::Packet::COMMAND_SHUTDOWN);
+ Common::RequestManager::get()->init();
+ Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
+ Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::StatusRequestHandler>(Net::Packet::STATUS);
+ Common::RequestManager::get()->registerPacketType<Daemon::RequestHandlers::CommandRequestHandler>(Net::Packet::COMMAND_REBOOT);
+ Common::RequestManager::get()->registerPacketType<Daemon::RequestHandlers::CommandRequestHandler>(Net::Packet::COMMAND_SHUTDOWN);
Common::Backends::SystemBackendPosix::registerBackend();
Common::Backends::SystemBackendProc::registerBackend();
@@ -64,23 +64,23 @@ int main() {
while(connection->isConnecting())
Net::FdManager::getFdManager()->run();
- Common::RequestManager::getRequestManager()->registerConnection(connection);
+ Common::RequestManager::get()->registerConnection(connection);
Common::SharedPtr<Common::Logger> networkLogger = new Daemon::Backends::NetworkLogger(connection);
- Common::LogManager::getLogManager()->registerLogger(networkLogger);
+ Common::LogManager::get()->registerLogger(networkLogger);
//char hostname[256];
//gethostname(hostname, sizeof(hostname));
- //Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest(hostname, sigc::ptr_fun(requestFinished))));
- Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest("test", sigc::ptr_fun(requestFinished))));
+ //Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest(hostname, sigc::ptr_fun(requestFinished))));
+ Common::RequestManager::get()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Daemon::Requests::IdentifyRequest("test", sigc::ptr_fun(requestFinished))));
while(connection->isConnected())
Net::FdManager::getFdManager()->run();
- Common::LogManager::getLogManager()->unregisterLogger(networkLogger);
+ Common::LogManager::get()->unregisterLogger(networkLogger);
- Common::RequestManager::getRequestManager()->unregisterConnection(connection);
+ Common::RequestManager::get()->unregisterConnection(connection);
}
catch(Mad::Common::Exception &e) {
Common::Logger::logf(Common::Logger::CRITICAL, "Connection error: %s", e.strerror().c_str());
diff --git a/src/madc.cpp b/src/madc.cpp
index b758ec8..7397972 100644
--- a/src/madc.cpp
+++ b/src/madc.cpp
@@ -44,15 +44,15 @@ static void usage(const std::string &cmd) {
static void handleCommand(char *cmd) {
if(!cmd)
- Client::CommandParser::getCommandParser()->requestDisconnect();
+ Client::CommandParser::get()->requestDisconnect();
else if(!*cmd)
return;
else {
- Client::CommandParser::getCommandParser()->parse(cmd);
+ Client::CommandParser::get()->parse(cmd);
add_history(cmd);
}
- if(Client::CommandParser::getCommandParser()->requestsActive()) {
+ if(Client::CommandManager::get()->requestsActive()) {
rl_callback_handler_remove();
Net::FdManager::getFdManager()->setFdEvents(STDIN_FILENO, 0);
}
@@ -64,7 +64,7 @@ static void charHandler(short events) {
}
static void activateReadline() {
- if(Client::CommandParser::getCommandParser()->willDisconnect())
+ if(Client::CommandManager::get()->willDisconnect())
return;
rl_callback_handler_install("mad> ", handleCommand);
@@ -79,11 +79,11 @@ int main(int argc, char *argv[]) {
Net::Connection::init();
- Common::LogManager::getLogManager()->init();
+ Common::LogManager::get()->init();
- Common::ConfigManager::getConfigManager()->finish();
+ Common::ConfigManager::get()->finish();
- Common::RequestManager::getRequestManager()->init();
+ Common::RequestManager::get()->init();
Net::ClientConnection *connection = new Net::ClientConnection;
try {
@@ -96,20 +96,20 @@ int main(int argc, char *argv[]) {
std::cerr << " connected." << std::endl;
- Common::RequestManager::getRequestManager()->registerConnection(connection);
+ Common::RequestManager::get()->registerConnection(connection);
std::cerr << "Receiving host list..." << std::flush;
- Client::InformationManager::getInformationManager()->init();
- Client::InformationManager::getInformationManager()->updateDaemonList(connection);
+ Client::InformationManager::get()->init();
+ Client::InformationManager::get()->updateDaemonList(connection);
- while(Client::InformationManager::getInformationManager()->isUpdating())
+ while(Client::InformationManager::get()->isUpdating())
Net::FdManager::getFdManager()->run();
std::cerr << " done." << std::endl << std::endl;
- Client::CommandParser::getCommandParser()->setConnection(connection);
- Client::CommandParser::getCommandParser()->signalFinished().connect(sigc::ptr_fun(activateReadline));
+ Client::CommandParser::get()->setConnection(connection);
+ Client::CommandManager::get()->signalFinished().connect(sigc::ptr_fun(activateReadline));
Net::FdManager::getFdManager()->registerFd(STDIN_FILENO, sigc::ptr_fun(charHandler));
@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) {
Net::FdManager::getFdManager()->unregisterFd(STDIN_FILENO);
- Common::RequestManager::getRequestManager()->unregisterConnection(connection);
+ Common::RequestManager::get()->unregisterConnection(connection);
}
catch(Mad::Common::Exception &e) {
Common::Logger::logf(Common::Logger::CRITICAL, "Connection error: %s", e.strerror().c_str());