+
+ anAttribute = anEntry->GetAttribute("shuttleAdmin"); // MAY
+ if (!anAttribute)
+ {
+ AliDebug(2, "Warning! No \"shuttleAdmin\" attribute!");
+ }
+ else
+ {
+ const char* anAdmin;
+ while ((anAdmin = anAttribute->GetValue()))
+ {
+ fAdmin[kGlobal]->AddLast(new TObjString(anAdmin));
+ }
+ }
+
+ anAttribute = anEntry->GetAttribute("amandaAdmin"); // MAY
+ if (!anAttribute)
+ {
+ AliDebug(2, "Warning! No \"amandaAdmin\" attribute!");
+ }
+ else
+ {
+ const char* anAdmin;
+ while ((anAdmin = anAttribute->GetValue()))
+ {
+ fAdmin[kAmanda]->AddLast(new TObjString(anAdmin));
+ }
+ }
+
+ anAttribute = anEntry->GetAttribute("sendMail"); // MAY
+ if (!anAttribute)
+ {
+ AliWarning("sendMail flag not set - default is FALSE");
+ } else {
+ TString sendMailStr = anAttribute->GetValue();
+ if (!(sendMailStr == "0" || sendMailStr == "1"))
+ {
+ AliError("sendMail flag must be 0 or 1!");
+ return 4;
+ }
+ fSendMail = (Bool_t) sendMailStr.Atoi();
+ }
+
+ anAttribute = anEntry->GetAttribute("passwdFilePath");
+ if (!anAttribute) {
+ AliError("Can't find Passwords File Path attribute!");
+ return 4;
+ }
+ fPasswdFilePath = anAttribute->GetValue();
+
+ return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliShuttleConfig::SetSysConfig(TList* list)
+{
+ // Set the online FXS configuration (DAQ + DCS + HLT)
+
+
+ TLDAPEntry* anEntry = 0;
+ TLDAPAttribute* anAttribute = 0;
+
+ if (list->GetEntries() != 3)
+ {
+ AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
+ return 1;
+ }
+
+ TIter iter(list);
+ Int_t count = 0;
+ SystemCode iSys=kDAQ;
+
+ while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
+ {
+ anAttribute = anEntry->GetAttribute("system");
+ TString sysName = anAttribute->GetValue();
+
+ if (sysName == "DAQ")
+ {
+ iSys = kDAQ;
+ count += 1;
+ }
+ else if (sysName == "DCS")
+ {
+ iSys = kDCS;
+ count += 10;
+ }
+ else if (sysName == "HLT")
+ {
+ iSys = kHLT;
+ count += 100;
+ }
+
+ anAttribute = anEntry->GetAttribute("dbHost");
+ if (!anAttribute) {
+ AliError(Form ("Can't find dbHost attribute for %s!!",
+ AliShuttleInterface::GetSystemName(iSys)));
+ return 5;
+ }
+ fFXSdbHost[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("dbPort"); // MAY
+ if (anAttribute)
+ {
+ fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
+ } else {
+ fFXSdbPort[iSys] = 3306; // mysql
+ }
+
+ anAttribute = anEntry->GetAttribute("dbUser");
+ if (!anAttribute) {
+ AliError(Form ("Can't find dbUser attribute for %s!!",
+ AliShuttleInterface::GetSystemName(iSys)));
+ return 5;
+ }
+ fFXSdbUser[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("dbName");
+ if (!anAttribute) {
+ AliError(Form ("Can't find dbName attribute for %s!!",
+ AliShuttleInterface::GetSystemName(iSys)));
+ return 5;
+ }
+
+ fFXSdbName[iSys] = anAttribute->GetValue();
+ anAttribute = anEntry->GetAttribute("dbTable");
+ if (!anAttribute) {
+ AliError(Form ("Can't find dbTable attribute for %s!!",
+ AliShuttleInterface::GetSystemName(iSys)));
+ return 5;
+ }
+ fFXSdbTable[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("fxsHost");
+ if (!anAttribute) {
+ AliError(Form ("Can't find fxsHost attribute for %s!!",
+ AliShuttleInterface::GetSystemName(iSys)));
+ return 5;
+ }
+ fFXSHost[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
+ if (anAttribute)
+ {
+ fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
+ } else {
+ fFXSPort[iSys] = 22; // scp port number
+ }
+
+ anAttribute = anEntry->GetAttribute("fxsUser");
+ if (!anAttribute) {
+ AliError(Form ("Can't find fxsUser attribute for %s!!",
+ AliShuttleInterface::GetSystemName(iSys)));
+ return 5;
+ }
+ fFXSUser[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("fxsPasswd");
+ if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("fxsBaseFolder");
+ if (anAttribute) fFXSBaseFolder[iSys] = anAttribute->GetValue();
+
+ anAttribute = anEntry->GetAttribute("fxsAdmin"); // MAY
+ if (!anAttribute)
+ {
+ AliDebug(2, "Warning! No \"fxsAdmin\" attribute!");
+ }
+ else
+ {
+ const char* anAdmin;
+ while ((anAdmin = anAttribute->GetValue()))
+ {
+ fAdmin[iSys]->AddLast(new TObjString(anAdmin));
+ }
+ }
+
+ }
+
+ if(count != 111) {
+ AliError(Form("Wrong system configuration! (code = %d)", count));
+ return 6;
+ }
+
+ return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliShuttleConfig::SetPasswords(){
+
+ AliInfo("Setting Passwords");
+
+ // Retrieving Passwords for DAQ lb, DAQ/DCS/HLT FXS
+
+ ifstream *inputfile = new ifstream(fPasswdFilePath.Data());
+ if (!*inputfile) {
+ AliError(Form("Error opening file %s !", fPasswdFilePath.Data()));
+ inputfile->close();
+ delete inputfile;
+ return 1;
+ }
+
+ TString line;
+ Int_t nPwd=0;
+ Int_t nPwdFake=0;
+ while (line.ReadLine(*inputfile)) {
+ TObjArray *tokens = line.Tokenize(" \t");
+ TString system = ((TObjString *)tokens->At(0))->String();
+ TString password = ((TObjString *)tokens->At(1))->String();
+ if (system.Contains("DAQ_LB")){
+ fDAQlbPass=password;
+ nPwd++;
+ AliDebug(3,Form("DAQ_LB: Password %s for %s found", password.Data(), system.Data()));
+ }
+ else if (system.Contains("DAQ_DB")){
+ fFXSdbPass[0]=password;
+ nPwd++;
+ AliDebug(3,Form("DAQ_DB: Password %s for %s found", password.Data(), system.Data()));
+ }
+ else if (system.Contains("DCS_DB")){
+ fFXSdbPass[1]=password;
+ nPwd++;
+ AliDebug(3,Form("DCS_DB: Password %s for %s found", password.Data(), system.Data()));
+ }
+ else if (system.Contains("HLT_DB")){
+ fFXSdbPass[2]=password;
+ nPwd++;
+ AliDebug(3,Form("HLT_DB: Password %s for %s found", password.Data(), system.Data()));
+ }
+ else {
+ nPwdFake++;
+ AliDebug(3,Form("%i fake line(s) found in file %s", nPwdFake, fPasswdFilePath.Data()));
+ continue;
+ }
+ delete tokens;
+ }
+
+ inputfile->close();
+ delete inputfile;
+
+ if (nPwd!=4){
+ AliError(Form("Wrong file for DAQ Logbook password found %s (some passwors missing), please Check!", fPasswdFilePath.Data()));
+ return 2;
+ }
+
+ return 0;
+
+}
+//______________________________________________________________________________________________
+UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
+{
+ // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
+
+ TLDAPEntry* anEntry = 0;
+
+ TIter iter(detList);
+ while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
+ {
+
+ AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
+
+ if (!detHolder->IsValid()) {
+ AliError("Detector configuration error!");
+ delete detHolder;
+ return 7;
+ }
+
+ TObjString* detStr = new TObjString(detHolder->GetDetector());
+
+ // Look for DCS Configuration
+ TIter dcsIter(dcsList);
+ TLDAPEntry *dcsEntry = 0;
+ while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
+ {
+ TString dn = dcsEntry->GetDn();
+ if(dn.Contains(detStr->GetName())) {
+ AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
+ AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
+ if (!dcsHolder->IsValid()) {
+ AliError("DCS configuration error!");
+ delete detHolder;
+ delete dcsHolder;
+ return 7;
+ }
+ detHolder->AddDCSConfig(dcsHolder);
+ }
+ }
+
+
+ fDetectorMap.Add(detStr, detHolder);
+ fDetectorList.AddLast(detStr);
+ }
+
+ return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliShuttleConfig::SetHostConfig(TList* list)
+{
+ // Set the Shuttle machines configuration (which detectors processes each machine)
+
+ TLDAPEntry* anEntry = 0;
+ TLDAPAttribute* anAttribute = 0;
+
+ fShuttleInstanceHost = gSystem->HostName();
+
+ TIter iter(list);
+ while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
+ {
+
+ TString dn(anEntry->GetDn());
+ if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
+
+ if (!fProcessAll)
+ {
+ anAttribute = anEntry->GetAttribute("detectors");
+ const char *detName;
+ while((detName = anAttribute->GetValue())){
+ TObjString *objDet= new TObjString(detName);
+ fProcessedDetectors.Add(objDet);
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+//______________________________________________________________________________________________
+void AliShuttleConfig::Print(Option_t* option) const
+{
+// print configuration
+// options : "": print configuration for all detectors, aliases and DPs in compacted format
+// "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
+// "DET": print configuration for DET, aliases and DPs in compacted format
+// "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
+