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>
27 class AliCDBStorage: public TObject {
33 void SetURI(const TString& uri) {fURI = uri;}
34 const TString& GetURI() const {return fURI;}
35 const TString& GetType() const {return fType;}
36 const TString& GetBaseFolder() const {return fBaseFolder;}
37 AliCDBManager::DataType GetDataType() const;
40 void ReadSelectionFromFile(const char *fileName);
42 void AddSelection(const AliCDBId& selection);
44 void AddSelection(const AliCDBPath& path,
45 const AliCDBRunRange& runRange,
47 Int_t subVersion = -1);
49 void AddSelection(const AliCDBPath& path,
53 Int_t subVersion = -1);
55 void RemoveSelection(const AliCDBId& selection);
57 void RemoveSelection(const AliCDBPath& path,
58 const AliCDBRunRange& runRange);
60 void RemoveSelection(const AliCDBPath& path,
64 void RemoveSelection(int position);
65 void RemoveAllSelections();
67 void PrintSelectionList();
69 AliCDBEntry* Get(const AliCDBId& query);
70 AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber,
71 Int_t version = -1, Int_t subVersion = -1);
72 AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
73 Int_t version = -1, Int_t subVersion = -1);
75 TList* GetAll(const AliCDBId& query);
76 TList* GetAll(const AliCDBPath& path, Int_t runNumber,
77 Int_t version = -1, Int_t subVersion = -1);
78 TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
79 Int_t version = -1, Int_t subVersion = -1);
81 AliCDBId* GetId(const AliCDBId& query);
82 AliCDBId* GetId(const AliCDBPath& path, Int_t runNumber,
83 Int_t version = -1, Int_t subVersion = -1);
84 AliCDBId* GetId(const AliCDBPath& path, const AliCDBRunRange& runRange,
85 Int_t version = -1, Int_t subVersion = -1);
87 Bool_t Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData,
88 AliCDBManager::DataType type=AliCDBManager::kPrivate);
89 Bool_t Put(AliCDBEntry* entry, AliCDBManager::DataType type=AliCDBManager::kPrivate);
91 virtual Bool_t IsReadOnly() const = 0;
92 virtual Bool_t HasSubVersion() const = 0;
93 virtual Bool_t Contains(const char* path) const = 0;
94 virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const = 0;
96 void QueryCDB(Int_t run, const char* pathFilter="*",
97 Int_t version=-1, AliCDBMetaData *mdFilter=0);
99 TObjArray* GetQueryCDBList() {return &fValidFileIds;}
101 virtual Int_t GetLatestVersion(const char* path, Int_t run)=0;
102 virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version=-1)=0;
106 virtual ~AliCDBStorage();
107 void GetSelection(/*const*/ AliCDBId* id);
108 virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
109 virtual AliCDBId* GetEntryId(const AliCDBId& query) = 0;
110 virtual TList* GetEntries(const AliCDBId& query) = 0;
111 virtual Bool_t PutEntry(AliCDBEntry* entry) = 0;
112 virtual TList *GetIdListFromFile(const char* fileName)=0;
113 virtual void QueryValidFiles() = 0;
114 void LoadTreeFromFile(AliCDBEntry* entry) const;
115 //void SetTreeToFile(AliCDBEntry* entry, TFile* file) const;
117 TObjArray fValidFileIds; // list of Id's of the files valid for a given run (cached as fRun)
118 Int_t fRun; // run number, used to manage list of valid files
119 AliCDBPath fPathFilter; // path filter, used to manage list of valid files
120 Int_t fVersion; // version, used to manage list of valid files
121 AliCDBMetaData* fMetaDataFilter; // metadata, used to manage list of valid files
123 TList fSelections; // list of selection criteria
124 TString fURI; // storage URI;
125 TString fType; //! Local, Grid: base folder name - Dump: file name
126 TString fBaseFolder; //! Local, Grid: base folder name - Dump: file name
129 AliCDBStorage(const AliCDBStorage & source);
130 AliCDBStorage & operator=(const AliCDBStorage & source);
132 ClassDef(AliCDBStorage, 0);