if(fSpecificStorages.Contains(objCalibType)){
AliWarning(Form("Storage \"%s\" already activated! It will be replaced by the new one",
calibType));
- fSpecificStorages.Remove(objCalibType);
+ delete fSpecificStorages.Remove(objCalibType);
}
GetStorage(param);
fSpecificStorages.Add(objCalibType, param->CloneParam());
if(fCache && query.GetFirstRun() != fRun)
AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
-
+
AliCDBEntry *entry=0;
-
+
// first look into map of cached objects
if(fCache && query.GetFirstRun() == fRun)
entry = (AliCDBEntry*) fEntryCache.GetValue(query.GetPath());
AliDebug(2,Form("Caching entry %s !",query.GetPath().Data()));
CacheEntry(query.GetPath(), entry);
}
-
+
return entry;
}
}
//_____________________________________________________________________________
-TList* AliCDBManager::GetAll(const AliCDBPath& path,
+TList* AliCDBManager::GetAll(const AliCDBPath& path,
const AliCDBRunRange& runRange, Int_t version, Int_t subVersion) {
// get multiple AliCDBEntry objects from the database
// get multiple AliCDBEntry objects from the database
// Warning: this method works correctly only for queries of the type "Detector/*"
// and not for more specific queries e.g. "Detector/Calib/*" !
+// Warning #2: Entries are cached, but GetAll will keep on retrieving objects from OCDB!
+// To get an object from cache use Get() function
if(!fDefaultStorage) {
AliError("No storage set!");
if((fSpecificStorages.GetEntries()>0) && query.GetPath().BeginsWith('*')){
// if specific storages are active a query with "*" is ambiguous
AliError("Query too generic in this context!");
- return NULL;
+ return NULL;
}
if (query.IsAnyRange()) {
AliError(Form("Unspecified run or runrange: %s",
- query.ToString().Data()));
+ query.ToString().Data()));
return NULL;
- }
-
+ }
+
TObjString objStrLev0(query.GetLevel0());
//AliCDBParam *aPar = (AliCDBParam*) fSpecificStorages.GetValue(&objStrLev0);
AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
- AliCDBStorage *aStorage;
+ AliCDBStorage *aStorage;
if(aPar) {
aStorage=GetStorage(aPar);
TString str = aPar->GetURI();
AliDebug(2,Form("Looking into storage: %s",str.Data()));
-
+
} else {
aStorage=GetDefaultStorage();
- AliDebug(2,"Looking into default storage");
+ AliDebug(2,"Looking into default storage");
}
TList *result = aStorage->GetAll(query);
+ if(!result) return 0;
+
+ // caching entries
+ if(fCache && (query.GetFirstRun() == fRun)){
- return result;
+ TIter iter(result);
+ AliCDBEntry* entry=0;
+ while((entry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
+ const AliCDBId& anId = entry->GetId();
+ AliDebug(2,Form("Caching entry %s !", anId.GetPath().Data()));
+ CacheEntry(anId.GetPath(), entry);
+ }
+ }
+
+ return result;
}
//_____________________________________________________________________________