Skip to content
Snippets Groups Projects
Commit 67c5efed authored by Auke Klazema's avatar Auke Klazema
Browse files

SW-597: Merge task branch back to release branch

parents a51d819e f29b6843
No related branches found
No related tags found
No related merge requests found
...@@ -128,15 +128,74 @@ GCFEvent::TResult Feedback::connect2OTDB_state(GCFEvent& event, GCFPortInterface ...@@ -128,15 +128,74 @@ GCFEvent::TResult Feedback::connect2OTDB_state(GCFEvent& event, GCFPortInterface
LOG_DEBUG_STR("Trying to read database information from file " << filename); LOG_DEBUG_STR("Trying to read database information from file " << filename);
ParameterSet otdbconf; ParameterSet otdbconf;
otdbconf.adoptFile(filename); otdbconf.adoptFile(filename);
string database = otdbconf.getString("SASGateway.OTDBdatabase"); string database;
string dbhost = otdbconf.getString("SASGateway.OTDBhostname"); try
itsOTDBconn = new OTDBconnection("paulus", "boskabouter", database, dbhost); {
database = otdbconf.getString("SASGateway.OTDBdatabase");
}
catch(LOFAR::APSException& ex)
{
LOG_ERROR_STR("FeedbackService code caught an exception while trying to "
"read the OTDB database name from its configuration file: "
<< ex.what());
throw(ex);
}
string dbhost;
try
{
dbhost = otdbconf.getString("SASGateway.OTDBhostname");
}
catch(LOFAR::APSException& ex)
{
LOG_ERROR_STR("FeedbackService code caught an exception while trying to "
"read the OTDB database server host name from its configuration file: "
<< ex.what());
throw(ex);
}
string username;
try
{
username = otdbconf.getString("SASGateway.OTDBusername");
}
catch(LOFAR::APSException& ex)
{
LOG_ERROR_STR("FeedbackService code caught an exception while trying to "
"read the OTDB database user name from its configuration file: "
<< ex.what());
throw(ex);
}
string password;
try
{
password = otdbconf.getString("SASGateway.OTDBpassword");
}
catch(LOFAR::APSException& ex)
{
LOG_ERROR_STR("FeedbackService code caught an exception while trying to "
"read the OTDB database password from its configuration file: "
<< ex.what());
throw(ex);
}
string port;
try
{
port = otdbconf.getString("SASGateway.OTDBport");
}
catch(LOFAR::APSException& ex)
{
LOG_ERROR_STR("FeedbackService code caught an exception while trying to "
"read the OTDB database server port from its configuration file: "
<< ex.what());
throw(ex);
}
itsOTDBconn = new OTDBconnection(username, password, database, dbhost, port);
if (!itsOTDBconn->connect()) { if (!itsOTDBconn->connect()) {
LOG_FATAL_STR("Cannot connect to database " << database << " on machine " << dbhost << ", retry in 10 seconds"); LOG_FATAL_STR("Cannot connect to database " << database << " on machine " << dbhost << " on port " << port << ", retry in 10 seconds");
itsTimer->setTimer(10.0); itsTimer->setTimer(10.0);
return (GCFEvent::HANDLED); return (GCFEvent::HANDLED);
} }
LOG_INFO_STR("Connected to database " << database << " on machine " << dbhost); LOG_INFO_STR("Connected to database " << database << " on machine " << dbhost << " on port " << port);
TRAN(Feedback::operational_state); TRAN(Feedback::operational_state);
} break; } break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment