]>
Commit | Line | Data |
---|---|---|
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 | |
14 | // AliPreprocessor. | |
15 | // | |
16 | ||
17 | #include <TMap.h> | |
18 | #include <TString.h> | |
19 | #include <TList.h> | |
20 | ||
21 | #include "AliShuttleInterface.h" | |
22 | #include "AliShuttleStatus.h" | |
23 | ||
24 | class TObject; | |
25 | class AliShuttleConfig; | |
26 | class AliShuttleLogbookEntry; | |
27 | class AliPreprocessor; | |
28 | class AliCDBMetaData; | |
29 | class TSQLServer; | |
30 | class AliCDBEntry; | |
31 | class AliCDBPath; | |
32 | ||
33 | class AliShuttle: public AliShuttleInterface { | |
34 | public: | |
35 | enum { kNDetectors=17 }; // number of subdetectors in ALICE | |
36 | ||
37 | AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5); | |
38 | virtual ~AliShuttle(); | |
39 | ||
40 | virtual void RegisterPreprocessor(AliPreprocessor* preprocessor); | |
41 | ||
42 | Bool_t Collect(Int_t run); | |
43 | Bool_t CollectNew(); | |
44 | Bool_t CollectAll(); | |
45 | ||
46 | Bool_t Process(AliShuttleLogbookEntry* entry); | |
47 | ||
48 | Int_t GetCurrentRun() const; | |
49 | UInt_t GetCurrentStartTime() const; | |
50 | UInt_t GetCurrentEndTime() const; | |
51 | ||
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); | |
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 | ||
61 | static TString GetMainCDB () {return fgkMainCDB;} | |
62 | static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} | |
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;} | |
68 | static TString GetLocalRefStorage() {return fgkLocalRefStorage;} | |
69 | static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} | |
70 | ||
71 | //TODO Test only, remove later ! | |
72 | void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;} | |
73 | ||
74 | static const char* GetDetCode(const char* detector); | |
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;} | |
78 | static const char* GetShuttleTempDir() {return fgkShuttleTempDir;} | |
79 | ||
80 | Bool_t Connect(Int_t system); | |
81 | ||
82 | private: | |
83 | AliShuttle(const AliShuttle& other); | |
84 | AliShuttle& operator= (const AliShuttle& other); | |
85 | ||
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); | |
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); | |
97 | Bool_t UpdateDAQTable(); | |
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 | ||
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 | ||
111 | Bool_t TryToStoreAgain(); | |
112 | Bool_t TryToStoreAgain(TString& storageType); | |
113 | ||
114 | AliShuttleStatus* ReadShuttleStatus(); | |
115 | Bool_t WriteShuttleStatus(AliShuttleStatus* status); | |
116 | Bool_t ContinueProcessing(); | |
117 | void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); | |
118 | Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0); | |
119 | ||
120 | const AliShuttleConfig* fConfig; // pointer to configuration object | |
121 | ||
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 | |
131 | ||
132 | UInt_t fTimeout; // DCS server connection timeout parameter | |
133 | Int_t fRetries; // Number of DCS server connection retries | |
134 | ||
135 | TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor") | |
136 | ||
137 | AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry | |
138 | TString fCurrentDetector; // current detector | |
139 | ||
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 | |
143 | ||
144 | AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved | |
145 | Bool_t fGridError; // Grid storage error flag | |
146 | ||
147 | //TODO Test only, remove later ! | |
148 | static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing | |
149 | ||
150 | ClassDef(AliShuttle, 0); | |
151 | }; | |
152 | ||
153 | #endif |