]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBGrid.h
Implementation of the local caching of the OCDB set required some upgrade of the...
[u/mrichter/AliRoot.git] / STEER / AliCDBGrid.h
1 #ifndef ALICDBGRID_H
2 #define ALICDBGRID_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 AliCDBGrid                                               //
10 //  access class to a DataBase in an AliEn storage                 //
11 //                                                                 //
12 /////////////////////////////////////////////////////////////////////
13
14 #include "AliCDBStorage.h"
15 #include "AliCDBManager.h"
16 #include "AliCDBMetaData.h"
17
18 class AliCDBGrid: public AliCDBStorage {
19         friend class AliCDBGridFactory;
20
21 public:
22                   
23         virtual Bool_t IsReadOnly() const {return kFALSE;}
24         virtual Bool_t HasSubVersion() const {return kFALSE;}
25         virtual Bool_t Contains(const char* path) const;
26         virtual Int_t  GetLatestVersion(const char* path, Int_t run);
27         virtual Int_t  GetLatestSubVersion(const char* path, Int_t run, Int_t version);
28         virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const;
29
30 protected:
31
32         virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
33         virtual AliCDBId*       GetEntryId(const AliCDBId& queryId);
34         virtual TList*          GetEntries(const AliCDBId& queryId);
35         virtual Bool_t          PutEntry(AliCDBEntry* entry);
36         virtual TList*          GetIdListFromFile(const char* fileName);
37
38 private:
39  
40         AliCDBGrid(const char *gridUrl, const char *user, const char* dbFolder, const char *se);
41
42         virtual ~AliCDBGrid();
43
44         AliCDBGrid(const AliCDBGrid& db);
45         AliCDBGrid& operator = (const AliCDBGrid& db);
46
47         Bool_t FilenameToId(TString& filename, AliCDBId& id);
48
49         Bool_t PrepareId(AliCDBId& id);
50         AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
51         AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
52
53         // TODO  use AliEnTag classes!
54         Bool_t AddTag(TString& foldername, const char* tagname);
55         Bool_t TagFileId(TString& filename, const AliCDBId* id);
56         Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
57         Bool_t TagShortLived(TString& filename, Bool_t value);
58
59         void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
60
61         virtual void QueryValidFiles();
62
63         TString    fGridUrl;    // Grid Url ("alien://aliendb4.cern.ch:9000")
64         TString    fUser;       // User
65         TString    fDBFolder;   // path of the DB folder
66         TString    fSE;         // Storage Element
67
68 ClassDef(AliCDBGrid, 0)      // access class to a DataBase in an AliEn storage
69 };
70
71 /////////////////////////////////////////////////////////////////////
72 //                                                                 //
73 //  class AliCDBGridFactory                                        //
74 //                                                                 //
75 /////////////////////////////////////////////////////////////////////
76
77 class AliCDBGridFactory: public AliCDBStorageFactory {
78
79 public:
80
81         virtual Bool_t Validate(const char* gridString);
82         virtual AliCDBParam* CreateParameter(const char* gridString);
83         virtual ~AliCDBGridFactory(){}
84
85 protected:
86         virtual AliCDBStorage* Create(const AliCDBParam* param);
87
88         ClassDef(AliCDBGridFactory, 0);
89 };
90
91 /////////////////////////////////////////////////////////////////////
92 //                                                                 //
93 //  class AliCDBGridParam                                          //
94 //                                                                 //
95 /////////////////////////////////////////////////////////////////////
96
97 class AliCDBGridParam: public AliCDBParam {
98         
99 public:
100         AliCDBGridParam();
101         AliCDBGridParam(const char* gridUrl, const char* user,
102                         const char* dbFolder, const char* se);
103         
104         virtual ~AliCDBGridParam();
105
106         const TString& GridUrl() const {return fGridUrl;};
107         const TString& GetUser() const {return fUser;};
108         const TString& GetDBFolder() const {return fDBFolder;};
109         const TString& GetSE()   const {return fSE;};
110
111         virtual AliCDBParam* CloneParam() const;
112
113         virtual ULong_t Hash() const;
114         virtual Bool_t IsEqual(const TObject* obj) const;
115
116 private:
117         TString fGridUrl;    // Grid url "Host:port"
118         TString fUser;       // User
119         TString fDBFolder;   // path of the DB folder
120         TString fSE;         // Storage Element
121
122         ClassDef(AliCDBGridParam, 0);
123 };
124
125
126 #endif