Commit 355cee8b authored by Micha Mueller's avatar Micha Mueller
Browse files

Integrate new RestAPI implementation into dcdbpusher

parent 6b086567
......@@ -146,7 +146,7 @@ bool Configuration::readGlobal() {
return true;
}
bool Configuration::readRestAPIUsers(HttpsServer* server) {
bool Configuration::readRestAPIUsers(RestAPI* server) {
//open file
std::string globalConfig = _cfgFilePath;
globalConfig.append("dcdbpusher.conf");
......
......@@ -10,7 +10,7 @@
#include <set>
#include "RestAPIServer.h"
#include "RestAPI.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/log/trivial.hpp>
#include "includes/PluginDefinitions.h"
......@@ -63,7 +63,7 @@ public:
* @param server The Rest API server where to add the users
* @return true on success, false otherwise
*/
bool readRestAPIUsers(HttpsServer* server);
bool readRestAPIUsers(RestAPI* server);
/**
* Reads the plugin configuration section from global.conf (located at _cfgFilePath).
......
......@@ -20,17 +20,16 @@ LIBS = -L$(DCDBDEPLOYPATH)/lib/ \
-lpthread \
-lcrypto \
-lssl \
-lcpprest \
-rdynamic
OBJS = dcdbpusher.o \
Configuration.o \
MQTTPusher.o \
RestAPIServer.o \
RestAPI.o \
../analytics/AnalyticsManager.o \
../common/src/sensornavigator.o \
../common/src/logging.o \
../common/src/HttpsServer.o
../common/src/RESTHttpsServer.o
TARGET = dcdbpusher
PLUGINS = procfs pdu sysfs ipmi bacnet snmp gpfsmon tester
......
......@@ -31,7 +31,7 @@
#include "Configuration.h"
#include "MQTTPusher.h"
#include "RestAPIServer.h"
#include "RestAPI.h"
#include "version.h"
#include <boost/foreach.hpp>
......@@ -49,7 +49,7 @@ using namespace std;
Configuration* _configuration;
MQTTPusher* _mqttPusher;
RestAPIServer* _httpsServer;
RestAPI* _httpsServer;
AnalyticsManager* _analyticsManager;
std::map<std::string, SBasePtr> _sensorMap;
QueryEngine& _queryEngine = QueryEngine::getInstance();
......@@ -340,7 +340,7 @@ int main(int argc, char** argv) {
//MQTTPusher and Https server get their own threads
_mqttPusher = new MQTTPusher(globalSettings.brokerPort, globalSettings.brokerHost, pluginSettings.sensorPattern, globalSettings.qosLevel,
_configuration->getPlugins(), _analyticsManager->getPlugins(), globalSettings.maxMsgNum, globalSettings.maxInflightMsgNum, globalSettings.maxQueuedMsgNum);
_httpsServer = new RestAPIServer(restAPISettings, _configuration->getPlugins(), _mqttPusher, _analyticsManager, io);
_httpsServer = new RestAPI(restAPISettings, _configuration->getPlugins(), _mqttPusher, _analyticsManager, io);
_configuration->readRestAPIUsers(_httpsServer);
LOG_VAR(vLogLevel) << "----- End Configuration -----";
......@@ -405,10 +405,12 @@ int main(int argc, char** argv) {
}
boost::thread mqttThread(bind(&MQTTPusher::push, _mqttPusher));
boost::thread restThread(bind(&RestAPIServer::start, _httpsServer));
LOG(info) << "Threads created!";
LOG(info) << "Starting RestAPI Https Server...";
_httpsServer->start();
LOG(info) << "Registering signal handlers...";
signal(SIGINT, sigHandler); //Handle Strg+C
signal(SIGTERM, sigHandler); //Handle termination
......@@ -426,9 +428,6 @@ int main(int argc, char** argv) {
mqttThread.join();
LOG(info) << "MQTTPusher stopped";
restThread.join();
LOG(info) << "REST API Server stopped";
LOG(info) << "Exiting...Goodbye!";
return 0;
}
......@@ -10,8 +10,8 @@
/*
* Simple header file to pull the pluginVector_t typedef out of Configuration.h
* This way HttpsServer.h only needs to include PluginDefinitions.h and we can avoid
* a dependency circle when including HttpsServer.h from Configuration.h
* This way RestAPI.h only needs to include PluginDefinitions.h and we can avoid
* a dependency circle when including RestAPI.h from Configuration.h
*/
#include <string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment