#include "AliCDBLocal.h"
#include "AliCDBGrid.h"
#include "AliCDBEntry.h"
-#include "AliCDBMetaData.h"
#include "AliCDBHandler.h"
#include <TObjString.h>
-#include <TSystem.h>
#include <TSAXParser.h>
#include <TFile.h>
#include <TUUID.h>
+#include <TGrid.h>
ClassImp(AliCDBParam)
void AliCDBManager::SetDefaultStorage(const char* dbString) {
// sets default storage from URI string
- AliInfo(Form("Setting Default storage to: %s",dbString));
-
// checking whether we are in the raw case
TString dbStringTemp(dbString);
- if (dbStringTemp == "raw://") fRaw = kTRUE;
+ if (dbStringTemp == "raw://")
+ {
+ fRaw = kTRUE;
+ AliInfo("Setting the run-number will set the corresponding OCDB for raw data reconstruction.");
+ AliInfo("Connecting to the grid...");
+ if(!gGrid) {
+ TGrid::Connect("alien://","");
+ if(!gGrid) {
+ AliError("Connection to alien failed!");
+ return;
+ }
+ }
+ return;
+ }
AliCDBStorage* bckStorage = fDefaultStorage;
}
// retrieve XML file from alien
+ if(!gGrid) {
+ TGrid::Connect("alien://","");
+ if(!gGrid) {
+ AliError("Connection to alien failed!");
+ return;
+ }
+ }
TUUID uuid;
TString rndname = "/tmp/";
rndname += "OCDBFolderXML.";
AliWarning("Clearing cache!");
ClearCache();
}
+
+ fRun = fStartRunLHCPeriod = fEndRunLHCPeriod = -1;
+ fRaw = kFALSE;
fDefaultStorage = 0x0;
}
// calibType must be a valid CDB path! (3 level folder structure)
- if(!fDefaultStorage) {
+ if(!fDefaultStorage && !fRaw) {
AliError("Please activate a default storage first!");
return;
}
return NULL;
}
- if(fLock && query.GetFirstRun() != fRun)
+ if(fLock && !(fRun >= query.GetFirstRun() && fRun <= query.GetLastRun()))
AliFatal("Lock is ON: cannot use different run number than the internal one!");
- if(fCache && query.GetFirstRun() != fRun)
+ if(fCache && !(fRun >= query.GetFirstRun() && fRun <= query.GetLastRun()))
AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
AliCDBEntry *entry=0;
}
//_____________________________________________________________________________
-Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, DataType type){
+Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, const DataType type){
// store an AliCDBEntry object into the database
if (object==0x0) {
return kFALSE;
}
- if (entry->GetObject()==0x0){
- AliError("No valid object in CDB entry!");
+ if (!entry){
+ AliError("No entry!");
return kFALSE;
}
- if (!entry){
- AliError("No entry!");
+ if (entry->GetObject()==0x0){
+ AliError("No valid object in CDB entry!");
return kFALSE;
}
// Sets current run number.
// When the run number changes the caching is cleared.
- if (fRun == run)
+ if(fRun == run)
return;
if(fLock && fRun >= 0) {
}
fRun = run;
- if (fRaw){
+ if(fRaw){
// here the LHCPeriod xml file is parsed; the string containing the correct period is returned; the default storage is set
if (fStartRunLHCPeriod <= run && fEndRunLHCPeriod >= run){
AliInfo("LHCPeriod alien folder for current run already in memory");
- }
- else {
+ }else{
SetDefaultStorageFromRun(run);
+ if(fEntryCache.GetEntries()!=0) ClearCache();
+ return;
}
}
ClearCache();
void AliCDBManager::UnloadFromCache(const char* path){
// unload cached object
+ if(!fActiveStorages.GetEntries()) {
+ AliDebug(2, Form("No active storages. Object \"%s\" is not unloaded from cache", path));
+ return;
+ }
+
AliCDBPath queryPath(path);
if(!queryPath.IsValid()) return;