]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBLocal.h
Implementation of Grid CDB access using the Grid metadata tables.
[u/mrichter/AliRoot.git] / STEER / AliCDBLocal.h
1 #ifndef ALI_CDB_LOCAL_H
2 #define ALI_CDB_LOCAL_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 AliCDBLocal                                              //
10 //  access class to a DataBase in a local storage                  //
11 //                                                                 //
12 /////////////////////////////////////////////////////////////////////
13
14 #include "AliCDBStorage.h"
15 #include "AliCDBManager.h"
16
17 class AliCDBLocal: public AliCDBStorage {
18         friend class AliCDBLocalFactory;
19
20 public:
21
22         virtual Bool_t IsReadOnly() const {return kFALSE;};
23         virtual Bool_t HasSubVersion() const {return kTRUE;};
24         virtual Bool_t Contains(const char* path) const;
25
26 protected:
27
28         virtual AliCDBEntry* GetEntry(const AliCDBId& queryId);
29         virtual TList* GetEntries(const AliCDBId& queryId);
30         virtual Bool_t PutEntry(AliCDBEntry* entry);
31         virtual TList*          GetIdListFromFile(const char* fileName);
32
33 private:
34
35         AliCDBLocal(const char* baseDir);
36         virtual ~AliCDBLocal();
37         
38         Bool_t FilenameToId(const char* filename, AliCDBRunRange& runRange, 
39                         Int_t& version, Int_t& subVersion);
40         Bool_t IdToFilename(const AliCDBRunRange& runRange, Int_t version, 
41                         Int_t subVersion, TString& filename);
42
43         Bool_t PrepareId(AliCDBId& id);
44         Bool_t GetId(const AliCDBId& query, AliCDBId& result);
45
46         virtual void QueryValidFiles();
47
48         void GetEntriesForLevel0(const char* level0, const AliCDBId& query, TList* result);
49         void GetEntriesForLevel1(const char* level0, const char* Level1,
50                         const AliCDBId& query, TList* result);
51
52         TString fBaseDirectory; // path of the DB folder
53
54         ClassDef(AliCDBLocal, 0); // access class to a DataBase in a local storage
55 };
56
57 /////////////////////////////////////////////////////////////////////
58 //                                                                 //
59 //  class AliCDBLocalFactory                                       //
60 //                                                                 //
61 /////////////////////////////////////////////////////////////////////
62
63 class AliCDBLocalFactory: public AliCDBStorageFactory {
64
65 public:
66
67         virtual Bool_t Validate(const char* dbString);
68         virtual AliCDBParam* CreateParameter(const char* dbString);
69
70 protected:
71         virtual AliCDBStorage* Create(const AliCDBParam* param);
72
73         ClassDef(AliCDBLocalFactory, 0);
74 };
75
76 /////////////////////////////////////////////////////////////////////
77 //                                                                 //
78 //  class AliCDBLocalParam                                         //
79 //                                                                 //
80 /////////////////////////////////////////////////////////////////////
81
82 class AliCDBLocalParam: public AliCDBParam {
83         
84 public:
85         AliCDBLocalParam();
86         AliCDBLocalParam(const char* dbPath);
87         
88         virtual ~AliCDBLocalParam();
89
90         const TString& GetPath() const {return fDBPath;};
91
92         virtual AliCDBParam* CloneParam() const;
93
94         virtual ULong_t Hash() const;
95         virtual Bool_t IsEqual(const TObject* obj) const;
96
97 private:
98
99         TString fDBPath; // path of the DB folder
100
101         ClassDef(AliCDBLocalParam, 0);
102 };
103
104 #endif