]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/AliShuttleConfig.h
7f0bf23771d0d5f2068c49b3d0c8f83d4e0fc0c1
[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         AliShuttleConfig(const char* host, Int_t port = LDAP_PORT,
24                         const char* binddn = 0, const char* password = 0,
25                         const char* basedn = "o=alice,dc=cern,dc=ch");
26         virtual ~AliShuttleConfig();
27
28         Bool_t IsValid() const {return fIsValid;};
29
30         const char* GetConfigHost() const {return fConfigHost.Data();}
31
32         const char* GetDAQlbHost() const {return fDAQlbHost.Data();}
33         UInt_t      GetDAQlbPort() const {return fDAQlbPort;}
34         const char* GetDAQlbUser() const {return fDAQlbUser.Data();}
35         const char* GetDAQlbPass() const {return fDAQlbPass.Data();}
36         const char* GetDAQlbDB() const {return fDAQlbDB.Data();}
37         const char* GetDAQlbTable() const {return fDAQlbTable.Data();}
38         const char* GetShuttlelbTable() const {return fShuttlelbTable.Data();}
39         const char* GetRunTypelbTable() const {return fRunTypelbTable.Data();}
40
41         const char* GetFXSHost(Int_t system) const {return fFXSHost[system].Data();}
42         UInt_t      GetFXSPort(Int_t system) const {return fFXSPort[system];}
43         const char* GetFXSUser(Int_t system) const {return fFXSUser[system].Data();}
44         const char* GetFXSPass(Int_t system) const {return fFXSPass[system].Data();}
45
46         const char* GetFXSdbHost(Int_t system) const {return fFXSdbHost[system].Data();}
47         UInt_t      GetFXSdbPort(Int_t system) const {return fFXSdbPort[system];}
48         const char* GetFXSdbUser(Int_t system) const {return fFXSdbUser[system].Data();}
49         const char* GetFXSdbPass(Int_t system) const {return fFXSdbPass[system].Data();}
50         const char* GetFXSdbName(Int_t system) const {return fFXSdbName[system].Data();}
51         const char* GetFXSdbTable(Int_t system) const {return fFXSdbTable[system].Data();}
52
53         Int_t GetMaxRetries() const { return fMaxRetries; }
54
55         Int_t GetPPTimeOut() const { return fPPTimeOut; }
56         Int_t GetPPMaxMem() const { return fPPMaxMem; }
57
58         const TObjArray* GetDetectors() const;
59
60         Bool_t HasDetector(const char* detector) const;
61         
62         Int_t GetNServers(const char* detector) const;
63         
64         const char* GetDCSHost(const char* detector, Int_t iServ) const;
65         Int_t GetDCSPort(const char* detector, Int_t iServ) const;
66         
67         Int_t GetMultiSplit(const char* detector, Int_t iServ) const;
68         
69         const TObjArray* GetDCSAliases(const char* detector, Int_t iServ) const;
70         const TObjArray* GetDCSDataPoints(const char* detector, Int_t iServ) const;
71         const TObjArray* GetCompactDCSAliases(const char* detector, Int_t iServ) const;
72         const TObjArray* GetCompactDCSDataPoints(const char* detector, Int_t iServ) const;
73         
74         const TObjArray* GetResponsibles(const char* detector) const;
75         Bool_t StrictRunOrder(const char* detector) const;
76
77         void SetProcessAll(Bool_t flag=kTRUE) {fProcessAll=flag;}
78         Bool_t ProcessAll() const {return fProcessAll;}
79
80         Bool_t HostProcessDetector(const char* detector) const;
81
82         virtual void Print(Option_t* option = NULL) const;
83
84 private:
85
86         class AliShuttleDCSConfigHolder: public TObject {
87         public:
88                 AliShuttleDCSConfigHolder(const TLDAPEntry* entry);
89                 ~AliShuttleDCSConfigHolder();
90                 
91                 const char* GetDCSHost() const {return fDCSHost;}
92                 Int_t GetDCSPort() const {return fDCSPort;}
93                 Int_t GetMultiSplit() const {return fMultiSplit;}
94                 
95                 const TObjArray* GetDCSAliases() const {return fDCSAliases;}
96                 const TObjArray* GetDCSDataPoints() const {return fDCSDataPoints;}
97                 const TObjArray* GetCompactDCSAliases() const {return fDCSAliasesComp;}
98                 const TObjArray* GetCompactDCSDataPoints() const {return fDCSDataPointsComp;}
99                 
100                 void ExpandAndAdd(TObjArray* target, const char* entry);
101                 Bool_t IsValid() const {return fIsValid;}
102
103         private:
104                 AliShuttleDCSConfigHolder(const AliShuttleDCSConfigHolder& other);  // not implemented
105                 AliShuttleDCSConfigHolder& operator= (const AliShuttleDCSConfigHolder& other);  // not implemented
106
107                 TString fDCSHost;       // Host name of the DCS server
108                 Int_t   fDCSPort;       // port of the DCS server
109                 Int_t   fMultiSplit;     // N. of DPs to be queried in each query chunk
110                 TObjArray* fDCSAliases; // List of DCS aliases to be retrieved
111                 TObjArray* fDCSDataPoints;     // List of DCS data points to be retrieved
112                 TObjArray* fDCSAliasesComp;    // Compact list of DCS aliases to be printed
113                 TObjArray* fDCSDataPointsComp; // Compact list of DCS data points to be printed
114                 Bool_t  fIsValid;              // flag for the validity of the configuration
115
116                 ClassDef(AliShuttleDCSConfigHolder, 0);
117         };
118
119         class AliShuttleDetConfigHolder: public TObject {
120         public:
121                 AliShuttleDetConfigHolder(const TLDAPEntry* entry);
122                 ~AliShuttleDetConfigHolder();
123
124                 const char* GetDetector() const {return fDetector.Data();}
125                 const TObjArray* GetDCSConfig() const {return fDCSConfig;}
126                 void AddDCSConfig(AliShuttleDCSConfigHolder* holder);
127
128                 Int_t GetNServers() const {return fDCSConfig ? fDCSConfig->GetEntries() : 0;}
129                 
130                 const char* GetDCSHost(Int_t iServ) const;
131                 Int_t GetDCSPort(Int_t iServ) const;
132                 Int_t GetMultiSplit(Int_t iServ) const;
133                 
134                 const TObjArray* GetDCSAliases(Int_t iServ) const;
135                 const TObjArray* GetDCSDataPoints(Int_t iServ) const;
136                 const TObjArray* GetCompactDCSAliases(Int_t iServ) const;
137                 const TObjArray* GetCompactDCSDataPoints(Int_t iServ) const;
138                 
139                 const TObjArray* GetResponsibles() const {return fResponsibles;}                
140                 Bool_t IsValid() const {return fIsValid;}
141                 Bool_t SkipDCSQuery() const {return fSkipDCSQuery;}
142                 Bool_t StrictRunOrder() const {return fStrictRunOrder;}
143
144         private:
145                 AliShuttleDetConfigHolder(const AliShuttleDetConfigHolder& other);  // not implemented
146                 AliShuttleDetConfigHolder& operator= (const AliShuttleDetConfigHolder& other);  // not implemented
147
148                 TString fDetector;      // Detector name
149                 TObjArray* fDCSConfig;  // Array of DCS configuration objects (AliShuttleDCSConfigHolder)
150                 TObjArray* fResponsibles; // List of email addresses of the detector's responsible(s)
151                 Bool_t fIsValid;        // flag for the validity of the configuration
152                 Bool_t fSkipDCSQuery;   // flag - if TRUE (-> DCS config empty) skip DCS archive data query
153                 Bool_t fStrictRunOrder; // flag - if TRUE connect data in a strict run ordering
154
155                 ClassDef(AliShuttleDetConfigHolder, 0);
156         };
157
158
159         UInt_t SetGlobalConfig(TList* globalList);
160         UInt_t SetSysConfig(TList* sysList);
161         UInt_t SetDetConfig(TList* detList, TList* dcsList);
162         UInt_t SetHostConfig(TList* hostList);
163         
164         TString fConfigHost;            //! Host of the Shuttle configuration LDAP server
165
166         TString fDAQlbHost;             //! Host of the DAQ logbook MySQL Server
167         UInt_t  fDAQlbPort;             //! port of the DAQ logbook MySQL Server
168         TString fDAQlbUser;             //! username of the DAQ logbook MySQL Server
169         TString fDAQlbPass;             //! password of the DAQ logbook MySQL Server
170         TString fDAQlbDB;               //! DB name of the DAQ logbook MySQL Server
171         TString fDAQlbTable;            //! Table name of the DAQ logbook 
172         TString fShuttlelbTable;        //! Table name of the Shuttle logbook
173         TString fRunTypelbTable;        //! Table name of the Run typr logbook
174
175         TString fFXSHost[3];            //! Host of the [DAQ, DCS, HLT] File eXchange Server
176         UInt_t  fFXSPort[3];            //! Port of the [DAQ, DCS, HLT] File eXchange Server
177         TString fFXSUser[3];            //! username of the [DAQ, DCS, HLT] File eXchange Server
178         TString fFXSPass[3];            //! password of the [DAQ, DCS, HLT] File eXchange Server
179
180         TString fFXSdbHost[3];          //! Host of the [DAQ, DCS, HLT] FXS database
181         UInt_t  fFXSdbPort[3];          //! Port of the [DAQ, DCS, HLT] FXS database
182         TString fFXSdbUser[3];          //! username of the [DAQ, DCS, HLT] FXS database
183         TString fFXSdbPass[3];          //! password of the [DAQ, DCS, HLT] FXS database
184         TString fFXSdbName[3];          //! name of the [DAQ, DCS, HLT] FXS database
185         TString fFXSdbTable[3];         //! Table name of the [DAQ, DCS, HLT] FXS database
186
187         Int_t fMaxRetries;        // number of retries of a failed preprocessor
188
189         Int_t fPPTimeOut;         // timeout until a preprocessor is killed
190         Int_t fPPMaxMem;          // maximum allowed memory until a preprocessor is killed
191
192         TMap fDetectorMap;              //! Map of the detector-by-detector configuration
193         TObjArray fDetectorList;        //! List of detectors with valid configuration
194
195         TString fShuttleInstanceHost;   //! Instance of the SHUTTLE
196         TObjArray fProcessedDetectors;  //! list of the detector to be processed by this machine
197         Bool_t fProcessAll;             //! flag indicating that all detectors will be processed
198         Bool_t fIsValid;                //! flag for the validity of the configuration
199
200         ClassDef(AliShuttleConfig, 0);
201 };
202
203 #endif
204