$treeview $search $mathjax $extrastylesheet
otsdaq_utilities
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_ConfigurationGUISupervisor_h_ 00002 #define _ots_ConfigurationGUISupervisor_h_ 00003 00004 #include "otsdaq-core/ConfigurationInterface/ConfigurationManagerRW.h" 00005 #include "otsdaq-core/CoreSupervisors/CoreSupervisorBase.h" 00006 00007 namespace ots 00008 { 00009 // ConfigurationGUISupervisor 00010 // This class handles the user requests to read and write the Configuration Tree. 00011 class ConfigurationGUISupervisor : public CoreSupervisorBase 00012 { 00013 public: 00014 static xdaq::Application* instantiate(xdaq::ApplicationStub* s); 00015 00016 ConfigurationGUISupervisor(xdaq::ApplicationStub* s); 00017 virtual ~ConfigurationGUISupervisor(void); 00018 00019 void init(void); 00020 void destroy(void); 00021 00022 virtual void defaultPage(xgi::Input* in, xgi::Output* out) override; 00023 virtual void request(const std::string& requestType, 00024 cgicc::Cgicc& cgiIn, 00025 HttpXmlDocument& xmlOut, 00026 const WebUsers::RequestUserInfo& userInfo) override; 00027 00028 virtual void setSupervisorPropertyDefaults(void) override; 00029 virtual void forceSupervisorPropertyValues(void) override; // override to force 00030 // supervisor property 00031 // values (and ignore user 00032 // settings) 00033 00034 private: 00035 void handleSaveTableInfoXML(HttpXmlDocument& xmldoc, 00036 ConfigurationManagerRW* cfgMgr, 00037 std::string& tableName, 00038 const std::string& columnCSV, 00039 const std::string& tableDescription, 00040 const std::string& columnChoicesCSV, 00041 bool allowOverwrite = false); 00042 void handleDeleteTableInfoXML(HttpXmlDocument& xmldoc, 00043 ConfigurationManagerRW* cfgMgr, 00044 std::string& tableName); 00045 00046 void handleGroupAliasesXML(HttpXmlDocument& xmldoc, ConfigurationManagerRW* cfgMgr); 00047 void handleSetGroupAliasInBackboneXML(HttpXmlDocument& xmldoc, 00048 ConfigurationManagerRW* cfgMgr, 00049 const std::string& groupAlias, 00050 const std::string& groupName, 00051 TableGroupKey groupKey, 00052 const std::string& author); 00053 void handleSetVersionAliasInBackboneXML(HttpXmlDocument& xmldoc, 00054 ConfigurationManagerRW* cfgMgr, 00055 const std::string& versionAlias, 00056 const std::string& tableName, 00057 TableVersion version, 00058 const std::string& author); 00059 void handleAliasGroupMembersInBackboneXML(HttpXmlDocument& xmldoc, 00060 ConfigurationManagerRW* cfgMgr, 00061 const std::string& versionAlias, 00062 const std::string& groupName, 00063 TableGroupKey groupKey, 00064 const std::string& author); 00065 void handleVersionAliasesXML(HttpXmlDocument& xmldoc, ConfigurationManagerRW* cfgMgr); 00066 void handleTableGroupsXML(HttpXmlDocument& xmldoc, 00067 ConfigurationManagerRW* cfgMgr, 00068 bool returnMembers); 00069 void handleGetTableGroupXML(HttpXmlDocument& xmldoc, 00070 ConfigurationManagerRW* cfgMgr, 00071 const std::string& groupName, 00072 TableGroupKey groupKey); 00073 void handleGetTableGroupTypeXML(HttpXmlDocument& xmldoc, 00074 ConfigurationManagerRW* cfgMgr, 00075 const std::string& configList); 00076 void handleCreateTableGroupXML(HttpXmlDocument& xmldoc, 00077 ConfigurationManagerRW* cfgMgr, 00078 const std::string& groupName, 00079 const std::string& configList, 00080 bool allowDuplicates = false, 00081 bool ignoreWarnings = false, 00082 const std::string& groupComment = "", 00083 bool lookForEquivalent = false); 00084 00085 void handleTablesXML(HttpXmlDocument& xmldoc, 00086 ConfigurationManagerRW* cfgMgr, 00087 bool allowIllegalColumns); 00088 void handleGetTableXML(HttpXmlDocument& xmldoc, 00089 ConfigurationManagerRW* cfgMgr, 00090 const std::string& tableName, 00091 TableVersion version, 00092 bool allowIllegalColumns = false); 00093 void handleCreateTableXML(HttpXmlDocument& xmldoc, 00094 ConfigurationManagerRW* cfgMgr, 00095 const std::string& tableName, 00096 TableVersion version, 00097 bool makeTemporary, 00098 const std::string& data, 00099 const int& dataOffset, 00100 const std::string& author, 00101 const std::string& comment, 00102 bool sourceTableAsIs, 00103 bool lookForEquivalent); 00104 00105 void setupActiveTablesXML( 00106 HttpXmlDocument& xmldoc, 00107 ConfigurationManagerRW* cfgMgr, 00108 const std::string& groupName, 00109 const TableGroupKey& groupKey, 00110 const std::string& modifiedTables, 00111 bool refreshAll = true, 00112 bool getGroupInfo = false, 00113 std::map<std::string /*name*/, TableVersion /*version*/>* returnMemberMap = 0, 00114 bool outputActiveTables = true, 00115 std::string* accumulatedErrors = 0); 00116 void handleFillTreeViewXML(HttpXmlDocument& xmldoc, 00117 ConfigurationManagerRW* cfgMgr, 00118 const std::string& groupName, 00119 const TableGroupKey& groupKey, 00120 const std::string& startPath, 00121 unsigned int depth, 00122 bool hideStatusFalse, 00123 const std::string& modifiedTables, 00124 const std::string& filterList); 00125 static void recursiveTreeToXML(const ConfigurationTree& t, 00126 unsigned int depth, 00127 HttpXmlDocument& xmldoc, 00128 DOMElement* parentEl, 00129 bool hideStatusFalse); 00130 void handleFillTreeNodeCommonFieldsXML(HttpXmlDocument& xmldoc, 00131 ConfigurationManagerRW* cfgMgr, 00132 const std::string& groupName, 00133 const TableGroupKey& groupKey, 00134 const std::string& startPath, 00135 unsigned int depth, 00136 const std::string& modifiedTables, 00137 const std::string& recordList, 00138 const std::string& fieldList); 00139 void handleFillUniqueFieldValuesForRecordsXML(HttpXmlDocument& xmldoc, 00140 ConfigurationManagerRW* cfgMgr, 00141 const std::string& groupName, 00142 const TableGroupKey& groupKey, 00143 const std::string& startPath, 00144 const std::string& modifiedTables, 00145 const std::string& recordList, 00146 const std::string& fieldList); 00147 void handleFillGetTreeNodeFieldValuesXML(HttpXmlDocument& xmldoc, 00148 ConfigurationManagerRW* cfgMgr, 00149 const std::string& groupName, 00150 const TableGroupKey& groupKey, 00151 const std::string& startPath, 00152 const std::string& modifiedTables, 00153 const std::string& recordList, 00154 const std::string& fieldList); 00155 void handleFillSetTreeNodeFieldValuesXML(HttpXmlDocument& xmldoc, 00156 ConfigurationManagerRW* cfgMgr, 00157 const std::string& groupName, 00158 const TableGroupKey& groupKey, 00159 const std::string& startPath, 00160 const std::string& modifiedTables, 00161 const std::string& recordList, 00162 const std::string& fieldList, 00163 const std::string& valueList, 00164 const std::string& author); 00165 void handleFillCreateTreeNodeRecordsXML(HttpXmlDocument& xmldoc, 00166 ConfigurationManagerRW* cfgMgr, 00167 const std::string& groupName, 00168 const TableGroupKey& groupKey, 00169 const std::string& startPath, 00170 const std::string& modifiedTables, 00171 const std::string& recordList, 00172 const std::string& author); 00173 void handleFillDeleteTreeNodeRecordsXML(HttpXmlDocument& xmldoc, 00174 ConfigurationManagerRW* cfgMgr, 00175 const std::string& groupName, 00176 const TableGroupKey& groupKey, 00177 const std::string& startPath, 00178 const std::string& modifiedTables, 00179 const std::string& recordList); 00180 void handleFillModifiedTablesXML(HttpXmlDocument& xmldoc, 00181 ConfigurationManagerRW* cfgMgr); 00182 00183 void handleSaveTreeNodeEditXML(HttpXmlDocument& xmldoc, 00184 ConfigurationManagerRW* cfgMgr, 00185 const std::string& tableName, 00186 TableVersion version, 00187 const std::string& type, 00188 const std::string& uid, 00189 const std::string& column, 00190 const std::string& newValue, 00191 const std::string& author); 00192 void handleGetAffectedGroupsXML(HttpXmlDocument& xmldoc, 00193 ConfigurationManagerRW* cfgMgr, 00194 const std::string& rootGroupName, 00195 const TableGroupKey& rootGroupKey, 00196 const std::string& modifiedTables); 00197 void handleGetLinkToChoicesXML(HttpXmlDocument& xmldoc, 00198 ConfigurationManagerRW* cfgMgr, 00199 const std::string& linkToTableName, 00200 const TableVersion& linkToTableVersion, 00201 const std::string& linkIdType, 00202 const std::string& linkIndex, 00203 const std::string& linkInitId); 00204 00205 void handleSavePlanCommandSequenceXML(HttpXmlDocument& xmldoc, 00206 ConfigurationManagerRW* cfgMgr, 00207 const std::string& groupName, 00208 const TableGroupKey& groupKey, 00209 const std::string& modifiedTables, 00210 const std::string& author, 00211 const std::string& planName, 00212 const std::string& commandString); 00213 00214 void handleMergeGroupsXML(HttpXmlDocument& xmlOut, 00215 ConfigurationManagerRW* cfgMgr, 00216 const std::string& groupANameContext, 00217 const TableGroupKey& groupAKeyContext, 00218 const std::string& groupBNameContext, 00219 const TableGroupKey& groupBKeyContext, 00220 const std::string& groupANameConfig, 00221 const TableGroupKey& groupAKeyConfig, 00222 const std::string& groupBNameConfig, 00223 const TableGroupKey& groupBKeyConfig, 00224 const std::string& author, 00225 const std::string& mergeApproach); 00226 00227 TableVersion saveModifiedVersionXML(HttpXmlDocument& xmldoc, 00228 ConfigurationManagerRW* cfgMgr, 00229 const std::string& tableName, 00230 TableVersion originalVersion, 00231 bool makeTemporary, 00232 TableBase* config, 00233 TableVersion temporaryModifiedVersion, 00234 bool ignoreDuplicates = false, 00235 bool lookForEquivalent = false); 00236 00237 void testXDAQContext(void); 00238 00239 enum 00240 { 00241 CONFIGURATION_MANAGER_EXPIRATION_TIME = 60 * 60 * 1, // 1 hour, in seconds 00242 CONFIGURATION_MANAGER_REFRESH_THRESHOLD = 60 * 15, // 15 minutes, in seconds 00243 }; 00244 00245 ConfigurationManagerRW* refreshUserSession(std::string username, 00246 uint64_t activeSessionIndex, 00247 bool refresh); 00248 std::map<std::string, ConfigurationManagerRW*> userConfigurationManagers_; 00249 std::map<std::string, time_t> userLastUseTime_; 00250 }; 00251 00252 } // end ots namespace 00253 00254 #endif