Skip to content
Snippets Groups Projects
Commit 51c9871a authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Task #7361: It compiles but during linking de dependancies are lost.

Checked all CMakeList.txt file but it puzzles me what is wrong.
parent 05f390df
No related branches found
No related tags found
No related merge requests found
...@@ -130,6 +130,7 @@ if(NOT DEFINED LOFAR_PACKAGE_LIST_INCLUDED) ...@@ -130,6 +130,7 @@ if(NOT DEFINED LOFAR_PACKAGE_LIST_INCLUDED)
set(Scheduler_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/Scheduler) set(Scheduler_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/Scheduler)
set(jOTDB3_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/OTB/jOTDB3) set(jOTDB3_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/OTB/jOTDB3)
set(OTB-Java_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/OTB/OTB) set(OTB-Java_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/OTB/OTB)
set(SAS_Feedback_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/Feedback_Service)
set(CCU_MAC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SubSystems/CCU_MAC) set(CCU_MAC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SubSystems/CCU_MAC)
set(LCU_MAC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SubSystems/LCU_MAC) set(LCU_MAC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SubSystems/LCU_MAC)
set(MCU_MAC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SubSystems/MCU_MAC) set(MCU_MAC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SubSystems/MCU_MAC)
......
...@@ -20,6 +20,9 @@ set(MATLAB_ROOT_DIR /usr/local/matlab-2008a) ...@@ -20,6 +20,9 @@ set(MATLAB_ROOT_DIR /usr/local/matlab-2008a)
# Path to JAVA # Path to JAVA
set(ENV{JAVA_HOME} /usr/local/jdk1.6.0_29) set(ENV{JAVA_HOME} /usr/local/jdk1.6.0_29)
# Path to Qpid
set(QPID_ROOT_DIR /opt/qpid)
# Ignore warnings matching the following pattern(s) # Ignore warnings matching the following pattern(s)
set(CTEST_CUSTOM_WARNING_EXCEPTION set(CTEST_CUSTOM_WARNING_EXCEPTION
"/boost/date_time/time_facet.hpp:[0-9]+: warning: unused parameter" "/boost/date_time/time_facet.hpp:[0-9]+: warning: unused parameter"
......
...@@ -4,3 +4,4 @@ lofar_add_package(OTDB) ...@@ -4,3 +4,4 @@ lofar_add_package(OTDB)
lofar_add_package(OTB) lofar_add_package(OTB)
lofar_add_package(OTDB_SQL OTDB/sql) lofar_add_package(OTDB_SQL OTDB/sql)
lofar_add_package(Scheduler) lofar_add_package(Scheduler)
lofar_add_package(Feedback_Service)
# $Id: CMakeLists.txt 23213 2012-12-07 13:00:09Z loose $ # $Id: CMakeLists.txt 23213 2012-12-07 13:00:09Z loose $
lofar_package(Feedback_Service 1.0 DEPENDS Common OTDB) lofar_package(Feedback_Service 1.0 DEPENDS Common MACIO GCFTM OTDB MessageBus)
#lofar_package(CEPCU 1.0 DEPENDS Common ApplCommon MACIO GCFTM GCFRTDB APLCommon RTDBCommon OTDB Stream MessageBus)
include(LofarFindPackage) include(LofarFindPackage)
lofar_find_package(Boost REQUIRED COMPONENTS date_time) lofar_find_package(Boost REQUIRED COMPONENTS date_time)
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
include(LofarPackageVersion) include(LofarPackageVersion)
#lofar_add_bin_program(FeedbackService Feedback.cc FeedbackMain.cc) lofar_add_library(feedbackservice Package__Version.cc)
lofar_add_bin_program(versionsas_feedback versionsas_feedback.cc)
lofar_add_bin_program(FeedbackService Feedback.cc FeedbackMain.cc)
#lofar_add_bin_program(FeedbackService Package__Version.cc Feedback.cc FeedbackMain.cc) #lofar_add_bin_program(FeedbackService Package__Version.cc Feedback.cc FeedbackMain.cc)
#lofar_add_bin_program(versionfeedback versionfeedback.cc)
install(PROGRAMS FeedbackService DESTINATION bin)
install(FILES FeedbackService.conf DESTINATION etc) install(FILES FeedbackService.conf DESTINATION etc)
...@@ -22,13 +22,26 @@ ...@@ -22,13 +22,26 @@
//# Always #include <lofar_config.h> first! //# Always #include <lofar_config.h> first!
#include <lofar_config.h> #include <lofar_config.h>
#include <signal.h>
//# Includes //# Includes
#include <Common/LofarLogger.h> #include <Common/LofarLogger.h>
#include <Feedback/Feedback.h> #include <Common/LofarLocators.h>
#include <Common/ParameterSet.h>
#include <Common/ParameterRecord.h>
#include <Common/Version.h>
#include <GCF/TM/GCF_Control.h>
#include <OTDB/TreeValue.h>
#include "Feedback.h"
#include <boost/date_time/posix_time/posix_time.hpp>
using namespace boost::posix_time;
using namespace qpid::messaging;
namespace LOFAR { namespace LOFAR {
namespace Feedback { using namespace OTDB;
using namespace GCF::TM;
namespace SAS {
static Feedback* thisFeedback = 0; static Feedback* thisFeedback = 0;
...@@ -37,11 +50,12 @@ static Feedback* thisFeedback = 0; ...@@ -37,11 +50,12 @@ static Feedback* thisFeedback = 0;
// //
Feedback::Feedback() : Feedback::Feedback() :
GCFTask ((State)&Feedback::connect2OTDB_state, "FeedbackService"), GCFTask ((State)&Feedback::connect2OTDB_state, "FeedbackService"),
itsTimerPort(0), itsTimer (0),
itsOTDBConn (0) itsOTDBconn (0),
itsMsgQueue (0)
{ {
// Log who we are. // Log who we are.
LOG_INFO(Version::getInfo<@@@Version>("FeedbackService")); LOG_INFO(Version::getInfo<SAS_FeedbackVersion>("FeedbackService"));
// attach timer // attach timer
itsTimer = new GCFTimerPort(*this, "TimerPort"); itsTimer = new GCFTimerPort(*this, "TimerPort");
...@@ -52,9 +66,9 @@ Feedback::Feedback() : ...@@ -52,9 +66,9 @@ Feedback::Feedback() :
ASSERTSTR(!queuenames.empty(), "Queuenames not specified in label 'FeedbackQueuenames'"); ASSERTSTR(!queuenames.empty(), "Queuenames not specified in label 'FeedbackQueuenames'");
// connect to bussystem // connect to bussystem
itsMultiBus = MultiBus(queuenames[0]); itsMsgQueue = new FromBus();
for (int i = 1; i < queuenames.size(); ++i) { for (size_t i = 0; i < queuenames.size(); ++i) {
itsMultibus.add(queuenames[i]); itsMsgQueue->addQueue(queuenames[i]);
} }
// redirect signal handlers // redirect signal handlers
...@@ -67,7 +81,11 @@ Feedback::Feedback() : ...@@ -67,7 +81,11 @@ Feedback::Feedback() :
// ~Feedback() // ~Feedback()
// //
Feedback::~Feedback() Feedback::~Feedback()
{} {
delete itsTimer;
delete itsMsgQueue;
delete itsOTDBconn;
}
// //
// sigintHandler(signum) // sigintHandler(signum)
...@@ -119,7 +137,7 @@ GCFEvent::TResult Feedback::connect2OTDB_state(GCFEvent& event, GCFPortInterface ...@@ -119,7 +137,7 @@ GCFEvent::TResult Feedback::connect2OTDB_state(GCFEvent& event, GCFPortInterface
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);
TRAN(Feedback::operational_state): TRAN(Feedback::operational_state);
} break; } break;
default: default:
...@@ -141,27 +159,29 @@ GCFEvent::TResult Feedback::operational_state(GCFEvent& event, GCFPortInterface& ...@@ -141,27 +159,29 @@ GCFEvent::TResult Feedback::operational_state(GCFEvent& event, GCFPortInterface&
case F_ENTRY: case F_ENTRY:
case F_TIMER: { case F_TIMER: {
// wait (blocking) for next message // wait (blocking) for next message
Message msg = itsMultiBus.getMessage(); Message msg;
LOG_DEBUG_STR(..); if (!itsMsgQueue->getMessage(msg)) {
LOG_FATAL_STR("Wow, lost connection with message bus");
GCFScheduler::instance()->stop(); // TODO better solution
}
if (!itsOTDBconn->connect()) { if (!itsOTDBconn->connect()) {
LOG_ERROR("Lost connection with OTDB, starting reconnect cycle"); LOG_ERROR("Lost connection with OTDB, starting reconnect cycle");
delete itsOTDBconn; delete itsOTDBconn;
itsOTDBconn = 0; itsOTDBconn = 0;
itsMultiBus.nack(); itsMsgQueue->nack(msg);
TRAN (Feedback::connect2OTDB_state); TRAN (Feedback::connect2OTDB_state);
return (GCFEvent::HANDLED); return (GCFEvent::HANDLED);
} }
// Yeah, still connected. // Yeah, still connected.
string content = msg.content(); if (passKVpairsToOTDB(msg.getContent())) {
if (passKVpairsToOTDB(content)) { itsMsgQueue->ack(msg);
itsMultiBus.ack(); LOG_DEBUG_STR("@@@");
LOG_DEBUG_STR(...);
} }
else { else {
itsMultibus.reject(); itsMsgQueue->reject(msg);
LOG_ERROR_STR(...); LOG_ERROR_STR("@@@");
} }
itsTimer->setTimer(0.0); itsTimer->setTimer(0.0);
} break; } break;
...@@ -182,12 +202,12 @@ GCFEvent::TResult Feedback::operational_state(GCFEvent& event, GCFPortInterface& ...@@ -182,12 +202,12 @@ GCFEvent::TResult Feedback::operational_state(GCFEvent& event, GCFPortInterface&
// //
bool Feedback::passKVpairsToOTDB(const string& content) bool Feedback::passKVpairsToOTDB(const string& content)
{ {
int obsID(getObservationNr(getName())); // TODO int obsID; // (getObservationNr(getName())); // TODO
TreeValue tv(itsOTDBconn, obsID); TreeValue tv(itsOTDBconn, obsID);
// read parameterset // read parameterset
ParameterSet metadata; ParameterSet metadata;
metadata.adoptString(content); metadata.adoptBuffer(content);
// Loop over the parameterset and send the information to the SAS database // Loop over the parameterset and send the information to the SAS database
// During the transition phase from parameter-based to record-based storage in OTDB the // During the transition phase from parameter-based to record-based storage in OTDB the
...@@ -234,5 +254,5 @@ bool Feedback::passKVpairsToOTDB(const string& content) ...@@ -234,5 +254,5 @@ bool Feedback::passKVpairsToOTDB(const string& content)
} // namespace Feedback } // namespace SAS
} // namespace LOFAR } // namespace LOFAR
//# FeedbackService.h: Pass key-value pairs to the database. //# Feedback.h: Pass key-value pairs to the database.
//# //#
//# Copyright (C) 2015 //# Copyright (C) 2015
//# ASTRON (Netherlands Foundation for Research in Astronomy) //# ASTRON (Netherlands Foundation for Research in Astronomy)
...@@ -23,36 +23,37 @@ ...@@ -23,36 +23,37 @@
#ifndef FEEDBACK_SERVICE_H_ #ifndef FEEDBACK_SERVICE_H_
#define FEEDBACK_SERVICE_H_ #define FEEDBACK_SERVICE_H_
// \file FeedbackService.h // \file Feedback.h
// Pass key-value pairs to the database. // Pass key-value pairs to the database.
//# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Never #include <config.h> or #include <lofar_config.h> in a header file!
//# Includes //# Includes
#include <MACIO/GCF_Event.h> #include <MACIO/GCF_Event.h>
#include <GCF/TM/GCF_Control.h> #include <GCF/TM/GCF_Control.h>
#include <OTDB/OTDBconnection.h>
#include <MessageBus/MsgBus.h> #include <MessageBus/MsgBus.h>
// Avoid 'using namespace' in headerfiles // Avoid 'using namespace' in headerfiles
namespace LOFAR { namespace LOFAR {
namespace Feedback { namespace SAS {
using MACIO::GCFEvent; using MACIO::GCFEvent;
using GCF::TM::GCFTimerPort; using GCF::TM::GCFTimerPort;
using GCF::TM::GCFPort; using GCF::TM::GCFPort;
using GCF::TM::GCFPortInterface; using GCF::TM::GCFPortInterface;
using GCF::TM::GCFTask; using GCF::TM::GCFTask;
using OTDB::OTDBconnection;
// \addtogroup package // \addtogroup package
// @{ // @{
class FeedbackService : public GCFTask; class Feedback : public GCFTask
{ {
public: public:
FeedbackService(); Feedback();
explicit FeedbackService (one_parameter); ~Feedback();
virtual/*?*/ ~FeedbackService();
// Interrupthandler for switching to finishingstate when exiting the program. // Interrupthandler for switching to finishingstate when exiting the program.
static void sigintHandler (int signum); static void sigintHandler (int signum);
...@@ -61,32 +62,21 @@ public: ...@@ -61,32 +62,21 @@ public:
private: private:
GCFEvent::TResult connect2OTDB_state(GCFEvent& e, GCFPortInterface& p); GCFEvent::TResult connect2OTDB_state(GCFEvent& e, GCFPortInterface& p);
GCFEvent::TResult operational_state (GCFEvent& e, GCFPortInterface& p); GCFEvent::TResult operational_state (GCFEvent& e, GCFPortInterface& p);
bool passKVpairsToOTDB(const string& content);
// Copying is not allowed // Copying is not allowed
FeedbackService(const FeedbackService& that) {}; Feedback(const Feedback& that);
FeedbackService& operator=(const FeedbackService& that) {}; Feedback& operator=(const Feedback& that);
//# --- Datamembers --- //# --- Datamembers ---
GCFTimerPort* itsTimer; // generic timer GCFTimerPort* itsTimer; // generic timer
OTDBConnection* itsOTDBconn; // connection with OTDB OTDBconnection* itsOTDBconn; // connection with OTDB
MultiBus itsMultiBus; // session with Qpid. FromBus* itsMsgQueue; // session with Qpid.
}; };
//# --- Inline functions ---
// ... example
//#
//# operator<<
//#
inline ostream& operator<< (ostream& os, const FeedbackService& aFeedbackService)
{
return (c.print(os));
}
// @} // @}
} // namespace Feedback } // namespace SAS
} // namespace LOFAR } // namespace LOFAR
#endif #endif
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
#include <lofar_config.h> #include <lofar_config.h>
#include <Common/LofarLogger.h> #include <Common/LofarLogger.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include <GCF/TM/GCF_Control.h>
#include "Feedback.h" #include "Feedback.h"
using namespace LOFAR::GCF::TM; using namespace LOFAR::GCF::TM;
using namespace LOFAR::CEPCU;
using namespace LOFAR; using namespace LOFAR;
using namespace LOFAR::SAS;
// Use a terminate handler that can produce a backtrace. // Use a terminate handler that can produce a backtrace.
Exception::TerminateHandler t(Exception::terminate); Exception::TerminateHandler t(Exception::terminate);
...@@ -38,7 +39,7 @@ int main(int argc, char* argv[]) ...@@ -38,7 +39,7 @@ int main(int argc, char* argv[])
try { try {
GCFScheduler::instance()->init(argc, argv, argv[1]); GCFScheduler::instance()->init(argc, argv, argv[1]);
Feedback fbTask(argv[1]); Feedback fbTask;
fbTask.start(); // make initial transition fbTask.start(); // make initial transition
GCFScheduler::instance()->run(); // until stop was called. GCFScheduler::instance()->run(); // until stop was called.
......
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