1 #include "otsdaq-utilities/Visualization/VisualSupervisor.h"
2 #include "otsdaq/DataManager/DataManagerSingleton.h"
3 #include "otsdaq/Macros/BinaryStringMacros.h"
4 #include "otsdaq/RootUtilities/VisualDataManager.h"
5 #include "otsdaq/XmlUtilities/XmlDocument.h"
7 #include <boost/regex.hpp>
8 #include "otsdaq/DataManager/DQMHistosConsumerBase.h"
9 #include "otsdaq/Macros/MessageTools.h"
10 #include "otsdaq/RootUtilities/RootFileExplorer.h"
15 #include <TBranchElement.h>
17 #include <TBufferJSON.h>
20 #include <TDirectory.h>
24 #include <TIterator.h>
31 #include "TBufferFile.h"
37 #include <xdaq/NamespaceURI.h>
47 #define ROOT_BROWSER_PATH __ENV__("ROOT_BROWSER_PATH")
48 #define ROOT_DISPLAY_CONFIG_PATH __ENV__("ROOT_DISPLAY_CONFIG_PATH")
50 #define LIVEDQM_DIR std::string("LIVE_DQM")
51 #define PRE_MADE_ROOT_CFG_DIR std::string("Pre-made Views")
53 #define PRE_MADE_ROOT_CFG_FILE_EXT std::string(".rcfg")
55 #define PREFERENCES_PATH std::string(__ENV__("SERVICE_DATA_PATH")) + "/VisualizerData/"
56 #define PREFERENCES_FILE_EXT ".pref"
58 #define ROOT_VIEWER_PERMISSIONS_THRESHOLD 100
63 #define __MF_SUBJECT__ "Visualizer"
68 #define STDLINE(X, Y) __COUT__ << X
71 VisualSupervisor::VisualSupervisor(xdaq::ApplicationStub* stub)
74 __SUP_COUT__ <<
"Constructor." << __E__;
77 mkdir(((std::string)PREFERENCES_PATH).c_str(), 0755);
78 ROOT::EnableThreadSafety();
80 __SUP_COUT__ <<
"Constructed." << __E__;
84 VisualSupervisor::~VisualSupervisor(
void)
86 __SUP_COUT__ <<
"Destructor." << __E__;
88 __SUP_COUT__ <<
"Destructed." << __E__;
92 void VisualSupervisor::destroy(
void)
94 __SUP_COUT__ <<
"Destroying..." << __E__;
97 if(theStateMachineImplementation_.size() > 1)
99 __SS__ <<
"Not expecting more than one visual data manager!" << __E__;
102 if(theStateMachineImplementation_.size())
103 theStateMachineImplementation_.pop_back();
105 __COUT_WARN__ <<
"No visual data manager was pushed." << __E__;
112 __SUP_COUT__ <<
"Configuring..." << __E__;
114 CoreSupervisorBase::configureInit();
120 theConfigurationManager_->__GET_CONFIG__(
XDAQContextTable)->getTableName() +
121 CorePropertySupervisorBase::getSupervisorConfigurationPath());
123 catch(
const std::runtime_error& e)
125 __SS__ <<
"The link to the Visual Supervisor configuration seems to be broken. "
126 "Please check this path: "
130 CorePropertySupervisorBase::getSupervisorConfigurationPath()
131 << __E__ << __E__ << e.what() << __E__;
136 "/" + theConfigurationManager_->__GET_CONFIG__(
XDAQContextTable)->getTableName() +
137 CorePropertySupervisorBase::getSupervisorConfigurationPath());
143 theDataManager_ = DataManagerSingleton::getInstance<VisualDataManager>(
144 theConfigurationManager_->getNode(
147 CorePropertySupervisorBase::getSupervisorConfigurationPath(),
148 CorePropertySupervisorBase::getSupervisorUID());
150 CoreSupervisorBase::theStateMachineImplementation_.push_back(theDataManager_);
152 __SUP_COUT__ <<
"Done instantiating Visual data manager." << __E__;
155 __SUP_COUT__ <<
"No Visual Supervisor configuration link, so skipping Visual "
156 "data manager instantiation."
160 CoreSupervisorBase::transitionConfiguringFSMs();
162 __SUP_COUT__ <<
"Configured." << __E__;
164 catch(
const std::runtime_error& e)
166 __SS__ <<
"Error with VisualSupervisor::transitionConfiguring(): " << e.what()
168 __COUT_ERR__ << ss.str();
172 theStateMachine_.setErrorMessage(ss.str());
173 throw toolbox::fsm::exception::Exception(
176 "VisualSupervisor::transitionConfiguring" ,
183 void VisualSupervisor::transitionHalting(toolbox::Event::Reference e)
185 __SUP_COUT__ <<
"Halting..." << __E__;
190 __SUP_COUT__ <<
"Halted." << __E__;
199 CorePropertySupervisorBase::setSupervisorProperty(
200 CorePropertySupervisorBase::SUPERVISOR_PROPERTIES.AllowNoLoginRequestTypes,
201 "setUserPreferences | getUserPreferences | getDirectoryContents | getRoot | "
204 CorePropertySupervisorBase::setSupervisorProperty(
205 CorePropertySupervisorBase::SUPERVISOR_PROPERTIES.UserPermissionsThreshold,
206 "*=1 | rootAdminControls=100");
214 CorePropertySupervisorBase::setSupervisorProperty(
215 CorePropertySupervisorBase::SUPERVISOR_PROPERTIES.AutomatedRequestTypes,
216 "getRoot | getEvents");
217 CorePropertySupervisorBase::setSupervisorProperty(
218 CorePropertySupervisorBase::SUPERVISOR_PROPERTIES.NoXmlWhiteSpaceRequestTypes,
219 "getRoot | getEvents");
227 const WebUsers::RequestUserInfo& userInfo)
254 __SUP_COUT__ <<
"Request type: " << requestType << __E__;
258 __SUP_COUT__ << __E__;
263 if(theDataManager_ ==
nullptr)
265 __SS__ <<
"No data manager instantiated." << __E__;
268 __SUP_COUT__ <<
"Getting Raw data and converting to binary string" << __E__;
271 __SUP_COUT__ << __E__;
272 __SUP_SS__ <<
"Raw data visualizion is deprecated!" << __E__;
275 catch(std::exception
const& e)
278 <<
"ERROR! Exception while getting raw data. Incoming exception data..."
280 __SUP_COUT__ << e.what() << __E__;
281 __SUP_COUT__ <<
"End Exception Data" << __E__;
285 __SUP_COUT__ <<
"ERROR! Something went wrong trying to get raw data."
291 catch(
const std::exception& e)
293 __SUP_COUT_ERR__ <<
"Exception message: " << e.what();
298 __SUP_COUT_INFO__ <<
"ERROR! Something went wrong trying to get raw data."
303 requestType ==
"setUserPreferences" &&
304 userInfo.username_ !=
307 __SUP_COUT__ <<
"userInfo.username_: " << userInfo.username_ << __E__;
308 std::string fullPath =
309 (std::string)PREFERENCES_PATH + userInfo.username_ + PREFERENCES_FILE_EXT;
310 __SUP_COUT__ <<
"fullPath: " << fullPath << __E__;
316 std::string autoRefreshPeriod =
319 __SUP_COUT__ <<
"radioSelect: " << radioSelect << __E__;
320 __SUP_COUT__ <<
"autoRefresh: " << autoRefresh << __E__;
321 __SUP_COUT__ <<
"autoHide: " << autoHide << __E__;
322 __SUP_COUT__ <<
"hardRefresh: " << hardRefresh << __E__;
323 __SUP_COUT__ <<
"autoRefreshPeriod: " << autoRefreshPeriod << __E__;
326 FILE* fp = fopen(fullPath.c_str(),
"r");
332 fgets(line, 100, fp);
333 sscanf(line,
"%*s %s", val);
334 if(radioSelect ==
"")
337 fgets(line, 100, fp);
338 sscanf(line,
"%*s %s", val);
339 if(autoRefresh ==
"")
342 fgets(line, 100, fp);
343 sscanf(line,
"%*s %s", val);
347 fgets(line, 100, fp);
348 sscanf(line,
"%*s %s", val);
349 if(hardRefresh ==
"")
352 fgets(line, 100, fp);
353 sscanf(line,
"%*s %s", val);
354 if(autoRefreshPeriod ==
"")
355 autoRefreshPeriod = val;
361 fp = fopen(fullPath.c_str(),
"w");
364 fprintf(fp,
"radioSelect %s\n", radioSelect.c_str());
365 fprintf(fp,
"autoRefresh %s\n", autoRefresh.c_str());
366 fprintf(fp,
"autoHide %s\n", autoHide.c_str());
367 fprintf(fp,
"hardRefresh %s\n", hardRefresh.c_str());
368 fprintf(fp,
"autoRefreshPeriod %s\n", autoRefreshPeriod.c_str());
372 __SUP_COUT_ERR__ <<
"Failure writing preferences to file: " << fullPath
377 "getUserPreferences")
379 __SUP_COUT__ <<
"Next is userinfo" << __E__;
380 __SUP_COUT__ <<
"userInfo.username_: " << userInfo.username_ << __E__;
381 std::string fullPath =
382 (std::string)PREFERENCES_PATH + userInfo.username_ + PREFERENCES_FILE_EXT;
383 __SUP_COUT__ <<
"fullPath: " << fullPath << __E__;
385 FILE* fp = fopen(fullPath.c_str(),
"r");
392 fgets(line, 100, fp);
393 sscanf(line,
"%*s %d", &val);
394 if(val < 0 || val > 3)
396 xmlOut.addTextElementToData(
"radioSelect", std::to_string(val));
397 fgets(line, 100, fp);
398 sscanf(line,
"%*s %d", &val);
399 xmlOut.addTextElementToData(
"autoRefresh", std::to_string(val));
400 fgets(line, 100, fp);
401 sscanf(line,
"%*s %d", &val);
402 xmlOut.addTextElementToData(
"autoHide", std::to_string(val));
403 fgets(line, 100, fp);
404 sscanf(line,
"%*s %d", &val);
405 xmlOut.addTextElementToData(
"hardRefresh", std::to_string(val));
406 fgets(line, 100, fp);
407 sscanf(line,
"%*s %d", &val);
408 xmlOut.addTextElementToData(
"autoRefreshPeriod", std::to_string(val));
414 xmlOut.addTextElementToData(
"radioSelect",
"");
415 xmlOut.addTextElementToData(
"autoRefresh",
"");
416 xmlOut.addTextElementToData(
"autoHide",
"");
417 xmlOut.addTextElementToData(
"hardRefresh",
"");
418 xmlOut.addTextElementToData(
"autoRefreshPeriod",
"");
420 __SUP_COUT__ <<
"Done with preferences!" << __E__;
424 "getDirectoryContents")
427 std::string rootpath =
428 std::string(ROOT_BROWSER_PATH) +
431 boost::regex re(
"%2F");
432 path = boost::regex_replace(path, re,
"/");
442 userInfo.permissionLevel_ >=
444 "rootAdminControls"));
445 xmlOut.addTextElementToData(
"permissions", permStr);
449 std::string dirpath = rootpath + path;
451 if(path ==
"/" + PRE_MADE_ROOT_CFG_DIR +
"/")
452 dirpath = ROOT_DISPLAY_CONFIG_PATH;
454 if(path.find(
"/" + PRE_MADE_ROOT_CFG_DIR +
"/") ==
456 dirpath = std::string(ROOT_DISPLAY_CONFIG_PATH) +
"/" +
457 path.substr(PRE_MADE_ROOT_CFG_DIR.length() + 2);
460 __SUP_COUT__ <<
"rootpath:-" << rootpath <<
"-path:-" << path <<
"-dirpath:-"
461 << dirpath <<
"-" << __E__;
464 struct dirent* entry;
467 if((pDIR = opendir(dirpath.c_str())))
469 xmlOut.addTextElementToData(
"path", path);
470 xmlOut.addTextElementToData(
"headOfSearch",
"located");
475 if(theDataManager_ !=
nullptr)
476 __COUT__ <<
"path-" << path <<
"-DM: " << theDataManager_
477 <<
" Live: " << theDataManager_->getLiveDQMHistos() << std::endl;
481 xmlOut.addTextElementToData(
"dir",
482 LIVEDQM_DIR +
".root");
485 DIR* pRtDIR = opendir(ROOT_DISPLAY_CONFIG_PATH);
486 bool recheck =
false;
490 if(mkdir(ROOT_DISPLAY_CONFIG_PATH,
491 S_IRWXU | (S_IRGRP | S_IXGRP) |
492 (S_IROTH | S_IXOTH)))
493 __SUP_COUT__ <<
"Failed to make directory for pre made views: "
494 << ROOT_DISPLAY_CONFIG_PATH << __E__;
499 if(!recheck || (pRtDIR = opendir(ROOT_DISPLAY_CONFIG_PATH)))
503 xmlOut.addTextElementToData(
"dir",
504 PRE_MADE_ROOT_CFG_DIR);
510 while((entry = readdir(pDIR)))
514 if(entry->d_name[0] !=
'.' &&
517 entry->d_type == 4 ||
523 std::string(entry->d_name).find(
".rcfg") == std::string::npos;
526 if(entry->d_type == 0)
530 DIR* pTmpDIR = opendir((dirpath + entry->d_name).c_str());
540 if((entry->d_type == 8 ||
541 (!isDir && entry->d_type == 0))
542 && std::string(entry->d_name).find(
".root") == std::string::npos &&
545 else if(entry->d_type == 4)
548 xmlOut.addTextElementToData(
549 isDir ?
"dir" : (isNotRtCfg ?
"dir" :
"file"), entry->d_name);
555 __SUP_COUT__ <<
"Failed to access directory contents!" << __E__;
567 unsigned splitter = path.find(
".root") + 5;
568 std::string rootFileName =
569 std::string(__ENV__(
"ROOT_BROWSER_PATH")) + path.substr(0, splitter);
570 __SUP_COUTV__(rootFileName);
572 std::string rootDirectoryName = path.substr(splitter, path.length() - splitter);
573 __SUP_COUTV__(rootDirectoryName);
578 bool isLiveDQM = (path.find(
"/" + LIVEDQM_DIR +
".root/") == 0) ?
true :
false;
579 __SUP_COUTV__(isLiveDQM);
581 TFile* rootFile =
nullptr;
582 TObject* tObject =
nullptr;
583 TDirectory* tDirectory =
nullptr;
587 rootFile = TFile::Open(rootFileName.c_str());
589 if(rootFile ==
nullptr || !rootFile->IsOpen())
591 __SUP_SS__ <<
"Failed to access ROOT file: " << rootFileName << __E__;
596 if((tObject = rootFile->Get(rootDirectoryName.c_str())) !=
598 (rootDirectoryName.size() &&
599 rootDirectoryName[0] ==
'/' &&
600 (tObject = rootFile->Get(rootDirectoryName.substr(1).c_str())) !=
603 if(tObject->IsA() == TCanvas::Class())
605 static_cast<TCanvas*
>(tObject)->Modified();
606 static_cast<TCanvas*
>(tObject)->Update();
608 TString json = TBufferJSON::ConvertToJSON(tObject);
609 TBufferFile tBuffer(TBuffer::kWrite);
610 tObject->Streamer(tBuffer);
612 tBuffer.Buffer(), tBuffer.Length());
614 __SUP_COUT__ <<
"Returning object from file '" << tObject->GetName()
615 <<
"' of class '" << tObject->ClassName() << __E__;
617 xmlOut.addTextElementToData(
"path", path);
618 xmlOut.addTextElementToData(
"rootType", tObject->ClassName());
619 xmlOut.addTextElementToData(
"rootData", hexString);
620 xmlOut.addTextElementToData(
"rootJSON", json.Data());
622 else if((tDirectory = rootFile->GetDirectory(rootDirectoryName.c_str())) !=
626 TIter next(tDirectory->GetListOfKeys());
627 xmlOut.addTextElementToData(
"path", path);
628 while((key = (TKey*)next()))
630 TString s = key->GetName();
631 TRegexp re(
"*", kTRUE);
632 if(s.Index(re) == kNPOS)
634 __SUP_COUT__ <<
"Class Name: " << key->GetClassName() << __E__;
635 xmlOut.addTextElementToData(
636 (std::string(key->GetClassName()).find(
"Directory") !=
638 std::string(key->GetClassName()) ==
"TTree" ||
639 std::string(key->GetClassName()).find(
"TBranch") !=
648 tObject = key->ReadObj();
649 __SUP_COUT__ <<
"JSON : " << key->GetClassName() << __E__;
651 TString json = TBufferJSON::ConvertToJSON(tObject);
652 TBufferFile tBuffer(TBuffer::kWrite);
653 tObject->Streamer(tBuffer);
654 std::string hexString =
658 __SUP_COUT__ <<
"Returning directory object from file '"
659 << tObject->GetName() <<
"' of class '"
660 << tObject->ClassName() << __E__;
662 __SUP_COUTV__(json.Data());
668 __SUP_COUT_ERR__ <<
"Failed to find object " << rootDirectoryName
669 <<
" in " << rootFileName << __E__;
673 else if(theDataManager_ !=
nullptr && theDataManager_->isReady())
675 if(theDataManager_ !=
nullptr)
676 theDataManager_->setDoNotStop(
true);
679 __SUP_COUT__ <<
"Attempting to get LIVE ROOT object." << __E__;
681 std::vector<DQMHistosBase*> dqmConsumers = theDataManager_->
getLiveDQMs();
683 for(
auto const& consumer : dqmConsumers)
685 rootFile = consumer->getFile();
686 __SUP_COUT__ <<
"LIVE file name: " << rootFile->GetName() << __E__;
687 if(rootFile ==
nullptr || !rootFile->IsOpen())
689 __SUP_SS__ <<
"Failed to access LIVE ROOT file: " << rootFileName
691 theDataManager_->setDoNotStop(
false);
695 if((tObject = rootFile->Get(rootDirectoryName.c_str())) !=
nullptr)
697 __SUP_COUT__ <<
"Object class name: " << tObject->ClassName()
699 std::string tmpClassName = tObject->ClassName();
701 TBufferFile tBuffer(TBuffer::kWrite);
702 if(tObject->IsA() == TCanvas::Class())
704 static_cast<TCanvas*
>(tObject)->Modified();
705 static_cast<TCanvas*
>(tObject)->Update();
708 std::unique_lock<std::mutex> lock(
710 ->getFillHistoMutex());
711 json = TBufferJSON::ConvertToJSON(tObject);
712 tObject->Streamer(tBuffer);
715 tBuffer.Buffer(), tBuffer.Length());
717 __SUP_COUT__ <<
"Returning object '" << tObject->GetName()
718 <<
"' of class '" << tObject->ClassName() << __E__;
721 xmlOut.addTextElementToData(
"path", path);
722 xmlOut.addTextElementToData(
"rootType", tObject->ClassName());
723 xmlOut.addTextElementToData(
"rootData", hexString);
724 xmlOut.addTextElementToData(
"rootJSON", json.Data());
726 theDataManager_->setDoNotStop(
false);
731 std::map<std::string, std::string> dirList;
733 for(
auto const& consumer : dqmConsumers)
735 __SUP_COUT__ <<
"Attempting to get LIVE ROOT directory." << __E__;
736 rootFile = consumer->getFile();
737 __SUP_COUT__ <<
"LIVE file name: " << rootFile->GetName() << __E__;
738 if(rootFile ==
nullptr || !rootFile->IsOpen())
740 __SUP_SS__ <<
"Failed to access LIVE ROOT file: " << rootFileName
742 xmlOut.addTextElementToData(
"Warning", ss.str());
743 theDataManager_->setDoNotStop(
false);
746 if((tDirectory = rootFile->GetDirectory(rootDirectoryName.c_str())) !=
749 xmlOut.addTextElementToData(
"path", path);
750 __SUP_COUT__ <<
"Directory found getting the content!" << __E__;
751 TRegexp re(
"*", kTRUE);
753 TIter nextobj(tDirectory->GetList());
754 while((obj = (TObject*)nextobj()))
756 TString s = obj->GetName();
757 if(s.Index(re) == kNPOS)
759 __SUP_COUT__ <<
"Class Name: " << obj->IsA()->GetName() << __E__;
760 dirList[obj->GetName()] =
761 (std::string(obj->IsA()->GetName()).find(
"Directory") !=
763 std::string(obj->IsA()->GetName()) ==
"TTree" ||
764 std::string(obj->IsA()->GetName()).find(
"TBranch") !=
771 for(
auto const& dir : dirList)
773 xmlOut.addTextElementToData(dir.second, dir.first);
774 __SUP_COUT__ <<
"Class Name: " << dir.second <<
" Object: " << dir.first
1182 if(theDataManager_ ==
nullptr)
1184 __SS__ <<
"No Data Manager instantiated." << __E__;
1188 int Run = atoi(cgiIn(
"run").c_str());
1190 __SUP_COUT__ <<
"getEvents for run " << Run << __E__;
1192 if(Run != (
int)loadedRunNumber_ || loadedRunNumber_ == (
unsigned int)-1)
1194 theDataManager_->load(
"Run1684.root",
"Monicelli");
1195 loadedRunNumber_ = Run;
1198 xmlOut.addTextElementToData(
"events",
"");
1241 __SUP_COUT__ <<
"Done hits xml" << __E__;
1247 __SUP_COUT__ <<
"getGeometry" << __E__;
1249 if(theDataManager_ ==
nullptr)
1251 __SS__ <<
"No Data Manager instantiated." << __E__;
1256 theDataManager_->load(
"Run1684.geo",
"Geometry");
1258 __SUP_COUT__ <<
"getGeometry" << __E__;
1260 xmlOut.addTextElementToData(
"geometry",
"");
1296 __SUP_COUT__ <<
"path " << path << __E__;
1298 if(path.find(
"/" + PRE_MADE_ROOT_CFG_DIR +
"/") ==
1301 path = std::string(ROOT_DISPLAY_CONFIG_PATH) +
"/" +
1302 path.substr(PRE_MADE_ROOT_CFG_DIR.length() + 2);
1303 __SUP_COUT__ <<
"mod path " << path << __E__;
1309 xmlOut.addTextElementToData(
"status",
"1");
1314 xmlOut.addTextElementToData(
"status",
1315 "Failed. File to properly load config file.");
1319 "rootAdminControls")
1331 std::string cmd = cgiIn(
"cmd");
1338 __SUP_COUT__ <<
"cmd " << cmd << __E__;
1339 __SUP_COUT__ <<
"path " << path << __E__;
1340 __SUP_COUT__ <<
"name " << name << __E__;
1342 if(path.find(
"/" + PRE_MADE_ROOT_CFG_DIR +
"/") ==
1345 path = std::string(ROOT_DISPLAY_CONFIG_PATH) +
"/" +
1346 path.substr(PRE_MADE_ROOT_CFG_DIR.length() + 2) + name;
1347 __SUP_COUT__ <<
"mod path " << path << __E__;
1351 if(mkdir(path.c_str(),
1352 S_IRWXU | (S_IRGRP | S_IXGRP) |
1353 (S_IROTH | S_IXOTH)))
1354 xmlOut.addTextElementToData(
"status",
1355 "Failed. Directory create rejected.");
1357 xmlOut.addTextElementToData(
"status",
"1");
1359 else if(cmd ==
"save")
1361 path += PRE_MADE_ROOT_CFG_FILE_EXT;
1363 bool useRunWildCard =
1367 __SUP_COUT__ <<
"config " << config << __E__;
1368 __SUP_COUT__ <<
"useRunWildCard " << useRunWildCard << __E__;
1371 FILE* fp = fopen(path.c_str(),
"r");
1375 xmlOut.addTextElementToData(
"status",
"Failed. File already exists.");
1376 __SUP_COUT__ <<
" Failed. File already exists." << __E__;
1385 fp = fopen(path.c_str(),
"w");
1386 fputs(config.c_str(), fp);
1395 xmlOut.addTextElementToData(
"status",
"1");
1399 xmlOut.addTextElementToData(
1400 "status",
"Failed. Fatal. Improper file format.");
1401 if(remove(path.c_str()) != 0)
1402 __SUP_COUT__ <<
"Failed. Could not remove poorly formed Root "
1408 else if(cmd ==
"delete")
1411 if(rmdir(path.c_str()) == 0 ||
1412 remove((path + PRE_MADE_ROOT_CFG_FILE_EXT).c_str()) == 0)
1413 xmlOut.addTextElementToData(
"status",
"1");
1415 xmlOut.addTextElementToData(
"status",
1416 "Failed. Target could not be deleted.");
1419 xmlOut.addTextElementToData(
"status",
"Failed. Unrecognized command.");
1422 xmlOut.addTextElementToData(
"status",
"Failed. Invalid path.");
1431 std::string fSystemPath = std::string(ROOT_BROWSER_PATH) +
"/";
1433 boost::regex re(
"%2F");
1434 fRootPath = boost::regex_replace(fRootPath, re,
"/");
1435 std::string fullPath = fSystemPath + fRootPath;
1437 STDLINE(std::string(
"Begin: fSystemPath = ") + fSystemPath, ACWhite);
1438 STDLINE(std::string(
"Begin: fRootPath = ") + fRootPath, ACWhite);
1439 STDLINE(std::string(
"Begin: fullPath = ") + fullPath, ACWhite);
1442 xmlOut.setRootPath(fRootPath);
1443 xmlOut.makeDirectoryBinaryTree(fSystemPath, fRootPath, 0, NULL);
1444 std::ostringstream* out =
new std::ostringstream();
1452 std::string fSystemPath = std::string(ROOT_BROWSER_PATH) +
"/";
1458 boost::regex re(
"%2F");
1459 fRootPath = boost::regex_replace(fRootPath, re,
"/");
1460 fFoldersPath = boost::regex_replace(fFoldersPath, re,
"/");
1468 fSystemPath, fRootPath, fFoldersPath, fHistName, fRFoldersPath, fFileName);
1469 xmlOut.setDocument(theExplorer->initialize(
false));
1535 "saveConfiguration")
1538 STDLINE(
"configPayload: ", ACRed);
1539 STDLINE(configPayload, ACYellow);
1542 outFile.open(
"/tmp/configPayload.json", ios::out | ios::app);
1543 outFile << configPayload << endl;
1551 std::string JSONPayLoad =
"";
1552 std::string line =
"";
1554 ifstream JSONFile(
"/tmp/configPayload.json");
1556 if(JSONFile.is_open())
1558 while(getline(JSONFile, line))
1560 JSONPayLoad += line;
1565 xmlOut.addTextElementToData(
"JSONPayLoad", JSONPayLoad);
1573 std::string fsmName = theStateMachine_.getCurrentStateName();
1574 bool in_transition = theStateMachine_.isInTransition();
1576 xmlOut.addTextElementToData(
"current_state", fsmName);
1577 xmlOut.addTextElementToData(
"in_transition", in_transition ?
"1" :
"0");
1581 __SUP_SS__ <<
"requestType Request, " << requestType
1582 <<
", not recognized by the Visual Supervisor (was it intended for "
1583 "another Supervisor?)."
1588 if(theDataManager_ !=
nullptr)
1589 theDataManager_->setDoNotStop(
false);
static std::string postData(cgicc::Cgicc &cgi, const std::string &needle)
static std::string getData(cgicc::Cgicc &cgi, const std::string &needle)
bool isDisconnected(void) const
ConfigurationTree getNode(const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
const std::string & getValueAsString(bool returnLinkTableValue=false) const
WebUsers::permissionLevel_t getSupervisorPropertyUserPermissionsThreshold(const std::string &requestType)
virtual void transitionHalting(toolbox::Event::Reference event)
static void deleteInstance(std::string instanceUID)
void copyDataChildren(HttpXmlDocument &document)
bool loadXmlDocument(const std::string &filePath)
void outputXmlDocument(std::ostringstream *out, bool dispStdOut=false, bool allowWhiteSpace=false, bool printErrors=false)
const std::vector< DQMHistosBase * > & getLiveDQMs(void)
virtual void setSupervisorPropertyDefaults(void) override
virtual void forceSupervisorPropertyValues(void) override
virtual void transitionConfiguring(toolbox::Event::Reference e) override
virtual void request(const std::string &requestType, cgicc::Cgicc &cgiIn, HttpXmlDocument &xmlOut, const WebUsers::RequestUserInfo &userInfo) override
void setDarioStyle(bool darioStyle)
void saveXmlDocument(const std::string &filePath)
void INIT_MF(const char *name)
static std::string binaryStringToHexString(const void *binaryBuffer, unsigned int numberOfBytes, const std::string &resultPreamble="", const std::string &resultDelimiter="")