Improved diagnostic messages. Different access strings for AliCDBGrid. New or renamed...
[u/mrichter/AliRoot.git] / STEER / AliCDBManager.h
CommitLineData
9e1ceb13 1#ifndef ALI_CDB_MANAGER_H
2#define ALI_CDB_MANAGER_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/////////////////////////////////////////////////////////////////////
8// //
9// class AliCDBManager //
10// //
11/////////////////////////////////////////////////////////////////////
12
13#include <TObject.h>
14#include <TList.h>
15#include <TMap.h>
16
fdf65bb5 17class AliCDBEntry;
9e1ceb13 18class AliCDBStorage;
19class AliCDBStorageFactory;
20class AliCDBParam;
21
22class AliCDBManager: public TObject {
23
24 public:
25
26 void RegisterFactory(AliCDBStorageFactory* factory);
27
fdf65bb5 28 Bool_t HasStorage(const char* dbString) const;
9e1ceb13 29
fdf65bb5 30 AliCDBParam* CreateParameter(const char* dbString) const;
9e1ceb13 31
32 AliCDBStorage* GetStorage(const char* dbString);
33 AliCDBStorage* GetStorage(const AliCDBParam* param);
34
35 TList* GetActiveStorages();
36
37 void SetDefaultStorage(const char* dbString);
38 void SetDefaultStorage(const AliCDBParam* param);
39 void SetDefaultStorage(AliCDBStorage *storage);
40
fdf65bb5 41 Bool_t IsDefaultStorageSet() const {return fDefaultStorage != 0;}
9e1ceb13 42
fdf65bb5 43 AliCDBStorage* GetDefaultStorage() const {return fDefaultStorage;}
9e1ceb13 44
b05400be 45 void UnsetDefaultStorage() {fDefaultStorage = 0x0;}
9e1ceb13 46
47 void SetDrain(const char* dbString);
48 void SetDrain(const AliCDBParam* param);
49 void SetDrain(AliCDBStorage *storage);
50
fdf65bb5 51 Bool_t IsDrainSet() const {return fDrainStorage != 0;}
9e1ceb13 52
53 Bool_t Drain(AliCDBEntry* entry);
54
b05400be 55 void UnsetDrain(){fDrainStorage = 0x0;}
9e1ceb13 56
57 void DestroyActiveStorages();
58 void DestroyActiveStorage(AliCDBStorage* storage);
59
60 static void Destroy();
61 ~AliCDBManager();
62
b05400be 63 static AliCDBManager* Instance();
9e1ceb13 64
65 private:
66
67 AliCDBManager();
fdf65bb5 68 static AliCDBManager* fgInstance; // AliCDBManager instance
9e1ceb13 69
70 AliCDBStorage* GetActiveStorage(const AliCDBParam* param);
71 void PutActiveStorage(AliCDBParam* param, AliCDBStorage* storage);
72
73 void Init();
74
b05400be 75 TList fFactories; //! list of registered storage factories
76 TMap fActiveStorages; //! list of active storages
77 AliCDBStorage *fDefaultStorage; //! pointer to default storage
78 AliCDBStorage *fDrainStorage; //! pointer to drain storage
9e1ceb13 79
80 ClassDef(AliCDBManager, 0);
81};
82
83
84/////////////////////////////////////////////////////////////////////
85// //
86// class AliCDBStorageFactory //
87// //
88/////////////////////////////////////////////////////////////////////
89
90class AliCDBParam;
91class AliCDBStorageFactory: public TObject {
92 friend class AliCDBManager;
93
94public:
95 virtual Bool_t Validate(const char* dbString) = 0;
b05400be 96 virtual AliCDBParam* CreateParameter(const char* dbString) = 0;
9e1ceb13 97
98protected:
99 virtual AliCDBStorage* Create(const AliCDBParam* param) = 0;
100
101 ClassDef(AliCDBStorageFactory, 0);
102};
103
104/////////////////////////////////////////////////////////////////////
105// //
106// class AliCDBParam //
107// //
108/////////////////////////////////////////////////////////////////////
109
110class AliCDBParam: public TObject {
111
112public:
113
114 AliCDBParam();
115 virtual ~AliCDBParam();
116
117 const TString& GetType() const {return fType;};
118 const TString& GetURI() const {return fURI;};
119
120 virtual AliCDBParam* CloneParam() const = 0;
121
122protected:
123
124 void SetType(const char* type) {fType = type;};
125 void SetURI(const char* uri) {fURI = uri;};
126
127private:
128
b05400be 129 TString fType; // CDB type
130 TString fURI; // CDB URI
9e1ceb13 131
132 ClassDef(AliCDBParam, 0);
133};
134
135#endif