]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/AliShuttle.h
Update to shuttle classes (Alberto)
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttle.h
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 AliPreprocessor;
27 class AliCDBMetaData;
28 class TSQLServer;
29 class AliCDBEntry;
30 class AliCDBPath;
31
32 class AliShuttle: public AliShuttleInterface {
33 public:
34         AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
35         virtual ~AliShuttle();
36
37         virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
38
39         Bool_t Process(Int_t run, UInt_t startTime, UInt_t endTime);
40         Bool_t Process();
41
42         Int_t GetCurrentRun() const {return fCurrentRun;};
43         UInt_t GetCurrentStartTime() const {return fCurrentStartTime;};
44         UInt_t GetCurrentEndTime() const {return fCurrentEndTime;};
45
46         virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
47                         Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
48         virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
49                         Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
50         virtual const char* GetFile(Int_t system, const char* detector,
51                 const char* id, const char* source);
52         virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
53         virtual void Log(const char* detector, const char* message);
54
55         static TString GetLocalCDB () {return fgkLocalCDB;}
56         static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
57
58         static TString GetMainRefStorage() {return fgkMainRefStorage;}
59         static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
60
61         static TString GetLocalRefStorage() {return fgkLocalRefStorage;}
62         static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
63
64         // TODO Test only, remove later!
65         void SetCurrentRun(int run) {fCurrentRun=run;}
66
67         static const char* GetDetCode(const char* detector);
68         static const char* GetShuttleTempDir() {return fgkShuttleTempDir;}
69
70         Bool_t Connect(Int_t system);
71
72
73 private:
74         AliShuttle(const AliShuttle& other);
75         AliShuttle& operator= (const AliShuttle& other);
76
77         Bool_t GetValueSet(const char* host, Int_t port, const char* alias,
78                         TObjArray& result);
79
80         const char* GetDAQFileName(const char* detector, const char* id, const char* source);
81         Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName);
82         TList* GetDAQFileSources(const char* detector, const char* id);
83         Bool_t UpdateDAQTable();
84
85         const char* GetDCSFileName(const char* detector, const char* id, const char* source);
86 //      Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName);
87         TList* GetDCSFileSources(const char* detector, const char* id);
88
89         const char* GetHLTFileName(const char* detector, const char* id, const char* source);
90 //      Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName;
91         TList* GetHLTFileSources(const char* detector, const char* id);
92
93   AliShuttleStatus* ReadShuttleStatus();
94   Bool_t WriteShuttleStatus(AliShuttleStatus* status);
95   Bool_t ContinueProcessing();
96   void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
97
98         const AliShuttleConfig* fConfig;        //! pointer to configuration object
99
100         static const Int_t fgkNDetectors = 17;                  //! number of detectors
101         static const char* fgkDetectorName[fgkNDetectors];      //! names of detectors
102         static const char* fgkDetectorCode[fgkNDetectors];      //! codes of detectors
103         static TString     fgkLocalCDB;         //! URI of the local backup storage
104         static TString     fgkMainRefStorage;   //! URI of the main (Grid) REFERENCE storage
105         static TString     fgkLocalRefStorage;  //! URI of the local REFERENCE storage
106         static const char* fgkShuttleTempDir;   //! base path of SHUTTLE temp folder
107         static const char* fgkShuttleLogDir;    //! path of SHUTTLE log folder
108
109         UInt_t fTimeout;        //! DCS server connection timeout parameter
110         Int_t fRetries;         //! Number of DCS server connection retries
111
112         TMap fPreprocessorMap;  //! list of detector Preprocessors ("DET", "Preprocessor")
113
114         Int_t fCurrentRun;              //! run currenty processed
115         UInt_t fCurrentStartTime;       //! Run Start time
116         UInt_t fCurrentEndTime;         //! Run end time
117
118   TString fCurrentDetector; // current detector
119
120         TSQLServer *fServer[3];         //! pointer to the three FS logbook servers
121
122         Bool_t fFESCalled[3];           //! FES call status
123         TList  fFESlist[3];             //! List of files retrieved from each FES
124
125   AliCDBEntry* fStatusEntry; //! last CDB entry containing a AliShuttleStatus retrieved
126
127         ClassDef(AliShuttle, 0);
128 };
129
130 #endif