fixed bug in storerefstorage
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.cxx
index 44450dd..335ecd1 100644 (file)
 
 /*
 $Log$
+Revision 1.19  2007/02/28 10:41:56  acolla
+Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
+AliPreprocessor::GetRunType() function.
+Added some ldap definition files.
+
+Revision 1.18  2007/01/23 19:20:03  acolla
+Removed old ldif files, added TOF, MCH ldif files. Added some options in
+AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
+SetShuttleLogDir
+
+Revision 1.17  2007/01/18 11:17:47  jgrosseo
+changing spaces to tabs ;-)
+
+Revision 1.16  2007/01/18 11:10:35  jgrosseo
+adding the possibility of defining DCS alias and data points with patterns
+first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
+
+Revision 1.15  2007/01/15 18:27:11  acolla
+implementation of sending mail to subdetector expert in case the preprocessor fails.
+shuttle.schema updated with expert's email entry
+
+Revision 1.13  2006/12/07 08:51:26  jgrosseo
+update (alberto):
+table, db names in ldap configuration
+added GRP preprocessor
+DCS data can also be retrieved by data point
+
+Revision 1.12  2006/11/16 16:16:48  jgrosseo
+introducing strict run ordering flag
+removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
+
+Revision 1.11  2006/11/06 14:23:04  jgrosseo
+major update (Alberto)
+o) reading of run parameters from the logbook
+o) online offline naming conversion
+o) standalone DCSclient package
+
+Revision 1.10  2006/10/20 15:22:59  jgrosseo
+o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
+o) Merging Collect, CollectAll, CollectNew function
+o) Removing implementation of empty copy constructors (declaration still there!)
+
+Revision 1.9  2006/10/02 16:38:39  jgrosseo
+update (alberto):
+fixed memory leaks
+storing of objects that failed to be stored to the grid before
+interfacing of shuttle status table in daq system
+
+Revision 1.8  2006/08/15 10:50:00  jgrosseo
+effc++ corrections (alberto)
+
+Revision 1.7  2006/07/20 09:54:40  jgrosseo
+introducing status management: The processing per subdetector is divided into several steps,
+after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
+can keep track of the number of failures and skips further processing after a certain threshold is
+exceeded. These thresholds can be configured in LDAP.
+
 Revision 1.6  2006/07/19 10:09:55  jgrosseo
 new configuration, accesst to DAQ FES (Alberto)
 
@@ -82,20 +139,68 @@ AliShuttleConfig::AliShuttleConfigHolder::AliShuttleConfigHolder(const TLDAPEntr
 fDetector(""),
 fDCSHost(""),
 fDCSPort(0),
-fDCSAliases(),
+fDCSAliases(0),
+fDCSDataPoints(0),
+fDCSAliasesComp(0),
+fDCSDataPointsComp(0),
+fResponsibles(0),
 fIsValid(kFALSE),
-fSkipDCSQuery(kFALSE)
+fSkipDCSQuery(kFALSE),
+fStrictRunOrder(kFALSE)
 {
 // constructor of the shuttle configuration holder
 
        TLDAPAttribute* anAttribute;
+       fDCSAliases = new TObjArray();
+       fDCSAliases->SetOwner(1);
+       fDCSDataPoints = new TObjArray();
+       fDCSDataPoints->SetOwner(1);
+       fDCSAliasesComp = new TObjArray();
+       fDCSAliasesComp->SetOwner(1);
+       fDCSDataPointsComp = new TObjArray();
+       fDCSDataPointsComp->SetOwner(1);
+       fResponsibles = new TObjArray();
+       fResponsibles->SetOwner(1);
 
        anAttribute = entry->GetAttribute("det"); // MUST
+        if (!anAttribute)
+       {
+               AliError(Form("Invalid configuration! No \"det\" attribute!"));
+               return;
+        }
        fDetector = anAttribute->GetValue();
 
+       anAttribute = entry->GetAttribute("StrictRunOrder"); // MAY
+        if (!anAttribute)
+       {
+               AliWarning(Form("%s did not set StrictRunOrder flag - the default is FALSE",
+                               fDetector.Data()));
+        } else {
+               TString strictRunStr = anAttribute->GetValue();
+               if (!(strictRunStr == "0" || strictRunStr == "1"))
+               {
+                       AliError("Invalid configuration! StrictRunOrder flag must be 0 or 1!");
+                       return;
+               }
+               fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
+       }
+
+       anAttribute = entry->GetAttribute("responsible"); // MUST
+        if (!anAttribute)
+       {
+               AliError(Form("Invalid configuration! No \"responsible\" attribute!"));
+               return;
+        }
+       const char* aResponsible;
+       while ((aResponsible = anAttribute->GetValue()))
+       {
+               fResponsibles->AddLast(new TObjString(aResponsible));
+       }
+
        anAttribute = entry->GetAttribute("DCSHost"); // MAY
-       if (!anAttribute) {
-               AliWarning(
+       if (!anAttribute)
+       {
+               AliDebug(2,
                        Form("%s has not DCS host entry - Shuttle will skip DCS data query!",
                                fDetector.Data()));
                fIsValid = kTRUE;
@@ -106,7 +211,8 @@ fSkipDCSQuery(kFALSE)
        fDCSHost = anAttribute->GetValue();
 
        anAttribute = entry->GetAttribute("DCSPort"); // MAY
-        if (!anAttribute) {
+        if (!anAttribute)
+       {
                AliError(Form("Invalid configuration! %s has DCS Host but no port number!",
                                fDetector.Data()));
                return;
@@ -114,21 +220,86 @@ fSkipDCSQuery(kFALSE)
        TString portStr = anAttribute->GetValue();
        fDCSPort = portStr.Atoi();
 
-       anAttribute = entry->GetAttribute("DCSAlias"); // MAY
-        if (!anAttribute) {
-               AliError(Form("Invalid configuration! %s has DCS host settings but no DCSAlias entries!",
-                               fDetector.Data()));
-               return;
+       anAttribute = entry->GetAttribute("DCSalias"); // MAY
+        if (anAttribute)
+       {
+               const char* anAlias;
+               while ((anAlias = anAttribute->GetValue()))
+               {
+                       fDCSAliasesComp->AddLast(new TObjString(anAlias));
+                       ExpandAndAdd(fDCSAliases, anAlias);
+               }
        }
 
-       const char* anAlias;
-       while ((anAlias = anAttribute->GetValue())) {
-               fDCSAliases.AddLast(new TObjString(anAlias));
+       anAttribute = entry->GetAttribute("DCSdatapoint"); // MAY
+        if (anAttribute)
+       {
+               const char* aDataPoint;
+               while ((aDataPoint = anAttribute->GetValue()))
+               {
+               fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
+               ExpandAndAdd(fDCSDataPoints, aDataPoint);
+               }
        }
 
        fIsValid = kTRUE;
+}
 
+//______________________________________________________________________________________________
+void AliShuttleConfig::AliShuttleConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
+{
+       //
+       // adds <entry> to <target> applying expanding of the name
+       // [N..M] creates M-N+1 names with the corresponding digits
+       //
+
+       TString entryStr(entry);
+
+       Int_t begin = entryStr.Index("[");
+       Int_t end = entryStr.Index("]");
+       if (begin != -1 && end != -1 && end > begin)
+       {
+               TString before(entryStr(0, begin));
+               TString after(entryStr(end+1, entryStr.Length()));
+
+               AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
+
+               Int_t dotdot = entryStr.Index("..");
+
+               TString nStr(entryStr(begin+1, dotdot-begin-1));
+               TString mStr(entryStr(dotdot+2, end-dotdot-2));
+
+               AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
+
+               if (nStr.IsDigit() && mStr.IsDigit())
+               {
+                       Int_t n = nStr.Atoi();
+                       Int_t m = mStr.Atoi();
+
+                       Int_t nDigits = nStr.Length();
+                       TString formatStr;
+                       formatStr.Form("%%s%%0%dd%%s", nDigits);
+
+                       AliDebug(2, Form("Format string is %s", formatStr.Data()));
+
+                       for (Int_t current = n; current<=m; ++current)
+                       {
+                               TString newEntry;
+                               newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
+
+                               AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
+
+                               // and go recursive
+                               ExpandAndAdd(target, newEntry);
+                       }
+
+                       // return here because we processed the entries already recursively.
+                       return;
+               }
+       }
 
+       AliDebug(2, Form("Adding name %s", entry));
+       target->AddLast(new TObjString(entry));
 }
 
 //______________________________________________________________________________________________
@@ -136,7 +307,9 @@ AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder()
 {
 // destructor of the shuttle configuration holder
 
-       fDCSAliases.Delete();
+       delete fDCSAliases;
+       delete fDCSDataPoints;
+       delete fResponsibles;
 }
 
 ClassImp(AliShuttleConfig)
@@ -144,8 +317,11 @@ ClassImp(AliShuttleConfig)
 //______________________________________________________________________________________________
 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        const char* binddn, const char* password, const char* basedn):
-       fIsValid(kFALSE),
-       fProcessAll(kFALSE)
+       fIsValid(kFALSE), fConfigHost(host),
+       fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""),
+       fDAQlbDB(""), fDAQlbTable(""), fShuttlelbTable(""), fRunTypelbTable(""),
+       fMaxRetries(0), fPPTimeOut(0), fPPMaxMem(0), fDetectorMap(), fDetectorList(),
+       fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
 {
        //
        // host: ldap server host
@@ -156,23 +332,24 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        // (objectClass=shuttleConfig) will be used as detector configurations.
        //
 
+       fDetectorMap.SetOwner();
+       fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
+       fProcessedDetectors.SetOwner();
+
        TLDAPServer aServer(host, port, binddn, password, 3);
 
        if (!aServer.IsConnected()) {
-               AliError(Form("Can't connect to ldap server %s:%d", 
+               AliError(Form("Can't connect to ldap server %s:%d",
                                host, port));
                return;
        }
 
        // reads configuration for the shuttle running on this machine
-       
+
        fShuttleInstanceHost = gSystem->HostName();
-       TString queryFilter = "(ShuttleHost=";
-       queryFilter += fShuttleInstanceHost;
-       queryFilter += ")";     
-       
-       TLDAPResult* aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
-                       queryFilter.Data());
+       TString queryFilter = Form("(ShuttleHost=%s)", fShuttleInstanceHost.Data());
+
+       TLDAPResult* aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
 
        if (!aResult) {
                AliError(Form("Can't find configuration with base DN: %s",
@@ -190,11 +367,12 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        if (aResult->GetCount() > 1) {
                AliError(Form("More than one Shuttle instance for host %s!",
                                        fShuttleInstanceHost.Data()));
+               delete aResult;
                return;
        }
 
-       TLDAPEntry* anEntry;
-       TLDAPAttribute* anAttribute;
+       TLDAPEntry* anEntry = 0;
+       TLDAPAttribute* anAttribute = 0;
 
        if(!fProcessAll){
                anEntry = aResult->GetNext();
@@ -206,13 +384,13 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
                }
        }
 
+       delete anEntry; delete aResult;
+
        // Detector configuration (DCS Archive DB settings)
 
-       aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
-                       "(objectClass=AliShuttleDetector)");
+       aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, "(objectClass=AliShuttleDetector)");
        if (!aResult) {
-               AliError(Form("Can't find configuration with base DN: %s",
-                               basedn));
+               AliError(Form("Can't find configuration with base DN: %s", basedn));
                return;
        }
 
@@ -224,6 +402,7 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
                if (!aHolder->IsValid()) {
                        AliError("Detector configuration error!");
                        delete aHolder;
+                       delete aResult;
                        return;
                }
 
@@ -246,11 +425,13 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
 
        if (aResult->GetCount() == 0) {
                AliError("Can't find DAQ logbook configuration!");
+               delete aResult;
                return;
        }
 
        if (aResult->GetCount() > 1) {
                AliError("More than one DAQ logbook configuration found!");
+               delete aResult;
                return;
        }
 
@@ -259,13 +440,23 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        anAttribute = anEntry->GetAttribute("DAQLogbookHost");
        if (!anAttribute) {
                AliError("Can't find DAQLogbookHost attribute!");
+               delete anEntry; delete aResult;
                return;
        }
        fDAQlbHost = anAttribute->GetValue();
 
+       anAttribute = anEntry->GetAttribute("DAQLogbookPort"); // MAY
+       if (anAttribute)
+       {
+               fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
+       } else {
+               fDAQlbPort = 3306; // mysql
+       }
+
        anAttribute = anEntry->GetAttribute("DAQLogbookUser");
        if (!anAttribute) {
                AliError("Can't find DAQLogbookUser attribute!");
+               delete aResult; delete anEntry;
                return;
        }
        fDAQlbUser = anAttribute->GetValue();
@@ -273,93 +464,174 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        anAttribute = anEntry->GetAttribute("DAQLogbookPassword");
        if (!anAttribute) {
                AliError("Can't find DAQLogbookPassword attribute!");
+               delete aResult; delete anEntry;
                return;
        }
        fDAQlbPass = anAttribute->GetValue();
 
-       anAttribute = anEntry->GetAttribute("MaxPPRetries");
+       anAttribute = anEntry->GetAttribute("DAQLogbookDB");
        if (!anAttribute) {
-               AliError("Can't find MaxPPRetries attribute!");
+               AliError("Can't find DAQLogbookDB attribute!");
+               delete aResult; delete anEntry;
                return;
        }
-       TString tmpStr = anAttribute->GetValue();
-  fMaxPPRetries = tmpStr.Atoi();
+       fDAQlbDB = anAttribute->GetValue();
+
+       anAttribute = anEntry->GetAttribute("DAQLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find DAQLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fDAQlbTable = anAttribute->GetValue();
+
+       anAttribute = anEntry->GetAttribute("ShuttleLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find ShuttleLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fShuttlelbTable = anAttribute->GetValue();
+
+       anAttribute = anEntry->GetAttribute("RunTypeLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find RunTypeLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fRunTypelbTable = anAttribute->GetValue();
 
        anAttribute = anEntry->GetAttribute("MaxRetries");
        if (!anAttribute) {
                AliError("Can't find MaxRetries attribute!");
+               delete aResult; delete anEntry;
                return;
        }
-       tmpStr = anAttribute->GetValue();
-  fMaxRetries = tmpStr.Atoi();
+       TString tmpStr = anAttribute->GetValue();
+       fMaxRetries = tmpStr.Atoi();
 
-  delete anEntry;
-       delete aResult;
+       anAttribute = anEntry->GetAttribute("PPTimeOut");
+       if (!anAttribute) {
+               AliError("Can't find PPTimeOut attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       tmpStr = anAttribute->GetValue();
+       fPPTimeOut = tmpStr.Atoi();
 
-       // FES configuration (FES logbook and hosts)
+       anAttribute = anEntry->GetAttribute("PPMaxMem");
+       if (!anAttribute) {
+               AliError("Can't find PPMaxMem attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       tmpStr = anAttribute->GetValue();
+       fPPMaxMem = tmpStr.Atoi();
+       
+       delete aResult; delete anEntry;
 
+       // FXS configuration (FXS logbook and hosts)
 
        for(int iSys=0;iSys<3;iSys++){
-               queryFilter = Form("(system=%s)", AliShuttleInterface::fkSystemNames[iSys]);
+               queryFilter = Form("(system=%s)", AliShuttleInterface::GetSystemName(iSys));
                aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
                if (!aResult) {
                        AliError(Form("Can't find configuration for system: %s",
-                                       AliShuttleInterface::fkSystemNames[iSys]));
+                                       AliShuttleInterface::GetSystemName(iSys)));
                        return;
                }
 
                if (aResult->GetCount() != 1 ) {
-                       AliError("Error in FES configuration!");
+                       AliError("Error in FXS configuration!");
+                       delete aResult;
                        return;
                }
 
                anEntry = aResult->GetNext();
 
-               anAttribute = anEntry->GetAttribute("LogbookHost");
+               anAttribute = anEntry->GetAttribute("DBHost");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find DBHost attribute for %s!!",
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
+                       return;
+               }
+               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 LogbookHost attribute for %s!!",
-                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       AliError(Form ("Can't find DBUser attribute for %s!!",
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
                        return;
                }
-               fFESlbHost[iSys] = anAttribute->GetValue();
+               fFXSdbUser[iSys] = anAttribute->GetValue();
 
-               anAttribute = anEntry->GetAttribute("LogbookUser");
+               anAttribute = anEntry->GetAttribute("DBPassword");
                if (!anAttribute) {
-                       AliError(Form ("Can't find LogbookUser attribute for %s!!",
-                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       AliError(Form ("Can't find DBPassword attribute for %s!!",
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
                        return;
                }
-               fFESlbUser[iSys] = anAttribute->GetValue();
+               fFXSdbPass[iSys] = anAttribute->GetValue();
 
-               anAttribute = anEntry->GetAttribute("LogbookPassword");
+               anAttribute = anEntry->GetAttribute("DBName");
                if (!anAttribute) {
-                       AliError(Form ("Can't find LogbookPassword attribute for %s!!",
-                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       AliError(Form ("Can't find DBName attribute for %s!!",
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
                        return;
                }
-               fFESlbPass[iSys] = anAttribute->GetValue();
+
+               fFXSdbName[iSys] = anAttribute->GetValue();
+               anAttribute = anEntry->GetAttribute("DBTable");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find DBTable attribute for %s!!",
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
+                       return;
+               }
+               fFXSdbTable[iSys] = anAttribute->GetValue();
 
                anAttribute = anEntry->GetAttribute("FSHost");
                if (!anAttribute) {
                        AliError(Form ("Can't find FSHost attribute for %s!!",
-                                               AliShuttleInterface::fkSystemNames[iSys]));
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
                        return;
                }
-               fFESHost[iSys] = anAttribute->GetValue();
+               fFXSHost[iSys] = anAttribute->GetValue();
+
+               anAttribute = anEntry->GetAttribute("FSPort"); // MAY
+               if (anAttribute)
+               {
+                       fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
+               } else {
+                       fFXSPort[iSys] = 22; // scp port number
+               }
 
                anAttribute = anEntry->GetAttribute("FSUser");
                if (!anAttribute) {
                        AliError(Form ("Can't find FSUser attribute for %s!!",
-                                               AliShuttleInterface::fkSystemNames[iSys]));
+                                               AliShuttleInterface::GetSystemName(iSys)));
+                       delete aResult; delete anEntry;
                        return;
                }
-               fFESUser[iSys] = anAttribute->GetValue();
+               fFXSUser[iSys] = anAttribute->GetValue();
 
                anAttribute = anEntry->GetAttribute("FSPassword");
-               if (anAttribute) fFESPass[iSys] = anAttribute->GetValue();
+               if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
 
-               delete anEntry;
-               delete aResult;
+               delete aResult; delete anEntry;
        }
 
        fIsValid = kTRUE;
@@ -371,6 +643,8 @@ AliShuttleConfig::~AliShuttleConfig()
 // destructor
 
        fDetectorMap.DeleteAll();
+       fDetectorList.Clear();
+       fProcessedDetectors.Delete();
 }
 
 //______________________________________________________________________________________________
@@ -447,6 +721,42 @@ const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
 }
 
 //______________________________________________________________________________________________
+const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector) const
+{
+       //
+       // returns collection of TObjString which represents the set of aliases
+       // which used for data retrieval for particular detector
+       //
+
+       AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
+        if (!aHolder) {
+                AliError(Form("There isn't configuration for detector: %s",
+                        detector));
+                return NULL;
+        }
+
+       return aHolder->GetDCSDataPoints();
+}
+
+//______________________________________________________________________________________________
+const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
+{
+       //
+       // returns collection of TObjString which represents the list of mail addresses
+       // of the detector's responsible(s)
+       //
+
+       AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
+        if (!aHolder) {
+                AliError(Form("There isn't configuration for detector: %s",
+                        detector));
+                return NULL;
+        }
+
+       return aHolder->GetResponsibles();
+}
+
+//______________________________________________________________________________________________
 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
 {
        // return TRUE if detector is handled by host or if fProcessAll is TRUE
@@ -461,17 +771,40 @@ Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
 }
 
 //______________________________________________________________________________________________
-void AliShuttleConfig::Print(Option_t* /*option*/) const
+Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
+{
+       // return TRUE if detector wants strict run ordering of stored data
+
+       AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
+        if (!aHolder)
+       {
+                AliError(Form("There isn't configuration for detector: %s",
+                        detector));
+                return kTRUE;
+        }
+
+       return aHolder->StrictRunOrder();
+}
+
+//______________________________________________________________________________________________
+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
+
        TString result;
        result += '\n';
 
