adding the possibility of defining DCS alias and data points with patterns
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.15  2007/01/15 18:27:11  acolla
19 implementation of sending mail to subdetector expert in case the preprocessor fails.
20 shuttle.schema updated with expert's email entry
21
22 Revision 1.13  2006/12/07 08:51:26  jgrosseo
23 update (alberto):
24 table, db names in ldap configuration
25 added GRP preprocessor
26 DCS data can also be retrieved by data point
27
28 Revision 1.12  2006/11/16 16:16:48  jgrosseo
29 introducing strict run ordering flag
30 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
31
32 Revision 1.11  2006/11/06 14:23:04  jgrosseo
33 major update (Alberto)
34 o) reading of run parameters from the logbook
35 o) online offline naming conversion
36 o) standalone DCSclient package
37
38 Revision 1.10  2006/10/20 15:22:59  jgrosseo
39 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
40 o) Merging Collect, CollectAll, CollectNew function
41 o) Removing implementation of empty copy constructors (declaration still there!)
42
43 Revision 1.9  2006/10/02 16:38:39  jgrosseo
44 update (alberto):
45 fixed memory leaks
46 storing of objects that failed to be stored to the grid before
47 interfacing of shuttle status table in daq system
48
49 Revision 1.8  2006/08/15 10:50:00  jgrosseo
50 effc++ corrections (alberto)
51
52 Revision 1.7  2006/07/20 09:54:40  jgrosseo
53 introducing status management: The processing per subdetector is divided into several steps,
54 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
55 can keep track of the number of failures and skips further processing after a certain threshold is
56 exceeded. These thresholds can be configured in LDAP.
57
58 Revision 1.6  2006/07/19 10:09:55  jgrosseo
59 new configuration, accesst to DAQ FES (Alberto)
60
61 Revision 1.5  2006/07/10 13:01:41  jgrosseo
62 enhanced storing of last sucessfully processed run (alberto)
63
64 Revision 1.4  2006/06/12 09:11:16  jgrosseo
65 coding conventions (Alberto)
66
67 Revision 1.3  2006/06/06 14:26:40  jgrosseo
68 o) removed files that were moved to STEER
69 o) shuttle updated to follow the new interface (Alberto)
70
71 Revision 1.7  2006/05/12 09:07:16  colla
72 12/05/06
73 New configuration complete
74
75 Revision 1.2  2006/03/07 07:52:34  hristov
76 New version (B.Yordanov)
77
78 Revision 1.4  2005/11/19 14:20:31  byordano
79 logbook config added to AliShuttleConfig
80
81 Revision 1.3  2005/11/17 19:24:25  byordano
82 TList changed to TObjArray in AliShuttleConfig
83
84 Revision 1.2  2005/11/17 14:43:23  byordano
85 import to local CVS
86
87 Revision 1.1.1.1  2005/10/28 07:33:58  hristov
88 Initial import as subdirectory in AliRoot
89
90 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
91 SHUTTLE package
92
93 Revision 1.3  2005/08/30 09:13:02  byordano
94 some docs added
95
96 */
97
98
99 //
100 // This class keeps the AliShuttle configuration.
101 // It reads the configuration for LDAP server.
102 // For every child entry in basedn which has schema type 'shuttleConfig'
103 // it creates a detector configuration. This configuration includes:
104 // DCS server host and port and the set of aliases for which data from
105 // will be retrieved (used by AliShuttle).
106 //
107
108
109 #include "AliShuttleConfig.h"
110 #include "AliShuttleInterface.h"
111
112 #include "AliLog.h"
113
114 #include <TSystem.h>
115 #include <TObjString.h>
116 #include <TLDAPResult.h>
117 #include <TLDAPEntry.h>
118 #include <TLDAPAttribute.h>
119
120
121 AliShuttleConfig::AliShuttleConfigHolder::AliShuttleConfigHolder(const TLDAPEntry* entry):
122 fDetector(""),
123 fDCSHost(""),
124 fDCSPort(0),
125 fDCSAliases(0),
126 fDCSDataPoints(0),
127 fResponsibles(0),
128 fIsValid(kFALSE),
129 fSkipDCSQuery(kFALSE),
130 fStrictRunOrder(kFALSE)
131 {
132 // constructor of the shuttle configuration holder
133
134         TLDAPAttribute* anAttribute;
135         fDCSAliases = new TObjArray();
136         fDCSAliases->SetOwner(1);
137         fDCSDataPoints = new TObjArray();
138         fDCSDataPoints->SetOwner(1);
139         fResponsibles = new TObjArray();
140         fResponsibles->SetOwner(1);
141
142         anAttribute = entry->GetAttribute("det"); // MUST
143         if (!anAttribute)
144         {
145                 AliError(Form("Invalid configuration! No \"det\" attribute!"));
146                 return;
147         }
148         fDetector = anAttribute->GetValue();
149
150         anAttribute = entry->GetAttribute("StrictRunOrder"); // MAY
151         if (!anAttribute)
152         {
153                 AliWarning(Form("%s did not set StrictRunOrder flag - the default is FALSE",
154                                 fDetector.Data()));
155         } else {
156                 TString strictRunStr = anAttribute->GetValue();
157                 if (!(strictRunStr == "0" || strictRunStr == "1"))
158                 {
159                         AliError("Invalid configuration! StrictRunOrder flag must be 0 or 1!");
160                         return;
161                 }
162                 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
163         }
164
165         anAttribute = entry->GetAttribute("responsible"); // MUST
166         if (!anAttribute)
167         {
168                 AliError(Form("Invalid configuration! No \"responsible\" attribute!"));
169                 return;
170         }
171         const char* aResponsible;
172         while ((aResponsible = anAttribute->GetValue()))
173         {
174                 fResponsibles->AddLast(new TObjString(aResponsible));
175         }
176
177         anAttribute = entry->GetAttribute("DCSHost"); // MAY
178         if (!anAttribute)
179         {
180                 AliDebug(2,
181                         Form("%s has not DCS host entry - Shuttle will skip DCS data query!",
182                                 fDetector.Data()));
183                 fIsValid = kTRUE;
184                 fSkipDCSQuery = kTRUE;
185                 return;
186         }
187
188         fDCSHost = anAttribute->GetValue();
189
190         anAttribute = entry->GetAttribute("DCSPort"); // MAY
191         if (!anAttribute)
192         {
193                 AliError(Form("Invalid configuration! %s has DCS Host but no port number!",
194                                 fDetector.Data()));
195                 return;
196         }
197         TString portStr = anAttribute->GetValue();
198         fDCSPort = portStr.Atoi();
199
200         anAttribute = entry->GetAttribute("DCSalias"); // MAY
201         if (anAttribute)
202         {
203                 const char* anAlias;
204                 while ((anAlias = anAttribute->GetValue()))
205                 {
206                         ExpandAndAdd(fDCSAliases, anAlias);
207                 }
208         }
209
210         anAttribute = entry->GetAttribute("DCSdatapoint"); // MAY
211         if (anAttribute)
212         {
213                 const char* aDataPoint;
214                 while ((aDataPoint = anAttribute->GetValue()))
215                 {
216       ExpandAndAdd(fDCSDataPoints, aDataPoint);
217                 }
218         }
219
220         fIsValid = kTRUE;
221 }
222
223 //______________________________________________________________________________________________
224 void AliShuttleConfig::AliShuttleConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
225 {
226   //
227   // adds <entry> to <target> applying expanding of the name
228   // [N..M] creates M-N+1 names with the corresponding digits
229   //
230
231   TString entryStr(entry);
232
233   Int_t begin = entryStr.Index("[");
234   Int_t end = entryStr.Index("]");
235   if (begin != -1 && end != -1 && end > begin)
236   {
237     TString before(entryStr(0, begin));
238     TString after(entryStr(end+1, entryStr.Length()));
239
240     AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
241
242     Int_t dotdot = entryStr.Index("..");
243
244     TString nStr(entryStr(begin+1, dotdot-begin-1));
245     TString mStr(entryStr(dotdot+2, end-dotdot-2));
246
247     AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
248
249     if (nStr.IsDigit() && mStr.IsDigit())
250     {
251       Int_t n = nStr.Atoi();
252       Int_t m = mStr.Atoi();
253
254       Int_t nDigits = nStr.Length();
255       TString formatStr;
256       formatStr.Form("%%s%%0%dd%%s", nDigits);
257
258       AliDebug(2, Form("Format string is %s", formatStr.Data()));
259
260       for (Int_t current = n; current<=m; ++current)
261       {
262         TString newEntry;
263         newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
264
265         AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
266
267         // and go recursive
268         ExpandAndAdd(target, newEntry);
269       }
270
271       // return here because we processed the entries already recursively.
272       return;
273     }
274   }
275
276   AliDebug(2, Form("Adding name %s", entry));
277   target->AddLast(new TObjString(entry));
278 }
279
280 //______________________________________________________________________________________________
281 AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder()
282 {
283 // destructor of the shuttle configuration holder
284
285         delete fDCSAliases;
286         delete fDCSDataPoints;
287         delete fResponsibles;
288 }
289
290 ClassImp(AliShuttleConfig)
291
292 //______________________________________________________________________________________________
293 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
294         const char* binddn, const char* password, const char* basedn):
295         fIsValid(kFALSE), fConfigHost(host),
296         fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""),
297         fDAQlbDB(""), fDAQlbTable(""),
298         fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(),
299         fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
300 {
301         //
302         // host: ldap server host
303         // port: ldap server port
304         // binddn: binddn used for ldap binding (simple bind is used!).
305         // password: password for binddn
306         // basedn: this is basedn whose childeren entries which have
307         // (objectClass=shuttleConfig) will be used as detector configurations.
308         //
309
310         fDetectorMap.SetOwner();
311         fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
312         fProcessedDetectors.SetOwner();
313
314         TLDAPServer aServer(host, port, binddn, password, 3);
315
316         if (!aServer.IsConnected()) {
317                 AliError(Form("Can't connect to ldap server %s:%d",
318                                 host, port));
319                 return;
320         }
321
322         // reads configuration for the shuttle running on this machine
323
324         fShuttleInstanceHost = gSystem->HostName();
325         TString queryFilter = Form("(ShuttleHost=%s)", fShuttleInstanceHost.Data());
326
327         TLDAPResult* aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
328
329         if (!aResult) {
330                 AliError(Form("Can't find configuration with base DN: %s",
331                                 basedn));
332                 return;
333         }
334
335         if (aResult->GetCount() == 0) {
336                 AliError(Form("No Shuttle instance for host = %s!",
337                                         fShuttleInstanceHost.Data()));
338                 AliError(Form("All detectors will be processed."));
339                 fProcessAll=kTRUE;
340         }
341
342         if (aResult->GetCount() > 1) {
343                 AliError(Form("More than one Shuttle instance for host %s!",
344                                         fShuttleInstanceHost.Data()));
345                 delete aResult;
346                 return;
347         }
348
349         TLDAPEntry* anEntry = 0;
350         TLDAPAttribute* anAttribute = 0;
351
352         if(!fProcessAll){
353                 anEntry = aResult->GetNext();
354                 anAttribute = anEntry->GetAttribute("detectors");
355                 const char *detName;
356                 while((detName = anAttribute->GetValue())){
357                         TObjString *objDet= new TObjString(detName);
358                         fProcessedDetectors.Add(objDet);
359                 }
360         }
361
362         delete anEntry; delete aResult;
363
364         // Detector configuration (DCS Archive DB settings)
365
366         aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, "(objectClass=AliShuttleDetector)");
367         if (!aResult) {
368                 AliError(Form("Can't find configuration with base DN: %s", basedn));
369                 return;
370         }
371
372
373         while ((anEntry = aResult->GetNext())) {
374                 AliShuttleConfigHolder* aHolder = new AliShuttleConfigHolder(anEntry);
375                 delete anEntry;
376
377                 if (!aHolder->IsValid()) {
378                         AliError("Detector configuration error!");
379                         delete aHolder;
380                         delete aResult;
381                         return;
382                 }
383
384                 TObjString* detStr = new TObjString(aHolder->GetDetector());
385                 fDetectorMap.Add(detStr, aHolder);
386                 fDetectorList.AddLast(detStr);
387         }
388
389         delete aResult;
390
391         // Global configuration (DAQ logbook)
392
393         aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
394                         "(objectClass=AliShuttleGlobalConfig)");
395         if (!aResult) {
396                 AliError(Form("Can't find configuration with base DN: %s",
397                                 basedn));
398                 return;
399         }
400
401         if (aResult->GetCount() == 0) {
402                 AliError("Can't find DAQ logbook configuration!");
403                 delete aResult;
404                 return;
405         }
406
407         if (aResult->GetCount() > 1) {
408                 AliError("More than one DAQ logbook configuration found!");
409                 delete aResult;
410                 return;
411         }
412
413         anEntry = aResult->GetNext();
414
415         anAttribute = anEntry->GetAttribute("DAQLogbookHost");
416         if (!anAttribute) {
417                 AliError("Can't find DAQLogbookHost attribute!");
418                 delete anEntry; delete aResult;
419                 return;
420         }
421         fDAQlbHost = anAttribute->GetValue();
422
423         anAttribute = anEntry->GetAttribute("DAQLogbookPort"); // MAY
424         if (anAttribute)
425         {
426                 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
427         } else {
428                 fDAQlbPort = 3306; // mysql
429         }
430
431         anAttribute = anEntry->GetAttribute("DAQLogbookUser");
432         if (!anAttribute) {
433                 AliError("Can't find DAQLogbookUser attribute!");
434                 delete aResult; delete anEntry;
435                 return;
436         }
437         fDAQlbUser = anAttribute->GetValue();
438
439         anAttribute = anEntry->GetAttribute("DAQLogbookPassword");
440         if (!anAttribute) {
441                 AliError("Can't find DAQLogbookPassword attribute!");
442                 delete aResult; delete anEntry;
443                 return;
444         }
445         fDAQlbPass = anAttribute->GetValue();
446
447         anAttribute = anEntry->GetAttribute("DAQLogbookDB");
448         if (!anAttribute) {
449                 AliError("Can't find DAQLogbookDB attribute!");
450                 delete aResult; delete anEntry;
451                 return;
452         }
453         fDAQlbDB = anAttribute->GetValue();
454
455         anAttribute = anEntry->GetAttribute("DAQLogbookTable");
456         if (!anAttribute) {
457                 AliError("Can't find DAQLogbookTable attribute!");
458                 delete aResult; delete anEntry;
459                 return;
460         }
461         fDAQlbTable = anAttribute->GetValue();
462
463
464         anAttribute = anEntry->GetAttribute("MaxRetries");
465         if (!anAttribute) {
466                 AliError("Can't find MaxRetries attribute!");
467                 delete aResult; delete anEntry;
468                 return;
469         }
470         TString tmpStr = anAttribute->GetValue();
471         fMaxRetries = tmpStr.Atoi();
472
473         anAttribute = anEntry->GetAttribute("PPTimeOut");
474         if (!anAttribute) {
475                 AliError("Can't find PPTimeOut attribute!");
476                 delete aResult; delete anEntry;
477                 return;
478         }
479         tmpStr = anAttribute->GetValue();
480         fPPTimeOut = tmpStr.Atoi();
481
482         delete aResult; delete anEntry;
483
484         // FXS configuration (FXS logbook and hosts)
485
486         for(int iSys=0;iSys<3;iSys++){
487                 queryFilter = Form("(system=%s)", AliShuttleInterface::GetSystemName(iSys));
488                 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
489                 if (!aResult) {
490                         AliError(Form("Can't find configuration for system: %s",
491                                         AliShuttleInterface::GetSystemName(iSys)));
492                         return;
493                 }
494
495                 if (aResult->GetCount() != 1 ) {
496                         AliError("Error in FXS configuration!");
497                         delete aResult;
498                         return;
499                 }
500
501                 anEntry = aResult->GetNext();
502
503                 anAttribute = anEntry->GetAttribute("DBHost");
504                 if (!anAttribute) {
505                         AliError(Form ("Can't find DBHost attribute for %s!!",
506                                                 AliShuttleInterface::GetSystemName(iSys)));
507                         delete aResult; delete anEntry;
508                         return;
509                 }
510                 fFXSdbHost[iSys] = anAttribute->GetValue();
511
512                 anAttribute = anEntry->GetAttribute("DBPort"); // MAY
513                 if (anAttribute)
514                 {
515                         fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
516                 } else {
517                         fFXSdbPort[iSys] = 3306; // mysql
518                 }
519
520                 anAttribute = anEntry->GetAttribute("DBUser");
521                 if (!anAttribute) {
522                         AliError(Form ("Can't find DBUser attribute for %s!!",
523                                                 AliShuttleInterface::GetSystemName(iSys)));
524                         delete aResult; delete anEntry;
525                         return;
526                 }
527                 fFXSdbUser[iSys] = anAttribute->GetValue();
528
529                 anAttribute = anEntry->GetAttribute("DBPassword");
530                 if (!anAttribute) {
531                         AliError(Form ("Can't find DBPassword attribute for %s!!",
532                                                 AliShuttleInterface::GetSystemName(iSys)));
533                         delete aResult; delete anEntry;
534                         return;
535                 }
536                 fFXSdbPass[iSys] = anAttribute->GetValue();
537
538                 anAttribute = anEntry->GetAttribute("DBName");
539                 if (!anAttribute) {
540                         AliError(Form ("Can't find DBName attribute for %s!!",
541                                                 AliShuttleInterface::GetSystemName(iSys)));
542                         delete aResult; delete anEntry;
543                         return;
544                 }
545
546                 fFXSdbName[iSys] = anAttribute->GetValue();
547                 anAttribute = anEntry->GetAttribute("DBTable");
548                 if (!anAttribute) {
549                         AliError(Form ("Can't find DBTable attribute for %s!!",
550                                                 AliShuttleInterface::GetSystemName(iSys)));
551                         delete aResult; delete anEntry;
552                         return;
553                 }
554                 fFXSdbTable[iSys] = anAttribute->GetValue();
555
556                 anAttribute = anEntry->GetAttribute("FSHost");
557                 if (!anAttribute) {
558                         AliError(Form ("Can't find FSHost attribute for %s!!",
559                                                 AliShuttleInterface::GetSystemName(iSys)));
560                         delete aResult; delete anEntry;
561                         return;
562                 }
563                 fFXSHost[iSys] = anAttribute->GetValue();
564
565                 anAttribute = anEntry->GetAttribute("FSPort"); // MAY
566                 if (anAttribute)
567                 {
568                         fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
569                 } else {
570                         fFXSPort[iSys] = 22; // scp port number
571                 }
572
573                 anAttribute = anEntry->GetAttribute("FSUser");
574                 if (!anAttribute) {
575                         AliError(Form ("Can't find FSUser attribute for %s!!",
576                                                 AliShuttleInterface::GetSystemName(iSys)));
577                         delete aResult; delete anEntry;
578                         return;
579                 }
580                 fFXSUser[iSys] = anAttribute->GetValue();
581
582                 anAttribute = anEntry->GetAttribute("FSPassword");
583                 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
584
585                 delete aResult; delete anEntry;
586         }
587
588         fIsValid = kTRUE;
589 }
590
591 //______________________________________________________________________________________________
592 AliShuttleConfig::~AliShuttleConfig()
593 {
594 // destructor
595
596         fDetectorMap.DeleteAll();
597         fDetectorList.Clear();
598         fProcessedDetectors.Delete();
599 }
600
601 //______________________________________________________________________________________________
602 const TObjArray* AliShuttleConfig::GetDetectors() const
603 {
604         //
605         // returns collection of TObjString which contains the name
606         // of every detector which is in the configuration.
607         //
608
609         return &fDetectorList;
610 }
611
612 //______________________________________________________________________________________________
613 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
614 {
615         //
616         // checks for paricular detector in the configuration.
617         //
618         return fDetectorMap.GetValue(detector) != NULL;
619 }
620
621 //______________________________________________________________________________________________
622 const char* AliShuttleConfig::GetDCSHost(const char* detector) const
623 {
624         //
625         // returns DCS server host used by particular detector
626         //
627         
628         AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
629         if (!aHolder) {
630                 AliError(Form("There isn't configuration for detector: %s",
631                         detector));
632                 return NULL;
633         }
634
635         return aHolder->GetDCSHost();
636 }
637
638 //______________________________________________________________________________________________
639 Int_t AliShuttleConfig::GetDCSPort(const char* detector) const
640 {
641         //
642         // returns DCS server port used by particular detector
643         //
644
645
646         AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
647         if (!aHolder) {
648                 AliError(Form("There isn't configuration for detector: %s",
649                         detector));
650                 return 0;
651         }
652
653         return aHolder->GetDCSPort();
654 }
655
656 //______________________________________________________________________________________________
657 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
658 {
659         //
660         // returns collection of TObjString which represents the set of aliases
661         // which used for data retrieval for particular detector
662         //
663
664         AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
665         if (!aHolder) {
666                 AliError(Form("There isn't configuration for detector: %s",
667                         detector));
668                 return NULL;
669         }
670
671         return aHolder->GetDCSAliases();
672 }
673
674 //______________________________________________________________________________________________
675 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector) const
676 {
677         //
678         // returns collection of TObjString which represents the set of aliases
679         // which used for data retrieval for particular detector
680         //
681
682         AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
683         if (!aHolder) {
684                 AliError(Form("There isn't configuration for detector: %s",
685                         detector));
686                 return NULL;
687         }
688
689         return aHolder->GetDCSDataPoints();
690 }
691
692 //______________________________________________________________________________________________
693 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
694 {
695         //
696         // returns collection of TObjString which represents the list of mail addresses
697         // of the detector's responsible(s)
698         //
699
700         AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
701         if (!aHolder) {
702                 AliError(Form("There isn't configuration for detector: %s",
703                         detector));
704                 return NULL;
705         }
706
707         return aHolder->GetResponsibles();
708 }
709
710 //______________________________________________________________________________________________
711 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
712 {
713         // return TRUE if detector is handled by host or if fProcessAll is TRUE
714
715         if(fProcessAll) return kTRUE;
716         TIter iter(&fProcessedDetectors);
717         TObjString* detName;
718         while((detName = (TObjString*) iter.Next())){
719                 if(detName->String() == detector) return kTRUE;
720         }
721         return kFALSE;
722 }
723
724 //______________________________________________________________________________________________
725 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
726 {
727         // return TRUE if detector wants strict run ordering of stored data
728
729         AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
730         if (!aHolder)
731         {
732                 AliError(Form("There isn't configuration for detector: %s",
733                         detector));
734                 return kTRUE;
735         }
736
737         return aHolder->StrictRunOrder();
738 }
739
740 //______________________________________________________________________________________________
741 void AliShuttleConfig::Print(Option_t* /*option*/) const
742 {
743 // print configuration
744         
745         TString result;
746         result += '\n';
747
748         result += "####################################################\n";
749         result += Form(" Shuttle configuration from %s \n", fConfigHost.Data());
750         result += "####################################################\n";
751         result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
752
753         if(fProcessAll) {
754                 result += Form("All detectors will be processed! \n");
755         } else {
756                 result += "Detectors processed by this host: ";
757                 TIter it(&fProcessedDetectors);
758                 TObjString* aDet;
759                 while ((aDet = (TObjString*) it.Next())) {
760                         result += Form("%s ", aDet->String().Data());
761                 }
762                 result += "\n";
763         }
764
765         result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries);
766         result += "------------------------------------------------------\n";
767
768         result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
769                 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
770
771 //      result += "Password: ";
772 //      result.Append('*', fDAQlbPass.Length());
773         result += Form("\tDB: %s; \tTable: %s",
774                 fDAQlbDB.Data(), fDAQlbTable.Data());
775
776         result += "\n\n";
777
778         result += "------------------------------------------------------\n";
779         result += "FXS configuration\n\n";
780
781         for(int iSys=0;iSys<3;iSys++){
782                 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
783                 result += Form("\tDB  host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
784                                                 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
785                                                 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
786                 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
787                 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
788                                                 fFXSUser[iSys].Data());
789                 // result += Form("FXS Password:",fFXSPass[iSys].Data());
790         }
791
792         result += "------------------------------------------------------\n";
793         result += "Detector-specific configuration\n\n";
794         TIter iter(fDetectorMap.GetTable());
795         TPair* aPair;
796         while ((aPair = (TPair*) iter.Next())) {
797                 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
798                 result += Form("*** %s *** \n", aHolder->GetDetector());
799
800                 const TObjArray* responsibles = aHolder->GetResponsibles();
801                 if (responsibles->GetEntries() != 0)
802                 {
803                         result += "\tDetector responsible(s): ";
804                         TIter it(responsibles);
805                         TObjString* aResponsible;
806                         while ((aResponsible = (TObjString*) it.Next()))
807                         {
808                                 result += Form("%s ", aResponsible->String().Data());
809                         }
810                         result += "\n";
811                 }
812
813                 result += Form("\tStrict run ordering: %s \n", aHolder->StrictRunOrder() ? "YES" : "NO");
814                 if(aHolder->SkipDCSQuery())
815                 {
816                         result += "\n";
817                         continue;
818                 }
819                 result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
820
821                 const TObjArray* aliases = aHolder->GetDCSAliases();
822                 if (aliases->GetEntries() != 0)
823                 {
824                         result += "\tDCS Aliases: ";
825                         TIter it(aliases);
826                         TObjString* anAlias;
827                         while ((anAlias = (TObjString*) it.Next()))
828                         {
829                                 result += Form("%s ", anAlias->String().Data());
830                         }
831                         result += "\n";
832                 }
833
834                 const TObjArray* dataPoints = aHolder->GetDCSDataPoints();
835                 if (dataPoints->GetEntries() != 0)
836                 {
837                         result += "\tDCS Data Points: ";
838                         TIter it(dataPoints);
839                         TObjString* aDataPoint;
840                         while ((aDataPoint = (TObjString*) it.Next())) {
841                                 result += Form("%s ", aDataPoint->String().Data());
842                         }
843                                 result += "\n";
844                 }
845                 result += "\n";
846         }
847
848         if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";
849
850         AliInfo(result);
851 }