// will be retrieved (used by AliShuttle).
//
-
+#include <Riostream.h>
#include "AliShuttleConfig.h"
#include "AliShuttleInterface.h"
#include <TLDAPResult.h>
#include <TLDAPEntry.h>
#include <TLDAPAttribute.h>
+#include <TKey.h>
AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
fIsValid = kTRUE;
}
+//______________________________________________________________________________________________
+AliShuttleConfig::AliShuttleConfig(const AliShuttleConfig & other):
+ TObject(),
+ fConfigHost(other.fConfigHost),
+ fDAQlbHost(other.fDAQlbHost),
+ fDAQlbPort(other.fDAQlbPort),
+ fDAQlbUser(other.fDAQlbUser),
+ fDAQlbPass(other.fDAQlbPass),
+ fDAQlbDB(other.fDAQlbDB),
+ fDAQlbTable(other.fDAQlbTable),
+ fShuttlelbTable(other.fShuttlelbTable),
+ fRunTypelbTable(other.fRunTypelbTable),
+ fPasswdFilePath(other.fPasswdFilePath),
+ fMaxRetries(other.fMaxRetries),
+ fPPTimeOut(other.fPPTimeOut),
+ fDCSTimeOut(other.fDCSTimeOut),
+ fDCSRetries(other.fDCSRetries),
+ fPPMaxMem(other.fPPMaxMem),
+ fMonitorHost(other.fMonitorHost),
+ fMonitorTable(other.fMonitorTable),
+ fTriggerWait(other.fTriggerWait),
+ fRunMode(other.fRunMode),
+ fDetectorMap(),
+ fDetectorList(other.fDetectorList),
+ fShuttleInstanceHost(other.fShuttleInstanceHost),
+ fProcessedDetectors(other.fProcessedDetectors),
+ fKeepDCSMap(other.fKeepDCSMap),
+ fKeepTempFolder(other.fKeepTempFolder),
+ fSendMail(other.fSendMail),
+ fProcessAll(other.fProcessAll),
+ fIsValid(other.fIsValid)
+{
+ //
+ // copy ctor
+ //
+ for (Int_t i = 0; i<3; i++){
+ fFXSHost[i]=other.fFXSHost[i];
+ fFXSPort[i]=other.fFXSPort[i];
+ fFXSUser[i]=other.fFXSUser[i];
+ fFXSPass[i]=other.fFXSPass[i];
+ fFXSBaseFolder[i]=other.fFXSBaseFolder[i];
+ fFXSdbHost[i]=other.fFXSdbHost[i];
+ fFXSdbPort[i]=other.fFXSdbPort[i];
+ fFXSdbUser[i]=other.fFXSdbUser[i];
+ fFXSdbPass[i]=other.fFXSdbPass[i];
+ fFXSdbName[i]=other.fFXSdbName[i];
+ fFXSdbTable[i]=other.fFXSdbTable[i];
+ }
+ for (Int_t i = 0; i<5; i++){
+ fAdmin[i] = new TObjArray();
+ fAdmin[i]->AddAt(other.fAdmin[i]->At(i),i);
+ }
+
+ TIter iter((other.fDetectorMap).GetTable());
+ TPair* aPair = 0;
+
+ while ((aPair = (TPair*) iter.Next())) {
+ AliShuttleDetConfigHolder *holder =(AliShuttleDetConfigHolder *)aPair->Value();
+ TKey *key = (TKey*)aPair->Key();
+ fDetectorMap.Add(key,holder);
+ }
+
+
+}
+//_____________________________________________________________________________________________
+AliShuttleConfig& AliShuttleConfig::operator=(const AliShuttleConfig &other)
+{
+ //
+ //assignment operator
+ //
+ this->fConfigHost=other.fConfigHost;
+ this->fDAQlbHost=other.fDAQlbHost;
+ this->fDAQlbPort=other.fDAQlbPort;
+ this->fDAQlbUser=other.fDAQlbUser;
+ this->fDAQlbPass=other.fDAQlbPass;
+ this->fDAQlbDB=other.fDAQlbDB;
+ this->fDAQlbTable=other.fDAQlbTable;
+ this->fShuttlelbTable=other.fShuttlelbTable;
+ this->fRunTypelbTable=other.fRunTypelbTable;
+ this->fPasswdFilePath=other.fPasswdFilePath;
+ this->fMaxRetries=other.fMaxRetries;
+ this->fPPTimeOut=other.fPPTimeOut;
+ this->fDCSTimeOut=other.fDCSTimeOut;
+ this->fDCSRetries=other.fDCSRetries;
+ this->fPPMaxMem=other.fPPMaxMem;
+ this->fMonitorHost=other.fMonitorHost;
+ this->fMonitorTable=other.fMonitorTable;
+ this->fTriggerWait=other.fTriggerWait;
+ this->fRunMode=other.fRunMode;
+ this->fDetectorList=other.fDetectorList;
+ this->fShuttleInstanceHost=other.fShuttleInstanceHost;
+ this->fProcessedDetectors=other.fProcessedDetectors;
+ this->fKeepDCSMap=other.fKeepDCSMap;
+ this->fKeepTempFolder=other.fKeepTempFolder;
+ this->fSendMail=other.fSendMail;
+ this->fProcessAll=other.fProcessAll;
+ this->fIsValid=other.fIsValid;
+ for (Int_t i = 0; i<3; i++){
+ this->fFXSHost[i]=other.fFXSHost[i];
+ this->fFXSPort[i]=other.fFXSPort[i];
+ this->fFXSUser[i]=other.fFXSUser[i];
+ this->fFXSPass[i]=other.fFXSPass[i];
+ this->fFXSBaseFolder[i]=other.fFXSBaseFolder[i];
+ this->fFXSdbHost[i]=other.fFXSdbHost[i];
+ this->fFXSdbPort[i]=other.fFXSdbPort[i];
+ this->fFXSdbUser[i]=other.fFXSdbUser[i];
+ this->fFXSdbPass[i]=other.fFXSdbPass[i];
+ this->fFXSdbName[i]=other.fFXSdbName[i];
+ this->fFXSdbTable[i]=other.fFXSdbTable[i];
+ }
+ for (Int_t i = 0; i<5; i++){
+ this->fAdmin[i] = new TObjArray();
+ this->fAdmin[i]->AddAt(other.fAdmin[i]->At(i),i);
+ }
+
+ TIter iter((other.fDetectorMap).GetTable());
+ TPair* aPair = 0;
+
+ while ((aPair = (TPair*) iter.Next())) {
+ AliShuttleDetConfigHolder *holder =(AliShuttleDetConfigHolder *)aPair->Value();
+ TKey *key = (TKey*)aPair->Key();
+ this->fDetectorMap.Add(key,holder);
+ }
+ return *this;
+}
//______________________________________________________________________________________________
void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
{
fDAQlbTable(""),
fShuttlelbTable(""),
fRunTypelbTable(""),
+ fPasswdFilePath(""),
fMaxRetries(0),
fPPTimeOut(0),
+ fDCSTimeOut(0),
+ fDCSRetries(0),
fPPMaxMem(0),
fMonitorHost(""),
fMonitorTable(""),
result += SetGlobalConfig(&globalList);
result += SetSysConfig(&sysList);
+ result += SetPasswords();
result += SetDetConfig(&detList,&dcsList);
result += SetHostConfig(&hostList);
fDetectorMap.DeleteAll();
fDetectorList.Clear();
fProcessedDetectors.Delete();
-
- delete[] fAdmin;
-
}
//______________________________________________________________________________________________
{
// Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
+
TLDAPEntry* anEntry = 0;
TLDAPAttribute* anAttribute = 0;
}
fDAQlbUser = anAttribute->GetValue();
- anAttribute = anEntry->GetAttribute("daqLbPasswd");
- if (!anAttribute) {
- AliError("Can't find daqLbPasswd attribute!");
- return 4;
- }
- fDAQlbPass = anAttribute->GetValue();
-
anAttribute = anEntry->GetAttribute("daqLbDB");
if (!anAttribute) {
AliError("Can't find daqLbDB attribute!");
tmpStr = anAttribute->GetValue();
fPPTimeOut = tmpStr.Atoi();
+ anAttribute = anEntry->GetAttribute("dcsTimeOut");
+ if (!anAttribute) {
+ AliError("Can't find dcsTimeOut attribute!");
+ return 4;
+ }
+ tmpStr = anAttribute->GetValue();
+ fDCSTimeOut = tmpStr.Atoi();
+
+ anAttribute = anEntry->GetAttribute("nDCSretries");
+ if (!anAttribute) {
+ AliError("Can't find dcsTimeOut attribute!");
+ return 4;
+ }
+ tmpStr = anAttribute->GetValue();
+ fDCSRetries = tmpStr.Atoi();
+
anAttribute = anEntry->GetAttribute("ppMaxMem");
if (!anAttribute) {
AliError("Can't find ppMaxMem attribute!");
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;
}
fFXSdbUser[iSys] = anAttribute->GetValue();
- anAttribute = anEntry->GetAttribute("dbPasswd");
- if (!anAttribute) {
- AliError(Form ("Can't find dbPasswd attribute for %s!!",
- AliShuttleInterface::GetSystemName(iSys)));
- return 5;
- }
- fFXSdbPass[iSys] = anAttribute->GetValue();
-
anAttribute = anEntry->GetAttribute("dbName");
if (!anAttribute) {
AliError(Form ("Can't find dbName attribute for %s!!",
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)
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)
{
result += "\n";
}
- result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d "
+ result += Form("PP time out = %d - DCS time out = %d - max PP mem size = %d KB - max retries = %d "
"- DIM trigger waiting timeout = %d\n",
- fPPTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait);
+ fPPTimeOut, fDCSTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait);
result += Form("FLAGS: keepDCSMap = %d - keepTempFolder = %d - SendMail = %d \n",
fKeepDCSMap, fKeepTempFolder, fSendMail);
const TObjArray* shuttleAdmins = GetAdmins(kGlobal);