]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBGrid.h
Implementation of Grid CDB access using the Grid metadata tables.
[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   
27 protected:
28
29         virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
30         virtual TList*          GetEntries(const AliCDBId& queryId);
31         virtual Bool_t          PutEntry(AliCDBEntry* entry);
32         virtual TList*          GetIdListFromFile(const char* fileName);
33
34 private:
35  
36         AliCDBGrid(const char *gridUrl, const char *user, const char* dbFolder, const char *se);
37
38         virtual ~AliCDBGrid();
39
40         AliCDBGrid(const AliCDBGrid& db);
41         AliCDBGrid& operator = (const AliCDBGrid& db);
42
43         Bool_t FilenameToId(TString& filename, AliCDBId& id);
44         Bool_t IdToFilename(const AliCDBId& id, TString& filename);
45
46         Bool_t PrepareId(AliCDBId& id);
47         AliCDBId* GetId(const TList& validFileIds, const AliCDBId& query);
48         AliCDBEntry* GetEntryFromFile(TString& filename, const AliCDBId* dataId);
49
50         Bool_t AddTag(TString& foldername, const char* tagname);
51         void TagFileId(TString& filename, const AliCDBId* id);
52         void TagFileMetaData(TString& filename, const AliCDBMetaData* md);
53
54 //      Bool_t CheckVersion(const AliCDBId& query, AliCDBId* idToCheck, AliCDBId* result);
55
56         void MakeQueryFilter(Long64_t firstRun, Long64_t lastRun, const AliCDBPath& pathFilter, Int_t version,
57                                 const AliCDBMetaData* md, TString& result) const;
58
59         virtual void QueryValidFiles();
60
61         TString    fGridUrl;    // Grid Url ("alien://aliendb4.cern.ch:9000")
62         TString    fUser;       // User
63         TString    fDBFolder;   // path of the DB folder
64         TString    fSE;         // Storage Element
65
66 ClassDef(AliCDBGrid, 0)      // access class to a DataBase in an AliEn storage 
67 };
68
69 /////////////////////////////////////////////////////////////////////
70 //                                                                 //
71 //  class AliCDBGridFactory                                        //
72 //                                                                 //
73 /////////////////////////////////////////////////////////////////////
74
75 class AliCDBGridFactory: public AliCDBStorageFactory {
76
77 public:
78
79         virtual Bool_t Validate(const char* gridString);
80         virtual AliCDBParam* CreateParameter(const char* gridString);
81
82 protected:
83         virtual AliCDBStorage* Create(const AliCDBParam* param);
84
85         ClassDef(AliCDBGridFactory, 0);
86 };
87
88 /////////////////////////////////////////////////////////////////////
89 //                                                                 //
90 //  class AliCDBGridParam                                          //
91 //                                                                 //
92 /////////////////////////////////////////////////////////////////////
93
94 class AliCDBGridParam: public AliCDBParam {
95         
96 public:
97         AliCDBGridParam();
98         AliCDBGridParam(const char* gridUrl, const char* user,
99                         const char* dbFolder, const char* se);
100         
101         virtual ~AliCDBGridParam();
102
103         const TString& GridUrl() const {return fGridUrl;};
104         const TString& GetUser() const {return fUser;};
105         const TString& GetDBFolder() const {return fDBFolder;};
106         const TString& GetSE()   const {return fSE;};
107
108         virtual AliCDBParam* CloneParam() const;
109
110         virtual ULong_t Hash() const;
111         virtual Bool_t IsEqual(const TObject* obj) const;
112
113 private:
114         TString fGridUrl;    // Grid url "Host:port"
115         TString fUser;       // User
116         TString fDBFolder;   // path of the DB folder
117         TString fSE;         // Storage Element 
118
119         ClassDef(AliCDBGridParam, 0);
120 };
121
122
123 #endif