-#ifndef ALICDBSTORAGE_H
-#define ALICDBSTORAGE_H
+#ifndef ALI_CDB_STORAGE_H
+#define ALI_CDB_STORAGE_H
+
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-/* $Id$ */
-
-///
-/// base class for data base access classes
-///
+/////////////////////////////////////////////////////////////////////
+// //
+// class AliCDBStorage //
+// interface to specific storage classes //
+// (AliCDBGrid, AliCDBLocal, AliCDBDump) //
+// //
+/////////////////////////////////////////////////////////////////////
-#include <TObject.h>
-#include <TObjArray.h>
-#include "AliCDBMetaDataSelect.h"
+#include "AliCDBId.h"
#include "AliCDBMetaData.h"
+#include <TList.h>
-class TFile;
-class AliCDBMetaDataSelect;
-class AliCDBMetaData;
class AliCDBEntry;
class AliCDBStorage: public TObject {
-public:
-
-typedef enum {kDevelopment, kProduction} StorageMode_t;
-
- virtual ~AliCDBStorage();
-
- const TObject* Get(const char* name, Int_t runNumber); // Gets an object from the database
-
- Bool_t Put(const TObject* object,
- const AliCDBMetaData& metaData); // Put an object into the database
-
- void Select(const AliCDBMetaDataSelect& selMetaData); // Add a selection criterion
- Bool_t DumpToFile(const char* fileName = "DB.root"); // prepares to dump the retrieved entries to a local file
-
- const AliCDBMetaData& GetCDBMetaData(const char* name); // Gets the CDBMetaData of the retrieved entry (name=entry's name)
-
- virtual void TagForProduction(const AliCDBMetaDataSelect& selMetaData, UInt_t prodVers) = 0;
-
- static AliCDBStorage* Instance(); // Instance of the current AliCDBStorage object (AliCDBDump, AliCDBLocalFile etc...)
-
- void SetStorageMode(StorageMode_t mode) {fStorageMode = mode;}
- StorageMode_t GetStorageMode() {return fStorageMode;}
-
+public:
+ AliCDBStorage();
+ virtual ~AliCDBStorage();
+
+
+ void AddSelection(const AliCDBId& selection);
+
+ void AddSelection(const AliCDBPath& path,
+ const AliCDBRunRange& runRange,
+ Int_t version,
+ Int_t subVersion = -1);
+
+ void AddSelection(const AliCDBPath& path,
+ Int_t firstRun,
+ Int_t lastRun,
+ Int_t version,
+ Int_t subVersion = -1);
+
+ void RemoveSelection(const AliCDBId& selection);
+
+ void RemoveSelection(const AliCDBPath& path,
+ const AliCDBRunRange& runRange);
+
+ void RemoveSelection(const AliCDBPath& path,
+ Int_t firstRun = -1,
+ Int_t lastRun = -1);
+
+ void RemoveSelection(int position);
+ void RemoveAllSelections();
+
+ AliCDBEntry* Get(const AliCDBId& query);
+ AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber,
+ Int_t version = -1, Int_t subVersion = -1);
+ AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
+ Int_t version = -1, Int_t subVersion = -1);
+
+ TList* GetAll(const AliCDBId& query);
+ TList* GetAll(const AliCDBPath& path, Int_t runNumber,
+ Int_t version = -1, Int_t subVersion = -1);
+ TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
+ Int_t version = -1, Int_t subVersion = -1);
+
+ void PrintSelectionList();
+
+
+ Bool_t Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData);
+ Bool_t Put(AliCDBEntry* entry);
+
+
+ virtual Bool_t IsReadOnly() const = 0;
+ virtual Bool_t HasSubVersion() const = 0;
protected:
- AliCDBStorage();
-
- virtual AliCDBEntry* GetEntry(AliCDBMetaDataSelect& selMetaData, Int_t runNumber) = 0; // virtual, see the correspondent method of the derived classes
-
- virtual Bool_t PutEntry(AliCDBEntry* entry); // virtual, see the correspondent method of the derived classes
-
- AliCDBEntry* GetCurrentEntry(const char* name) const
- {return (AliCDBEntry*) fEntries.FindObject(name);}
-
- StorageMode_t fStorageMode;
+
+ AliCDBId GetSelection(const AliCDBId& id);
+ virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
+ virtual TList* GetEntries(const AliCDBId& query) = 0;
+ virtual Bool_t PutEntry(AliCDBEntry* entry) = 0;
private:
- AliCDBStorage(const AliCDBStorage& db);
- AliCDBStorage& operator = (const AliCDBStorage& db);
-
- TObjArray fSelection; //! meta data selection
-
- TObjArray fEntries; //! array of current AliCDBEntry objects
- TFile* fDumpFile; //! file for dumped entries
- static AliCDBStorage* fgInstance; //! pointer to the DB instance
+ TList fSelections; // list of selection criteria
- ClassDef(AliCDBStorage, 0) // base class for data base access classes
+ ClassDef(AliCDBStorage, 0);
};
#endif