]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/CDB/AliCDBLocal.cxx
better just warning than error in case of mirrors requesting when putting to local...
[u/mrichter/AliRoot.git] / STEER / CDB / AliCDBLocal.cxx
index b9651e9157719e085d4c6a348c280dfbcb570028..f2221623478f86d7f280fa0d9f3612f2499558e0 100644 (file)
@@ -39,6 +39,8 @@ fBaseDirectory(baseDir)
 {
 // constructor
 
+  AliDebug(1, Form("fBaseDirectory = %s",fBaseDirectory.Data()));
+
        // check baseDire: trying to cd to baseDir; if it does not exist, create it
        void* dir = gSystem->OpenDirectory(baseDir);
        if (dir == NULL) {
@@ -102,6 +104,8 @@ Bool_t AliCDBLocal::FilenameToId(const char* filename, AliCDBRunRange& runRange,
 Bool_t AliCDBLocal::IdToFilename(const AliCDBId& id, TString& filename) const {
 // build file name from AliCDBId data (run range, version, subVersion)
 
+  AliDebug(1, Form("fBaseDirectory = %s",fBaseDirectory.Data()));
+
        if (!id.GetAliCDBRunRange().IsValid()) {
                AliDebug(2,Form("Invalid run range <%d, %d>.", 
                        id.GetFirstRun(), id.GetLastRun()));
@@ -716,7 +720,7 @@ TList* AliCDBLocal::GetEntries(const AliCDBId& queryId) {
 }
 
 //_____________________________________________________________________________
-Bool_t AliCDBLocal::PutEntry(AliCDBEntry* entry) {
+Bool_t AliCDBLocal::PutEntry(AliCDBEntry* entry, const char* mirrors) {
 // put an AliCDBEntry object into the database
 
        AliCDBId& id = entry->GetId();
@@ -733,6 +737,10 @@ Bool_t AliCDBLocal::PutEntry(AliCDBEntry* entry) {
                return kFALSE;
        }
 
+       TString mirrorsString(mirrors);
+       if(!mirrorsString.IsNull())
+               AliWarning("AliCDBLocal storage cannot take mirror SEs into account. They will be ignored.");
+
        // open file
        TFile file(filename, "CREATE");
        if (!file.IsOpen()) {
@@ -942,9 +950,9 @@ ClassImp(AliCDBLocalFactory)
 Bool_t AliCDBLocalFactory::Validate(const char* dbString) {
 // check if the string is valid local URI
 
-        TRegexp dbPattern("^local://.+$");
+        TRegexp dbPatternLocal("^local://.+$");
 
-        return TString(dbString).Contains(dbPattern);
+        return (TString(dbString).Contains(dbPatternLocal) || TString(dbString).BeginsWith("snapshot://folder="));
 }
 
 //_____________________________________________________________________________
@@ -955,13 +963,25 @@ AliCDBParam* AliCDBLocalFactory::CreateParameter(const char* dbString) {
                return NULL;
        }
 
+       TString checkSS(dbString);
+       if(checkSS.BeginsWith("snapshot://"))
+       {
+           TString snapshotPath("OCDB");
+           snapshotPath.Prepend(TString(gSystem->WorkingDirectory()) + '/');
+           checkSS.Remove(0,checkSS.First(':')+3);
+           return new AliCDBLocalParam(snapshotPath,checkSS);
+       }
+               
+       // if the string argument is not a snapshot URI, than it is a plain local URI
        TString pathname(dbString + sizeof("local://") - 1);
        
-       gSystem->ExpandPathName(pathname);
+       if(gSystem->ExpandPathName(pathname))
+           return NULL;
 
        if (pathname[0] != '/') {
                pathname.Prepend(TString(gSystem->WorkingDirectory()) + '/');
        }
+       //pathname.Prepend("local://");
 
        return new AliCDBLocalParam(pathname);
 }
@@ -980,6 +1000,16 @@ AliCDBStorage* AliCDBLocalFactory::Create(const AliCDBParam* param) {
 
        return NULL;
 }
+//_____________________________________________________________________________
+void AliCDBLocal::SetRetry(Int_t /* nretry */, Int_t /* initsec */) {
+
+       // Function to set the exponential retry for putting entries in the OCDB
+
+       AliInfo("This function sets the exponential retry for putting entries in the OCDB - to be used ONLY for AliCDBGrid --> returning without doing anything");
+       return;
+} 
+
+
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //                                                                                             //
@@ -1009,6 +1039,17 @@ AliCDBLocalParam::AliCDBLocalParam(const char* dbPath):
        SetURI(TString("local://") + dbPath);
 }
 
+//_____________________________________________________________________________
+AliCDBLocalParam::AliCDBLocalParam(const char* dbPath, const char* uri):
+ AliCDBParam(),
+ fDBPath(dbPath)
+{
+// constructor
+
+       SetType("local");
+       SetURI(TString("alien://") + uri);
+}
+
 //_____________________________________________________________________________
 AliCDBLocalParam::~AliCDBLocalParam() {
 // destructor