1 #ifndef _Supervisor_Supervisor_h
2 #define _Supervisor_Supervisor_h
4 #include "otsdaq-core/SOAPUtilities/SOAPMessenger.h"
5 #include "otsdaq-core/WebUsersUtilities/WebUsers.h"
6 #include "otsdaq-core/SystemMessenger/SystemMessenger.h"
7 #include "otsdaq-core/WorkLoopManager/WorkLoopManager.h"
8 #include "otsdaq-core/FiniteStateMachine/RunControlStateMachine.h"
9 #include "otsdaq-core/Supervisor/SupervisorsInfo.h"
10 #include "otsdaq-core/SupervisorDescriptorInfo/SupervisorDescriptorInfo.h"
11 #include "otsdaq-core/ConfigurationDataFormats/ConfigurationGroupKey.h"
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
15 #include <xdaq/Application.h>
16 #pragma GCC diagnostic pop
18 #include <toolbox/task/WorkLoop.h>
19 #include <xgi/Method.h>
20 #include <xdata/String.h>
26 #define FSM_LAST_CONFIGURED_GROUP_ALIAS_FILE std::string("FSMLastConfiguredGroupAlias.hist")
27 #define FSM_LAST_STARTED_GROUP_ALIAS_FILE std::string("FSMLastStartedGroupAlias.hist")
33 class ConfigurationManager;
34 class ConfigurationGroupKey;
35 class WorkLoopManager;
39 friend class OtsConfigurationWizardSupervisor;
45 Supervisor (xdaq::ApplicationStub * s)
throw (xdaq::exception::Exception);
50 void Default (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
53 void loginRequest (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
54 void request (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
55 void tooltipRequest (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
58 void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
59 void stateMachineResultXgiHandler (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
60 xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference msg )
throw (xoap::exception::Exception);
61 xoap::MessageReference stateMachineResultXoapHandler (xoap::MessageReference msg )
throw (xoap::exception::Exception);
62 bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
65 void infoRequestHandler (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
66 void infoRequestResultHandler (xgi::Input* in, xgi::Output* out )
throw (xgi::exception::Exception);
67 bool infoRequestThread (toolbox::task::WorkLoop* workLoop);
70 xoap::MessageReference supervisorCookieCheck (xoap::MessageReference msg)
throw (xoap::exception::Exception);
71 xoap::MessageReference supervisorGetActiveUsers (xoap::MessageReference msg)
throw (xoap::exception::Exception);
72 xoap::MessageReference supervisorSystemMessage (xoap::MessageReference msg)
throw (xoap::exception::Exception);
73 xoap::MessageReference supervisorGetUserInfo (xoap::MessageReference msg)
throw (xoap::exception::Exception);
74 xoap::MessageReference supervisorSystemLogbookEntry (xoap::MessageReference msg)
throw (xoap::exception::Exception);
75 xoap::MessageReference supervisorLastConfigGroupRequest(xoap::MessageReference msg)
throw (xoap::exception::Exception);
78 void stateInitial (toolbox::fsm::FiniteStateMachine& fsm)
throw (toolbox::fsm::exception::Exception);
79 void statePaused (toolbox::fsm::FiniteStateMachine& fsm)
throw (toolbox::fsm::exception::Exception);
80 void stateRunning (toolbox::fsm::FiniteStateMachine& fsm)
throw (toolbox::fsm::exception::Exception);
81 void stateHalted (toolbox::fsm::FiniteStateMachine& fsm)
throw (toolbox::fsm::exception::Exception);
82 void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm)
throw (toolbox::fsm::exception::Exception);
83 void inError (toolbox::fsm::FiniteStateMachine& fsm)
throw (toolbox::fsm::exception::Exception);
85 void transitionConfiguring (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
86 void transitionHalting (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
87 void transitionInitializing (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
88 void transitionPausing (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
89 void transitionResuming (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
90 void transitionStarting (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
91 void transitionStopping (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
92 void enteringError (toolbox::Event::Reference e)
throw (toolbox::fsm::exception::Exception);
94 void getSupervisorsStatus (
void)
throw (toolbox::fsm::exception::Exception);
96 void makeSystemLogbookEntry (std::string entryText);
101 unsigned int getNextRunNumber(
const std::string &fsmName =
"");
102 bool setNextRunNumber(
unsigned int runNumber,
const std::string &fsmName =
"");
103 static std::pair<std::string ,
ConfigurationGroupKey> loadGroupNameAndKey(
const std::string &fileName, std::string &returnedTimeString);
104 void saveGroupNameAndKey(
const std::pair<std::string /*group name*/, ConfigurationGroupKey> &theGroup,
const std::string &fileName);
105 static xoap::MessageReference lastConfigGroupRequestHandler(
const SOAPParameters ¶meters);
107 bool broadcastMessage(xoap::MessageReference msg)
throw (toolbox::fsm::exception::Exception);
109 bool supervisorGuiHasBeenLoaded_ ;
112 std::string outputDir_ ;
120 toolbox::BSem stateMachineSemaphore_ ;
122 toolbox::BSem infoRequestSemaphore_ ;
124 std::string supervisorContextUID_ ;
125 std::string supervisorApplicationUID_ ;
127 std::string activeStateMachineName_;
128 std::string activeStateMachineWindowName_;
132 void wait(
int milliseconds, std::string who=
"")
const;
133 unsigned long long counterTest_ ;
134 std::vector<int> vectorTest_ ;
135 std::string securityType_;