]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New version (B.Yordanov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Mar 2006 07:52:34 +0000 (07:52 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Mar 2006 07:52:34 +0000 (07:52 +0000)
26 files changed:
SHUTTLE/AliCDBPreProcessor.cxx
SHUTTLE/AliCDBPreProcessor.h
SHUTTLE/AliDCSClient.cxx
SHUTTLE/AliDCSClient.h
SHUTTLE/AliDCSMessage.cxx
SHUTTLE/AliDCSMessage.h
SHUTTLE/AliDCSValue.cxx
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleConfig.h
SHUTTLE/AliShuttleTrigger.cxx [new file with mode: 0644]
SHUTTLE/AliShuttleTrigger.h [new file with mode: 0644]
SHUTTLE/AliSimpleValue.cxx
SHUTTLE/DATENotifier.cxx [new file with mode: 0644]
SHUTTLE/DATENotifier.h [new file with mode: 0644]
SHUTTLE/SHUTTLELinkDef.h
SHUTTLE/Shuttle.C [new file with mode: 0644]
SHUTTLE/libSHUTTLE.pkg
SHUTTLE/schema/shuttle.schema
SHUTTLE/test/TestClient.C
SHUTTLE/test/TestITSPreProcessor.cxx
SHUTTLE/test/TestITSPreProcessor.h
SHUTTLE/test/TestMessage.C
SHUTTLE/test/TestShuttle.C
SHUTTLE/test/TestShuttleConfig.C

index 599b35b944d379782fb4f72be1e0d37c38a5c6c2..30f9427cc6886c76131e7bd6d54b19624af92ede 100644 (file)
 
 /*
 $Log$
+Revision 1.3  2005/11/17 17:47:34  byordano
+TList changed to TObjArray
+
+Revision 1.2  2005/11/17 14:43:22  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
 SHUTTLE package
 
@@ -37,7 +46,7 @@ some docs added
 //     startTime: when the run started
 //     endTime: when the run finished  
 //
-//     2) virtual void Process(const char* alias, TList& valueSet,
+//     2) virtual void Process(const char* alias, TObjArray& valueSet,
 //                       Bool_t hasError)      
 //     
 //     This method is called for every particular alias which the detector
index 91ff7f0c9ae0e2ae4e3e83df404aa4b5195d41b0..5f0bfb201689aa3daf1091d22388d02ecd1315ad 100644 (file)
@@ -43,7 +43,7 @@ protected:
 
        virtual void Finalize() {};
 
-       virtual void Process(const char* alias, TList& valueSet, 
+       virtual void Process(const char* alias, TObjArray& valueSet, 
                        Bool_t hasError) = 0;
 
 private:
index f71520a2a5f332e29908ac8577e03cced845bcec..9c57e6b95ea8d93125d15956f9eaae9a53751c69 100644 (file)
 
 /*
 $Log$
+Revision 1.3  2005/11/17 17:47:34  byordano
+TList changed to TObjArray
+
+Revision 1.2  2005/11/17 14:43:23  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
 SHUTTLE package
 
@@ -44,7 +53,7 @@ some more descriptions added
 #include "AliDCSValue.h"
 #include "AliLog.h"
 
-#include <TList.h>
+#include <TObjArray.h>
 #include <TMap.h>
 #include <TObjString.h>
 #include <TSystem.h>
@@ -237,7 +246,7 @@ Int_t AliDCSClient::ReceiveMessage(AliDCSMessage& message) {
 }
 
 Int_t AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
-       const char* reqString, UInt_t startTime, UInt_t endTime, TList& result) 
+       const char* reqString, UInt_t startTime, UInt_t endTime, TObjArray& result) 
 {
        if (!IsConnected()) {
                AliError("Not connected!");
@@ -275,15 +284,15 @@ Int_t AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
        multiRequestMessage.CreateMultiRequestMessage(reqType, 
                        startTime, endTime);
 
-       TList requests;
+       TObjArray requests;
        
        TIter iter(&result);
        TObjString* aRequest;
        
-       // copy request strings to temporary TList because
+       // copy request strings to temporary TObjArray because
        // TMap doesn't guarantee the order of elements!!!
        while ((aRequest = (TObjString*) iter.Next())) {
-               requests.Add(aRequest);
+               requests.AddLast(aRequest);
                if (!multiRequestMessage.AddRequestString(aRequest->String()))
                {
                        return AliDCSClient::fgkInvalidParameter;
@@ -303,7 +312,7 @@ Int_t AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
 
        TIter reqIter(&requests);
        while ((aRequest = (TObjString*) reqIter.Next())) {
-               TList* resultSet = new TList();
+               TObjArray* resultSet = new TObjArray();
                resultSet->SetOwner(1);
 
                if ((sResult = ReceiveValueSet(*resultSet)) < 0) {
@@ -331,7 +340,7 @@ Int_t AliDCSClient::GetValues(AliDCSMessage::RequestType reqType,
        return sResult;
 }
        
-Int_t AliDCSClient::ReceiveValueSet(TList& result) {
+Int_t AliDCSClient::ReceiveValueSet(TObjArray& result) {
 
        Int_t sResult;
 
@@ -406,7 +415,7 @@ Int_t AliDCSClient::ReceiveValueSet(TList& result) {
 }
                
 Int_t AliDCSClient::GetDPValues(const char* dpName, UInt_t startTime,
-                               UInt_t endTime, TList& result)
+                               UInt_t endTime, TObjArray& result)
 {
        //
        // Reads a values from the server which correspond to this
@@ -423,7 +432,7 @@ Int_t AliDCSClient::GetDPValues(const char* dpName, UInt_t startTime,
 }
 
 Int_t AliDCSClient::GetAliasValues(const char* alias, UInt_t startTime,
-                               UInt_t endTime, TList& result)
+                               UInt_t endTime, TObjArray& result)
 {
        //
         // Reads a values from the server which correspond to this
@@ -447,7 +456,7 @@ Int_t AliDCSClient::GetDPValues(UInt_t startTime, UInt_t endTime,
        // reads a valueSet. The key represents particular DataPoint to be read.
         // For all DataPoints time interval (startTime - endTime) is used.
         // After the read, the correspoding value for every key is a 
-       // TList - collection of AliDCSValue, or result is an empty map in
+       // TObjArray - collection of AliDCSValue, or result is an empty map in
        // case of error.
        // 
         // Returns:
@@ -466,7 +475,7 @@ Int_t AliDCSClient::GetAliasValues(UInt_t startTime, UInt_t endTime,
         // reads a valueSet. The key represents particular Alias to be read.
         // For all aliases time interval (startTime - endTime) is used.
         // After the read, the correspoding value for every key is a 
-        // TList - collection of AliDCSValue, or result is an empty map in
+        // TObjArray - collection of AliDCSValue, or result is an empty map in
         // case of error.
         // 
         // Returns:
index 91bfe254e6f70c6a4825f6f6aa75ae24bb8207e8..64edbad3bbd9b8f483dd2913996408c964167e0e 100644 (file)
@@ -16,7 +16,7 @@
 #include <TSocket.h>
 
 
-class TList;
+class TObjArray;
 class TMap;
 
 class AliDCSClient: public TObject {
@@ -53,10 +53,10 @@ public:
 
 
         Int_t GetDPValues(const char* dpName, UInt_t startTime, UInt_t endTime,
-                                TList& result);
+                                TObjArray& result);
 
         Int_t GetAliasValues(const char* alias, UInt_t startTime,
-                                UInt_t endTime, TList& result);
+                                UInt_t endTime, TObjArray& result);
 
         Int_t GetDPValues(UInt_t startTime, UInt_t endTime, TMap& result);
 
@@ -99,12 +99,12 @@ private:
 
        Int_t GetValues(AliDCSMessage::RequestType requestType,
                const char* requestString, UInt_t startTime, UInt_t endTime,
-               TList& result);
+               TObjArray& result);
        
        Int_t GetValues(AliDCSMessage::RequestType requestType,
                UInt_t startTime, UInt_t endTime, TMap& result);
 
-       Int_t ReceiveValueSet(TList& result);
+       Int_t ReceiveValueSet(TObjArray& result);
 
 
        ClassDef(AliDCSClient, 0);
index 7368891000cd18df7ffb5952dbb7ae4f94889b6c..c746fb32d5118045e24656513d849b58ed6254ec 100644 (file)
 
 /*
 $Log$
+Revision 1.3  2005/11/17 17:47:34  byordano
+TList changed to TObjArray
+
+Revision 1.2  2005/11/17 14:43:23  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
 SHUTTLE package
 
@@ -694,7 +703,7 @@ void AliDCSMessage::LoadMultiRequestMessage() {
 
                TObjString* anObjString = new TObjString(
                        GetString(fMessage + cursor, strSize));
-               fRequestStrings.Add(anObjString);
+               fRequestStrings.AddLast(anObjString);
 
                cursor += strSize;
        }       
@@ -875,7 +884,7 @@ Bool_t AliDCSMessage::AddRequestString(const char* request) {
                return kFALSE;  
        }
 
-       fRequestStrings.Add(new TObjString(request));
+       fRequestStrings.AddLast(new TObjString(request));
        return kTRUE;
 }
 
@@ -888,7 +897,7 @@ void AliDCSMessage::ClearRequestStrings() {
        fRequestStrings.Delete();
 }
 
-void AliDCSMessage::GetRequestStrings(TList& result) const {
+void AliDCSMessage::GetRequestStrings(TObjArray& result) const {
        //
         // MultRequest.
         // Returns all request strings in this message.
@@ -906,7 +915,7 @@ void AliDCSMessage::GetRequestStrings(TList& result) const {
        TObjString* anObjString;
        
        while ((anObjString = (TObjString*) iter.Next())) {
-               result.Add(new TObjString(*anObjString));
+               result.AddLast(new TObjString(*anObjString));
        }
 }
 
@@ -953,10 +962,10 @@ UInt_t AliDCSMessage::GetValueCount() const {
                 return 0;
         }
 
-       return fValues.GetSize();
+       return fValues.GetEntriesFast();
 }
 
-UInt_t AliDCSMessage::GetValues(TList& result) const {
+UInt_t AliDCSMessage::GetValues(TObjArray& result) const {
        //
         // ResultSet.
         // Returns the number of values got from the message.
@@ -973,10 +982,10 @@ UInt_t AliDCSMessage::GetValues(TList& result) const {
        AliDCSValue* aValue;
        
        while ((aValue = (AliDCSValue*) iter.Next())) {
-               result.Add(new AliDCSValue(*aValue));
+               result.AddLast(new AliDCSValue(*aValue));
        }
 
-       return fValues.GetSize();
+       return fValues.GetEntriesFast();
 }
 
 Bool_t AliDCSMessage::AddValue(const AliDCSValue& value) {
index ef600539c6c1745b2b01f03c55970436d6645243..105e97657c02cc6af1899003d54ad0a7b3b47986 100644 (file)
@@ -15,7 +15,7 @@
 #include "AliDCSValue.h"
 
 #include <TString.h>
-#include <TList.h>
+#include <TObjArray.h>
 
 #define HEADER_SIZE 8
 #define ID_OFFSET 0
@@ -127,7 +127,7 @@ public:
         TString GetRequestString() const;
 
         // MultiRequestType Message getters and setters
-        void GetRequestStrings(TList& result) const;
+        void GetRequestStrings(TObjArray& result) const;
 
         Bool_t AddRequestString(const char* request);
 
@@ -141,7 +141,7 @@ public:
 
         UInt_t GetValueCount() const;
 
-        UInt_t GetValues(TList& result) const;
+        UInt_t GetValues(TObjArray& result) const;
 
         Bool_t AddValue(const AliDCSValue& value);
 
@@ -181,7 +181,7 @@ private:
        //ResultSet message fields
        AliSimpleValue::Type fSimpleValueType;
 
-       TList fValues;
+       TObjArray fValues;
        
        //Error message fields
        ErrorCode fErrorCode;
@@ -189,7 +189,7 @@ private:
        TString fErrorString;
 
        //MultiRequest message fields
-       TList fRequestStrings; 
+       TObjArray fRequestStrings; 
 
        
        // Message setter helpers
index 10ae6767afca2f8c5169197954a5c7c6dc04cb98..1e8da0a7fe6508bc431a6c9b97b23fe7e5518c50 100644 (file)
 
 /*
 $Log$
+Revision 1.2  2005/11/17 14:43:23  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
 SHUTTLE package
 
index c430d13697fea8d20826b59ba52559dcecd3596d..08e79410444d34319922d8f265d5e7bfb87c9be6 100644 (file)
 
 /*
 $Log$
+Revision 1.6  2005/11/19 17:19:14  byordano
+RetrieveDATEEntries and RetrieveConditionsData added
+
+Revision 1.5  2005/11/19 11:09:27  byordano
+AliShuttle declaration added
+
+Revision 1.4  2005/11/17 17:47:34  byordano
+TList changed to TObjArray
+
+Revision 1.3  2005/11/17 14:43:23  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.2  2005/09/13 08:41:15  byordano
 default startTime endTime added
 
@@ -54,41 +69,18 @@ some docs added
 ClassImp(AliShuttle)
 
 AliShuttle::AliShuttle(const AliShuttleConfig* config, 
-               const char* cdbStorageURI, UInt_t timeout, Int_t retries):
-       fConfig(config), fStorage(NULL), fTimeout(timeout), fRetries(retries),
-       fCurrentRun(-1), fCurrentStartTime(0), fCurrentEndTime(0)
+               AliCDBStorage* cdbStorage, UInt_t timeout, Int_t retries):
+       fConfig(config), fStorage(cdbStorage), fTimeout(timeout), 
+       fRetries(retries), fCurrentRun(-1), fCurrentStartTime(0), 
+       fCurrentEndTime(0)
 {
        //
        // config: AliShuttleConfig used
-       // cdbStorageURI: uri of the underlying AliCDBStorage
+       // cdbStorage: underlying AliCDBStorage
        // timeout: timeout used for AliDCSClient connection
        // retries: the number of retries in case of connection error.
        //
 
-       fStorage = AliCDBManager::Instance()->GetStorage(cdbStorageURI);
-       if (!fStorage) {
-               AliError(Form("Can't get valid storage object for %s!", 
-                       cdbStorageURI));
-       }
-}
-
-AliShuttle::AliShuttle(const AliShuttleConfig* config,
-               const AliCDBParam*  param, UInt_t timeout, Int_t retries):
-       fConfig(config), fStorage(NULL), fTimeout(timeout), fRetries(retries),
-       fCurrentRun(-1), fCurrentStartTime(0), fCurrentEndTime(0)
-{
-       //
-        // config: AliShuttleConfig used
-        // param: param of the underlying AliCDBStorage
-        // timeout: timeout used for AliDCSClient connection
-        // retries: the number of retries in case of connection error.
-        //
-
-       fStorage = AliCDBManager::Instance()->GetStorage(param);
-        if (!fStorage) {
-                AliError(Form("Can't get valid storage object for %s!", 
-                        param->GetURI().Data()));
-        }
 }
 
 AliShuttle::~AliShuttle() {
@@ -126,22 +118,29 @@ Bool_t AliShuttle::Store(const char* detector, const char* specType,
        return fStorage->Put(object, id, metaData);
 }
 
-void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime) {
+Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime) {
        //
        // Makes data retrieval for all detectors in the configuration. 
        // run: is the run number used
        // startTime: is the run start time
        // endTime: is the run end time
+       // Returns kFALSE in case of error occured and kTRUE otherwise
        //
 
+       Bool_t hasError = kFALSE;
+
        TIter iter(fConfig->GetDetectors());    
        TObjString* aDetector;
        while ((aDetector = (TObjString*) iter.Next())) {
-               Process(run, startTime, endTime, aDetector->String());
+               if(!Process(run, startTime, endTime, aDetector->String())) {
+                       hasError = kTRUE;
+               }
        }
+
+       return !hasError;
 }
 
-void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
+Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                const char* detector)
 {
        //
@@ -151,6 +150,7 @@ void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
         // startTime: is the run start time
         // endTime: is the run end time
         // detector: detector for which the retrieval will be made
+       // Returns kFALSE in case of error occured and kTRUE otherwise
        //
 
        AliInfo(Form("Retrieving values for %s, run %d", detector, run));
@@ -158,7 +158,7 @@ void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
        if (!fConfig->HasDetector(detector)) {
                AliError(Form("There isn't any configuration for %s",
                                detector));
-               return;
+               return kFALSE;
        }
 
        fCurrentRun = run;
@@ -174,10 +174,12 @@ void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
        TIter iter(fConfig->GetAliases(detector));
        TObjString* anAlias;
 
+       Bool_t hasError = kFALSE;
+
        if (aPreProcessor) {
                aPreProcessor->Initialize(run, startTime, endTime);
 
-               TList valueSet;
+               TObjArray valueSet;
                while ((anAlias = (TObjString*) iter.Next())) {
                        Bool_t result = GetValueSet(host, port, 
                                        anAlias->String(), valueSet);
@@ -198,7 +200,7 @@ void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                                new AliSimpleValue(endTime));
                metaData.SetComment("Automatically stored by AliShuttle!");
 
-               TList valueSet;
+               TObjArray valueSet;
                while ((anAlias = (TObjString*) iter.Next())) {
                        if (GetValueSet(host, port, anAlias->String(), 
                                valueSet)) {
@@ -207,6 +209,7 @@ void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                                        AliError(Form("Can't store %s for %s!",
                                                anAlias->String().Data(),
                                                detector));
+                                       hasError = kTRUE;
                                }               
                        }
 
@@ -217,10 +220,12 @@ void AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
        fCurrentRun = -1;
        fCurrentStartTime = 0;
        fCurrentEndTime = 0;
+
+       return !hasError;
 }
 
 Bool_t AliShuttle::GetValueSet(const char* host, Int_t port, const char* alias,
-                               TList& valueSet)
+                               TObjArray& valueSet)
 {
        AliDCSClient client(host, port, fTimeout, fRetries);
        if (!client.IsConnected()) {
index b7c71eac21ca902cbeff125e063b9c597276f724..0e682c6ea6d1e5d80b589938201fa36cf22556a5 100644 (file)
@@ -25,16 +25,14 @@ class AliCDBPreProcessor;
 
 class AliShuttle: public TObject {
 public:
-       AliShuttle(const AliShuttleConfig* config, const char* cdbStorageURI,
-               UInt_t timeout = 5000, Int_t retries = 5);
-       AliShuttle(const AliShuttleConfig* config, const AliCDBParam* param,
+       AliShuttle(const AliShuttleConfig* config, AliCDBStorage* cdbStorage,
                UInt_t timeout = 5000, Int_t retries = 5);
        virtual ~AliShuttle();
 
        void RegisterCDBPreProcessor(AliCDBPreProcessor* processor);
        
-       void Process(Int_t run, UInt_t startTime, UInt_t endTime);
-       void Process(Int_t run, UInt_t startTime, UInt_t endTime,
+       Bool_t Process(Int_t run, UInt_t startTime, UInt_t endTime);
+       Bool_t Process(Int_t run, UInt_t startTime, UInt_t endTime,
                const char* detector);
 
        Int_t GetCurrentRun() const {return fCurrentRun;};
@@ -57,7 +55,7 @@ private:
        UInt_t fCurrentEndTime;
 
        Bool_t GetValueSet(const char* host, Int_t port, const char* alias,
-                       TList& result);
+                       TObjArray& result);
        
        ClassDef(AliShuttle, 0);
 };
index dd3e4531452aedffc28e7f524bf8ac7d47b7e841..1ae8580904d36f8aea82827c03e0a73dbee1cdf9 100644 (file)
 
 /*
 $Log$
+Revision 1.4  2005/11/19 14:20:31  byordano
+logbook config added to AliShuttleConfig
+
+Revision 1.3  2005/11/17 19:24:25  byordano
+TList changed to TObjArray in AliShuttleConfig
+
+Revision 1.2  2005/11/17 14:43:23  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
 SHUTTLE package
 
@@ -89,7 +101,7 @@ AliShuttleConfig::ConfigHolder::ConfigHolder(const TLDAPEntry* entry):
        }
        const char* anAlias;
        while ((anAlias = anAttribute->GetValue())) {
-               fAliases.Add(new TObjString(anAlias));
+               fAliases.AddLast(new TObjString(anAlias));
        }
                
        fIsValid = kTRUE;
@@ -144,11 +156,57 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
 
                TObjString* detStr = new TObjString(aHolder->GetDetector());
                fDetectorMap.Add(detStr, aHolder);
-               fDetectorList.Add(detStr);
+               fDetectorList.AddLast(detStr);
        }       
        
        delete aResult;
 
+
+       aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
+                       "(objectClass=logbookConfig)");
+       if (!aResult) {
+               AliError(Form("Can't find configuration with base DN: %s",
+                               basedn));
+               return;
+       }
+
+       if (aResult->GetCount() == 0) {
+               AliError("Can't find DAQ log book configuration!");
+               return;
+       }
+
+       if (aResult->GetCount() > 1) {
+               AliError("More than one DAQ log book configuration found!");
+               return;
+       }
+
+       anEntry = aResult->GetNext();
+       
+       TLDAPAttribute* anAttribute;
+       anAttribute = anEntry->GetAttribute("lbURI");
+       if (!anAttribute) {
+               AliError("Can't find lbURI attribute!");
+               return;
+       }
+       fLogBookURI = anAttribute->GetValue();
+
+       anAttribute = anEntry->GetAttribute("lbUser");
+       if (!anAttribute) {
+               AliError("Can't find lbUser attribute!");
+               return;
+       }
+       fLogBookUser = anAttribute->GetValue();
+       
+       anAttribute = anEntry->GetAttribute("lbPassword");
+       if (!anAttribute) {
+               AliError("Can't find lbPassword attribute!");
+               return;
+       }
+       fLogBookPassword = anAttribute->GetValue();
+
+       delete anEntry;
+       delete aResult;
+       
        fIsValid = kTRUE;
 }
 
@@ -156,7 +214,7 @@ AliShuttleConfig::~AliShuttleConfig() {
        fDetectorMap.DeleteAll();
 }
 
-const TList* AliShuttleConfig::GetDetectors() const {
+const TObjArray* AliShuttleConfig::GetDetectors() const {
        //
        // returns collection of TObjString which contains the name
        // of every detector which is in the configuration.
@@ -203,7 +261,7 @@ Int_t AliShuttleConfig::GetPort(const char* detector) const {
        return aHolder->GetPort();
 }
 
-const TList* AliShuttleConfig::GetAliases(const char* detector) const {
+const TObjArray* AliShuttleConfig::GetAliases(const char* detector) const {
        //
        // returns collection of TObjString which represents the set of aliases
        // which used for data retrieval for particular detector
@@ -223,6 +281,16 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const {
        
        TString result;
        result += '\n';
+
+       result += "LogBook URI: ";
+       result += fLogBookURI;
+       result += '\n';
+       result += "LogBook User: ";
+       result += fLogBookUser;
+       result += '\n';
+       result += "LogBook Password: ";
+       result.Append('*', fLogBookPassword.Length());
+       result += '\n';
        
        TIter iter(fDetectorMap.GetTable());
        TPair* aPair;
@@ -240,7 +308,7 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const {
                result += '\n';
 
                result += " Aliases: ";
-               const TList* aliases = aHolder->GetAliases();   
+               const TObjArray* aliases = aHolder->GetAliases();       
                TIter it(aliases);              
                TObjString* anAlias;    
                while ((anAlias = (TObjString*) it.Next())) {
index cb53a8cfe9d11b6f3e0285d55aac60a50c80cdb6..c1dc05754480f6bac97525657e49563c4a1cb432 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <TObject.h>
 #include <TString.h>
-#include <TList.h>
+#include <TObjArray.h>
 #include <TMap.h>
 #include <TLDAPServer.h>
 
@@ -26,12 +26,16 @@ public:
 
        Bool_t IsValid() const {return fIsValid;};
 
-       const TList* GetDetectors() const;
+       const char* GetLogBookURI() const {return fLogBookURI.Data();}
+       const char* GetLogBookUser() const {return fLogBookUser.Data();}
+       const char* GetLogBookPassword() const {return fLogBookPassword.Data();}
+
+       const TObjArray* GetDetectors() const;
 
        Bool_t HasDetector(const char* detector) const;
        const char* GetHost(const char* detector) const;
        Int_t GetPort(const char* detector) const;
-       const TList* GetAliases(const char* detector) const;
+       const TObjArray* GetAliases(const char* detector) const;
 
        virtual void Print(Option_t* option = NULL) const;
 
@@ -41,7 +45,7 @@ private:
                TString fDetector;
                TString fHost;
                Int_t fPort;
-               TList fAliases;         
+               TObjArray fAliases;             
                Bool_t fIsValid;
 
        public:
@@ -51,7 +55,7 @@ private:
                const char* GetDetector() const {return fDetector.Data();};
                const char* GetHost() const {return fHost.Data();};
                Int_t GetPort() const {return fPort;};
-               const TList* GetAliases() const {return &fAliases;};
+               const TObjArray* GetAliases() const {return &fAliases;};
 
                Bool_t IsValid() const {return fIsValid;};
 
@@ -61,8 +65,12 @@ private:
 
        Bool_t fIsValid;
 
+       TString fLogBookURI;
+       TString fLogBookUser;
+       TString fLogBookPassword;
+
        TMap fDetectorMap;
-       TList fDetectorList;    
+       TObjArray fDetectorList;        
 
        ClassDef(AliShuttleConfig, 0);
 };
diff --git a/SHUTTLE/AliShuttleTrigger.cxx b/SHUTTLE/AliShuttleTrigger.cxx
new file mode 100644 (file)
index 0000000..ec2cc25
--- /dev/null
@@ -0,0 +1,360 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+ $Log$
+ Revision 1.5  2005/11/21 09:03:48  byordano
+ one more print added
+
+ Revision 1.4  2005/11/20 10:12:37  byordano
+ comments added to AliShuttleTrigger
+
+ */
+
+
+// 
+// This class is to deal with DAQ LogBook and DAQ "end of run" notification.
+// It has severeal two modes:
+//     1) syncrhnized - Collect(), CollectNew() and CollectAll methods
+//     2) asynchronized - Run() - starts listening for DAQ "end of run" 
+//             notification by DIM service.
+//
+
+#include "AliShuttleTrigger.h"
+
+#include <TSQLServer.h>
+#include <TSQLResult.h>
+#include <TSQLRow.h>
+#include <TObjArray.h>
+#include <TSystem.h>
+
+#include "AliLog.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
+
+#include "AliSimpleValue.h"
+#include "AliShuttleConfig.h"
+#include "AliShuttle.h"
+#include "DATENotifier.h"
+
+ClassImp(TerminateSignalHandler)
+Bool_t TerminateSignalHandler::Notify() {
+
+       AliInfo("Terminate signal received ...");
+       fTrigger->Terminate();
+
+       return kTRUE;
+}
+
+ClassImp(AliShuttleTrigger)
+AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
+               AliCDBStorage* storage, UInt_t timeout, Int_t retries):
+       fConfig(config), fStorage(storage), fShuttle(NULL),
+       fNotified(kFALSE), fTerminate(kFALSE), fCondition(&fMutex),
+       fQuitSignalHandler(this, kSigQuit), 
+       fInterruptSignalHandler(this, kSigInterrupt)
+{
+       //
+       // config - pointer to the AliShuttleConfig object which represents
+       // the configuration
+       // storage - pointer to AliCDBStorage for the undelying CDBStorage
+       //
+
+       fShuttle = new AliShuttle(config, storage, timeout, retries);
+
+       gSystem->AddSignalHandler(&fQuitSignalHandler);
+       gSystem->AddSignalHandler(&fInterruptSignalHandler);
+}
+
+AliShuttleTrigger::~AliShuttleTrigger() {
+
+       gSystem->RemoveSignalHandler(&fQuitSignalHandler);
+       gSystem->RemoveSignalHandler(&fInterruptSignalHandler);
+
+       delete fShuttle;
+}
+
+Bool_t AliShuttleTrigger::Notify() {
+       //
+       // Trigger CollectNew() methods in asynchronized (listen) mode.
+       // Usually called automaticly by DATENotifier on "end of run" 
+       // notification event.
+       //
+
+       fMutex.Lock();
+
+       fNotified = kTRUE;
+       fCondition.Signal();
+
+       fMutex.UnLock();
+
+       return kTRUE;
+}
+
+void AliShuttleTrigger::Terminate() {
+       //
+       // Stop triggers listen mode and exist from Run()
+       // Usually called automaticly by TerminateSignalHandler.
+       //
+
+       fTerminate = kTRUE;
+       fCondition.Signal();
+}
+
+void AliShuttleTrigger::Run() {
+       //
+       // AliShuttleTrigger main loop for asynchronized (listen) mode.
+       // It spawns DIM service listener and waits for DAQ "end of run"
+       // notification. Calls CollectNew() on notification.
+       //
+
+       fTerminate = kFALSE;
+
+       DATENotifier* notifier = new DATENotifier(this, "/DATE/LOGBOOK/UPDATE");
+
+       while (1) {
+       
+               fMutex.Lock();
+
+               while (!(fNotified || fTerminate)) {
+                       fCondition.Wait();
+               }
+
+               fNotified = kFALSE;
+               
+               fMutex.UnLock();
+
+               if (fTerminate) {
+                       AliInfo("Terminated.");
+                       break;          
+               }
+       
+               CollectNew();
+       }
+
+       delete notifier;
+}
+
+Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
+               TObjArray& entries, Int_t& lastRun) {
+
+       TString sqlQuery;
+       sqlQuery += "select run, time_start, time_end from logbook ";
+       sqlQuery += whereClause;
+       sqlQuery += " order by run";
+
+       TSQLServer* aServer;
+       aServer = TSQLServer::Connect(fConfig->GetLogBookURI(),
+                       fConfig->GetLogBookUser(),
+                       fConfig->GetLogBookPassword());
+       if (!aServer) {
+               AliError("Can't establish connection to DAQ log book DB!");
+               return kFALSE;
+       }
+
+       TSQLResult* aResult;
+       aResult = aServer->Query(sqlQuery);
+       if (!aResult) {
+               AliError(Form("Can't execute query <%s>!", sqlQuery.Data()));
+               delete aServer;
+               return kFALSE;
+       }
+
+       if (aResult->GetFieldCount() != 3) {
+               AliError("Invalid SQL result field number!");
+               delete aResult;
+               delete aServer;
+               return kFALSE;
+       }
+
+       lastRun = 0;
+
+       TSQLRow* aRow;
+       while ((aRow = aResult->Next())) {
+               TString runString(aRow->GetField(0), aRow->GetFieldLength(0));
+               Int_t run = runString.Atoi();
+
+               TString startTimeString(aRow->GetField(1),
+                               aRow->GetFieldLength(1));
+               Int_t startTime = startTimeString.Atoi();
+               if (!startTime) {
+                       AliWarning(Form("Zero StartTime for run <%d>!", run));
+                       AliWarning("Going to skip this run!");
+                       continue;
+               }
+
+               TString endTimeString(aRow->GetField(2),
+                               aRow->GetFieldLength(2));
+               Int_t endTime = endTimeString.Atoi();
+               if (!endTime) {
+                       AliWarning(Form("Zero EndTime for run <%d>!", run));
+                       AliWarning("Going to skip this run!");
+                       continue;
+               }
+
+               if (startTime > endTime) {
+                       AliWarning(Form("StartTime bigger than EndTime for run <%d>", run));
+                       AliWarning("Going to skip this run!");
+                       continue;
+               }
+
+               entries.AddLast(new DATEEntry(run, startTime, endTime));
+               if (lastRun < run) {
+                       lastRun = run;
+               }
+               delete aRow;
+       }
+
+       delete aResult;
+       
+       aServer->Shutdown();
+       delete aServer;
+
+       entries.SetOwner(1);
+
+       return kTRUE;
+}
+
+Bool_t AliShuttleTrigger::RetrieveConditionsData(const TObjArray& dateEntries) {
+
+       Bool_t hasError = kFALSE;
+
+       TIter iter(&dateEntries);
+       DATEEntry* anEntry;
+       while ((anEntry = (DATEEntry*) iter.Next())) {
+               if(!fShuttle->Process(anEntry->GetRun(), 
+                               anEntry->GetStartTime(),
+                               anEntry->GetEndTime())) {
+                       hasError = kTRUE;
+               }       
+       }
+
+       return !hasError;
+}
+
+Bool_t AliShuttleTrigger::Collect(Int_t run) {
+       //
+       // Collects conditions date for the given run.
+       //
+
+       AliInfo(Form("Collecting conditions data for run <%d> ...", run));
+
+       TString whereClause("where run = ");
+       whereClause += run;
+
+       Int_t lastRun;
+       TObjArray dateEntries;
+       if (!RetrieveDATEEntries(whereClause, dateEntries, lastRun)) {
+               AliError("Can't retrieve entries from DAQ log book.");
+               return kFALSE;
+        }
+
+       if (!dateEntries.GetEntriesFast()) {
+               AliError(Form("There isn't entry for run <%d> in DAQ log book!",
+                       run));
+               return kFALSE;
+       }
+
+       if (dateEntries.GetEntriesFast() > 1) {
+               AliError(Form("There is more than one entry for run <%d> in DAQ log book", run));
+               return kFALSE;
+       }
+
+       if (!RetrieveConditionsData(dateEntries)) {
+               AliError("An error occured during conditions data retrieval!");
+               return kFALSE;
+       }
+
+       return kTRUE;
+}
+
+Bool_t AliShuttleTrigger::CollectNew() {
+       //
+       // Collects conditions data for all new run written to DAQ LogBook.
+       //
+
+       AliInfo("Collecting conditions data for new runs ...");
+
+       Int_t lastRun;
+
+       AliCDBEntry* cdbEntry = fStorage->Get("/SHUTTLE/SYSTEM/LASTRUN", 0);
+       if (cdbEntry) {
+               TObject* anObject = cdbEntry->GetObject();
+               if (anObject == NULL || 
+                       anObject->IsA() != AliSimpleValue::Class()) {
+                       AliError("Invalid last run object stored to CDB!");
+                       return kFALSE;
+               }
+               AliSimpleValue* simpleValue = (AliSimpleValue*) anObject;
+               lastRun = simpleValue->GetInt();
+               delete cdbEntry;
+       } else {
+               AliWarning("There isn't last run stored! Starting from run 0");
+               lastRun = -1;
+       }
+
+       AliInfo(Form("Last run number <%d>", lastRun));
+
+       TString whereClause("where run > ");
+       whereClause += lastRun;
+
+       Int_t newLastRun;
+       TObjArray dateEntries;
+       if (!RetrieveDATEEntries(whereClause, dateEntries, newLastRun)) {
+               AliError("Can't retrieve entries from DAQ log book.");
+               return kFALSE;
+       }
+
+       if (newLastRun > lastRun) {
+               AliSimpleValue lastRunObj(newLastRun);
+               AliCDBMetaData metaData;
+               AliCDBId cdbID(AliCDBPath("SHUTTLE", "SYSTEM", "LASTRUN"), 0, 0);
+
+               if (!fStorage->Put(&lastRunObj, cdbID, &metaData)) {
+                       AliError("Can't store last run to CDB!");
+                       return kFALSE;
+               }
+       }
+
+       if (!RetrieveConditionsData(dateEntries)) {
+               AliError("An error occured during conditions data retrieval!");
+               return kFALSE;
+       }
+
+       return kTRUE;
+}
+
+Bool_t AliShuttleTrigger::CollectAll() {
+       //
+       // Collects conditions data for all run written in DAQ LogBook.
+       //
+
+       AliInfo("Collecting conditions data for all runs ...");
+
+       Int_t lastRun;
+       TObjArray dateEntries;
+       if (!RetrieveDATEEntries("", dateEntries, lastRun)) {
+               AliError("Can't retrieve entries from DAQ log book.");
+               return kFALSE;
+       }
+
+       if (!RetrieveConditionsData(dateEntries)) {
+               AliError("An error occured during conditions data retrieval!");
+               return kFALSE;
+       }
+
+       return kTRUE;
+}
+
diff --git a/SHUTTLE/AliShuttleTrigger.h b/SHUTTLE/AliShuttleTrigger.h
new file mode 100644 (file)
index 0000000..143cf4c
--- /dev/null
@@ -0,0 +1,96 @@
+#ifndef ALI_SHUTTLE_TRIGGER_H
+#define ALI_SHUTTLE_TRIGGER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//
+// This class is to deal with DAQ LogBook and DAQ end run notification.
+// It executes AliShuttle for retrieval of conditions data.
+//
+
+#include <TObject.h>
+#include <TSysEvtHandler.h>
+#include <TMutex.h>
+#include <TCondition.h>
+
+
+class AliCDBStorage;
+class AliShuttle;
+class AliShuttleConfig;
+
+class AliShuttleTrigger;
+class DATENotifier;
+
+class TerminateSignalHandler: public TSignalHandler {
+       
+       AliShuttleTrigger* fTrigger;
+public:
+       TerminateSignalHandler(AliShuttleTrigger* trigger, ESignals signal):
+               TSignalHandler(signal, kFALSE), fTrigger(trigger) {}
+
+       virtual Bool_t Notify();
+
+       ClassDef(TerminateSignalHandler, 0)
+};
+
+class AliShuttleTrigger: public TObject {
+public:
+       AliShuttleTrigger(const AliShuttleConfig* config,
+                       AliCDBStorage* storage, UInt_t timeout = 5000,
+                       Int_t retries = 5);
+       ~AliShuttleTrigger();
+
+       AliShuttle* GetShuttle() {return fShuttle;}
+
+       Bool_t Collect(Int_t run);
+       Bool_t CollectNew();
+       Bool_t CollectAll();
+       
+       virtual Bool_t Notify();
+       void Terminate();
+
+       void Run();
+
+private:
+
+       class DATEEntry: public TObject {
+               Int_t fRun;
+               UInt_t fStartTime;
+               UInt_t fEndTime;
+       public:
+               DATEEntry(Int_t run, UInt_t startTime, UInt_t endTime):
+                       fRun(run), fStartTime(startTime), fEndTime(endTime) {}
+
+               Int_t GetRun() {return fRun;}
+               UInt_t GetStartTime() {return fStartTime;}
+               UInt_t GetEndTime() {return fEndTime;}
+
+               ClassDef(DATEEntry, 0)
+       };
+
+       Bool_t RetrieveDATEEntries(const char* whereClause, TObjArray& entries,
+                       Int_t& lastRun);
+       Bool_t RetrieveConditionsData(const TObjArray& dateEntries);
+
+       const AliShuttleConfig* fConfig;
+       AliCDBStorage* fStorage;
+
+       AliShuttle* fShuttle;
+
+       Bool_t fNotified;
+       Bool_t fTerminate;
+
+       TMutex fMutex;
+       TCondition fCondition;
+
+       TerminateSignalHandler fQuitSignalHandler;
+       TerminateSignalHandler fInterruptSignalHandler;
+
+
+       ClassDef(AliShuttleTrigger, 0)
+};
+
+#endif
index df8649ebd9293bd9275c98cfae6190b6985133d6..f26fdf277f404b2afbe2b855f56806f2a8456395 100644 (file)
 
 /*
 $Log$
+Revision 1.2  2005/11/17 14:43:23  byordano
+import to local CVS
+
+Revision 1.1.1.1  2005/10/28 07:33:58  hristov
+Initial import as subdirectory in AliRoot
+
 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
 SHUTTLE package
 
diff --git a/SHUTTLE/DATENotifier.cxx b/SHUTTLE/DATENotifier.cxx
new file mode 100644 (file)
index 0000000..f9a2533
--- /dev/null
@@ -0,0 +1,18 @@
+#include "DATENotifier.h"
+
+#include "AliLog.h"
+
+#include "AliShuttleTrigger.h"
+
+void DATENotifier::infoHandler() {
+       AliInfoGeneral("DATENotifier::infoHandler()",
+                       "DATE notification received ...");
+       fTrigger->Notify();
+}
+
+void DATENotifier::errorHandler(int severity, int code, char *msg) {
+
+       AliInfoGeneral("DATENotifier::errorHandler()",
+               Form("DIM Error: severity<%d>, code<%d> , message<%s>",
+               severity, code, msg));
+}
diff --git a/SHUTTLE/DATENotifier.h b/SHUTTLE/DATENotifier.h
new file mode 100644 (file)
index 0000000..0f8fcbb
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef DATE_NOTIFIER_H
+#define DATE_NOTIFIER_H
+
+#include <dic.hxx>
+
+class AliShuttleTrigger;
+
+class DATENotifier: public DimInfo
+{
+       AliShuttleTrigger* fTrigger;
+public:
+        DATENotifier(AliShuttleTrigger* trigger, const char* service): 
+               DimInfo(service, -1), fTrigger(trigger) {}
+
+       void infoHandler();
+
+       void errorHandler(int severity, int code, char *msg); 
+};
+
+#endif
index 8adacd56b68b8c46cb61e424dbf09d0c3171626d..757cf0435e26f58aa718f11fed5f63fea97ccae1 100644 (file)
@@ -34,5 +34,8 @@
 #pragma link C++ class  AliShuttleConfig::ConfigHolder;
 #pragma link C++ class  AliShuttle;
 #pragma link C++ class  AliCDBPreProcessor;
+#pragma link C++ class  AliShuttleTrigger;
+#pragma link C++ class  TerminateSignalHandler;
+#pragma link C++ class  AliShuttleTrigger::DATEEntry;
 
 #endif
diff --git a/SHUTTLE/Shuttle.C b/SHUTTLE/Shuttle.C
new file mode 100644 (file)
index 0000000..9341df2
--- /dev/null
@@ -0,0 +1,46 @@
+void Shuttle(const char* param = "listen") {
+
+       gSystem->Load("libSHUTTLE");
+        gSystem->Load("$ROOTSYS/lib/libRLDAP");
+       gSystem->Load("$ROOTSYS/lib/libThread");
+
+//     AliLog::SetGlobalDebugLevel(1);
+
+        AliShuttleConfig config("pcepalice60.cern.ch", 389,
+                       "cn=Shuttle,dc=alice,dc=cern,dc=ch", "passhuttle");
+        config.Print();
+
+       AliCDBStorage* cdbStorage = AliCDBManager::Instance()->
+                       GetStorage("local://~/temp/DCS");
+
+       AliShuttleTrigger trigger(&config, cdbStorage);
+
+       AliShuttle* shuttle = trigger.GetShuttle();
+       // Add here detectors preprocessor ...
+       //shuttle->RegisterCDBPreProcessor(new TestITSPreProcessor());
+
+       TString paramStr(param);
+       
+       if (paramStr.IsDigit()) {
+               Int_t run = paramStr.Atoi();
+               trigger.Collect(run);
+       } else if (paramStr == "new") {
+               trigger.CollectNew();
+       } else if (paramStr == "all") {
+               trigger.CollectAll();
+       } else if (paramStr == "listen") {
+               trigger.Run();
+       } else {
+               cout<<"Bad parameter: "<<param<<endl;
+               cout<<"Parameter options: "<<endl;
+               cout<<"<run> - collect data for the given run"<<endl;
+               cout<<"new - collect data only for the new runs"<<endl;
+               cout<<"all - collect data for all runs"<<endl;
+               cout<<"listen - start listening for DAQ notification"<<endl;
+               cout<<"<empty parameter> - the same as 'listen'"<<endl;
+       }
+
+       AliCDBManager::Destroy();
+}
+
+
index 13023234d9bff84b5b596e01d13fe0df0a85e289..965fb2be113035ad4c2fa50ea8d37b81a4031ebb 100644 (file)
@@ -1,9 +1,17 @@
 SRCS = AliSimpleValue.cxx AliDCSValue.cxx AliDCSMessage.cxx\
        AliDCSClient.cxx AliShuttle.cxx AliShuttleConfig.cxx\
-       AliCDBPreProcessor.cxx
+       AliCDBPreProcessor.cxx AliShuttleTrigger.cxx
 
+CINTHDRS:= $(patsubst %,$(MODDIR)/%,$(SRCS:.cxx=.h))
+
+SRCS += DATENotifier.cxx
 HDRS:= $(SRCS:.cxx=.h) 
 
+EINCLUDE := $(DIMDIR)/dim
+ELIBS := dim
+ELIBSDIR := $(DIMDIR)/$(ODIR)
+
+
 DHDR= SHUTTLELinkDef.h
 
 
index 4ae1fb74787bfecafef5c6f243ce2d17730b9d22..af80b5c78fa15736a12fb760764a0c63bd1ace40 100644 (file)
@@ -16,10 +16,31 @@ attributetype ( 1.1.1.3 NAME 'alias'
         DESC 'DCS alias'
         EQUALITY caseIgnoreMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40})
-               
+
+attributetype ( 1.1.2.1 NAME 'lbURI'
+        DESC 'DAQ Logbook URI'
+        EQUALITY caseIgnoreMatch
+        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} SINGLE-VALUE )
+
+attributetype ( 1.1.2.2 NAME 'lbUser'
+        DESC 'DAQ Logbook user name'
+        EQUALITY caseIgnoreMatch
+        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} SINGLE-VALUE )
+
+attributetype ( 1.1.2.3 NAME 'lbPassword'
+        DESC 'DAQ Logbook password'
+        EQUALITY caseIgnoreMatch
+        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} SINGLE-VALUE )
+
 objectclass ( 1.1.1
         NAME 'shuttleConfig'
         DESC 'ALICE: Shuttle configuration object.'
         SUP top
         MUST (dt $ ipHost $ ipServicePort $ alias) )
        
+objectclass ( 1.1.2
+        NAME 'logbookConfig'
+        DESC 'ALICE: Logbook configuration object.'
+        SUP top AUXILIARY
+        MUST (lbURI $ lbUser $ lbPassword) )
+
index f23ab18e16168888e1cb27fc3095e0b984e2bf48..90a2a2330929d7093393514e1f21ff2b592f697f 100644 (file)
@@ -29,7 +29,7 @@ void GetValues(const char* host, Int_t port, const char* request,
                result = client.GetDPValues(startTime, endTime, values);
 
        } else {
-               TList* valueSet = new TList();
+               TObjArray* valueSet = new TObjArray();
                valueSet->SetOwner(1);
 
                values.Add(new TObjString(request), valueSet);
@@ -60,16 +60,16 @@ void GetValues(const char* host, Int_t port, const char* request,
        TObjString* aRequest;
        while ((aRequest = (TObjString*) iter.Next())) {
 
-               TList* valueSet = (TList*) values.GetValue(aRequest);
+               TObjArray* valueSet = (TObjArray*) values.GetValue(aRequest);
                
                cout<<" '"<<aRequest->String()<<"' values: " 
-                       <<valueSet->GetSize()<<endl;
+                       <<valueSet->GetEntriesFast()<<endl;
 
-/*             TIter valIter(valueSet);
+               TIter valIter(valueSet);
                AliDCSValue* aValue;
                while ((aValue = (AliDCSValue*) valIter.Next())) {
                        cout<<aValue->ToString()<<endl;
-               } */
+               } 
        }
 
 /*     TFile file("dump.root", "UPDATE");
index 02d7ceabc3a86af13cd1239f9e2863193a635bab..e1d2f8b920bba891e926931139bc49984097879b 100644 (file)
@@ -4,7 +4,6 @@
 #include "AliDCSValue.h"
 #include "AliLog.h"
 
-#include <TList.h>
 #include <TTimeStamp.h>
 
 ClassImp(TestITSPreProcessor)
@@ -28,7 +27,7 @@ void TestITSPreProcessor::Finalize() {
        AliInfo("Finalizing...");
 }
 
-void TestITSPreProcessor::Process(const char* alias, TList& valueSet, 
+void TestITSPreProcessor::Process(const char* alias, TObjArray& valueSet, 
        Bool_t hasError)
 {
        AliInfo(Form("Alias %s, hasError: %d", alias, hasError));       
index 98517bf28676b97f30b727cf65bd5c546e9be6e7..c57f752d6523fcb8bffdbd8f7a24ca5dc696ac5c 100644 (file)
@@ -14,7 +14,7 @@ protected:
 
         virtual void Finalize();
 
-        virtual void Process(const char* alias, TList& valueSet, 
+        virtual void Process(const char* alias, TObjArray& valueSet, 
                         Bool_t hasError);
 
        ClassDef(TestITSPreProcessor, 0);
index 83b749b3f3cc56565fb037c67a7cf2639e646ce2..676bb16063c5895d2d4ba050d91af3d651a3a9dc 100644 (file)
@@ -1,4 +1,4 @@
-void Compare(TList& a, TList& b) {
+void Compare(TObjArray& a, TObjArray& b) {
 
        Assert(a.GetSize() == b.GetSize());
 
@@ -20,7 +20,7 @@ void Compare(TList& a, TList& b) {
        
 }
 
-void CompareStr(TList& a, TList& b) {
+void CompareStr(TObjArray& a, TObjArray& b) {
 
        cout<<"A size: "<<a.GetSize()<<endl;
        cout<<"B size: "<<b.GetSize()<<endl;
@@ -112,11 +112,11 @@ void TestMessage() {
 
         Assert(rsMsg.GetType() == AliDCSMessage::kResultSet);
 
-        TList values;
+        TObjArray values;
        values.SetOwner(1);
-        values.Add(new AliDCSValue(kFALSE, currentTime.GetSec()));
-        values.Add(new AliDCSValue(kTRUE, currentTime.GetSec() + 1));
-        values.Add(new AliDCSValue(kFALSE, currentTime.GetSec()+ 200));
+        values.AddLast(new AliDCSValue(kFALSE, currentTime.GetSec()));
+        values.AddLast(new AliDCSValue(kTRUE, currentTime.GetSec() + 1));
+        values.AddLast(new AliDCSValue(kFALSE, currentTime.GetSec()+ 200));
 
         rsMsg.AddValue(*(AliDCSValue*) values.At(0));
         rsMsg.AddValue(*(AliDCSValue*) values.At(1));
@@ -131,7 +131,7 @@ void TestMessage() {
         Assert(nrsMsg.GetType() == AliDCSMessage::kResultSet);
        Assert(nrsMsg.GetSimpleValueType() == AliSimpleValue::kBool);
 
-        TList nvalues;
+        TObjArray nvalues;
        nvalues.SetOwner(1);
         Assert(nrsMsg.GetValues(nvalues) == maxCount);
 
@@ -143,11 +143,11 @@ void TestMessage() {
 
         Assert(rsMsg.GetType() == AliDCSMessage::kResultSet);
 
-        TList values;
+        TObjArray values;
        values.SetOwner(1);
-        values.Add(new AliDCSValue((Char_t) 25, currentTime.GetSec()));
-        values.Add(new AliDCSValue((Char_t) 0, currentTime.GetSec() + 1));
-        values.Add(new AliDCSValue((Char_t) 255, currentTime.GetSec()+ 200));
+        values.AddLast(new AliDCSValue((Char_t) 25, currentTime.GetSec()));
+        values.AddLast(new AliDCSValue((Char_t) 0, currentTime.GetSec() + 1));
+        values.AddLast(new AliDCSValue((Char_t) 255, currentTime.GetSec()+ 200));
 
         rsMsg.AddValue(*(AliDCSValue*) values.At(0));
         rsMsg.AddValue(*(AliDCSValue*) values.At(1));
@@ -160,7 +160,7 @@ void TestMessage() {
         Assert(nrsMsg.GetType() == AliDCSMessage::kResultSet);
         Assert(nrsMsg.GetSimpleValueType() == AliSimpleValue::kByte);
 
-        TList nvalues;
+        TObjArray nvalues;
        nvalues.SetOwner(1);
         Assert(nrsMsg.GetValues(nvalues) == maxCount);
 
@@ -173,11 +173,11 @@ void TestMessage() {
 
        Assert(rsMsg.GetType() == AliDCSMessage::kResultSet);
 
-       TList values;
+       TObjArray values;
        values.SetOwner(1);
-       values.Add(new AliDCSValue(100, currentTime.GetSec()));
-       values.Add(new AliDCSValue(10, currentTime.GetSec() + 1));
-       values.Add(new AliDCSValue(666, currentTime.GetSec()+ 200));
+       values.AddLast(new AliDCSValue(100, currentTime.GetSec()));
+       values.AddLast(new AliDCSValue(10, currentTime.GetSec() + 1));
+       values.AddLast(new AliDCSValue(666, currentTime.GetSec()+ 200));
        
        rsMsg.AddValue(*(AliDCSValue*) values.At(0));
        rsMsg.AddValue(*(AliDCSValue*) values.At(1));
@@ -190,7 +190,7 @@ void TestMessage() {
        Assert(nrsMsg.GetType() == AliDCSMessage::kResultSet);
        Assert(nrsMsg.GetSimpleValueType() == AliSimpleValue::kInt);
 
-        TList nvalues;
+        TObjArray nvalues;
        nvalues.SetOwner(1);
        Assert(nrsMsg.GetValues(nvalues) == maxCount);
 
@@ -202,11 +202,11 @@ void TestMessage() {
 
         Assert(rsMsg.GetType() == AliDCSMessage::kResultSet);
 
-        TList values;
+        TObjArray values;
        values.SetOwner(1);
-        values.Add(new AliDCSValue((UInt_t) 1000, currentTime.GetSec()));
-        values.Add(new AliDCSValue((UInt_t) 104, currentTime.GetSec() + 1));
-        values.Add(new AliDCSValue((UInt_t) 6665, currentTime.GetSec()+ 200));
+        values.AddLast(new AliDCSValue((UInt_t) 1000, currentTime.GetSec()));
+        values.AddLast(new AliDCSValue((UInt_t) 104, currentTime.GetSec() + 1));
+        values.AddLast(new AliDCSValue((UInt_t) 6665, currentTime.GetSec()+ 200));
 
         rsMsg.AddValue(*(AliDCSValue*) values.At(0));
         rsMsg.AddValue(*(AliDCSValue*) values.At(1));
@@ -219,7 +219,7 @@ void TestMessage() {
         Assert(nrsMsg.GetType() == AliDCSMessage::kResultSet);
         Assert(nrsMsg.GetSimpleValueType() == AliSimpleValue::kUInt);
 
-        TList nvalues;
+        TObjArray nvalues;
        nvalues.SetOwner(1);
         Assert(nrsMsg.GetValues(nvalues) == maxCount);
 
@@ -231,11 +231,11 @@ void TestMessage() {
 
         Assert(rsMsg.GetType() == AliDCSMessage::kResultSet);
 
-        TList values;
+        TObjArray values;
        values.SetOwner(1);
-        values.Add(new AliDCSValue((Float_t) 1000.55, currentTime.GetSec()));
-        values.Add(new AliDCSValue((Float_t) 10.4, currentTime.GetSec() + 1));
-        values.Add(new AliDCSValue((Float_t) 6665.1, currentTime.GetSec()+ 200));
+        values.AddLast(new AliDCSValue((Float_t) 1000.55, currentTime.GetSec()));
+        values.AddLast(new AliDCSValue((Float_t) 10.4, currentTime.GetSec() + 1));
+        values.AddLast(new AliDCSValue((Float_t) 6665.1, currentTime.GetSec()+ 200));
 
         rsMsg.AddValue(*(AliDCSValue*) values.At(0));
         rsMsg.AddValue(*(AliDCSValue*) values.At(1));
@@ -248,7 +248,7 @@ void TestMessage() {
         Assert(nrsMsg.GetType() == AliDCSMessage::kResultSet);
         Assert(nrsMsg.GetSimpleValueType() == AliSimpleValue::kFloat);
 
-        TList nvalues;
+        TObjArray nvalues;
        nvalues.SetOwner(1);
         Assert(nrsMsg.GetValues(nvalues) == maxCount);
 
@@ -276,11 +276,11 @@ void TestMessage() {
         Assert(newErrorMsg.GetErrorString() == errorString); 
 
        // MultiRequest Message
-       TList requests;
+       TObjArray requests;
        requests.SetOwner(1);
-       requests.Add(new TObjString("alias1.test"));
-       requests.Add(new TObjString("alias2.test"));
-       requests.Add(new TObjString("alias3.test"));
+       requests.AddLast(new TObjString("alias1.test"));
+       requests.AddLast(new TObjString("alias2.test"));
+       requests.AddLast(new TObjString("alias3.test"));
 
        AliDCSMessage multiMsg;
        multiMsg.CreateMultiRequestMessage(AliDCSMessage::kAlias, 
@@ -309,7 +309,7 @@ void TestMessage() {
 
        PrintBuffer(nmultiMsg.GetMessage(), nmultiMsg.GetMessageSize());
        
-       TList nrequests;
+       TObjArray nrequests;
        nrequests.SetOwner(1);
        nmultiMsg.GetRequestStrings(nrequests);
        
index 55b26247fbaa49b0e3b6c22e049927e68699fcc6..0f57c95bf5f505086b4d14421f940a0f58e28e29 100644 (file)
@@ -7,15 +7,23 @@ void TestShuttle() {
 
        AliLog::SetGlobalDebugLevel(1);
 
-        AliShuttleConfig config("localhost", 5000);
+        AliShuttleConfig config("pcepalice60.cern.ch", 389,
+                       "cn=Shuttle,dc=alice,dc=cern,dc=ch", "passhuttle");
         config.Print();
 
-       AliShuttle shuttle(&config, "local://~/temp/DCS");
-       shuttle.RegisterCDBPreProcessor(new TestITSPreProcessor());
+       AliCDBStorage* cdbStorage = AliCDBManager::Instance()->
+                       GetStorage("local://~/temp/DCS");
+
+       AliShuttleTrigger trigger(&config, cdbStorage);
+
+       AliShuttle* shuttle = trigger.GetShuttle();
+       shuttle->RegisterCDBPreProcessor(new TestITSPreProcessor());
+
+       trigger.CollectNew();
        
-       TTimeStamp currentTime;
+/*     TTimeStamp currentTime;
        shuttle.Process(1, currentTime.GetSec() - 18 * 3600, 
-               currentTime.GetSec());
+               currentTime.GetSec());*/
 }
 
 
index 768fef69bfcb5cc122b74ba1e01fb7b2b4a9c887..55d160c2a61f2e44e6be542129a3bf03a2178120 100644 (file)
@@ -3,6 +3,7 @@ void TestShuttleConfig() {
        gSystem->Load("libSHUTTLE");
        gSystem->Load("libRLDAP");
        
-       AliShuttleConfig config("localhost", 5000);
+       AliShuttleConfig config("pcepalice60.cern.ch", 389,
+                       "cn=Shuttle,dc=alice,dc=cern,dc=ch", "passhuttle");
        config.Print();
 }