Fix event server's preferences. Now, it reads them correctly from $ALICE_ROOT/MONITOR/
authorquark <quark@cern.ch>
Thu, 19 Jun 2014 14:44:08 +0000 (16:44 +0200)
committerquark <quark@cern.ch>
Thu, 19 Jun 2014 14:50:11 +0000 (16:50 +0200)
MONITOR/AliEventServerPreferencesWindow.cxx
MONITOR/AliEventServerUtil.h
MONITOR/AliEventServerWindow.cxx
MONITOR/CMakelibMONITOR.pkg
MONITOR/alieventserver.rootrc

index 3a585c6..8da4573 100644 (file)
@@ -355,7 +355,7 @@ void AliEventServerPreferencesWindow::onUnCheckAllDetectors()
 Int_t AliEventServerPreferencesWindow::ReadSettings()
 {
        TEnv settings;
-       int readStatus = settings.ReadFile(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF), kEnvLocal);
+       int readStatus = settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
        //check if there was an error reading the file
        if(readStatus!=0) return readStatus;
        
@@ -483,7 +483,9 @@ Int_t AliEventServerPreferencesWindow::WriteSettings()
        settings.SetValue("logbook.user", fEntryLogbookUser->GetText());
        settings.SetValue("logbook.pass", fEntryLogbookPass->GetText());
        
-       return settings.WriteFile(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF));
+       printf("Writting settings to file: %s\n", Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF) );
+       
+       return settings.WriteFile(AliEventServerUtil::GetPathToServerConf());
 }
 
 void AliEventServerPreferencesWindow::RestoreDefaults()
index da99463..ff303bc 100644 (file)
 #define DEFAULT_LOGBOOK_USER "dqm"
 #define DEFAULT_LOGBOOK_PASS "nopass"
 
+namespace AliEventServerUtil
+{
+
+// return full path to the server configuration file
+const char* GetPathToServerConf();
+}
+
 #endif /* __ALIEVENTSERVER_UTIL_H__ */
index 5132aa0..2167f07 100644 (file)
@@ -111,15 +111,20 @@ void AliEventServerWindow::InitDIMListeners()
 
 void AliEventServerWindow::FillRunsFromDatabase()
 {
-       TEnv settings(ALIEVENTSERVER_CONF);
-
+       TEnv settings;
+       settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
+       
        TString dbHost = settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
        TString dbPort =  Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT));
        TString dbName =  settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
        TString user =  settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
        TString password = settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
 
-  TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%s/%s", dbHost.Data(), dbPort.Data(), dbName.Data()), user.Data(), password.Data());
+       TString connStr = Form("mysql://%s:%s/%s", dbHost.Data(), dbPort.Data(), dbName.Data()) ;
+
+       AliInfo(Form("connecting to %s", connStr.Data()) );
+
+  TSQLServer* server = TSQLServer::Connect(connStr.Data(), user.Data(), password.Data());
   if (!server) {
     AliWarning("ERROR: Could not connect to DAQ Logbook");
     return;
index e3067b8..7456b80 100644 (file)
@@ -33,6 +33,7 @@ set ( SRCS
     AliDimIntNotifier.cxx 
     AliChildProcTerminator.cxx
     AliEventServerPreferencesWindow.cxx
+    AliEventServerUtil.cxx
     AliTestChildProc.cxx 
     )
 
index d4ff7ad..0933595 100644 (file)
@@ -20,4 +20,4 @@ logbook.host:                            pcaldbl501
 logbook.port:                            3306
 logbook.db:                              logbook
 logbook.user:                            dqm
-logbook.pass:                            nopass
+logbook.pass:                            dqm123