]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttle.h
changing order of library loading
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttle.h
CommitLineData
73abe331 1#ifndef ALI_SHUTTLE_H
2#define ALI_SHUTTLE_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
8
9
10//
11// This class is the main manager for
12// AliShuttle. It organizes the data retrieval
13// from DCS and call the interface methods of
a7160fe9 14// AliPreprocessor.
73abe331 15//
16
73abe331 17#include <TMap.h>
b948db8d 18#include <TString.h>
57f50b3c 19#include <TList.h>
b948db8d 20
21#include "AliShuttleInterface.h"
5164a766 22#include "AliShuttleStatus.h"
73abe331 23
58bc3020 24class TObject;
73abe331 25class AliShuttleConfig;
2bb7b766 26class AliShuttleLogbookEntry;
b948db8d 27class AliPreprocessor;
73abe331 28class AliCDBMetaData;
57f50b3c 29class TSQLServer;
5164a766 30class AliCDBEntry;
84090f85 31class AliCDBPath;
73abe331 32
b948db8d 33class AliShuttle: public AliShuttleInterface {
73abe331 34public:
2bb7b766 35 enum { kNDetectors=17 }; // number of subdetectors in ALICE
36
b948db8d 37 AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
73abe331 38 virtual ~AliShuttle();
39
b948db8d 40 virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
41
2bb7b766 42 Bool_t Collect(Int_t run);
43 Bool_t CollectNew();
44 Bool_t CollectAll();
45
46 Bool_t Process(AliShuttleLogbookEntry* entry);
73abe331 47
2bb7b766 48 Int_t GetCurrentRun() const;
49 UInt_t GetCurrentStartTime() const;
50 UInt_t GetCurrentEndTime() const;
73abe331 51
84090f85 52 virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
53 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
54 virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
55 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
b948db8d 56 virtual const char* GetFile(Int_t system, const char* detector,
57 const char* id, const char* source);
58 virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
59 virtual void Log(const char* detector, const char* message);
60
4f0ab988 61 static TString GetMainCDB () {return fgkMainCDB;}
62 static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;}
84090f85 63 static TString GetLocalCDB () {return fgkLocalCDB;}
64 static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
65
66 static TString GetMainRefStorage() {return fgkMainRefStorage;}
67 static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
84090f85 68 static TString GetLocalRefStorage() {return fgkLocalRefStorage;}
69 static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
73abe331 70
4f0ab988 71 //TODO Test only, remove later !
2bb7b766 72 void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;}
57f50b3c 73
74 static const char* GetDetCode(const char* detector);
2bb7b766 75 static const char* GetDetCode(UInt_t detPos);
76 static const Int_t GetDetPos(const char* detCode);
77 static const UInt_t NDetectors() {return kNDetectors;}
57f50b3c 78 static const char* GetShuttleTempDir() {return fgkShuttleTempDir;}
79
80 Bool_t Connect(Int_t system);
81
73abe331 82private:
57f50b3c 83 AliShuttle(const AliShuttle& other);
84 AliShuttle& operator= (const AliShuttle& other);
85
2bb7b766 86 UInt_t ProcessCurrentDetector();
87
88 Bool_t QueryRunParameters(Int_t& run, UInt_t& startTime, UInt_t& endTime);
89 Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries);
90 Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries);
91
92 Bool_t GetValueSet(const char* host, Int_t port, const char* alias, TObjArray* result);
57f50b3c 93
94 const char* GetDAQFileName(const char* detector, const char* id, const char* source);
95 Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName);
96 TList* GetDAQFileSources(const char* detector, const char* id);
5164a766 97 Bool_t UpdateDAQTable();
57f50b3c 98
99 const char* GetDCSFileName(const char* detector, const char* id, const char* source);
100// Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName);
101 TList* GetDCSFileSources(const char* detector, const char* id);
102
103 const char* GetHLTFileName(const char* detector, const char* id, const char* source);
104// Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName;
105 TList* GetHLTFileSources(const char* detector, const char* id);
106
85a80aa9 107 UInt_t WriteToCDB(const char* mainUri, const char* localUri,
108 const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
109 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
110
2bb7b766 111 Bool_t TryToStoreAgain();
112 Bool_t TryToStoreAgain(TString& storageType);
113
4f0ab988 114 AliShuttleStatus* ReadShuttleStatus();
115 Bool_t WriteShuttleStatus(AliShuttleStatus* status);
116 Bool_t ContinueProcessing();
117 void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
2bb7b766 118 Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0);
b948db8d 119
2bb7b766 120 const AliShuttleConfig* fConfig; // pointer to configuration object
73abe331 121
2bb7b766 122// static const UInt_t fgkNDetectors = 17; //! number of detectors
123 static const char* fgkDetectorName[kNDetectors]; //! names of detectors
124 static const char* fgkDetectorCode[kNDetectors]; //! codes of detectors
125 static TString fgkMainCDB; // URI of the main (Grid) CDB storage
126 static TString fgkLocalCDB; //! URI of the local backup CDB storage
127 static TString fgkMainRefStorage; // URI of the main (Grid) REFERENCE storage
128 static TString fgkLocalRefStorage; // URI of the local REFERENCE storage
129 static const char* fgkShuttleTempDir; // base path of SHUTTLE temp folder
130 static const char* fgkShuttleLogDir; // path of SHUTTLE log folder
57f50b3c 131
2bb7b766 132 UInt_t fTimeout; // DCS server connection timeout parameter
133 Int_t fRetries; // Number of DCS server connection retries
5164a766 134
2bb7b766 135 TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor")
57f50b3c 136
2bb7b766 137 AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry
138 TString fCurrentDetector; // current detector
57f50b3c 139
2bb7b766 140 TSQLServer *fServer[3]; // pointer to the three FS logbook servers
141 Bool_t fFESCalled[3]; // FES call status
142 TList fFESlist[3]; // List of files retrieved from each FES
85a80aa9 143
2bb7b766 144 AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved
145 Bool_t fGridError; // Grid storage error flag
4f0ab988 146
147 //TODO Test only, remove later !
148 static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing
b948db8d 149
73abe331 150 ClassDef(AliShuttle, 0);
151};
152
153#endif