]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/AliShuttleConfig.h
Parsing the output of ldapsearch with a perl script to unfold lines and make it compa...
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.h
1 #ifndef ALI_SHUTTLE_CONFIG_H
2 #define ALI_SHUTTLE_CONFIG_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 //
10 // This class keeps the AliShuttle configuration.
11 // It reads the configuration for LDAP server.
12 // For more info see AliShuttleConfig.cxx
13 //
14
15 #include <TObject.h>
16 #include <TString.h>
17 #include <TObjArray.h>
18 #include <TMap.h>
19 #include <TLDAPServer.h>
20
21 class AliShuttleConfig: public TObject {
22 public:
23         enum RunMode {kTest=0, kProd};
24         enum SystemCode { kDAQ = 0, kDCS, kHLT, kGlobal, kAmanda };
25         
26         AliShuttleConfig(const char* host, Int_t port = LDAP_PORT,
27                         const char* binddn = 0, const char* password = 0,
28                         const char* basedn = "o=alice,dc=cern,dc=ch");
29         virtual ~AliShuttleConfig();
30
31         Bool_t IsValid() const {return fIsValid;};
32
33         const char* GetConfigHost() const {return fConfigHost.Data();}
34
35         const char* GetDAQlbHost() const {return fDAQlbHost.Data();}
36         UInt_t      GetDAQlbPort() const {return fDAQlbPort;}
37         const char* GetDAQlbUser() const {return fDAQlbUser.Data();}
38         const char* GetDAQlbPass() const {return fDAQlbPass.Data();}
39         const char* GetDAQlbDB() const {return fDAQlbDB.Data();}
40         const char* GetDAQlbTable() const {return fDAQlbTable.Data();}
41         const char* GetShuttlelbTable() const {return fShuttlelbTable.Data();}
42         const char* GetRunTypelbTable() const {return fRunTypelbTable.Data();}
43
44         const char* GetFXSHost(Int_t sys) const {return fFXSHost[sys].Data();}
45         UInt_t      GetFXSPort(Int_t sys) const {return fFXSPort[sys];}
46         const char* GetFXSUser(Int_t sys) const {return fFXSUser[sys].Data();}
47         const char* GetFXSPass(Int_t sys) const {return fFXSPass[sys].Data();}
48
49         const char* GetFXSdbHost(Int_t sys) const {return fFXSdbHost[sys].Data();}
50         UInt_t      GetFXSdbPort(Int_t sys) const {return fFXSdbPort[sys];}
51         const char* GetFXSdbUser(Int_t sys) const {return fFXSdbUser[sys].Data();}
52         const char* GetFXSdbPass(Int_t sys) const {return fFXSdbPass[sys].Data();}
53         const char* GetFXSdbName(Int_t sys) const {return fFXSdbName[sys].Data();}
54         const char* GetFXSdbTable(Int_t sys) const {return fFXSdbTable[sys].Data();}
55
56         const TObjArray* GetAdmins(Int_t sys) const;
57         
58         Bool_t SendMail() const { return fSendMail; }
59         
60         Int_t GetMaxRetries() const { return fMaxRetries; }
61
62         Int_t GetPPTimeOut() const { return fPPTimeOut; }
63         Int_t GetPPMaxMem() const { return fPPMaxMem; }
64
65         Bool_t KeepDCSMap() const { return fKeepDCSMap; }
66         Bool_t KeepTempFolder() const { return fKeepTempFolder; }
67         
68                 
69         const char* GetMonitorHost() const {return fMonitorHost.Data();}
70         const char* GetMonitorTable() const {return fMonitorTable.Data();}
71
72         Int_t GetTriggerWait() const {return fTriggerWait;}
73         
74         RunMode GetRunMode() const {return fRunMode;}
75         
76         const TObjArray* GetDetectors() const;
77
78         Bool_t HasDetector(const char* detector) const;
79         
80         Int_t GetNServers(const char* detector) const;
81         
82         const char* GetDCSHost(const char* detector, Int_t iServ) const;
83         Int_t GetDCSPort(const char* detector, Int_t iServ) const;
84         
85         Int_t GetMultiSplit(const char* detector, Int_t iServ) const;
86         
87         const TObjArray* GetDCSAliases(const char* detector, Int_t iServ) const;
88         const TObjArray* GetDCSDataPoints(const char* detector, Int_t iServ) const;
89         const TObjArray* GetCompactDCSAliases(const char* detector, Int_t iServ) const;
90         const TObjArray* GetCompactDCSDataPoints(const char* detector, Int_t iServ) const;
91         
92         const TObjArray* GetResponsibles(const char* detector) const;
93         Bool_t StrictRunOrder(const char* detector) const;
94
95         void SetProcessAll(Bool_t flag=kTRUE) {fProcessAll=flag;}
96         Bool_t ProcessAll() const {return fProcessAll;}
97
98         Bool_t HostProcessDetector(const char* detector) const;
99
100         virtual void Print(Option_t* option = NULL) const;
101
102 private:
103
104         class AliShuttleDCSConfigHolder: public TObject {
105         public:
106                 AliShuttleDCSConfigHolder(const TLDAPEntry* entry);
107                 ~AliShuttleDCSConfigHolder();
108                 
109                 const char* GetDCSHost() const {return fDCSHost;}
110                 Int_t GetDCSPort() const {return fDCSPort;}
111                 Int_t GetMultiSplit() const {return fMultiSplit;}
112                 
113                 const TObjArray* GetDCSAliases() const {return fDCSAliases;}
114                 const TObjArray* GetDCSDataPoints() const {return fDCSDataPoints;}
115                 const TObjArray* GetCompactDCSAliases() const {return fDCSAliasesComp;}
116                 const TObjArray* GetCompactDCSDataPoints() const {return fDCSDataPointsComp;}
117                 
118                 void ExpandAndAdd(TObjArray* target, const char* entry);
119                 Bool_t IsValid() const {return fIsValid;}
120
121         private:
122                 AliShuttleDCSConfigHolder(const AliShuttleDCSConfigHolder& other);  // not implemented
123                 AliShuttleDCSConfigHolder& operator= (const AliShuttleDCSConfigHolder& other);  // not implemented
124
125                 TString fDCSHost;       // Host name of the DCS server
126                 Int_t   fDCSPort;       // port of the DCS server
127                 Int_t   fMultiSplit;     // N. of DPs to be queried in each query chunk
128                 TObjArray* fDCSAliases; // List of DCS aliases to be retrieved
129                 TObjArray* fDCSDataPoints;     // List of DCS data points to be retrieved
130                 TObjArray* fDCSAliasesComp;    // Compact list of DCS aliases to be printed
131                 TObjArray* fDCSDataPointsComp; // Compact list of DCS data points to be printed
132                 Bool_t  fIsValid;              // flag for the validity of the configuration
133
134                 ClassDef(AliShuttleDCSConfigHolder, 0);
135         };
136
137         class AliShuttleDetConfigHolder: public TObject {
138         public:
139                 AliShuttleDetConfigHolder(const TLDAPEntry* entry);
140                 ~AliShuttleDetConfigHolder();
141
142                 const char* GetDetector() const {return fDetector.Data();}
143                 const TObjArray* GetDCSConfig() const {return fDCSConfig;}
144                 void AddDCSConfig(AliShuttleDCSConfigHolder* holder);
145
146                 Int_t GetNServers() const {return fDCSConfig ? fDCSConfig->GetEntries() : 0;}
147                 
148                 const char* GetDCSHost(Int_t iServ) const;
149                 Int_t GetDCSPort(Int_t iServ) const;
150                 Int_t GetMultiSplit(Int_t iServ) const;
151                 
152                 const TObjArray* GetDCSAliases(Int_t iServ) const;
153                 const TObjArray* GetDCSDataPoints(Int_t iServ) const;
154                 const TObjArray* GetCompactDCSAliases(Int_t iServ) const;
155                 const TObjArray* GetCompactDCSDataPoints(Int_t iServ) const;
156                 
157                 const TObjArray* GetResponsibles() const {return fResponsibles;}                
158                 Bool_t IsValid() const {return fIsValid;}
159                 Bool_t SkipDCSQuery() const {return fSkipDCSQuery;}
160                 Bool_t StrictRunOrder() const {return fStrictRunOrder;}
161
162         private:
163                 AliShuttleDetConfigHolder(const AliShuttleDetConfigHolder& other);  // not implemented
164                 AliShuttleDetConfigHolder& operator= (const AliShuttleDetConfigHolder& other);  // not implemented
165
166                 TString fDetector;      // Detector name
167                 TObjArray* fDCSConfig;  // Array of DCS configuration objects (AliShuttleDCSConfigHolder)
168                 TObjArray* fResponsibles; // List of email addresses of the detector's responsible(s)
169                 Bool_t fIsValid;        // flag for the validity of the configuration
170                 Bool_t fSkipDCSQuery;   // flag - if TRUE (-> DCS config empty) skip DCS archive data query
171                 Bool_t fStrictRunOrder; // flag - if TRUE connect data in a strict run ordering
172
173                 ClassDef(AliShuttleDetConfigHolder, 0);
174         };
175
176
177         UInt_t SetGlobalConfig(TList* globalList);
178         UInt_t SetSysConfig(TList* sysList);
179         UInt_t SetDetConfig(TList* detList, TList* dcsList);
180         UInt_t SetHostConfig(TList* hostList);
181         
182         TString fConfigHost;            // Host of the Shuttle configuration LDAP server
183
184         TString fDAQlbHost;             // Host of the DAQ logbook MySQL Server
185         UInt_t  fDAQlbPort;             // port of the DAQ logbook MySQL Server
186         TString fDAQlbUser;             // username of the DAQ logbook MySQL Server
187         TString fDAQlbPass;             // password of the DAQ logbook MySQL Server
188         TString fDAQlbDB;               // DB name of the DAQ logbook MySQL Server
189         TString fDAQlbTable;            // Table name of the DAQ logbook 
190         TString fShuttlelbTable;        // Table name of the Shuttle logbook
191         TString fRunTypelbTable;        // Table name of the Run typr logbook
192
193         TString fFXSHost[3];            // Host of the [DAQ, DCS, HLT] File eXchange Server
194         UInt_t  fFXSPort[3];            // Port of the [DAQ, DCS, HLT] File eXchange Server
195         TString fFXSUser[3];            // username of the [DAQ, DCS, HLT] File eXchange Server
196         TString fFXSPass[3];            // password of the [DAQ, DCS, HLT] File eXchange Server
197
198         TString fFXSdbHost[3];          // Host of the [DAQ, DCS, HLT] FXS database
199         UInt_t  fFXSdbPort[3];          // Port of the [DAQ, DCS, HLT] FXS database
200         TString fFXSdbUser[3];          // username of the [DAQ, DCS, HLT] FXS database
201         TString fFXSdbPass[3];          // password of the [DAQ, DCS, HLT] FXS database
202         TString fFXSdbName[3];          // name of the [DAQ, DCS, HLT] FXS database
203         TString fFXSdbTable[3];         // Table name of the [DAQ, DCS, HLT] FXS database
204
205         Int_t fMaxRetries;              // number of retries of a failed preprocessor
206         
207         Int_t fPPTimeOut;               // timeout until a preprocessor is killed
208         Int_t fPPMaxMem;                // maximum allowed memory until a preprocessor is killed
209         
210         TString fMonitorHost;           // host of the MonaLisa monitoring server
211         TString fMonitorTable;          // Monalisa's SHUTTLE table name
212         
213         Int_t fTriggerWait;             // time to wait for DIM trigger before starting new collection 
214         RunMode  fRunMode;              // Working mode (0=test; 1=prod)
215
216         TMap fDetectorMap;              // Map of the detector-by-detector configuration
217         TObjArray fDetectorList;        // List of detectors with valid configuration
218         
219         TObjArray *fAdmin[4];           // Array of system administrators' email addresses (DAQ, DCS, HLT, Global, Amanda)
220
221         TString fShuttleInstanceHost;   // Instance of the SHUTTLE
222         TObjArray fProcessedDetectors;  // list of the detector to be processed by this machine
223         
224         Bool_t fKeepDCSMap;             // Flag to keep DCS map also in case of success 
225         Bool_t fKeepTempFolder;         // Flag to keep temp folder also in case of success
226
227         Bool_t fSendMail;               // Send mail flag
228         
229         Bool_t fProcessAll;             // flag indicating that all detectors will be processed
230         Bool_t fIsValid;                // flag for the validity of the configuration
231
232         ClassDef(AliShuttleConfig, 0);
233 };
234
235 #endif
236