]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/CDB/AliCDBGrid.h
fix for coverity 20846
[u/mrichter/AliRoot.git] / STEER / CDB / 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         virtual void SetRetry(Int_t nretry, Int_t initsec);
30         virtual void SetMirrorSEs(const char* mirrors) {fMirrorSEs=mirrors;}
31         virtual const char* GetMirrorSEs() const {return fMirrorSEs;}
32
33
34 protected:
35
36         virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
37         virtual AliCDBId*       GetEntryId(const AliCDBId& queryId);
38         virtual TList*          GetEntries(const AliCDBId& queryId);
39         virtual Bool_t          PutEntry(AliCDBEntry* entry, const char* mirrors="");
40         virtual TList*          GetIdListFromFile(const char* fileName);
41
42 private:
43
44         AliCDBGrid(const char *gridUrl, const char *user, const char* dbFolder,
45                    const char *se, const char* cacheFolder, Bool_t operateDisconnected,
46                    Long64_t cacheSize, Long_t cleanupInterval);
47
48         virtual ~AliCDBGrid();
49
50         AliCDBGrid(const AliCDBGrid& db);
51         AliCDBGrid& operator = (const AliCDBGrid& db);
52
53         Bool_t FilenameToId(TString& filename, AliCDBId& id);
54
55         Bool_t PrepareId(AliCDBId& id);
56         AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
57         AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
58
59         // TODO  use AliEnTag classes!
60         Bool_t AddTag(TString& foldername, const char* tagname);
61         Bool_t TagFileId(TString& filename, const AliCDBId* id);
62         Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
63         Bool_t TagShortLived(TString& filename, Bool_t value);
64
65         void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
66
67         virtual void QueryValidFiles();
68
69         TString    fGridUrl;     // Grid Url ("alien://aliendb4.cern.ch:9000")
70         TString    fUser;        // User
71         TString    fDBFolder;    // path of the DB folder
72         TString    fSE;          // Storage Element
73         TString    fMirrorSEs;   // Mirror Storage Elements
74         TString    fCacheFolder; // local cache folder
75         Bool_t     fOperateDisconnected; // Operate disconnected flag
76         Long64_t   fCacheSize;           // local cache size (in bytes)
77         Long_t     fCleanupInterval;     // local cache cleanup interval
78
79 ClassDef(AliCDBGrid, 0)      // access class to a DataBase in an AliEn storage
80 };
81
82 /////////////////////////////////////////////////////////////////////
83 //                                                                 //
84 //  class AliCDBGridFactory                                        //
85 //                                                                 //
86 /////////////////////////////////////////////////////////////////////
87
88 class AliCDBGridFactory: public AliCDBStorageFactory {
89
90 public:
91
92         virtual Bool_t Validate(const char* gridString);
93         virtual AliCDBParam* CreateParameter(const char* gridString);
94         virtual ~AliCDBGridFactory(){}
95
96 protected:
97         virtual AliCDBStorage* Create(const AliCDBParam* param);
98
99         ClassDef(AliCDBGridFactory, 0);
100 };
101
102 /////////////////////////////////////////////////////////////////////
103 //                                                                 //
104 //  class AliCDBGridParam                                          //
105 //                                                                 //
106 /////////////////////////////////////////////////////////////////////
107
108 class AliCDBGridParam: public AliCDBParam {
109         
110 public:
111         AliCDBGridParam();
112         AliCDBGridParam(const char* gridUrl, const char* user,
113                         const char* dbFolder, const char* se,
114                         const char* cacheFolder, Bool_t operateDisconnected,
115                         Long64_t cacheSize, Long_t cleanupInterval);
116         
117         virtual ~AliCDBGridParam();
118
119         const TString& GridUrl() const {return fGridUrl;}
120         const TString& GetUser() const {return fUser;}
121         const TString& GetDBFolder() const {return fDBFolder;}
122         const TString& GetSE()   const {return fSE;}
123         const TString& GetCacheFolder() const {return fCacheFolder;}
124         Bool_t  GetOperateDisconnected() const {return fOperateDisconnected;}
125         Long64_t  GetCacheSize() const {return fCacheSize;}
126         Long_t  GetCleanupInterval() const {return fCleanupInterval;}
127
128         virtual AliCDBParam* CloneParam() const;
129
130         virtual ULong_t Hash() const;
131         virtual Bool_t IsEqual(const TObject* obj) const;
132
133 private:
134         TString  fGridUrl;     // Grid url "Host:port"
135         TString  fUser;       // User
136         TString  fDBFolder;    // path of the DB folder
137         TString  fSE;         // Storage Element
138         TString  fCacheFolder; // Cache folder
139         Bool_t   fOperateDisconnected; // Operate disconnected flag
140         Long64_t fCacheSize;           // local cache size (in bytes)
141         Long_t   fCleanupInterval;     // local cache cleanup interval
142
143         ClassDef(AliCDBGridParam, 0);
144 };
145
146
147 #endif