CMS 3D CMS Logo

DQMBaseClient.cc

Go to the documentation of this file.
00001 #include "DQMServices/XdaqCollector/interface/DQMBaseClient.h"
00002 #include "DQMServices/XdaqCollector/interface/Updater.h"
00003 #include "DQMServices/XdaqCollector/interface/Updater.h"
00004 #include "DQMServices/Core/interface/DQMOldReceiver.h"
00005 
00006 #include "xgi/Method.h"
00007 #include "xgi/Utils.h"
00008 
00009 #include <iostream>
00010 using std::cout; using std::endl;
00011 
00012 DQMBaseClient::DQMBaseClient(xdaq::ApplicationStub *s, 
00013                              std::string name, 
00014                              std::string server, 
00015                              int port,
00016                              int reconnect_delay_secs,
00017                              bool actAsServer) 
00018   : dqm::StateMachine(s)
00019 {
00020   contextURL = getApplicationDescriptor()->getContextDescriptor()->getURL();
00021   applicationURL = contextURL + "/" + getApplicationDescriptor()->getURN();
00022 
00023   mui_    = 0;
00024   upd_    = 0;
00025   name_   = name;
00026   server_ = server;
00027   port_   = port;
00028   reconnect_delay_secs_ = reconnect_delay_secs;
00029   actAsServer_ = actAsServer;
00030 
00031   xgi::bind(this, &DQMBaseClient::Default, "Default");
00032   xgi::bind(this, &DQMBaseClient::general, "general");
00033 
00034   dqm::StateMachine::bind("fsm");
00035 
00036   fireConfiguration(name_, server_, port_);
00037 }
00038 
00039 void DQMBaseClient::fireConfiguration(std::string name, std::string server, int port)
00040 {
00041   xdata::InfoSpace *sp = getApplicationInfoSpace();
00042   sp->fireItemAvailable("serverHost",&server_);
00043   sp->fireItemAvailable("serverPort",&port_);
00044   sp->fireItemAvailable("subscribeList",&subs_);
00045   sp->fireItemAvailable("actAsServer",&actAsServer_);
00046   sp->fireItemAvailable("reconnectDelaySecs",&reconnect_delay_secs_);
00047 }
00048 
00049 void DQMBaseClient::Default(xgi::Input * in, xgi::Output * out ) throw (xgi::exception::Exception)
00050 {
00051   *out << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << std::endl;
00052   *out << cgicc::html().set("lang", "en").set("dir","ltr") << std::endl;
00053   std::string url = getApplicationDescriptor()->getContextDescriptor()->getURL() + "/" + getApplicationDescriptor()->getURN();
00054   *out << "<frameset rows=\"300,90%\">" << std::endl;
00055   *out << "  <frame src=\"" << url << "/fsm" << "\">" << std::endl;
00056   *out << "  <frame src=\"" << url << "/general" << "\">" << std::endl;
00057   *out << "</frameset>" << std::endl;
00058   *out << cgicc::html() << std::endl;
00059 }
00060 
00061 void DQMBaseClient::general(xgi::Input * in, xgi::Output * out ) throw (xgi::exception::Exception)
00062 {
00063   *out << "General access to client info " << std::endl;
00064 }
00065 
00066 void DQMBaseClient::configureAction(toolbox::Event::Reference e) 
00067   throw (toolbox::fsm::exception::Exception)
00068 {
00069   cout << "configureAction called " << endl;
00070   if(!mui_)
00071     {
00072       mui_ = new DQMOldReceiver(server_, port_, name_, reconnect_delay_secs_, actAsServer_);
00073     }
00074 #if 0 // FIXME (LAT): Removed as a feature no longer available.
00075   for(unsigned int i = 0; i < subs_.size(); i++)
00076       mui_->subscribe(*((std::string*)subs_.elementAt(i)));
00077 #endif
00078 
00079   configure();
00080 }
00081 
00082 void DQMBaseClient::enableAction(toolbox::Event::Reference e) 
00083     throw (toolbox::fsm::exception::Exception)
00084 {
00085 
00086   if(mui_)
00087     upd_ = new dqm::Updater(mui_);
00088   cout << "enableAction called " << endl;
00089   newRun();
00090 }
00091 
00092     
00093 void DQMBaseClient::suspendAction(toolbox::Event::Reference e) 
00094     throw (toolbox::fsm::exception::Exception)
00095 {
00096   cout << "suspendAction called " << endl;
00097 }
00098 
00099 
00100 void DQMBaseClient::resumeAction(toolbox::Event::Reference e) 
00101     throw (toolbox::fsm::exception::Exception)
00102 {
00103   cout << "resumeAction called " << endl;
00104 }
00105 
00106 
00107 void DQMBaseClient::haltAction(toolbox::Event::Reference e) 
00108     throw (toolbox::fsm::exception::Exception)
00109 {
00110   cout << "haltAction called " << endl;
00111   upd_->setStopped();
00112   delete upd_;
00113   endRun();
00114 }
00115 
00116 void DQMBaseClient::nullAction(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception)
00117 {
00118   //this action has no effect. A warning is issued to this end
00119   LOG4CPLUS_WARN(this->getApplicationLogger(),
00120                     "Null action invoked");
00121 }

Generated on Tue Jun 9 17:34:16 2009 for CMSSW by  doxygen 1.5.4