-       result += Form("\nShuttle running on %s \n\n", fShuttleInstanceHost.Data());
+       result += "####################################################\n";
+       result += Form(" Shuttle configuration from %s \n", fConfigHost.Data());
+       result += "####################################################\n";
+       result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
 
        if(fProcessAll) {
-               result += Form("All detectors will be processed! \n\n");
+               result += Form("All detectors will be processed! \n");
        } else {
                result += "Detectors processed by this host: ";
                TIter it(&fProcessedDetectors);
@@ -479,43 +812,107 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
                while ((aDet = (TObjString*) it.Next())) {
                        result += Form("%s ", aDet->String().Data());
                }
-               result += "\n\n";
+               result += "\n";
        }
 
-       result += Form("DAQ Logbook Configuration \n \tHost: %s - User: %s - ",
-               fDAQlbHost.Data(), fDAQlbUser.Data());
+       result += Form("PP time out = %d - Max PP memsize = %d KB - Max total retries = %d\n\n", fPPTimeOut, fPPMaxMem, fMaxRetries);
+       result += "------------------------------------------------------\n";
+
+       result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
+               fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
+
+//     result += "Password: ";
+//     result.Append('*', fDAQlbPass.Length());
+       result += Form("\tDB: %s; \tTables: %s, %s, %s",
+               fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
 
-       result += "Password: ";
-       result.Append('*', fDAQlbPass.Length());
        result += "\n\n";
 
+       result += "------------------------------------------------------\n";
+       result += "FXS configuration\n\n";
+
        for(int iSys=0;iSys<3;iSys++){
-               result += Form("FES Configuration for %s system\n", AliShuttleInterface::fkSystemNames[iSys]);
-               result += Form("\tLogbook host: \t%s - \tUser: %s\n",
-                                               fFESlbHost[iSys].Data(), fFESlbUser[iSys].Data());
-               // result += Form("Logbook Password:",fFESlbPass[iSys].Data());
-               result += Form("\tFES host: \t%s - \tUser: %s\n\n", fFESHost[iSys].Data(), fFESUser[iSys].Data());
-               // result += Form("FES Password:",fFESPass[iSys].Data());
+               result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
+               result += Form("\tDB  host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
+                                               fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
+                                               fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
+               // result += Form("DB Password:",fFXSdbPass[iSys].Data());
+               result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
+                                               fFXSUser[iSys].Data());
+               // result += Form("FXS Password:",fFXSPass[iSys].Data());
        }
 
+       TString optStr(option);
+
+       result += "------------------------------------------------------\n";
+       result += "Detector-specific configuration\n\n";
        TIter iter(fDetectorMap.GetTable());
        TPair* aPair;
        while ((aPair = (TPair*) iter.Next())) {
                AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
-               if(aHolder->SkipDCSQuery()) continue;
-               result += Form("DCS archive DB configuration for *** %s *** \n", aHolder->GetDetector());
+               if (option != 0 && !optStr.Contains(aHolder->GetDetector()) && optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
+                               continue;
+               result += Form("*** %s *** \n", aHolder->GetDetector());
+
+               const TObjArray* responsibles = aHolder->GetResponsibles();
+               if (responsibles->GetEntries() != 0)
+               {
+                       result += "\tDetector responsible(s): ";
+                       TIter it(responsibles);
+                       TObjString* aResponsible;
+                       while ((aResponsible = (TObjString*) it.Next()))
+                       {
+                               result += Form("%s ", aResponsible->String().Data());
+                       }
+                       result += "\n";
+               }
+
+               result += Form("\tStrict run ordering: %s \n", aHolder->StrictRunOrder() ? "YES" : "NO");
+               if(aHolder->SkipDCSQuery())
+               {
+                       result += "\n";
+                       continue;
+               }
                result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
 
-               result += "\tDCS Aliases: ";
-               const TObjArray* aliases = aHolder->GetDCSAliases();
-               TIter it(aliases);
-               TObjString* anAlias;
-               while ((anAlias = (TObjString*) it.Next())) {
-                       result += Form("%s ", anAlias->String().Data());
+               const TObjArray* aliases = 0;
+               if (optStr.Contains("uncompact",TString::kIgnoreCase))
+               {
+                       aliases = aHolder->GetDCSAliases();
+               } else {
+                       aliases = aHolder->GetCompactDCSAliases();
                }
 
-               result += "\n\n";
+               if (aliases->GetEntries() != 0)
+               {
+                       result += "\tDCS Aliases: ";
+                       TIter it(aliases);
+                       TObjString* anAlias;
+                       while ((anAlias = (TObjString*) it.Next()))
+                       {
+                               result += Form("%s ", anAlias->String().Data());
+                       }
+                       result += "\n";
+               }
 
+               const TObjArray* dataPoints = 0;
+               if (optStr.Contains("uncompact",TString::kIgnoreCase))
+               {
+                       dataPoints = aHolder->GetDCSDataPoints();
+               } else {
+                       dataPoints = aHolder->GetCompactDCSDataPoints();
+               }
+               if (dataPoints->GetEntries() != 0)
+               {
+                       result += "\tDCS Data Points: ";
+                       TIter it(dataPoints);
+                       TObjString* aDataPoint;
+                       while ((aDataPoint = (TObjString*) it.Next())) {
+                               result += Form("%s ", aDataPoint->String().Data());
+                       }
+                               result += "\n";
+               }
+               result += "\n";
        }
 
        if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";