#include <SMProxyServer.h>
Public Member Functions | |
SMProxyServer (xdaq::ApplicationStub *s) | |
Private Types | |
typedef stor::ConsumerUtils < Configuration, EventQueueCollection > | ConsumerUtils_t |
Private Member Functions | |
void | bindConsumerCallbacks () |
void | bindStateMachineCallbacks () |
void | bindWebInterfaceCallbacks () |
void | consumerStatisticsWebPage (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
void | css (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception) |
void | dataRetrieverWebPage (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
void | defaultWebPage (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception) |
void | dqmEventStatisticsWebPage (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception) |
xoap::MessageReference | handleFSMSoapMessage (xoap::MessageReference) throw ( xoap::exception::Exception ) |
void | initializeSharedResources () |
SMProxyServer & | operator= (SMProxyServer const &) |
void | processConsumerEventRequest (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
void | processConsumerHeaderRequest (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
void | processConsumerRegistrationRequest (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
void | processDQMConsumerEventRequest (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
void | processDQMConsumerRegistrationRequest (xgi::Input *in, xgi::Output *out) throw ( xgi::exception::Exception ) |
SMProxyServer (SMProxyServer const &) | |
void | startWorkerThreads () |
Private Attributes | |
boost::scoped_ptr < ConsumerUtils_t > | consumerUtils_ |
boost::scoped_ptr < SMPSWebPageHelper > | smpsWebPageHelper_ |
StateMachinePtr | stateMachine_ |
Main class of the SMProxyServer XDAQ application
Definition at line 31 of file SMProxyServer.h.
typedef stor::ConsumerUtils<Configuration,EventQueueCollection> smproxy::SMProxyServer::ConsumerUtils_t [private] |
Definition at line 140 of file SMProxyServer.h.
SMProxyServer::SMProxyServer | ( | xdaq::ApplicationStub * | s | ) |
Definition at line 24 of file SMProxyServer.cc.
References bindConsumerCallbacks(), bindStateMachineCallbacks(), bindWebInterfaceCallbacks(), alignCSCRings::e, exception, Exception, initializeSharedResources(), and startWorkerThreads().
: xdaq::Application(s) { LOG4CPLUS_INFO(this->getApplicationLogger(),"Making SMProxyServer"); // bind all callback functions bindStateMachineCallbacks(); bindWebInterfaceCallbacks(); bindConsumerCallbacks(); std::string errorMsg = "Exception in SMProxyServer constructor: "; try { initializeSharedResources(); } catch(std::exception &e) { errorMsg += e.what(); LOG4CPLUS_FATAL( getApplicationLogger(), e.what() ); XCEPT_RAISE( exception::Exception, e.what() ); } catch(...) { errorMsg += "unknown exception"; LOG4CPLUS_FATAL( getApplicationLogger(), errorMsg ); XCEPT_RAISE( exception::Exception, errorMsg ); } startWorkerThreads(); }
smproxy::SMProxyServer::SMProxyServer | ( | SMProxyServer const & | ) | [private] |
void SMProxyServer::bindConsumerCallbacks | ( | ) | [private] |
Bind callbacks for consumers
Definition at line 87 of file SMProxyServer.cc.
References processConsumerEventRequest(), processConsumerHeaderRequest(), processConsumerRegistrationRequest(), processDQMConsumerEventRequest(), and processDQMConsumerRegistrationRequest().
Referenced by SMProxyServer().
{ // event consumers xgi::bind( this, &SMProxyServer::processConsumerRegistrationRequest, "registerConsumer" ); xgi::bind( this, &SMProxyServer::processConsumerHeaderRequest, "getregdata" ); xgi::bind( this, &SMProxyServer::processConsumerEventRequest, "geteventdata" ); // dqm event consumers xgi::bind(this,&SMProxyServer::processDQMConsumerRegistrationRequest, "registerDQMConsumer"); xgi::bind(this,&SMProxyServer::processDQMConsumerEventRequest, "getDQMeventdata"); }
void SMProxyServer::bindStateMachineCallbacks | ( | ) | [private] |
Bind callbacks for state machine SOAP messages
Definition at line 56 of file SMProxyServer.cc.
References handleFSMSoapMessage().
Referenced by SMProxyServer().
{ xoap::bind( this, &SMProxyServer::handleFSMSoapMessage, "Configure", XDAQ_NS_URI ); xoap::bind( this, &SMProxyServer::handleFSMSoapMessage, "Enable", XDAQ_NS_URI ); xoap::bind( this, &SMProxyServer::handleFSMSoapMessage, "Stop", XDAQ_NS_URI ); xoap::bind( this, &SMProxyServer::handleFSMSoapMessage, "Halt", XDAQ_NS_URI ); }
void SMProxyServer::bindWebInterfaceCallbacks | ( | ) | [private] |
Bind callbacks for web interface
Definition at line 77 of file SMProxyServer.cc.
References consumerStatisticsWebPage(), css(), dataRetrieverWebPage(), defaultWebPage(), and dqmEventStatisticsWebPage().
Referenced by SMProxyServer().
{ xgi::bind(this,&SMProxyServer::css, "styles.css"); xgi::bind(this,&SMProxyServer::defaultWebPage, "Default"); xgi::bind(this,&SMProxyServer::dataRetrieverWebPage, "dataRetriever"); xgi::bind(this,&SMProxyServer::dqmEventStatisticsWebPage,"dqmEventStatistics"); xgi::bind(this,&SMProxyServer::consumerStatisticsWebPage,"consumerStatistics" ); }
void SMProxyServer::consumerStatisticsWebPage | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Webinterface callback creating web page showing the connected consumers
Definition at line 211 of file SMProxyServer.cc.
References alignCSCRings::e, exception, Exception, and dbtoconf::out.
Referenced by bindWebInterfaceCallbacks().
{ std::string err_msg = "Failed to create consumer web page"; try { smpsWebPageHelper_->consumerStatisticsWebPage(out); } catch( std::exception &e ) { err_msg += ": "; err_msg += e.what(); LOG4CPLUS_ERROR( getApplicationLogger(), err_msg ); XCEPT_RAISE( xgi::exception::Exception, err_msg ); } catch(...) { err_msg += ": Unknown exception"; LOG4CPLUS_ERROR( getApplicationLogger(), err_msg ); XCEPT_RAISE( xgi::exception::Exception, err_msg ); } }
void SMProxyServer::css | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw (xgi::exception::Exception) [private] |
Webinterface callback for style sheet
Definition at line 150 of file SMProxyServer.cc.
References recoMuon::in, and dbtoconf::out.
Referenced by bindWebInterfaceCallbacks().
{ smpsWebPageHelper_->css(in,out); }
void SMProxyServer::dataRetrieverWebPage | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Webinterface callback creating web page showing the data retrieval
Definition at line 184 of file SMProxyServer.cc.
References alignCSCRings::e, exception, Exception, and dbtoconf::out.
Referenced by bindWebInterfaceCallbacks().
{ std::string err_msg = "Failed to create data retriever web page"; try { smpsWebPageHelper_->dataRetrieverWebPage(out); } catch( std::exception &e ) { err_msg += ": "; err_msg += e.what(); LOG4CPLUS_ERROR( getApplicationLogger(), err_msg ); XCEPT_RAISE( xgi::exception::Exception, err_msg ); } catch(...) { err_msg += ": Unknown exception"; LOG4CPLUS_ERROR( getApplicationLogger(), err_msg ); XCEPT_RAISE( xgi::exception::Exception, err_msg ); } }
void SMProxyServer::defaultWebPage | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw (xgi::exception::Exception) [private] |
Webinterface callback creating default web page
Definition at line 157 of file SMProxyServer.cc.
References alignCSCRings::e, exception, Exception, and dbtoconf::out.
Referenced by bindWebInterfaceCallbacks().
{ std::string errorMsg = "Failed to create the default webpage"; try { smpsWebPageHelper_->defaultWebPage(out); } catch(std::exception &e) { errorMsg += ": "; errorMsg += e.what(); LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg); XCEPT_RAISE(xgi::exception::Exception, errorMsg); } catch(...) { errorMsg += ": Unknown exception"; LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg); XCEPT_RAISE(xgi::exception::Exception, errorMsg); } }
void SMProxyServer::dqmEventStatisticsWebPage | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw (xgi::exception::Exception) [private] |
Webinterface callback creating web page showing statistics about the processed DQM events.
Definition at line 238 of file SMProxyServer.cc.
References alignCSCRings::e, exception, Exception, and dbtoconf::out.
Referenced by bindWebInterfaceCallbacks().
{ std::string errorMsg = "Failed to create the DQM event statistics webpage"; try { smpsWebPageHelper_->dqmEventStatisticsWebPage(out); } catch(std::exception &e) { errorMsg += ": "; errorMsg += e.what(); LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg); XCEPT_RAISE(xgi::exception::Exception, errorMsg); } catch(...) { errorMsg += ": Unknown exception"; LOG4CPLUS_ERROR(getApplicationLogger(), errorMsg); XCEPT_RAISE(xgi::exception::Exception, errorMsg); } }
xoap::MessageReference SMProxyServer::handleFSMSoapMessage | ( | xoap::MessageReference | msg | ) | throw ( xoap::exception::Exception ) [private] |
Callback for SOAP message containint a state machine event, possibly including new configuration values
Definition at line 269 of file SMProxyServer.cc.
References edmPickEvents::command, evf::soaputils::createFsmSoapResponseMsg(), alignCSCRings::e, exception, Exception, cms::Exception::explainSelf(), evf::soaputils::extractParameters(), and lumiQueryAPI::msg.
Referenced by bindStateMachineCallbacks().
{ std::string errorMsg; xoap::MessageReference returnMsg; try { errorMsg = "Failed to extract FSM event and parameters from SOAP message: "; std::string command = stor::soaputils::extractParameters(msg, this); std::string newState = "unknown"; errorMsg = "Failed to process '" + command + "' state machine event: "; if (command == "Configure") { newState = stateMachine_->processEvent( Configure() ); } else if (command == "Enable") { newState = stateMachine_->processEvent( Enable() ); } else if (command == "Stop") { newState = stateMachine_->processEvent( Stop() ); } else if (command == "Halt") { newState = stateMachine_->processEvent( Halt() ); } else { XCEPT_RAISE(exception::StateMachine, "Received an unknown state machine event '" + command + "'."); } errorMsg = "Failed to create FSM SOAP reply message: "; returnMsg = stor::soaputils::createFsmSoapResponseMsg(command, newState); } catch (cms::Exception& e) { errorMsg += e.explainSelf(); XCEPT_DECLARE(xoap::exception::Exception, sentinelException, errorMsg); stateMachine_->moveToFailedState(sentinelException); } catch (xcept::Exception &e) { XCEPT_DECLARE_NESTED(xoap::exception::Exception, sentinelException, errorMsg, e); stateMachine_->moveToFailedState(sentinelException); } catch (std::exception& e) { errorMsg += e.what(); XCEPT_DECLARE(xoap::exception::Exception, sentinelException, errorMsg); stateMachine_->moveToFailedState(sentinelException); } catch (...) { errorMsg += "Unknown exception"; XCEPT_DECLARE(xoap::exception::Exception, sentinelException, errorMsg); stateMachine_->moveToFailedState(sentinelException); } return returnMsg; }
void SMProxyServer::initializeSharedResources | ( | ) | [private] |
Initialize the shared resources
Definition at line 100 of file SMProxyServer.cc.
References consumerUtils_, smpsWebPageHelper_, and stateMachine_.
Referenced by SMProxyServer().
{ stateMachine_.reset( new StateMachine(this) ); consumerUtils_.reset( new ConsumerUtils_t ( stateMachine_->getConfiguration(), stateMachine_->getRegistrationCollection(), stateMachine_->getRegistrationQueue(), stateMachine_->getInitMsgCollection(), stateMachine_->getEventQueueCollection(), stateMachine_->getDQMEventQueueCollection(), stateMachine_->getStatisticsReporter()->alarmHandler() ) ); smpsWebPageHelper_.reset( new SMPSWebPageHelper( getApplicationDescriptor(), stateMachine_)); }
SMProxyServer& smproxy::SMProxyServer::operator= | ( | SMProxyServer const & | ) | [private] |
void SMProxyServer::processConsumerEventRequest | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Callback handling event consumer event request
Definition at line 355 of file SMProxyServer.cc.
References recoMuon::in, and dbtoconf::out.
Referenced by bindConsumerCallbacks().
{ consumerUtils_->processConsumerEventRequest(in,out); }
void SMProxyServer::processConsumerHeaderRequest | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Callback handling event consumer init message request
Definition at line 347 of file SMProxyServer.cc.
References recoMuon::in, and dbtoconf::out.
Referenced by bindConsumerCallbacks().
{ consumerUtils_->processConsumerHeaderRequest(in,out); }
void SMProxyServer::processConsumerRegistrationRequest | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Callback handling event consumer registration request
Definition at line 339 of file SMProxyServer.cc.
References recoMuon::in, and dbtoconf::out.
Referenced by bindConsumerCallbacks().
{ consumerUtils_->processConsumerRegistrationRequest(in,out); }
void SMProxyServer::processDQMConsumerEventRequest | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Callback handling DQM event consumer DQM event request
Definition at line 371 of file SMProxyServer.cc.
References recoMuon::in, and dbtoconf::out.
Referenced by bindConsumerCallbacks().
{ consumerUtils_->processDQMConsumerEventRequest(in,out); }
void SMProxyServer::processDQMConsumerRegistrationRequest | ( | xgi::Input * | in, |
xgi::Output * | out | ||
) | throw ( xgi::exception::Exception ) [private] |
Callback handling DQM event consumer registration request
Definition at line 363 of file SMProxyServer.cc.
References recoMuon::in, and dbtoconf::out.
Referenced by bindConsumerCallbacks().
{ consumerUtils_->processDQMConsumerRegistrationRequest(in,out); }
void SMProxyServer::startWorkerThreads | ( | ) | [private] |
Create and start all worker threads
Definition at line 119 of file SMProxyServer.cc.
References alignCSCRings::e, exception, Exception, and stateMachine_.
Referenced by SMProxyServer().
{ // Start the workloops try { stateMachine_->getStatisticsReporter()->startWorkLoop("theStatisticsReporter"); } catch(xcept::Exception &e) { stateMachine_->moveToFailedState(e); } catch(std::exception &e) { XCEPT_DECLARE(exception::Exception, sentinelException, e.what()); stateMachine_->moveToFailedState(sentinelException); } catch(...) { std::string errorMsg = "Unknown exception when starting the workloops"; XCEPT_DECLARE(exception::Exception, sentinelException, errorMsg); stateMachine_->moveToFailedState(sentinelException); } }
boost::scoped_ptr<ConsumerUtils_t> smproxy::SMProxyServer::consumerUtils_ [private] |
Definition at line 141 of file SMProxyServer.h.
Referenced by initializeSharedResources().
boost::scoped_ptr<SMPSWebPageHelper> smproxy::SMProxyServer::smpsWebPageHelper_ [private] |
Definition at line 144 of file SMProxyServer.h.
Referenced by initializeSharedResources().
Definition at line 138 of file SMProxyServer.h.
Referenced by initializeSharedResources(), and startWorkerThreads().