#include <EventFilter/Utilities/interface/WebGUI.h>
Definition at line 27 of file WebGUI.h.
typedef xdata::UnsignedInteger32 evf::WebGUI::Counter_t |
typedef std::vector<std::pair<std::string,Counter_t*> > evf::WebGUI::CounterVec_t |
typedef const std::string evf::WebGUI::CString_t |
typedef xgi::Input evf::WebGUI::Input_t |
typedef xgi::Output evf::WebGUI::Output_t |
typedef xdata::Serializable evf::WebGUI::Param_t |
typedef std::vector<std::pair<std::string,Param_t*> > evf::WebGUI::ParamVec_t |
typedef std::vector<std::pair<std::string,void*> > evf::WebGUI::UpdateVec_t |
WebGUI::WebGUI | ( | xdaq::Application * | app, | |
StateMachine * | fsm | |||
) |
Definition at line 32 of file WebGUI.cc.
References app_, appInfoSpace(), appInfoSpace_, css(), debugWebPage(), defaultWebPage(), itemGroupListener_, largeAppIcon_, monInfoSpace(), monInfoSpace_, sourceId_, and urn_.
00033 : app_(app) 00034 , fsm_(fsm) 00035 , log_(app->getApplicationContext()->getLogger()) 00036 , appInfoSpace_(0) 00037 , monInfoSpace_(0) 00038 , itemGroupListener_(0) 00039 , parametersExported_(false) 00040 , countersAddedToParams_(false) 00041 , largeAppIcon_("/evf/images/rbicon.jpg") 00042 , smallAppIcon_("/evf/images/rbicon.jpg") 00043 , smallDbgIcon_("/evf/images/bugicon.jpg") 00044 , smallCtmIcon_("/evf/images/spoticon.jpg") 00045 , hyperDAQIcon_("/hyperdaq/images/HyperDAQ.jpg") 00046 { 00047 // initialize application information 00048 string appClass=app_->getApplicationDescriptor()->getClassName(); 00049 unsigned int instance=app_->getApplicationDescriptor()->getInstance(); 00050 stringstream oss; 00051 oss<<appClass<<instance; 00052 00053 sourceId_=oss.str(); 00054 urn_ ="/"+app_->getApplicationDescriptor()->getURN(); 00055 00056 std::stringstream oss2; 00057 oss2<<"urn:xdaq-monitorable-"<<appClass; 00058 string monInfoSpaceName=oss2.str(); 00059 toolbox::net::URN urn = app_->createQualifiedInfoSpace(monInfoSpaceName); 00060 00061 appInfoSpace_=app_->getApplicationInfoSpace(); 00062 monInfoSpace_=xdata::getInfoSpaceFactory()->get(urn.toString()); 00063 app_->getApplicationDescriptor()->setAttribute("icon",largeAppIcon_); 00064 00065 // bind xgi callbacks 00066 xgi::bind(this,&WebGUI::defaultWebPage,"defaultWebPage"); 00067 xgi::bind(this,&WebGUI::debugWebPage, "debugWebPage"); 00068 xgi::bind(this,&WebGUI::css, "styles.css"); 00069 00070 // set itemGroupListener 00071 itemGroupListener_ = dynamic_cast<xdata::ActionListener*>(app_); 00072 if (0!=itemGroupListener_) { 00073 appInfoSpace()->addGroupRetrieveListener(itemGroupListener_); 00074 monInfoSpace()->addGroupRetrieveListener(itemGroupListener_); 00075 } 00076 }
void WebGUI::addCountersToParams | ( | ) | [private] |
Definition at line 291 of file WebGUI.cc.
References countersAddedToParams_, debugCounters_, debugParams_, first, i, monitorCounters_, monitorParams_, edm::second(), standardCounters_, and standardParams_.
Referenced by exportParameters().
00292 { 00293 if (countersAddedToParams_) return; 00294 00295 // standard counters 00296 for (unsigned int i=0;i<standardCounters_.size();i++) { 00297 standardParams_.push_back(make_pair(standardCounters_[i].first, 00298 standardCounters_[i].second)); 00299 } 00300 // monitor counters 00301 for (unsigned int i=0;i<monitorCounters_.size();i++) { 00302 monitorParams_.push_back(make_pair(monitorCounters_[i].first, 00303 monitorCounters_[i].second)); 00304 } 00305 // debug counters 00306 for (unsigned int i=0;i<debugCounters_.size();i++) { 00307 debugParams_.push_back(make_pair(debugCounters_[i].first, 00308 debugCounters_[i].second)); 00309 } 00310 countersAddedToParams_=true; 00311 }
Definition at line 189 of file WebGUI.cc.
References countersAddedToParams_, debugCounters_, log_, and sourceId_.
Referenced by evf::FUResourceBroker::exportParameters().
00190 { 00191 if (countersAddedToParams_) { 00192 LOG4CPLUS_ERROR(log_,"can't add debug counter '"<<name 00193 <<"' to WebGUI of "<<sourceId_); 00194 } 00195 debugCounters_.push_back(make_pair(name,counter)); 00196 }
Definition at line 156 of file WebGUI.cc.
References debugParams_, log_, and parametersExported_.
00157 { 00158 if (parametersExported_) { 00159 LOG4CPLUS_ERROR(log_,"Failed to add debug parameter '"<<name<<"'."); 00160 return; 00161 } 00162 debugParams_.push_back(make_pair(name,param)); 00163 }
Definition at line 238 of file WebGUI.cc.
References appInfoSpace(), Exception, isMonitorParam(), log_, monInfoSpace(), and parametersExported_.
Referenced by evf::FUResourceBroker::exportParameters(), and evf::BU::exportParameters().
00239 { 00240 if (!parametersExported_) { 00241 LOG4CPLUS_ERROR(log_,"Can't add ItemChangedListener for parameter '"<<name 00242 <<"' before WebGUI::exportParameters() is called."); 00243 return; 00244 } 00245 00246 try { 00247 appInfoSpace()->addItemChangedListener(name,l); 00248 } 00249 catch (xcept::Exception) { 00250 LOG4CPLUS_ERROR(log_,"failed to add ItemChangedListener to " 00251 <<"application infospace for parameter '"<<name<<"'."); 00252 } 00253 00254 if (isMonitorParam(name)) { 00255 try { 00256 monInfoSpace()->addItemChangedListener(name,l); 00257 } 00258 catch (xcept::Exception) { 00259 LOG4CPLUS_ERROR(log_,"failed to add ItemChangedListener to " 00260 <<"monitor infospace for parameter '"<<name<<"'."); 00261 } 00262 } 00263 00264 }
Definition at line 178 of file WebGUI.cc.
References countersAddedToParams_, log_, monitorCounters_, and sourceId_.
Referenced by evf::FUResourceBroker::exportParameters(), and evf::BU::exportParameters().
00179 { 00180 if (countersAddedToParams_) { 00181 LOG4CPLUS_ERROR(log_,"can't add monitor counter '"<<name 00182 <<"' to WebGUI of "<<sourceId_); 00183 } 00184 monitorCounters_.push_back(make_pair(name,counter)); 00185 }
Definition at line 145 of file WebGUI.cc.
References log_, monitorParams_, and parametersExported_.
Referenced by evf::FUResourceBroker::exportParameters(), and evf::BU::exportParameters().
00146 { 00147 if (parametersExported_) { 00148 LOG4CPLUS_ERROR(log_,"Failed to add monitor parameter '"<<name<<"'."); 00149 return; 00150 } 00151 monitorParams_.push_back(make_pair(name,param)); 00152 }
void WebGUI::addParamsToInfoSpace | ( | const ParamVec_t & | params, | |
xdata::InfoSpace * | infoSpace | |||
) | [private] |
Definition at line 272 of file WebGUI.cc.
References e, Exception, i, log_, name, and value.
Referenced by exportParameters().
00274 { 00275 for (unsigned int i=0;i<params.size();i++) { 00276 string name =params[i].first; 00277 Param_t* value=params[i].second; 00278 try { 00279 infoSpace->fireItemAvailable(name,value); 00280 } 00281 catch (xcept::Exception &e) { 00282 LOG4CPLUS_ERROR(log_,"Can't add parameter '"<<name<<"' to info space '" 00283 <<infoSpace->name()<<"': " 00284 <<xcept::stdformat_exception_history(e)); 00285 } 00286 } 00287 }
Definition at line 167 of file WebGUI.cc.
References countersAddedToParams_, log_, sourceId_, and standardCounters_.
00168 { 00169 if (countersAddedToParams_) { 00170 LOG4CPLUS_ERROR(log_,"can't add standard counter '"<<name 00171 <<"' to WebGUI of "<<sourceId_); 00172 } 00173 standardCounters_.push_back(make_pair(name,counter)); 00174 }
Definition at line 134 of file WebGUI.cc.
References log_, parametersExported_, and standardParams_.
Referenced by evf::FUResourceBroker::exportParameters(), and evf::BU::exportParameters().
00135 { 00136 if (parametersExported_) { 00137 LOG4CPLUS_ERROR(log_,"Failed to add standard parameter '"<<name<<"'."); 00138 return; 00139 } 00140 standardParams_.push_back(make_pair(name,param)); 00141 }
xdata::InfoSpace* evf::WebGUI::appInfoSpace | ( | ) | [inline] |
Definition at line 71 of file WebGUI.h.
References appInfoSpace_.
Referenced by addItemChangedListener(), exportParameters(), updateParams(), and WebGUI().
00071 { return appInfoSpace_; }
void WebGUI::css | ( | Input_t * | in, | |
Output_t * | out | |||
) | throw (XgiException_t) |
void WebGUI::debugWebPage | ( | Input_t * | in, | |
Output_t * | out | |||
) | throw (XgiException_t) |
Definition at line 110 of file WebGUI.cc.
References alivecheck_mergeAndRegister::body, debugParams_, lat::endl(), htmlHead(), htmlHeadline(), htmlTable(), in, out, sourceId_, and updateParams().
Referenced by WebGUI().
00111 { 00112 updateParams(); 00113 00114 *out<<"<html>"<<endl; 00115 htmlHead(in,out,sourceId_+" [DEBUG]"); 00116 *out<<body()<<endl; 00117 htmlHeadline(in,out); 00118 *out<<"<table cellpadding=\"25\"><tr valign=\"top\"><td>"<<endl; 00119 htmlTable(in,out,"Debug Parameters",debugParams_); 00120 *out<<"</td></tr></table>"<<endl; 00121 *out<<body()<<endl<<"</html>"<<endl; 00122 return; 00123 }
void WebGUI::defaultWebPage | ( | Input_t * | in, | |
Output_t * | out | |||
) | throw (XgiException_t) |
Definition at line 91 of file WebGUI.cc.
References alivecheck_mergeAndRegister::body, lat::endl(), htmlHead(), htmlHeadline(), htmlTable(), in, monitorParams_, out, sourceId_, standardParams_, and updateParams().
Referenced by WebGUI().
00092 { 00093 updateParams(); 00094 00095 *out<<"<html>"<<endl; 00096 htmlHead(in,out,sourceId_); 00097 *out<<body()<<endl; 00098 htmlHeadline(in,out); 00099 *out<<"<table cellpadding=\"25\"><tr valign=\"top\"><td>"<<endl; 00100 htmlTable(in,out,"Standard Parameters",standardParams_); 00101 *out<<"</td><td>"<<endl; 00102 htmlTable(in,out,"Monitored Parameters",monitorParams_); 00103 *out<<"</td></tr></table>"<<endl; 00104 *out<<body()<<endl<<"</html>"<<endl; 00105 return; 00106 }
void WebGUI::exportParameters | ( | ) |
Definition at line 200 of file WebGUI.cc.
References addCountersToParams(), addParamsToInfoSpace(), appInfoSpace(), countersAddedToParams_, debugParams_, monInfoSpace(), monitorParams_, parametersExported_, and standardParams_.
Referenced by evf::FUResourceBroker::exportParameters(), and evf::BU::exportParameters().
00201 { 00202 if (parametersExported_) return; 00203 00204 if (!countersAddedToParams_) addCountersToParams(); 00205 00206 addParamsToInfoSpace(standardParams_,appInfoSpace()); 00207 addParamsToInfoSpace(monitorParams_, appInfoSpace()); 00208 addParamsToInfoSpace(debugParams_, appInfoSpace()); 00209 00210 addParamsToInfoSpace(monitorParams_,monInfoSpace()); 00211 00212 parametersExported_=true; 00213 }
Definition at line 365 of file WebGUI.cc.
References lat::endl(), link(), indexGen::title, and urn_.
Referenced by evf::FUResourceBroker::customWebPage(), debugWebPage(), and defaultWebPage().
00366 { 00367 *out<<head()<<endl<<cgicc::link().set("type","text/css") 00368 .set("rel","stylesheet") 00369 .set("href",urn_+"/styles.css") 00370 <<endl<<title(pageTitle.c_str())<<endl<<head()<<endl; 00371 }
Definition at line 375 of file WebGUI.cc.
References a, b, lat::endl(), fsm_, hyperDAQIcon_, indexGen::img, largeAppIcon_, smallAppIcon_, smallCtmIcon_, smallDbgIcon_, sourceId_, evf::StateMachine::stateName(), edm::table, getDQMSummary::td, and urn_.
Referenced by evf::FUResourceBroker::customWebPage(), debugWebPage(), and defaultWebPage().
00376 { 00377 string stateName=fsm_->stateName()->toString(); 00378 00379 *out<<table().set("border","0").set("width","100%")<<endl 00380 <<tr()<<td().set("align","left")<<endl 00381 <<img().set("align","middle").set("src",largeAppIcon_) 00382 .set("alt","main") .set("width","64") 00383 .set("height","64") .set("border","") 00384 <<endl 00385 <<b()<<sourceId_<<" "<<stateName<<b()<<endl 00386 <<td()<<endl 00387 <<td().set("width","32")<<endl 00388 <<a().set("href","/urn:xdaq-application:lid=3") 00389 <<img().set("align","middle").set("src",hyperDAQIcon_) 00390 .set("alt","HyperDAQ").set("width","32") 00391 .set("height","32") .set("border","") 00392 <<a() 00393 <<td()<<endl 00394 <<td().set("width","32")<<td() 00395 <<td().set("width","32") 00396 <<a().set("href",urn_+"/defaultWebPage") 00397 <<img().set("align","middle").set("src",smallAppIcon_) 00398 .set("alt","Debug") .set("width","32") 00399 .set("height","32") .set("border","") 00400 <<a() 00401 <<td()<<endl 00402 <<td().set("width","32")<<td() 00403 <<td().set("width","32") 00404 <<a().set("href",urn_+"/debugWebPage") 00405 <<img().set("align","middle").set("src",smallDbgIcon_) 00406 .set("alt","Debug") .set("width","32") 00407 .set("height","32") .set("border","") 00408 <<a() 00409 <<td()<<endl 00410 <<td().set("width","32")<<td() 00411 <<td().set("width","32") 00412 <<a().set("href",urn_+"/customWebPage") 00413 <<img().set("align","middle").set("src",smallCtmIcon_) 00414 .set("alt","Debug") .set("width","32") 00415 .set("height","32") .set("border","") 00416 <<a() 00417 <<td()<<tr()<<table()<<endl; 00418 *out<<hr()<<endl; 00419 }
void WebGUI::htmlTable | ( | Input_t * | in, | |
Output_t * | out, | |||
CString_t & | title, | |||
const ParamVec_t & | params | |||
) |
Definition at line 335 of file WebGUI.cc.
References e, lat::endl(), Exception, first, i, edm::table, and getDQMSummary::td.
Referenced by debugWebPage(), and defaultWebPage().
00337 { 00338 *out<<table().set("frame","void").set("rules","rows") 00339 .set("class","modules").set("width","300")<<endl 00340 <<tr()<<th(title).set("colspan","2")<<tr()<<endl 00341 <<tr() 00342 <<th("Parameter").set("align","left") 00343 <<th("Value").set("align","right") 00344 <<tr() 00345 <<endl; 00346 00347 for (unsigned int i=0;i<params.size();i++) { 00348 string valueAsString; 00349 try { 00350 valueAsString = params[i].second->toString(); 00351 } 00352 catch (xcept::Exception& e) { 00353 valueAsString = e.what(); 00354 } 00355 *out<<tr() 00356 <<td(params[i].first).set("align","left") 00357 <<td(valueAsString).set("align","right") 00358 <<tr()<<endl; 00359 } 00360 *out<<table()<<endl; 00361 }
Definition at line 315 of file WebGUI.cc.
References it, and monitorParams_.
Referenced by addItemChangedListener().
00316 { 00317 ParamVec_t::const_iterator it; 00318 for (it=monitorParams_.begin();it!=monitorParams_.end();++it) 00319 if (it->first==name) return true; 00320 return false; 00321 }
xdata::InfoSpace* evf::WebGUI::monInfoSpace | ( | ) | [inline] |
Definition at line 72 of file WebGUI.h.
References monInfoSpace_.
Referenced by evf::BU::actionPerformed(), addItemChangedListener(), exportParameters(), evf::FUResourceBroker::monitoring(), evf::BU::monitoring(), and WebGUI().
00072 { return monInfoSpace_; }
void WebGUI::resetCounters | ( | ) |
Definition at line 217 of file WebGUI.cc.
References counter(), debugCounters_, i, monitorCounters_, and standardCounters_.
Referenced by evf::FUResourceBroker::reset(), and evf::BU::reset().
00218 { 00219 // standard counters 00220 for (unsigned int i=0;i<standardCounters_.size();i++) { 00221 Counter_t* counter=standardCounters_[i].second; 00222 *counter=0; 00223 } 00224 // monitor counters 00225 for (unsigned int i=0;i<monitorCounters_.size();i++) { 00226 Counter_t* counter=monitorCounters_[i].second; 00227 *counter=0; 00228 } 00229 // debug counters 00230 for (unsigned int i=0;i<debugCounters_.size();i++) { 00231 Counter_t* counter=debugCounters_[i].second; 00232 *counter=0; 00233 } 00234 }
Definition at line 74 of file WebGUI.h.
References largeAppIcon_.
Referenced by evf::BU::BU().
00074 { largeAppIcon_=icon; }
Definition at line 75 of file WebGUI.h.
References smallAppIcon_.
Referenced by evf::BU::BU().
00075 { smallAppIcon_=icon; }
void WebGUI::updateParams | ( | ) | [private] |
Definition at line 325 of file WebGUI.cc.
References appInfoSpace(), and itemGroupListener_.
Referenced by debugWebPage(), and defaultWebPage().
00326 { 00327 if (0!=itemGroupListener_) { 00328 std::list<std::string> emptyList; 00329 appInfoSpace()->fireItemGroupRetrieve(emptyList,itemGroupListener_); 00330 } 00331 }
xdaq::Application* evf::WebGUI::app_ [private] |
xdata::InfoSpace* evf::WebGUI::appInfoSpace_ [private] |
bool evf::WebGUI::countersAddedToParams_ [private] |
Definition at line 122 of file WebGUI.h.
Referenced by addCountersToParams(), addDebugCounter(), addMonitorCounter(), addStandardCounter(), and exportParameters().
Css evf::WebGUI::css_ [private] |
CounterVec_t evf::WebGUI::debugCounters_ [private] |
Definition at line 119 of file WebGUI.h.
Referenced by addCountersToParams(), addDebugCounter(), and resetCounters().
ParamVec_t evf::WebGUI::debugParams_ [private] |
Definition at line 116 of file WebGUI.h.
Referenced by addCountersToParams(), addDebugParam(), debugWebPage(), and exportParameters().
StateMachine* evf::WebGUI::fsm_ [private] |
std::string evf::WebGUI::hyperDAQIcon_ [private] |
xdata::ActionListener* evf::WebGUI::itemGroupListener_ [private] |
std::string evf::WebGUI::largeAppIcon_ [private] |
Definition at line 124 of file WebGUI.h.
Referenced by htmlHeadline(), setLargeAppIcon(), and WebGUI().
Logger evf::WebGUI::log_ [private] |
Definition at line 104 of file WebGUI.h.
Referenced by addDebugCounter(), addDebugParam(), addItemChangedListener(), addMonitorCounter(), addMonitorParam(), addParamsToInfoSpace(), addStandardCounter(), and addStandardParam().
xdata::InfoSpace* evf::WebGUI::monInfoSpace_ [private] |
CounterVec_t evf::WebGUI::monitorCounters_ [private] |
Definition at line 118 of file WebGUI.h.
Referenced by addCountersToParams(), addMonitorCounter(), and resetCounters().
ParamVec_t evf::WebGUI::monitorParams_ [private] |
Definition at line 115 of file WebGUI.h.
Referenced by addCountersToParams(), addMonitorParam(), defaultWebPage(), exportParameters(), and isMonitorParam().
bool evf::WebGUI::parametersExported_ [private] |
Definition at line 121 of file WebGUI.h.
Referenced by addDebugParam(), addItemChangedListener(), addMonitorParam(), addStandardParam(), and exportParameters().
std::string evf::WebGUI::smallAppIcon_ [private] |
std::string evf::WebGUI::smallCtmIcon_ [private] |
std::string evf::WebGUI::smallDbgIcon_ [private] |
std::string evf::WebGUI::sourceId_ [private] |
Definition at line 106 of file WebGUI.h.
Referenced by addDebugCounter(), addMonitorCounter(), addStandardCounter(), debugWebPage(), defaultWebPage(), htmlHeadline(), and WebGUI().
CounterVec_t evf::WebGUI::standardCounters_ [private] |
Definition at line 117 of file WebGUI.h.
Referenced by addCountersToParams(), addStandardCounter(), and resetCounters().
ParamVec_t evf::WebGUI::standardParams_ [private] |
Definition at line 114 of file WebGUI.h.
Referenced by addCountersToParams(), addStandardParam(), defaultWebPage(), and exportParameters().
std::string evf::WebGUI::urn_ [private] |