if (factory->Validate(dbString)) {
return kTRUE;
- }
+ }
}
return kFALSE;
AliError("Please activate a default storage first!");
return;
}
-
+
AliCDBPath aPath(calibType);
if(!aPath.IsValid()){
AliError(Form("Not a valid path: %s", calibType));
if(fSpecificStorages.Contains(objCalibType)){
AliWarning(Form("Storage \"%s\" already activated! It will be replaced by the new one",
calibType));
+ AliCDBParam *checkPar = dynamic_cast<AliCDBParam*> (fSpecificStorages.GetValue(calibType));
+ if(checkPar) delete checkPar;
delete fSpecificStorages.Remove(objCalibType);
}
GetStorage(param);
AliCDBStorage* AliCDBManager::GetSpecificStorage(const char* calibType) {
// get storage specific for detector or calibration type
- AliCDBParam *checkPar = (AliCDBParam*) fSpecificStorages.GetValue(calibType);
+ AliCDBPath calibPath(calibType);
+ if(!calibPath.IsValid()) return NULL;
+
+ AliCDBParam *checkPar = (AliCDBParam*) fSpecificStorages.GetValue(calibPath.GetPath());
if(!checkPar){
AliError(Form("%s storage not found!", calibType));
return NULL;
// select storage valid for path from the list of specific storages
AliCDBPath aPath(path);
- if(!aPath.IsValid()){
- AliError(Form("Not a valid path: %s", path.Data()));
- return NULL;
- }
+ if(!aPath.IsValid()) return NULL;
TIter iter(&fSpecificStorages);
TObjString *aCalibType=0;
AliCDBId id = entry->GetId();
AliCDBParam *aPar = SelectSpecificStorage(id.GetPath());
- AliCDBStorage *aStorage;
+ AliCDBStorage *aStorage=0;
if(aPar) {
aStorage=GetStorage(aPar);
AliDebug(2,Form("Storing object into storage: %s", aStorage->GetURI().Data()));
- return aStorage->Put(entry, type);
+ Bool_t result = aStorage->Put(entry, type);
+
+ if(fRun >= 0) QueryCDB();
+
+ return result;
}
}
+//_____________________________________________________________________________
+void AliCDBManager::UnloadFromCache(const char* path){
+// unload cached object
+
+ AliCDBPath queryPath(path);
+ if(!queryPath.IsValid()) return;
+
+ if(!queryPath.IsWildcard()) { // path is not wildcard, get it directly from the cache and unload it!
+ if(fEntryCache.Contains(path)){
+ AliInfo(Form("Unloading object \"%s\" from cache", path));
+ TObjString pathStr(path);
+ AliCDBEntry *entry = dynamic_cast<AliCDBEntry*> (fEntryCache.GetValue(&pathStr));
+ if(entry) delete entry;
+ delete fEntryCache.Remove(&pathStr);
+ } else {
+ AliError(Form("Cache does not contain object \"%s\"!", path))
+ }
+ AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries()));
+ return;
+ }
+
+ // path is wildcard: loop on the cache and unload all comprised objects!
+ TIter iter(fEntryCache.GetTable());
+ TPair* pair = 0;
+
+ while((pair = dynamic_cast<TPair*> (iter.Next()))){
+ AliCDBPath entryPath = pair->Key()->GetName();
+ if(queryPath.Comprises(entryPath)) {
+ AliInfo(Form("Unloading object \"%s\" from cache", entryPath.GetPath().Data()));
+ TObjString pathStr(entryPath.GetPath().Data());
+ AliCDBEntry *entry = dynamic_cast<AliCDBEntry*> (fEntryCache.GetValue(&pathStr));
+ if(entry) delete entry;
+ delete fEntryCache.Remove(&pathStr);
+ }
+ }
+ AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries()));
+}
+
//_____________________________________________________________________________
void AliCDBManager::DestroyActiveStorages() {
// delete list of active storages