1 #ifndef ALI_CDB_STORAGE_H
2 #define ALI_CDB_STORAGE_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 /////////////////////////////////////////////////////////////////////
9 // class AliCDBStorage //
10 // interface to specific storage classes //
11 // (AliCDBGrid, AliCDBLocal, AliCDBDump) //
13 /////////////////////////////////////////////////////////////////////
16 #include "AliCDBMetaData.h"
17 #include "AliCDBManager.h"
20 #include <TObjArray.h>
26 class AliCDBStorage: public TObject {
32 void SetURI(const TString& uri) {fURI = uri;}
33 const TString& GetURI() const {return fURI;}
34 const TString& GetType() const {return fType;}
35 const TString& GetBaseFolder() const {return fBaseFolder;}
36 AliCDBManager::DataType GetDataType() const;
39 void ReadSelectionFromFile(const char *fileName);
41 void AddSelection(const AliCDBId& selection);
43 void AddSelection(const AliCDBPath& path,
44 const AliCDBRunRange& runRange,
46 Int_t subVersion = -1);
48 void AddSelection(const AliCDBPath& path,
52 Int_t subVersion = -1);
54 void RemoveSelection(const AliCDBId& selection);
56 void RemoveSelection(const AliCDBPath& path,
57 const AliCDBRunRange& runRange);
59 void RemoveSelection(const AliCDBPath& path,
63 void RemoveSelection(int position);
64 void RemoveAllSelections();
66 void PrintSelectionList();
68 AliCDBEntry* Get(const AliCDBId& query);
69 AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber,
70 Int_t version = -1, Int_t subVersion = -1);
71 AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
72 Int_t version = -1, Int_t subVersion = -1);
74 TList* GetAll(const AliCDBId& query);
75 TList* GetAll(const AliCDBPath& path, Int_t runNumber,
76 Int_t version = -1, Int_t subVersion = -1);
77 TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
78 Int_t version = -1, Int_t subVersion = -1);
80 Bool_t Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData,
81 AliCDBManager::DataType type=AliCDBManager::kPrivate);
82 Bool_t Put(AliCDBEntry* entry, AliCDBManager::DataType type=AliCDBManager::kPrivate);
84 virtual Bool_t IsReadOnly() const = 0;
85 virtual Bool_t HasSubVersion() const = 0;
86 virtual Bool_t Contains(const char* path) const = 0;
87 virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const = 0;
89 void QueryCDB(Int_t run, const char* pathFilter="*",
90 Int_t version=-1, AliCDBMetaData *mdFilter=0);
92 TObjArray* GetQueryCDBList() {return &fValidFileIds;}
94 virtual Int_t GetLatestVersion(const char* path, Int_t run)=0;
95 virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1)=0;
99 virtual ~AliCDBStorage();
100 void GetSelection(/*const*/ AliCDBId* id);
101 virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
102 virtual TList* GetEntries(const AliCDBId& query) = 0;
103 virtual Bool_t PutEntry(AliCDBEntry* entry) = 0;
104 virtual TList *GetIdListFromFile(const char* fileName)=0;
105 virtual void QueryValidFiles() = 0;
107 TObjArray fValidFileIds; // list of Id's of the files valid for a given run (cached as fRun)
108 Int_t fRun; // run number, used to manage list of valid files
109 AliCDBPath fPathFilter; // path filter, used to manage list of valid files
110 Int_t fVersion; // version, used to manage list of valid files
111 AliCDBMetaData* fMetaDataFilter; // metadata, used to manage list of valid files
113 TList fSelections; // list of selection criteria
114 TString fURI; // storage URI;
115 TString fType; //! Local, Grid: base folder name - Dump: file name
116 TString fBaseFolder; //! Local, Grid: base folder name - Dump: file name
119 AliCDBStorage(const AliCDBStorage & source);
120 AliCDBStorage & operator=(const AliCDBStorage & source);
122 ClassDef(AliCDBStorage, 0);