Commit 11ceac57 authored by Dainius Simelevicius's avatar Dainius Simelevicius
Browse files

references #137: added support for direct eventing configuration in spotlightocci

parent 868eeb70
......@@ -2,12 +2,12 @@
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2009, CERN. *
* Copyright (C) 2000-2020, CERN. *
* All rights reserved. *
* Authors: J. Gutleber and L. Orsini *
* Authors: J. Gutleber, L. Orsini and D. Simelevicius *
* *
* For the licensing terms see LICENSE. *
* For the list of contributors see CREDITS. *
* For the licensing terms see LICENSE. *
* For the list of contributors see CREDITS. *
*************************************************************************/
#ifndef _sentinel_spotlightocci_Application_h_
......@@ -48,12 +48,12 @@
#include "sentinel/spotlightocci/Repository.h"
namespace sentinel
namespace sentinel
{
namespace spotlightocci
namespace spotlightocci
{
class Application : public xdaq::Application, public xgi::framework::UIManager,
public toolbox::ActionListener,
public toolbox::ActionListener,
public xdata::ActionListener,
public toolbox::task::TimerListener,
public b2in::utils::MessengerCacheListener
......@@ -62,107 +62,85 @@ namespace sentinel
XDAQ_INSTANTIATOR();
Application(xdaq::ApplicationStub* s) ;
Application(xdaq::ApplicationStub* s);
~Application();
void actionPerformed ( xdata::Event& e );
void actionPerformed( toolbox::Event& event );
void actionPerformed ( xdata::Event& e);
void actionPerformed( toolbox::Event& event);
void timeExpired(toolbox::task::TimerEvent& e);
//
// XGI Interface
//
void Default(xgi::Input * in, xgi::Output * out ) ;
/*! Clear exception history
*/
void reset(xgi::Input * in, xgi::Output * out ) ;
/*! View a specific exception referenced by uuid
*/
void view(xgi::Input * in, xgi::Output * out )
;
/*! list all available exceptions
*/
void catalog(xgi::Input * in, xgi::Output * out )
;
void query(xgi::Input*, xgi::Output*)
;
void events(xgi::Input * in, xgi::Output * out )
;
void lastStoredEvents(xgi::Input * in, xgi::Output * out )
;
/*! generate a test exception
*/
void inject(xgi::Input * in, xgi::Output * out )
;
void generate(xgi::Input * in, xgi::Output * out )
;
/*! XGI Interface */
void Default(xgi::Input * in, xgi::Output * out);
/*! Clear exception history */
void reset(xgi::Input * in, xgi::Output * out);
/*! View a specific exception referenced by uuid */
void view(xgi::Input * in, xgi::Output * out);
/*! list all available exceptions */
void catalog(xgi::Input * in, xgi::Output * out);
void query(xgi::Input*, xgi::Output*);
void events(xgi::Input * in, xgi::Output * out);
void lastStoredEvents(xgi::Input * in, xgi::Output * out);
/*! generate a test exception */
void inject(xgi::Input * in, xgi::Output * out);
void generate(xgi::Input * in, xgi::Output * out);
/*! Retrieve list of spotlight database files in the configured path */
/*
void files(xgi::Input * in, xgi::Output * out )
;
void files(xgi::Input * in, xgi::Output * out);
*/
/*! Retrieve list of open databases */
void databases(xgi::Input * in, xgi::Output * out )
;
void databases(xgi::Input * in, xgi::Output * out);
/*! Attach to an additional database file in the configured directory
parameters 'dbname' and 'filename'
*/
void attach(xgi::Input * in, xgi::Output * out )
;
/*! Detach from an attached database
parameter 'dbname'
*/
void detach(xgi::Input * in, xgi::Output * out )
;
//
// B2IN interface
//
void onMessage (toolbox::mem::Reference * msg, xdata::Properties & plist) ;
void attach(xgi::Input * in, xgi::Output * out);
/*! Detach from an attached database parameter 'dbname' */
void detach(xgi::Input * in, xgi::Output * out);
/*! B2IN interface */
void onMessage(toolbox::mem::Reference * msg, xdata::Properties & plist);
void asynchronousExceptionNotification(xcept::Exception& e);
void rearm(xgi::Input * in, xgi::Output * out ) ;
void rearm(xgi::Input * in, xgi::Output * out );
void statisticsTabPage(xgi::Input * in, xgi::Output * out) ;
void statisticsTabPage(xgi::Input * in, xgi::Output * out);
protected:
void refreshSubscriptionsToEventing() ;
void refreshSubscriptionsToEventing();
void loadJEL(const std::string & fname);
void loadOCL(const std::string & fname);
bool applyJEL( xcept::Exception & e);
bool match ( xcept::Exception & e, std::map<std::string, std::string>& filter);
bool applyJEL(xcept::Exception & e);
bool match(xcept::Exception & e, std::map<std::string, std::string>& filter);
std::string mapToAttributeName(const std::string & name);
void mainPage ( xgi::Input * in, xgi::Output * out) ;
void mainPage(xgi::Input * in, xgi::Output * out);
void HotspotTabPage(xgi::Output * out) ;
void JELTabPage(xgi::Output * out) ;
void HotspotTabPage(xgi::Output * out);
void JELTabPage(xgi::Output * out);
private:
toolbox::task::AsynchronousEventDispatcher dispatcher_;
Repository* repository_;
Repository* repository_;
xdata::UnsignedInteger64T exceptionsLostCounter_;
xdata::String topic_;
xdata::Vector<xdata::String> eventings_;
xdata::String subscribeGroup_; // one or more comma separated groups hosting a ws-eventing service for exceptions
xdata::String jelFileName_; // xml file containing junk exception filter rules
xdata::String oclFileName_;
......@@ -175,9 +153,9 @@ namespace sentinel
xdata::UnsignedInteger scatterReadNum_;
b2in::utils::ServiceProxy* b2inEventingProxy_;
xdata::String scanPeriod_;
xdata::String subscribeExpiration_;
b2in::utils::ServiceProxy* b2inEventingProxy_;
xdata::String scanPeriod_;
xdata::String subscribeExpiration_;
std::map<std::string, xdata::Properties> subscriptions_; // indexed by topic
......
......@@ -2,9 +2,9 @@
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2016, CERN. *
* Copyright (C) 2000-2020, CERN. *
* All rights reserved. *
* Authors: J. Gutleber and L. Orsini *
* Authors: J. Gutleber, L. Orsini and D. Simelevicius *
* *
* For the licensing terms see LICENSE. *
* For the list of contributors see CREDITS. *
......@@ -17,11 +17,11 @@
// !!! Edit this line to reflect the latest package version !!!
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MAJOR 3
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MINOR 4
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MAJOR 4
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_MINOR 0
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_VERSION_PATCH 0
// If any previous versions available E.g. #define WORKSUITE_SENTINELSPOTLIGHTOCCI_PREVIOUS_VERSIONS "3.8.0,3.8.1"
#define WORKSUITE_SENTINELSPOTLIGHTOCCI_PREVIOUS_VERSIONS "3.0.3,3.0.4,3.0.5,3.1.0,3.1.1,3.2.0,3.3.0,3.3.1,3.3.2"
#undef WORKSUITE_SENTINELSPOTLIGHTOCCI_PREVIOUS_VERSIONS
//
......
......@@ -2,13 +2,14 @@
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2009, CERN. *
* Copyright (C) 2000-2020, CERN. *
* All rights reserved. *
* Authors: J. Gutleber and L. Orsini *
* Authors: J. Gutleber, L. Orsini and D. Simelevicius *
* *
* For the licensing terms see LICENSE. *
* For the list of contributors see CREDITS. *
* For the licensing terms see LICENSE. *
* For the list of contributors see CREDITS. *
*************************************************************************/
#include <sstream>
#include "cgicc/CgiDefs.h"
#include "cgicc/Cgicc.h"
......@@ -45,7 +46,6 @@
#include "xoap/DOMParserFactory.h"
#include "xoap/DOMParser.h"
#include "xgi/Table.h"
#include "xgi/framework/Method.h"
#include "xcept/tools.h"
......@@ -55,7 +55,6 @@
#include "sentinel/spotlightocci/ExceptionEvent.h"
#include "sentinel/spotlightocci/RevokeEvent.h"
#include "xdata/exdr/Serializer.h"
#include "xdata/InfoSpaceFactory.h"
#include "xdata/exdr/FixedSizeInputStreamBuffer.h"
......@@ -74,6 +73,9 @@ sentinel::spotlightocci::Application::Application(xdaq::ApplicationStub* s)
s->getDescriptor()->setAttribute("icon16x16", "/sentinel/spotlightocci/images/spotlight-occi-icon.png");
s->getDescriptor()->setAttribute("service", "sentinelspotlight2g");
//Direct eventing addresses
this->getApplicationInfoSpace()->fireItemAvailable("eventings", &eventings_);
subscribeGroup_ = "";
this->getApplicationInfoSpace()->fireItemAvailable("subscribeGroup", &subscribeGroup_);
......@@ -573,20 +575,22 @@ void sentinel::spotlightocci::Application::refreshSubscriptionsToEventing()
void sentinel::spotlightocci::Application::timeExpired(toolbox::task::TimerEvent& e)
{
std::string name = e.getTimerTask()->name;
std::string name = e.getTimerTask()->name;
if (name == "discovery-staging")
{
try
{
b2inEventingProxy_->scan();
}
catch (b2in::utils::exception::Exception& e)
if (eventings_.elements() == 0)
{
LOG4CPLUS_FATAL (this->getApplicationLogger(), xcept::stdformat_exception_history(e));
try
{
b2inEventingProxy_->scan();
}
catch (b2in::utils::exception::Exception& e)
{
LOG4CPLUS_FATAL (this->getApplicationLogger(), xcept::stdformat_exception_history(e));
}
}
try
{
this->refreshSubscriptionsToEventing();
......@@ -595,7 +599,6 @@ void sentinel::spotlightocci::Application::timeExpired(toolbox::task::TimerEvent
{
LOG4CPLUS_FATAL (this->getApplicationLogger(), xcept::stdformat_exception_history(e));
}
}
}
......@@ -1231,10 +1234,29 @@ bool sentinel::spotlightocci::Application::match
void sentinel::spotlightocci::Application::actionPerformed( toolbox::Event& event)
{
/* xcept::Exception* newException = new xcept::Exception();
sentinel::utils::Serializer::importFrom (command, *newException);
toolbox::task::EventReference e(new sentinel::spotlight2g::ExceptionEvent(newException,""));
*/
if (event.type() == "urn:xdaq-event:profile-loaded")
{
LOG4CPLUS_DEBUG(this->getApplicationLogger(), "Setting proxy to b2in-eventing services " );
if (eventings_.elements() != 0)
{
for (xdata::Vector<xdata::String>::iterator i = eventings_.begin(); i != eventings_.end(); i++)
{
try
{
LOG4CPLUS_DEBUG(this->getApplicationLogger(), "Adding eventing on " << (*i).toString());
b2inEventingProxy_->addURL(*i);
}
catch(b2in::utils::exception::Exception & e)
{
std::stringstream msg;
msg << "Failed to add b2in-eventing address";
XCEPT_DECLARE_NESTED(sentinel::spotlightocci::exception::Exception, ex, msg.str(),e);
LOG4CPLUS_ERROR (this->getApplicationLogger(), xcept::stdformat_exception_history(ex));
}
}
}
}
if (event.type() == "urn:sentinel-spotlight:ExceptionEvent")
{
......
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