]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttleConfig.cxx
make the buffer size check a bit less strict in order to workaround a bug/feature...
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.cxx
index b707e9efd5082153c2f592259962f67459cf3596..da8998be15136c7c5ed2665c90c01d4b5e5fa14a 100644 (file)
@@ -175,7 +175,7 @@ some docs added
 // will be retrieved (used by AliShuttle).
 //
 
-
+#include <Riostream.h>
 #include "AliShuttleConfig.h"
 #include "AliShuttleInterface.h"
 
@@ -271,6 +271,7 @@ fIsValid(kFALSE)
 AliShuttleConfig::AliShuttleConfig(const AliShuttleConfig & other):
        TObject(),
        fConfigHost(other.fConfigHost),
+       fAlienPath(other.fAlienPath),
        fDAQlbHost(other.fDAQlbHost),
        fDAQlbPort(other.fDAQlbPort),
        fDAQlbUser(other.fDAQlbUser),
@@ -279,6 +280,7 @@ AliShuttleConfig::AliShuttleConfig(const AliShuttleConfig & other):
        fDAQlbTable(other.fDAQlbTable),
        fShuttlelbTable(other.fShuttlelbTable),
        fRunTypelbTable(other.fRunTypelbTable),
+       fPasswdFilePath(other.fPasswdFilePath),
        fMaxRetries(other.fMaxRetries),
        fPPTimeOut(other.fPPTimeOut),
        fDCSTimeOut(other.fDCSTimeOut),
@@ -306,6 +308,7 @@ AliShuttleConfig::AliShuttleConfig(const AliShuttleConfig & other):
                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];
@@ -344,6 +347,7 @@ AliShuttleConfig& AliShuttleConfig::operator=(const AliShuttleConfig &other)
        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;
@@ -366,6 +370,7 @@ AliShuttleConfig& AliShuttleConfig::operator=(const AliShuttleConfig &other)
                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];
@@ -649,6 +654,7 @@ ClassImp(AliShuttleConfig)
 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        const char* binddn, const char* password, const char* basedn):
        fConfigHost(host), 
+       fAlienPath(""), 
        fDAQlbHost(""), 
        fDAQlbPort(), 
        fDAQlbUser(""), 
@@ -657,10 +663,13 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        fDAQlbTable(""), 
        fShuttlelbTable(""), 
        fRunTypelbTable(""),
+       fPasswdFilePath(""),
        fMaxRetries(0), 
        fPPTimeOut(0), 
        fDCSTimeOut(0), 
        fDCSRetries(0), 
+       fDCSQueryOffset(0),
+       fDCSDelay(0),
        fPPMaxMem(0), 
        fMonitorHost(""), 
        fMonitorTable(""), 
@@ -764,6 +773,7 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        
        result += SetGlobalConfig(&globalList);
        result += SetSysConfig(&sysList);
+       result += SetPasswords();
        result += SetDetConfig(&detList,&dcsList);
        result += SetHostConfig(&hostList);
        
@@ -785,9 +795,6 @@ AliShuttleConfig::~AliShuttleConfig()
        fDetectorMap.DeleteAll();
        fDetectorList.Clear();
        fProcessedDetectors.Delete();
-       
-       delete[] fAdmin;
-       
 }
 
 //______________________________________________________________________________________________
@@ -1018,6 +1025,7 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
 {
        // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
 
+
        TLDAPEntry* anEntry = 0;
        TLDAPAttribute* anAttribute = 0;
        
@@ -1041,6 +1049,13 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
        } 
        
        
+       anAttribute = anEntry->GetAttribute("AlienPath");
+       if (!anAttribute) {
+               AliError("Can't find AlienPath attribute!");
+               return 4;
+       }
+       fAlienPath = anAttribute->GetValue();
+
        anAttribute = anEntry->GetAttribute("daqLbHost");
        if (!anAttribute) {
                AliError("Can't find daqLbHost attribute!");
@@ -1063,13 +1078,6 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
        }
        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!");
@@ -1130,6 +1138,22 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
        tmpStr = anAttribute->GetValue();
        fDCSRetries = tmpStr.Atoi();
 
+       anAttribute = anEntry->GetAttribute("DCSQueryOffset");
+       if (!anAttribute) {
+               AliError("Can't find DCSQueryOffset attribute!");
+               return 4;
+       }
+       tmpStr = anAttribute->GetValue();
+       fDCSQueryOffset = tmpStr.Atoi();
+
+       anAttribute = anEntry->GetAttribute("DCSDelay");
+       if (!anAttribute) {
+               AliError("Can't find DCSDelay attribute!");
+               return 4;
+       }
+       tmpStr = anAttribute->GetValue();
+       fDCSDelay = tmpStr.Atoi();
+
        anAttribute = anEntry->GetAttribute("ppMaxMem");
        if (!anAttribute) {
                AliError("Can't find ppMaxMem attribute!");
@@ -1246,6 +1270,13 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
                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;
 }
 
@@ -1253,7 +1284,8 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
 {
        // Set the online FXS configuration (DAQ + DCS + HLT)
-       
+
+
        TLDAPEntry* anEntry = 0;
        TLDAPAttribute* anAttribute = 0;
        
@@ -1312,14 +1344,6 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list)
                }
                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!!",
@@ -1362,6 +1386,9 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list)
 
                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)
@@ -1387,6 +1414,67 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list)
        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)
 {