]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBGrid.h
New version of CDB storage framework (A.Colla)
[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
17 class AliCDBGrid: public AliCDBStorage {
18         friend class AliCDBGridFactory;
19
20 public:
21                   
22         virtual Bool_t IsReadOnly() {return kFALSE;};
23         virtual Bool_t HasSubVersion() {return kFALSE;};
24   
25 protected:
26
27         virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
28         virtual TList*          GetEntries(const AliCDBId& queryId);
29         virtual Bool_t          PutEntry(AliCDBEntry* entry);
30
31 private:
32  
33         AliCDBGrid(const char *host="aliendb4.cern.ch", 
34                 const Int_t port = 9000, 
35                 const char *user="colla", 
36                 const char* dbPath = "/alice/cern.ch/user/c/colla/DB", 
37                 const char *SE="ALICE::CERN::Server");
38
39         virtual ~AliCDBGrid();
40
41         AliCDBGrid(const AliCDBGrid& db);
42         AliCDBGrid& operator = (const AliCDBGrid& db);
43
44         Bool_t FilenameToId(const char* filename, AliCDBRunRange& runRange, Int_t& version);
45         Bool_t IdToFilename(const AliCDBRunRange& runRange, Int_t version, TString& filename);
46
47         Bool_t PrepareId(AliCDBId& id);
48         AliCDBId GetId(const AliCDBId& query);
49
50
51         void GetEntriesForLevel0(const char* level0, const AliCDBId& query, TList* result);
52         void GetEntriesForLevel1(const char* level0, const char* level1, 
53                                  const AliCDBId& query, TList* result);
54
55         TString    fHost;       // Grid host
56         Int_t      fPort;       // port
57         TString    fUser;       // User
58         TString    fDBPath;     // path of the DB folder
59         TString    fSE;         // Storage Element 
60
61 ClassDef(AliCDBGrid, 0)      // access class to a DataBase in an AliEn storage 
62 };
63
64 /////////////////////////////////////////////////////////////////////
65 //                                                                 //
66 //  class AliCDBGridFactory                                        //
67 //                                                                 //
68 /////////////////////////////////////////////////////////////////////
69
70 class AliCDBGridFactory: public AliCDBStorageFactory {
71
72 public:
73
74         virtual Bool_t Validate(const char* gridString);
75         virtual AliCDBParam* CreateParameter(const char* gridString);
76
77 protected:
78         virtual AliCDBStorage* Create(const AliCDBParam* param);
79
80         ClassDef(AliCDBGridFactory, 0);
81 };
82
83 /////////////////////////////////////////////////////////////////////
84 //                                                                 //
85 //  class AliCDBGridParam                                          //
86 //                                                                 //
87 /////////////////////////////////////////////////////////////////////
88
89 class AliCDBGridParam: public AliCDBParam {
90         
91 public:
92         AliCDBGridParam();
93         AliCDBGridParam(const char* host, const Int_t port, const char* user, 
94                         const char* dbPath, const char* se);
95         
96         virtual ~AliCDBGridParam();
97
98         const TString& GetHost() const {return fHost;};
99         const Int_t&   GetPort() const {return fPort;};
100         const TString& GetUser() const {return fUser;};
101         const TString& GetPath() const {return fDBPath;};
102         const TString& GetSE()   const {return fSE;};
103
104         virtual AliCDBParam* CloneParam() const;
105
106         virtual ULong_t Hash() const;
107         virtual Bool_t IsEqual(const TObject* obj) const;
108
109 private:
110         TString fHost;       // Grid host
111         Int_t   fPort;       // port
112         TString fUser;       // User
113         TString fDBPath;     // path of the DB folder
114         TString fSE;         // Storage Element 
115
116         ClassDef(AliCDBGridParam, 0);
117 };
118
119
120 #endif