]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Implementation of the local caching of the OCDB set required some upgrade of the...
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Sep 2007 17:38:39 +0000 (17:38 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Sep 2007 17:38:39 +0000 (17:38 +0000)
framework

Main changes:

- Public method GetId(AliCDBId& query) added to AliCDBManager and AliCDBStorage. It is used to retrieve the Id of the valid object
without retieving the object itself.
- "Remote storage" added to AliCDBManager's possible storages. Remote storage is used if it
is activated and if object is not found in the default storage. This is used in case an
object in the local cache is lost before the job is executed.

13 files changed:
STEER/AliCDBDump.cxx
STEER/AliCDBDump.h
STEER/AliCDBGrid.cxx
STEER/AliCDBGrid.h
STEER/AliCDBId.h
STEER/AliCDBLocal.cxx
STEER/AliCDBLocal.h
STEER/AliCDBManager.cxx
STEER/AliCDBManager.h
STEER/AliCDBPath.cxx
STEER/AliCDBPath.h
STEER/AliCDBStorage.cxx
STEER/AliCDBStorage.h

index d40bb51f981fb0db87d0236f44b085223e77c68a..49b97af77fb938d28769cfd32c8a252c25218932 100644 (file)
@@ -251,9 +251,119 @@ Bool_t AliCDBDump::PrepareId(AliCDBId& id) {
 
 }
 
 
 }
 
+// //_____________________________________________________________________________
+// Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
+// // look for filename matching query (called by GetEntry)
+// 
+// 
+//         AliCDBRunRange aRunRange; // the runRange got from filename
+//         Int_t aVersion, aSubVersion; // the version and subVersion got from filename
+// 
+//     TIter iter(gDirectory->GetListOfKeys());
+//     TKey* key;
+// 
+//     if (!query.HasVersion()) { // neither version and subversion specified -> look for highest version and subVersion
+// 
+//                 while ((key = (TKey*) iter.Next())) { // loop on the keys
+// 
+//                     if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
+//                         // aRunRange, aVersion, aSubVersion filled from filename
+// 
+//                     if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
+//                     // aRunRange contains requested run!
+// 
+//                     if (result.GetVersion() < aVersion) {
+//                             result.SetVersion(aVersion);
+//                             result.SetSubVersion(aSubVersion);
+// 
+//                             result.SetFirstRun(
+//                                     aRunRange.GetFirstRun());
+//                             result.SetLastRun(
+//                                     aRunRange.GetLastRun());
+// 
+//                     } else if (result.GetVersion() == aVersion
+//                             && result.GetSubVersion()
+//                                     < aSubVersion) {
+// 
+//                             result.SetSubVersion(aSubVersion);
+// 
+//                             result.SetFirstRun(
+//                                     aRunRange.GetFirstRun());
+//                             result.SetLastRun(
+//                                     aRunRange.GetLastRun());
+//                     } else if (result.GetVersion() == aVersion
+//                             && result.GetSubVersion() == aSubVersion){
+//                                     AliDebug(2,Form("More than one object valid for run %d, version %d_%d!",
+//                                     query.GetFirstRun(), aVersion, aSubVersion));
+//                             result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
+//                             return kFALSE;
+//                             }
+//             }
+// 
+//     } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
+// 
+//             result.SetVersion(query.GetVersion());
+// 
+//                 while ((key = (TKey*) iter.Next())) { // loop on the keys
+// 
+//                     if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
+//                         // aRunRange, aVersion, aSubVersion filled from filename
+// 
+//                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
+//                     // aRunRange contains requested run!
+//                     
+//                     if(query.GetVersion() != aVersion) continue;
+//                     // aVersion is requested version!
+// 
+//                     if(result.GetSubVersion() == aSubVersion){
+//                                     AliDebug(2,Form("More than one object valid for run %d, version %d_%d!",
+//                                     query.GetFirstRun(), aVersion, aSubVersion));
+//                             result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
+//                             return kFALSE;
+//                     }
+//                     if( result.GetSubVersion() < aSubVersion) {
+// 
+//                                 result.SetSubVersion(aSubVersion);
+// 
+//                                 result.SetFirstRun(
+//                                     aRunRange.GetFirstRun());
+//                                 result.SetLastRun(
+//                                     aRunRange.GetLastRun());
+//                     }
+//                 }
+// 
+//     } else { // both version and subversion specified
+// 
+//                 while ((key = (TKey*) iter.Next())) { // loop on the keys
+// 
+//                     if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
+//                         // aRunRange, aVersion, aSubVersion filled from filename
+// 
+//                     if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
+//                     // aRunRange contains requested run!
+// 
+//                     if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue;
+//                     // aVersion and aSubVersion are requested version and subVersion!
+// 
+//                     if(result.GetVersion() == aVersion && result.GetSubVersion() == aSubVersion){
+//                                     AliDebug(2,Form("More than one object valid for run %d, version %d_%d!",
+//                                     query.GetFirstRun(), aVersion, aSubVersion));
+//                             result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
+//                             return kFALSE; 
+//                     }
+//                     result.SetVersion(aVersion);
+//                     result.SetSubVersion(aSubVersion);
+//                     result.SetFirstRun(aRunRange.GetFirstRun());
+//                     result.SetLastRun(aRunRange.GetLastRun());
+// 
+//             }
+//     }
+// 
+//     return kTRUE;
+// }
 
 //_____________________________________________________________________________
 
 //_____________________________________________________________________________
-Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
+AliCDBId* AliCDBDump::GetId(const AliCDBId& query) {
 // look for filename matching query (called by GetEntry)
 
 
 // look for filename matching query (called by GetEntry)
 
 
@@ -263,8 +373,11 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
        TIter iter(gDirectory->GetListOfKeys());
        TKey* key;
 
        TIter iter(gDirectory->GetListOfKeys());
        TKey* key;
 
+       AliCDBId* result = new AliCDBId();
+       result->SetPath(query.GetPath());
+
        if (!query.HasVersion()) { // neither version and subversion specified -> look for highest version and subVersion
        if (!query.HasVersion()) { // neither version and subversion specified -> look for highest version and subVersion
-               
+
                 while ((key = (TKey*) iter.Next())) { // loop on the keys
                        
                        if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
                 while ((key = (TKey*) iter.Next())) { // loop on the keys
                        
                        if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
@@ -272,41 +385,41 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
 
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
-                       
-                       if (result.GetVersion() < aVersion) {
-                               result.SetVersion(aVersion);
-                               result.SetSubVersion(aSubVersion);
 
 
-                               result.SetFirstRun(
+                       if (result->GetVersion() < aVersion) {
+                               result->SetVersion(aVersion);
+                               result->SetSubVersion(aSubVersion);
+
+                               result->SetFirstRun(
                                        aRunRange.GetFirstRun());
                                        aRunRange.GetFirstRun());
-                               result.SetLastRun(
+                               result->SetLastRun(
                                        aRunRange.GetLastRun());
 
                                        aRunRange.GetLastRun());
 
-                       } else if (result.GetVersion() == aVersion 
-                               && result.GetSubVersion() 
+                       } else if (result->GetVersion() == aVersion
+                               && result->GetSubVersion()
                                        < aSubVersion) {
 
                                        < aSubVersion) {
 
-                               result.SetSubVersion(aSubVersion);
+                               result->SetSubVersion(aSubVersion);
 
 
-                               result.SetFirstRun(
+                               result->SetFirstRun(
                                        aRunRange.GetFirstRun());
                                        aRunRange.GetFirstRun());
-                               result.SetLastRun(
+                               result->SetLastRun(
                                        aRunRange.GetLastRun());
                                        aRunRange.GetLastRun());
-                       } else if (result.GetVersion() == aVersion
-                               && result.GetSubVersion() == aSubVersion){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
+                       } else if (result->GetVersion() == aVersion
+                               && result->GetSubVersion() == aSubVersion){
+                               AliError(Form("More than one object valid for run %d, version %d_%d!",
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                        query.GetFirstRun(), aVersion, aSubVersion));
-                               result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
-                               return kFALSE; 
+                               delete result;
+                               return NULL;
                                }
                }
                                }
                }
-               
+
        } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
 
        } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
 
-               result.SetVersion(query.GetVersion());
+               result->SetVersion(query.GetVersion());
 
                 while ((key = (TKey*) iter.Next())) { // loop on the keys
 
                 while ((key = (TKey*) iter.Next())) { // loop on the keys
-                       
+
                        if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
 
                        if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
 
@@ -315,20 +428,20 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
                        
                        if(query.GetVersion() != aVersion) continue;
                        // aVersion is requested version!
                        
                        if(query.GetVersion() != aVersion) continue;
                        // aVersion is requested version!
-                       
-                       if(result.GetSubVersion() == aSubVersion){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
+
+                       if(result->GetSubVersion() == aSubVersion){
+                               AliError(Form("More than one object valid for run %d, version %d_%d!",
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                        query.GetFirstRun(), aVersion, aSubVersion));
-                               result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
-                               return kFALSE; 
+                               delete result;
+                               return NULL;
                        }
                        }
-                       if( result.GetSubVersion() < aSubVersion) {
+                       if( result->GetSubVersion() < aSubVersion) {
 
 
-                                result.SetSubVersion(aSubVersion);
+                                result->SetSubVersion(aSubVersion);
 
 
-                                result.SetFirstRun(
+                                result->SetFirstRun(
                                        aRunRange.GetFirstRun());
                                        aRunRange.GetFirstRun());
-                                result.SetLastRun(
+                                result->SetLastRun(
                                        aRunRange.GetLastRun());
                        } 
                 }
                                        aRunRange.GetLastRun());
                        } 
                 }
@@ -339,28 +452,28 @@ Bool_t AliCDBDump::GetId(const AliCDBId& query, AliCDBId& result) {
                        
                        if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
                        
                        if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
-                       
+
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
-                       if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue; 
+                       if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue;
                        // aVersion and aSubVersion are requested version and subVersion!
 
                        // aVersion and aSubVersion are requested version and subVersion!
 
-                       if(result.GetVersion() == aVersion && result.GetSubVersion() == aSubVersion){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
+                       if(result->GetVersion() == aVersion && result->GetSubVersion() == aSubVersion){
+                               AliError(Form("More than one object valid for run %d, version %d_%d!",
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                        query.GetFirstRun(), aVersion, aSubVersion));
-                               result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
-                               return kFALSE; 
+                               delete result;
+                               return NULL;
                        }
                        }
-                       result.SetVersion(aVersion);
-                       result.SetSubVersion(aSubVersion);
-                       result.SetFirstRun(aRunRange.GetFirstRun());
-                       result.SetLastRun(aRunRange.GetLastRun());
+                       result->SetVersion(aVersion);
+                       result->SetSubVersion(aSubVersion);
+                       result->SetFirstRun(aRunRange.GetFirstRun());
+                       result->SetLastRun(aRunRange.GetLastRun());
                        
                }
        }
 
                        
                }
        }
 
-       return kTRUE;
+       return result;
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
@@ -378,50 +491,79 @@ AliCDBEntry* AliCDBDump::GetEntry(const AliCDBId& queryId) {
                 return NULL;
         }
 
                 return NULL;
         }
 
-       AliCDBId dataId(queryId.GetAliCDBPath(), -1, -1, -1, -1);
-        Bool_t result;
+       AliCDBId *dataId = GetEntryId(queryId);
 
 
-       // look for a filename matching query requests (path, runRange, version, subVersion)
-       if (!queryId.HasVersion()) {
-               // if version is not specified, first check the selection criteria list
-               AliCDBId selectedId(queryId);
-               GetSelection(&selectedId);
-               result = GetId(selectedId, dataId);
-       } else {
-               result = GetId(queryId, dataId);
-       }
-
-       if (!result || !dataId.IsSpecified()) {
+       if (!dataId || !dataId->IsSpecified()) {
+               if(dataId) delete dataId;
                return NULL;
        }
                return NULL;
        }
-       
+
        TString keyname;
        TString keyname;
-       if (!IdToKeyName(dataId.GetAliCDBRunRange(), dataId.GetVersion(), 
-               dataId.GetSubVersion(), keyname)) {
+       if (!IdToKeyName(dataId->GetAliCDBRunRange(), dataId->GetVersion(),
+               dataId->GetSubVersion(), keyname)) {
                AliDebug(2,Form("Bad ID encountered! Subnormal error!"));
                AliDebug(2,Form("Bad ID encountered! Subnormal error!"));
+               delete dataId;
                return NULL;
        }
 
        // get the only AliCDBEntry object from the file
                return NULL;
        }
 
        // get the only AliCDBEntry object from the file
-       // the object in the file is an AliCDBEntry entry named keyname 
+       // the object in the file is an AliCDBEntry entry named keyname
        // keyName = Run#firstRun_#lastRun_v#version_s#subVersion
 
        TObject* anObject = gDirectory->Get(keyname);
        if (!anObject) {
                AliDebug(2,Form("Bad storage data: NULL entry object!"));
        // keyName = Run#firstRun_#lastRun_v#version_s#subVersion
 
        TObject* anObject = gDirectory->Get(keyname);
        if (!anObject) {
                AliDebug(2,Form("Bad storage data: NULL entry object!"));
+               delete dataId;
                return NULL;
        } 
 
        if (AliCDBEntry::Class() != anObject->IsA()) {
                AliDebug(2,Form("Bad storage data: Invalid entry object!"));
                return NULL;
        } 
 
        if (AliCDBEntry::Class() != anObject->IsA()) {
                AliDebug(2,Form("Bad storage data: Invalid entry object!"));
+               delete dataId;
                return NULL;
        }
 
        ((AliCDBEntry*) anObject)->SetLastStorage("dump");
                return NULL;
        }
 
        ((AliCDBEntry*) anObject)->SetLastStorage("dump");
-       
+
+       delete dataId;
        return (AliCDBEntry*) anObject;
 }
 
        return (AliCDBEntry*) anObject;
 }
 
+//_____________________________________________________________________________
+AliCDBId* AliCDBDump::GetEntryId(const AliCDBId& queryId) {
+// get AliCDBEntry from the database
+
+       TDirectory::TContext context(gDirectory, fFile);
+
+       if (!(fFile && fFile->IsOpen())) {
+                AliError("AliCDBDump storage is not initialized properly");
+                return NULL;
+        }
+
+        if (!gDirectory->cd(queryId.GetPath())) {
+                return NULL;
+        }
+
+       AliCDBId* dataId = 0;
+
+       // look for a filename matching query requests (path, runRange, version, subVersion)
+       if (!queryId.HasVersion()) {
+               // if version is not specified, first check the selection criteria list
+               AliCDBId selectedId(queryId);
+               GetSelection(&selectedId);
+               dataId = GetId(queryId);
+       } else {
+               dataId = GetId(queryId);
+       }
+
+       if (dataId && !dataId->IsSpecified()) {
+               delete dataId;
+               return NULL;
+       }
+
+       return dataId;
+}
+
 //_____________________________________________________________________________
 void AliCDBDump::GetEntriesForLevel0(const AliCDBId& queryId, TList* result) {
 // multiple request (AliCDBStorage::GetAll)
 //_____________________________________________________________________________
 void AliCDBDump::GetEntriesForLevel0(const AliCDBId& queryId, TList* result) {
 // multiple request (AliCDBStorage::GetAll)
@@ -432,7 +574,7 @@ void AliCDBDump::GetEntriesForLevel0(const AliCDBId& queryId, TList* result) {
        TKey* key;
 
        while ((key = (TKey*) iter.Next())) {
        TKey* key;
 
        while ((key = (TKey*) iter.Next())) {
-               
+
                TString keyNameStr(key->GetName());
                if (queryId.GetAliCDBPath().Level1Comprises(keyNameStr)) {
                        gDirectory->cd(keyNameStr);
                TString keyNameStr(key->GetName());
                if (queryId.GetAliCDBPath().Level1Comprises(keyNameStr)) {
                        gDirectory->cd(keyNameStr);
@@ -631,11 +773,13 @@ Int_t AliCDBDump::GetLatestVersion(const char* path, Int_t run){
        }
 
        AliCDBId query(path, run, run, -1, -1);
        }
 
        AliCDBId query(path, run, run, -1, -1);
-       AliCDBId dataId;
+       AliCDBId *dataId = GetId(query);
 
 
-       GetId(query,dataId);
+       if(!dataId) return -1;
+       Int_t version = dataId->GetVersion();
 
 
-       return dataId.GetVersion();
+       delete dataId;
+       return version;
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
@@ -649,11 +793,14 @@ Int_t AliCDBDump::GetLatestSubVersion(const char* path, Int_t run, Int_t version
        }
 
        AliCDBId query(path, run, run, version, -1);
        }
 
        AliCDBId query(path, run, run, version, -1);
-       AliCDBId dataId;
+       AliCDBId *dataId = GetId(query);
+
+       if(!dataId) return -1;
 
 
-       GetId(query,dataId);
+       Int_t subVersion = dataId->GetSubVersion();
 
 
-       return dataId.GetSubVersion();
+       delete dataId;
+       return subVersion;
 
 }
 
 
 }
 
@@ -712,7 +859,7 @@ AliCDBStorage* AliCDBDumpFactory::Create(const AliCDBParam* param) {
                 const AliCDBDumpParam* dumpParam = 
                        (const AliCDBDumpParam*) param;
 
                 const AliCDBDumpParam* dumpParam = 
                        (const AliCDBDumpParam*) param;
 
-                return new AliCDBDump(dumpParam->GetPath(), 
+                return new AliCDBDump(dumpParam->GetPath(),
                                dumpParam->IsReadOnly());
         }
 
                                dumpParam->IsReadOnly());
         }
 
index c8b33694f9f168ed79a09f9da67c48d2b8f5cca9..4c54ae6ad1638c6eb44ad139fa9b65b50a8b6f1d 100644 (file)
@@ -32,6 +32,7 @@ public:
 protected:
 
        virtual AliCDBEntry*    GetEntry(const AliCDBId& query);
 protected:
 
        virtual AliCDBEntry*    GetEntry(const AliCDBId& query);
+       virtual AliCDBId*       GetEntryId(const AliCDBId& query);
         virtual TList*                 GetEntries(const AliCDBId& query);
         virtual Bool_t                 PutEntry(AliCDBEntry* entry);
        virtual TList*          GetIdListFromFile(const char* fileName);
         virtual TList*                 GetEntries(const AliCDBId& query);
         virtual Bool_t                 PutEntry(AliCDBEntry* entry);
        virtual TList*          GetIdListFromFile(const char* fileName);
@@ -52,7 +53,8 @@ private:
 
 
        Bool_t PrepareId(AliCDBId& id);
 
 
        Bool_t PrepareId(AliCDBId& id);
-       Bool_t GetId(const AliCDBId& query, AliCDBId& result);
+//     Bool_t GetId(const AliCDBId& query, AliCDBId& result);
+       AliCDBId* GetId(const AliCDBId& query);
 
        virtual void QueryValidFiles();
 
 
        virtual void QueryValidFiles();
 
index 1fcd7719e9a8d1be1d938bf273e576c86b411d3f..962865ed001845ecb95ba9f8e3ce3f089dc3036e 100644 (file)
@@ -26,7 +26,7 @@
 #include <TFile.h>
 #include <TKey.h>
 #include <TROOT.h>
 #include <TFile.h>
 #include <TKey.h>
 #include <TROOT.h>
-//#include <TSystem.h>
+#include <TList.h>
 #include <TObjArray.h>
 #include <TObjString.h>
 #include <TRegexp.h>
 #include <TObjArray.h>
 #include <TObjString.h>
 #include <TRegexp.h>
@@ -34,6 +34,7 @@
 #include "AliLog.h"
 #include "AliCDBEntry.h"
 #include "AliCDBGrid.h"
 #include "AliLog.h"
 #include "AliCDBEntry.h"
 #include "AliCDBGrid.h"
+#include "AliCDBManager.h"
 
 
 ClassImp(AliCDBGrid)
 
 
 ClassImp(AliCDBGrid)
@@ -49,7 +50,7 @@ fSE(se)
 // constructor //
 
        // if the same Grid is alreay active, skip connection
 // constructor //
 
        // if the same Grid is alreay active, skip connection
-       if (!gGrid || fGridUrl != gGrid->GridUrl()  
+       if (!gGrid || fGridUrl != gGrid->GridUrl()
             || (( fUser != "" ) && ( fUser != gGrid->GetUser() )) ) {
                // connection to the Grid
                AliInfo("Connection to the Grid...");
             || (( fUser != "" ) && ( fUser != gGrid->GetUser() )) ) {
                // connection to the Grid
                AliInfo("Connection to the Grid...");
@@ -74,7 +75,7 @@ fSE(se)
        if(!gGrid->Cd(fDBFolder.Data(),0)){
                AliDebug(2,Form("Creating new folder <%s> ...",fDBFolder.Data()));
                if(!gGrid->Mkdir(fDBFolder.Data(),"",0)){
        if(!gGrid->Cd(fDBFolder.Data(),0)){
                AliDebug(2,Form("Creating new folder <%s> ...",fDBFolder.Data()));
                if(!gGrid->Mkdir(fDBFolder.Data(),"",0)){
-                       AliError(Form("Cannot create folder <%s> !",fDBFolder.Data())); 
+                       AliError(Form("Cannot create folder <%s> !",fDBFolder.Data()));
                }
        } else {
                AliDebug(2,Form("Folder <%s> found",fDBFolder.Data()));
                }
        } else {
                AliDebug(2,Form("Folder <%s> found",fDBFolder.Data()));
@@ -184,17 +185,16 @@ Bool_t AliCDBGrid::PrepareId(AliCDBId& id) {
 // prepare id (version) of the object that will be stored (called by PutEntry)
 
        TString initDir(gGrid->Pwd(0));
 // prepare id (version) of the object that will be stored (called by PutEntry)
 
        TString initDir(gGrid->Pwd(0));
-       TString pathName= id.GetPath();
 
        TString dirName(fDBFolder);
 
        Bool_t dirExist=kFALSE;
 
 
        TString dirName(fDBFolder);
 
        Bool_t dirExist=kFALSE;
 
+
+
        // go to the path; if directory does not exist, create it
        // go to the path; if directory does not exist, create it
-       TObjArray *arrName=pathName.Tokenize("/");
-       for(int i=0;i<arrName->GetEntries();i++){
-               TString buffer((arrName->At(i))->GetName());
-               dirName+=buffer; dirName+="/";
+       for(int i=0;i<3;i++){
+               dirName+=Form("%s/",id.GetPathLevel(i).Data());
                dirExist=gGrid->Cd(dirName,0);
                if (!dirExist) {
                        AliDebug(2,Form("Creating new folder <%s> ...",dirName.Data()));
                dirExist=gGrid->Cd(dirName,0);
                if (!dirExist) {
                        AliDebug(2,Form("Creating new folder <%s> ...",dirName.Data()));
@@ -203,9 +203,61 @@ Bool_t AliCDBGrid::PrepareId(AliCDBId& id) {
                                gGrid->Cd(initDir.Data());
                        return kFALSE;
                        }
                                gGrid->Cd(initDir.Data());
                        return kFALSE;
                        }
+
+                       // if folders are new add tags to them
+                       if(i == 1) {
+                               // TODO Currently disabled
+                               // AliInfo("Tagging level 1 folder with \"ShortLived\" tag");
+                               // if(!AddTag(dirName,"ShortLived_try")){
+                               //      AliError(Form("Could not tag folder %s !", dirName.Data()));
+                               //      if(!gGrid->Rmdir(dirName.Data())){
+                               //              AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
+                               //      }
+                               //      return 0;
+                               //}
+
+                       } else if(i == 2) {
+                               AliInfo("Tagging level 2 folder with \"CDB\" and \"CDB_MD\" tag");
+                               if(!AddTag(dirName,"CDB")){
+                                       AliError(Form("Could not tag folder %s !", dirName.Data()));
+                                       if(!gGrid->Rmdir(dirName.Data())){
+                                               AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
+                                       }
+                                       return 0;
+                               }
+                               if(!AddTag(dirName,"CDB_MD")){
+                                       AliError(Form("Could not tag folder %s !", dirName.Data()));
+                                       if(!gGrid->Rmdir(dirName.Data())){
+                                               AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
+                                       }
+                                       return 0;
+                               }
+
+                               // add short lived tag!
+                               // TODO Currently disabled
+                               // TString path=id.GetPath();
+                               // if(AliCDBManager::Instance()->IsShortLived(path.Data())) {
+                               //      AliInfo(Form("Tagging %s as short lived", dirName.Data()));
+                               //      if(!TagShortLived(dirName, kTRUE)){
+                               //              AliError(Form("Could not tag folder %s !", dirName.Data()));
+                               //              if(!gGrid->Rmdir(dirName.Data())){
+                               //                      AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
+                               //              }
+                               //              return 0;
+                               //      }
+                               // } else {
+                               //      AliInfo(Form("Tagging %s as long lived", dirName.Data()));
+                               //      if(!TagShortLived(dirName, kFALSE)){
+                               //              AliError(Form("Could not tag folder %s !", dirName.Data()));
+                               //              if(!gGrid->Rmdir(dirName.Data())){
+                               //                      AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
+                               //              }
+                               //              return 0;
+                               //      }
+                               // }
+                       }
                }
        }
                }
        }
-       delete arrName;
        gGrid->Cd(initDir,0);
 
        TString filename;
        gGrid->Cd(initDir,0);
 
        TString filename;
@@ -252,7 +304,7 @@ AliCDBId* AliCDBGrid::GetId(const TObjArray& validFileIds, const AliCDBId& query
        if(validFileIds.GetEntriesFast() < 1) {
                return NULL;
        } else if (validFileIds.GetEntriesFast() == 1) {
        if(validFileIds.GetEntriesFast() < 1) {
                return NULL;
        } else if (validFileIds.GetEntriesFast() == 1) {
-               return dynamic_cast<AliCDBId*> (validFileIds.At(0));
+               return dynamic_cast<AliCDBId*> (validFileIds.At(0)->Clone());
        }
 
        TIter iter(&validFileIds);
        }
 
        TIter iter(&validFileIds);
@@ -268,7 +320,7 @@ AliCDBId* AliCDBGrid::GetId(const TObjArray& validFileIds, const AliCDBId& query
                if (!query.HasVersion()){ // look for highest version
                        if(result && result->GetVersion() > anIdPtr->GetVersion()) continue;
                        if(result && result->GetVersion() == anIdPtr->GetVersion()) {
                if (!query.HasVersion()){ // look for highest version
                        if(result && result->GetVersion() > anIdPtr->GetVersion()) continue;
                        if(result && result->GetVersion() == anIdPtr->GetVersion()) {
-                               AliDebug(2,Form("More than one object valid for run %d, version %d!",
+                               AliError(Form("More than one object valid for run %d, version %d!",
                                        query.GetFirstRun(), anIdPtr->GetVersion()));
                                return NULL;
                        }
                                        query.GetFirstRun(), anIdPtr->GetVersion()));
                                return NULL;
                        }
@@ -276,7 +328,7 @@ AliCDBId* AliCDBGrid::GetId(const TObjArray& validFileIds, const AliCDBId& query
                } else { // look for specified version
                        if(query.GetVersion() != anIdPtr->GetVersion()) continue;
                        if(result && result->GetVersion() == anIdPtr->GetVersion()){
                } else { // look for specified version
                        if(query.GetVersion() != anIdPtr->GetVersion()) continue;
                        if(result && result->GetVersion() == anIdPtr->GetVersion()){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d!",
+                               AliError(Form("More than one object valid for run %d, version %d!",
                                        query.GetFirstRun(), anIdPtr->GetVersion()));
                                return NULL;
                        }
                                        query.GetFirstRun(), anIdPtr->GetVersion()));
                                return NULL;
                        }
@@ -285,13 +337,13 @@ AliCDBId* AliCDBGrid::GetId(const TObjArray& validFileIds, const AliCDBId& query
 
        }
 
 
        }
 
-
-       return result;
+       return dynamic_cast<AliCDBId*> (result->Clone());
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) {
-// get AliCDBEntry from the database
+AliCDBId* AliCDBGrid::GetEntryId(const AliCDBId& queryId) {
+// get AliCDBId from the database
+// User must delete returned object
 
        AliCDBId* dataId=0;
 
 
        AliCDBId* dataId=0;
 
@@ -337,16 +389,27 @@ AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) {
                dataId = GetId(validFileIds, selectedId);
        }
 
                dataId = GetId(validFileIds, selectedId);
        }
 
+       return dataId;
+}
+
+//_____________________________________________________________________________
+AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) {
+// get AliCDBEntry from the database
+
+       AliCDBId* dataId = GetEntryId(queryId);
+
        if (!dataId) return NULL;
 
        TString filename;
        if (!IdToFilename(*dataId, filename)) {
                AliDebug(2,Form("Bad data ID encountered! Subnormal error!"));
        if (!dataId) return NULL;
 
        TString filename;
        if (!IdToFilename(*dataId, filename)) {
                AliDebug(2,Form("Bad data ID encountered! Subnormal error!"));
+               delete dataId;
                return NULL;
        }
 
        AliCDBEntry* anEntry = GetEntryFromFile(filename, dataId);
 
                return NULL;
        }
 
        AliCDBEntry* anEntry = GetEntryFromFile(filename, dataId);
 
+       delete dataId;
        return anEntry;
 }
 
        return anEntry;
 }
 
@@ -476,7 +539,7 @@ TList* AliCDBGrid::GetEntries(const AliCDBId& queryId) {
                } else {
                        dataId = GetId(validFileIds, thisId);
                }
                } else {
                        dataId = GetId(validFileIds, thisId);
                }
-               if(dataId) selectedIds.Add(dataId->Clone());
+               if(dataId) selectedIds.Add(dataId);
        }
 
        delete iter; iter=0;
        }
 
        delete iter; iter=0;
@@ -521,11 +584,6 @@ Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry) {
                                        fDBFolder.Data(),
                                        id.GetPath().Data());
 
                                        fDBFolder.Data(),
                                        id.GetPath().Data());
 
-       // add CDB and CDB_MD tag to folder
-       // TODO how to check that folder has already tags?
-       AddTag(folderToTag,"CDB");
-       AddTag(folderToTag,"CDB_MD");
-
        TDirectory* saveDir = gDirectory;
 
        TString fullFilename = Form("/alien%s", filename.Data());
        TDirectory* saveDir = gDirectory;
 
        TString fullFilename = Form("/alien%s", filename.Data());
@@ -598,9 +656,9 @@ Bool_t AliCDBGrid::TagFileId(TString& filename, const AliCDBId* id){
                                        id->GetLastRun(),
                                        id->GetVersion());
        TString addTagValue3 = Form("path_level_0=\"%s\" path_level_1=\"%s\" path_level_2=\"%s\"",
                                        id->GetLastRun(),
                                        id->GetVersion());
        TString addTagValue3 = Form("path_level_0=\"%s\" path_level_1=\"%s\" path_level_2=\"%s\"",
-                                       id->GetLevel0().Data(),
-                                       id->GetLevel1().Data(),
-                                       id->GetLevel2().Data());
+                                       id->GetPathLevel(0).Data(),
+                                       id->GetPathLevel(1).Data(),
+                                       id->GetPathLevel(2).Data());
        TString addTagValue = Form("%s%s%s",
                                        addTagValue1.Data(),
                                        addTagValue2.Data(),
        TString addTagValue = Form("%s%s%s",
                                        addTagValue1.Data(),
                                        addTagValue2.Data(),
@@ -623,6 +681,28 @@ Bool_t AliCDBGrid::TagFileId(TString& filename, const AliCDBId* id){
 
 }
 
 
 }
 
+//_____________________________________________________________________________
+Bool_t AliCDBGrid::TagShortLived(TString& filename, Bool_t value){
+// tag folder with ShortLived tag
+
+       TString addTagValue = Form("addTagValue %s ShortLived_try value=%d", filename.Data(), value);
+
+       Bool_t result = kFALSE;
+       AliDebug(2, Form("Tagging file. Tag command: %s", addTagValue.Data()));
+       TGridResult* res = gGrid->Command(addTagValue.Data());
+       const char* resCode = res->GetKey(0,"__result__"); // '1' if success
+       if(resCode[0] != '1') {
+               AliError(Form("Couldn't add ShortLived tag value to file %s !", filename.Data()));
+               result = kFALSE;
+       } else {
+               AliInfo("Object successfully tagged.");
+               result = kTRUE;
+       }
+       delete res;
+       return result;
+
+}
+
 //_____________________________________________________________________________
 Bool_t AliCDBGrid::TagFileMetaData(TString& filename, const AliCDBMetaData* md){
 // tag stored object in CDB table using object Id's parameters
 //_____________________________________________________________________________
 Bool_t AliCDBGrid::TagFileMetaData(TString& filename, const AliCDBMetaData* md){
 // tag stored object in CDB table using object Id's parameters
@@ -778,9 +858,6 @@ void AliCDBGrid::MakeQueryFilter(Int_t firstRun, Int_t lastRun,
 Int_t AliCDBGrid::GetLatestVersion(const char* path, Int_t run){
 // get last version found in the database valid for run and path
 
 Int_t AliCDBGrid::GetLatestVersion(const char* path, Int_t run){
 // get last version found in the database valid for run and path
 
-       TObjArray validFileIds;
-       validFileIds.SetOwner(1);
-
        AliCDBPath aCDBPath(path);
        if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) {
                AliError(Form("Invalid path in request: %s", path));
        AliCDBPath aCDBPath(path);
        if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) {
                AliError(Form("Invalid path in request: %s", path));
@@ -796,13 +873,18 @@ Int_t AliCDBGrid::GetLatestVersion(const char* path, Int_t run){
                                        run, path));
                dataId = GetId(fValidFileIds, query);
                if (!dataId) return -1;
                                        run, path));
                dataId = GetId(fValidFileIds, query);
                if (!dataId) return -1;
-               return dataId->GetVersion();
+               Int_t version = dataId->GetVersion();
+               delete dataId;
+               return version;
 
        }
        // List of files valid for reqested run was not loaded. Looking directly into CDB
        AliDebug(2, Form("List of files valid for run %d and for path %s was not loaded. Looking directly into CDB!",
                                run, path));
 
 
        }
        // List of files valid for reqested run was not loaded. Looking directly into CDB
        AliDebug(2, Form("List of files valid for run %d and for path %s was not loaded. Looking directly into CDB!",
                                run, path));
 
+       TObjArray validFileIds;
+       validFileIds.SetOwner(1);
+
        TString filter;
        MakeQueryFilter(run, run, 0, filter);
 
        TString filter;
        MakeQueryFilter(run, run, 0, filter);
 
@@ -822,7 +904,9 @@ Int_t AliCDBGrid::GetLatestVersion(const char* path, Int_t run){
        dataId = GetId(validFileIds, query);
        if (!dataId) return -1;
 
        dataId = GetId(validFileIds, query);
        if (!dataId) return -1;
 
-       return dataId->GetVersion();
+       Int_t version = dataId->GetVersion();
+       delete dataId;
+       return version;
 
 }
 
 
 }
 
@@ -867,13 +951,13 @@ AliCDBParam* AliCDBGridFactory::CreateParameter(const char* gridString) {
 
        TString gridUrl         = "alien://";
        TString user            = "";
 
        TString gridUrl         = "alien://";
        TString user            = "";
-       TString dbFolder        = "DBGrid";
+       TString dbFolder        = "";
        TString se              = "default";
 
        TObjArray *arr = buffer.Tokenize('?');
        TIter iter(arr);
        TObjString *str = 0;
        TString se              = "default";
 
        TObjArray *arr = buffer.Tokenize('?');
        TIter iter(arr);
        TObjString *str = 0;
-       
+
        while((str = (TObjString*) iter.Next())){
                TString entry(str->String());
                Int_t indeq = entry.Index('=');
        while((str = (TObjString*) iter.Next())){
                TString entry(str->String());
                Int_t indeq = entry.Index('=');
@@ -913,6 +997,11 @@ AliCDBParam* AliCDBGridFactory::CreateParameter(const char* gridString) {
        AliDebug(2, Form("dbFolder:     %s",dbFolder.Data()));
        AliDebug(2, Form("s.e.: %s",se.Data()));
 
        AliDebug(2, Form("dbFolder:     %s",dbFolder.Data()));
        AliDebug(2, Form("s.e.: %s",se.Data()));
 
+       if(dbFolder == ""){
+               AliError("DBFolder must be specified!");
+               return NULL;
+       }
+
        return new AliCDBGridParam(gridUrl.Data(), user.Data(), dbFolder.Data(), se.Data());
 }
 
        return new AliCDBGridParam(gridUrl.Data(), user.Data(), dbFolder.Data(), se.Data());
 }
 
index 9d0356881f12d6e697342a15bd0edaa9128e95bb..40af651a5ae4eef8629efdfcc3ee1b1167dfdb1f 100644 (file)
@@ -30,6 +30,7 @@ public:
 protected:
 
        virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
 protected:
 
        virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
+       virtual AliCDBId*       GetEntryId(const AliCDBId& queryId);
        virtual TList*          GetEntries(const AliCDBId& queryId);
        virtual Bool_t          PutEntry(AliCDBEntry* entry);
        virtual TList*          GetIdListFromFile(const char* fileName);
        virtual TList*          GetEntries(const AliCDBId& queryId);
        virtual Bool_t          PutEntry(AliCDBEntry* entry);
        virtual TList*          GetIdListFromFile(const char* fileName);
@@ -49,9 +50,11 @@ private:
        AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
        AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
 
        AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
        AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
 
+       // TODO  use AliEnTag classes!
        Bool_t AddTag(TString& foldername, const char* tagname);
        Bool_t TagFileId(TString& filename, const AliCDBId* id);
        Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
        Bool_t AddTag(TString& foldername, const char* tagname);
        Bool_t TagFileId(TString& filename, const AliCDBId* id);
        Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
+       Bool_t TagShortLived(TString& filename, Bool_t value);
 
        void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
 
 
        void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
 
@@ -62,7 +65,7 @@ private:
        TString    fDBFolder;   // path of the DB folder
        TString    fSE;         // Storage Element
 
        TString    fDBFolder;   // path of the DB folder
        TString    fSE;         // Storage Element
 
-ClassDef(AliCDBGrid, 0)      // access class to a DataBase in an AliEn storage 
+ClassDef(AliCDBGrid, 0)      // access class to a DataBase in an AliEn storage
 };
 
 /////////////////////////////////////////////////////////////////////
 };
 
 /////////////////////////////////////////////////////////////////////
index d3b4ea9d915ac9f55addd198753f47e5a6c7558a..54ae14aabf9970898e77525b416bbb050ebae145 100644 (file)
@@ -34,45 +34,43 @@ public:
 
        virtual ~AliCDBId();
 
 
        virtual ~AliCDBId();
 
-       const AliCDBPath&       GetAliCDBPath() const {return fPath;};
-       const TString&          GetPath() const {return fPath.GetPath();};
-       const TString&          GetLevel0() const {return fPath.GetLevel0();};
-       const TString&          GetLevel1() const {return fPath.GetLevel1();};
-       const TString&          GetLevel2() const {return fPath.GetLevel2();};
-       Bool_t                  IsWildcard() const {return fPath.IsWildcard();};
+       const AliCDBPath&       GetAliCDBPath() const {return fPath;}
+       const TString&          GetPath() const {return fPath.GetPath();}
+       const TString           GetPathLevel(Int_t i) const {return fPath.GetLevel(i);}
+       Bool_t                  IsWildcard() const {return fPath.IsWildcard();}
 
 
-       void    SetPath(const char* path) {fPath.SetPath(path);};
+       void    SetPath(const char* path) {fPath.SetPath(path);}
 
 
-       const           AliCDBRunRange& GetAliCDBRunRange() const {return fRunRange;};
-       AliCDBRunRange& GetAliCDBRunRange() {return fRunRange;};
-       Int_t           GetFirstRun() const {return fRunRange.GetFirstRun();};
-       Int_t           GetLastRun() const {return fRunRange.GetLastRun();};    
-       void            SetFirstRun(Int_t firstRun) {fRunRange.SetFirstRun(firstRun);};
-       void            SetLastRun(Int_t lastRun) {fRunRange.SetLastRun(lastRun);};
-       void            SetRunRange(Int_t firstRun, Int_t lastRun) 
-                       {fRunRange.SetRunRange(firstRun, lastRun);};
+       const           AliCDBRunRange& GetAliCDBRunRange() const {return fRunRange;}
+       AliCDBRunRange& GetAliCDBRunRange() {return fRunRange;}
+       Int_t           GetFirstRun() const {return fRunRange.GetFirstRun();}
+       Int_t           GetLastRun() const {return fRunRange.GetLastRun();}
+       void            SetFirstRun(Int_t firstRun) {fRunRange.SetFirstRun(firstRun);}
+       void            SetLastRun(Int_t lastRun) {fRunRange.SetLastRun(lastRun);}
+       void            SetRunRange(Int_t firstRun, Int_t lastRun)
+                       {fRunRange.SetRunRange(firstRun, lastRun);}
 
 
 
 
-       Bool_t  IsAnyRange() const {return fRunRange.IsAnyRange();};
+       Bool_t  IsAnyRange() const {return fRunRange.IsAnyRange();}
 
 
 
 
-       Int_t   GetVersion() const {return fVersion;};
-       Int_t   GetSubVersion() const {return fSubVersion;};
-       void    SetVersion(Int_t version) {fVersion = version;};        
-       void    SetSubVersion(Int_t subVersion) {fSubVersion = subVersion;};
+       Int_t   GetVersion() const {return fVersion;}
+       Int_t   GetSubVersion() const {return fSubVersion;}
+       void    SetVersion(Int_t version) {fVersion = version;}
+       void    SetSubVersion(Int_t subVersion) {fSubVersion = subVersion;}
 
 
-       const TString&  GetLastStorage() const {return fLastStorage;};
-       void            SetLastStorage(TString& lastStorage){fLastStorage = lastStorage;};
+       const TString&  GetLastStorage() const {return fLastStorage;}
+       void            SetLastStorage(TString& lastStorage){fLastStorage = lastStorage;}
 
        Bool_t IsValid() const; 
 
        Bool_t IsValid() const; 
-       Bool_t IsSpecified() const {return !(IsWildcard() || IsAnyRange());};
+       Bool_t IsSpecified() const {return !(IsWildcard() || IsAnyRange());}
 
 
-       Bool_t HasVersion() const {return fVersion >= 0;};
-       Bool_t HasSubVersion() const {return fSubVersion >= 0;};
+       Bool_t HasVersion() const {return fVersion >= 0;}
+       Bool_t HasSubVersion() const {return fSubVersion >= 0;}
 
        Bool_t Comprises(const AliCDBId& other) const
                {return fPath.Comprises(other.fPath)
 
        Bool_t Comprises(const AliCDBId& other) const
                {return fPath.Comprises(other.fPath)
-                        && fRunRange.Comprises(other.fRunRange);};
+                        && fRunRange.Comprises(other.fRunRange);}
 
        virtual Bool_t IsEqual(const TObject *obj) const;
 
 
        virtual Bool_t IsEqual(const TObject *obj) const;
 
index f79da4af04c87f5973e0dba04a730bf5559786dc..28ef71989b64ad40bb91d580300b4e757258403f 100644 (file)
@@ -145,7 +145,7 @@ Bool_t AliCDBLocal::PrepareId(AliCDBId& id) {
        }
 
        const char* filename;
        }
 
        const char* filename;
-       AliCDBRunRange aRunRange; // the runRange got from filename 
+       AliCDBRunRange aRunRange; // the runRange got from filename
        AliCDBRunRange lastRunRange(-1,-1); // highest runRange found
        Int_t aVersion, aSubVersion; // the version subVersion got from filename
        Int_t lastVersion = 0, lastSubVersion = -1; // highest version and subVersion found
        AliCDBRunRange lastRunRange(-1,-1); // highest runRange found
        Int_t aVersion, aSubVersion; // the version subVersion got from filename
        Int_t lastVersion = 0, lastSubVersion = -1; // highest version and subVersion found
@@ -232,9 +232,138 @@ Bool_t AliCDBLocal::PrepareId(AliCDBId& id) {
        return kTRUE;
 }
 
        return kTRUE;
 }
 
+// //_____________________________________________________________________________
+// Bool_t AliCDBLocal::GetId(const AliCDBId& query, AliCDBId& result) {
+// // look for filename matching query (called by GetEntry)
+// 
+//     TString dirName = Form("%s/%s", fBaseDirectory.Data(), query.GetPath().Data());
+// 
+//     void* dirPtr = gSystem->OpenDirectory(dirName);
+//     if (!dirPtr) {
+//             AliDebug(2,Form("Directory <%s> not found", (query.GetPath()).Data()));
+//             AliDebug(2,Form("in DB folder %s", fBaseDirectory.Data()));
+//             return kFALSE;
+//     }
+// 
+//     const char* filename;
+// 
+//     AliCDBRunRange aRunRange; // the runRange got from filename
+//     Int_t aVersion, aSubVersion; // the version and subVersion got from filename
+// 
+//     if (!query.HasVersion()) { // neither version and subversion specified -> look for highest version and subVersion
+// 
+//             while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
+// 
+//                     TString aString(filename);
+//                     if (aString == "." || aString == "..") continue;
+// 
+//                     if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;
+//                         // aRunRange, aVersion, aSubVersion filled from filename
+// 
+//                     if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
+//                     // aRunRange contains requested run!
+// 
+//                     if (result.GetVersion() < aVersion) {
+//                             result.SetVersion(aVersion);
+//                             result.SetSubVersion(aSubVersion);
+// 
+//                             result.SetFirstRun(
+//                                     aRunRange.GetFirstRun());
+//                             result.SetLastRun(
+//                                     aRunRange.GetLastRun());
+// 
+//                     } else if (result.GetVersion() == aVersion
+//                             && result.GetSubVersion()
+//                                     < aSubVersion) {
+// 
+//                             result.SetSubVersion(aSubVersion);
+// 
+//                             result.SetFirstRun(
+//                                     aRunRange.GetFirstRun());
+//                             result.SetLastRun(
+//                                     aRunRange.GetLastRun());
+//                     } else if (result.GetVersion() == aVersion
+//                             && result.GetSubVersion() == aSubVersion){
+//                                     AliDebug(2,Form("More than one object valid for run %d, version %d_%d!",
+//                                     query.GetFirstRun(), aVersion, aSubVersion));
+//                             gSystem->FreeDirectory(dirPtr);
+//                             return kFALSE;
+//                             }
+//             }
+// 
+//     } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
+// 
+//             result.SetVersion(query.GetVersion());
+// 
+//             while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
+// 
+//                         TString aString(filename);
+//                         if (aString == "." || aString == "..") continue;
+// 
+//                     if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;
+//                         // aRunRange, aVersion, aSubVersion filled from filename
+// 
+//                         if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; 
+//                     // aRunRange contains requested run!
+// 
+//                     if(query.GetVersion() != aVersion) continue;
+//                     // aVersion is requested version!
+// 
+//                     if(result.GetSubVersion() == aSubVersion){
+//                                     AliDebug(2,Form("More than one object valid for run %d, version %d_%d!",
+//                                     query.GetFirstRun(), aVersion, aSubVersion));
+//                             gSystem->FreeDirectory(dirPtr);
+//                             return kFALSE; 
+//                     }
+//                     if( result.GetSubVersion() < aSubVersion) {
+// 
+//                                 result.SetSubVersion(aSubVersion);
+// 
+//                                 result.SetFirstRun(
+//                                     aRunRange.GetFirstRun());
+//                                 result.SetLastRun(
+//                                     aRunRange.GetLastRun());
+//                     } 
+//                 }
+// 
+//     } else { // both version and subversion specified
+// 
+//             while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
+// 
+//                         TString aString(filename);
+//                         if (aString == "." || aString == "..") continue;
+// 
+//                         if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;
+//                         // aRunRange, aVersion, aSubVersion filled from filename
+// 
+//                     if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
+//                     // aRunRange contains requested run!
+// 
+//                     if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue;
+//                     // aVersion and aSubVersion are requested version and subVersion!
+// 
+//                     if(result.GetVersion() == aVersion && result.GetSubVersion() == aSubVersion){
+//                                     AliDebug(2,Form("More than one object valid for run %d, version %d_%d!",
+//                                     query.GetFirstRun(), aVersion, aSubVersion));
+//                             gSystem->FreeDirectory(dirPtr);
+//                             return kFALSE;
+//                     }
+//                     result.SetVersion(aVersion);
+//                     result.SetSubVersion(aSubVersion);
+//                     result.SetFirstRun(aRunRange.GetFirstRun());
+//                     result.SetLastRun(aRunRange.GetLastRun());
+// 
+//             }
+//     }
+// 
+//     gSystem->FreeDirectory(dirPtr);
+// 
+//     return kTRUE;
+// }
+
 //_____________________________________________________________________________
 //_____________________________________________________________________________
-Bool_t AliCDBLocal::GetId(const AliCDBId& query, AliCDBId& result) {
-// look for filename matching query (called by GetEntry)
+AliCDBId* AliCDBLocal::GetId(const AliCDBId& query) {
+// look for filename matching query (called by GetEntryId)
 
        TString dirName = Form("%s/%s", fBaseDirectory.Data(), query.GetPath().Data());
 
 
        TString dirName = Form("%s/%s", fBaseDirectory.Data(), query.GetPath().Data());
 
@@ -242,10 +371,12 @@ Bool_t AliCDBLocal::GetId(const AliCDBId& query, AliCDBId& result) {
        if (!dirPtr) {
                AliDebug(2,Form("Directory <%s> not found", (query.GetPath()).Data()));
                AliDebug(2,Form("in DB folder %s", fBaseDirectory.Data()));
        if (!dirPtr) {
                AliDebug(2,Form("Directory <%s> not found", (query.GetPath()).Data()));
                AliDebug(2,Form("in DB folder %s", fBaseDirectory.Data()));
-               return kFALSE;
+               return NULL;
        }
 
        const char* filename;
        }
 
        const char* filename;
+       AliCDBId *result = new AliCDBId();
+       result->SetPath(query.GetPath());
 
        AliCDBRunRange aRunRange; // the runRange got from filename
        Int_t aVersion, aSubVersion; // the version and subVersion got from filename
 
        AliCDBRunRange aRunRange; // the runRange got from filename
        Int_t aVersion, aSubVersion; // the version and subVersion got from filename
@@ -263,157 +394,154 @@ Bool_t AliCDBLocal::GetId(const AliCDBId& query, AliCDBId& result) {
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
-                       if (result.GetVersion() < aVersion) {
-                               result.SetVersion(aVersion);
-                               result.SetSubVersion(aSubVersion);
+                       if (result->GetVersion() < aVersion) {
+                               result->SetVersion(aVersion);
+                               result->SetSubVersion(aSubVersion);
 
 
-                               result.SetFirstRun(
+                               result->SetFirstRun(
                                        aRunRange.GetFirstRun());
                                        aRunRange.GetFirstRun());
-                               result.SetLastRun(
+                               result->SetLastRun(
                                        aRunRange.GetLastRun());
 
                                        aRunRange.GetLastRun());
 
-                       } else if (result.GetVersion() == aVersion 
-                               && result.GetSubVersion() 
+                       } else if (result->GetVersion() == aVersion
+                               && result->GetSubVersion()
                                        < aSubVersion) {
 
                                        < aSubVersion) {
 
-                               result.SetSubVersion(aSubVersion);
+                               result->SetSubVersion(aSubVersion);
 
 
-                               result.SetFirstRun(
+                               result->SetFirstRun(
                                        aRunRange.GetFirstRun());
                                        aRunRange.GetFirstRun());
-                               result.SetLastRun(
+                               result->SetLastRun(
                                        aRunRange.GetLastRun());
                                        aRunRange.GetLastRun());
-                       } else if (result.GetVersion() == aVersion
-                               && result.GetSubVersion() == aSubVersion){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
+                       } else if (result->GetVersion() == aVersion
+                               && result->GetSubVersion() == aSubVersion){
+                               AliError(Form("More than one object valid for run %d, version %d_%d!",
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                gSystem->FreeDirectory(dirPtr);
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                gSystem->FreeDirectory(dirPtr);
-                               return kFALSE; 
+                               delete result;
+                               return NULL;
                                }
                }
                                }
                }
-               
+
        } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
 
        } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
 
-               result.SetVersion(query.GetVersion());
+               result->SetVersion(query.GetVersion());
 
                while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
 
                         TString aString(filename);
                         if (aString == "." || aString == "..") continue;
 
 
                while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
 
                         TString aString(filename);
                         if (aString == "." || aString == "..") continue;
 
-                       if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;       
+                       if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
 
                         if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; 
                        // aRunRange contains requested run!
                         // aRunRange, aVersion, aSubVersion filled from filename
 
                         if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; 
                        // aRunRange contains requested run!
-                       
+
                        if(query.GetVersion() != aVersion) continue;
                        // aVersion is requested version!
                        if(query.GetVersion() != aVersion) continue;
                        // aVersion is requested version!
-                       
-                       if(result.GetSubVersion() == aSubVersion){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
+
+                       if(result->GetSubVersion() == aSubVersion){
+                               AliError(Form("More than one object valid for run %d, version %d_%d!",
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                gSystem->FreeDirectory(dirPtr);
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                gSystem->FreeDirectory(dirPtr);
-                               return kFALSE; 
+                               delete result;
+                               return NULL;
                        }
                        }
-                       if( result.GetSubVersion() < aSubVersion) {
+                       if( result->GetSubVersion() < aSubVersion) {
 
 
-                                result.SetSubVersion(aSubVersion);
+                                result->SetSubVersion(aSubVersion);
 
 
-                                result.SetFirstRun(
+                                result->SetFirstRun(
                                        aRunRange.GetFirstRun());
                                        aRunRange.GetFirstRun());
-                                result.SetLastRun(
+                                result->SetLastRun(
                                        aRunRange.GetLastRun());
                        } 
                 }
 
        } else { // both version and subversion specified
 
                                        aRunRange.GetLastRun());
                        } 
                 }
 
        } else { // both version and subversion specified
 
-               while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
+               //AliCDBId dataId(queryId.GetAliCDBPath(), -1, -1, -1, -1);
+        //Bool_t result;
+       while ((filename = gSystem->GetDirEntry(dirPtr))) { // loop on files
 
                         TString aString(filename);
                         if (aString == "." || aString == "..") continue;
 
                         if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
 
                         TString aString(filename);
                         if (aString == "." || aString == "..") continue;
 
                         if (!FilenameToId(filename, aRunRange, aVersion, aSubVersion)) continue;
                         // aRunRange, aVersion, aSubVersion filled from filename
-                       
+
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
                        // aRunRange contains requested run!
 
-                       if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue; 
+                       if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue;
                        // aVersion and aSubVersion are requested version and subVersion!
                        // aVersion and aSubVersion are requested version and subVersion!
-                       
-                       if(result.GetVersion() == aVersion && result.GetSubVersion() == aSubVersion){
-                               AliDebug(2,Form("More than one object valid for run %d, version %d_%d!", 
+
+                       if(result->GetVersion() == aVersion && result->GetSubVersion() == aSubVersion){
+                               AliError(Form("More than one object valid for run %d, version %d_%d!",
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                gSystem->FreeDirectory(dirPtr);
                                        query.GetFirstRun(), aVersion, aSubVersion));
                                gSystem->FreeDirectory(dirPtr);
-                               return kFALSE; 
+                               delete result;
+                               return NULL;
                        }
                        }
-                       result.SetVersion(aVersion);
-                       result.SetSubVersion(aSubVersion);
-                       result.SetFirstRun(aRunRange.GetFirstRun());
-                       result.SetLastRun(aRunRange.GetLastRun());
+                       result->SetVersion(aVersion);
+                       result->SetSubVersion(aSubVersion);
+                       result->SetFirstRun(aRunRange.GetFirstRun());
+                       result->SetLastRun(aRunRange.GetLastRun());
                        
                }
        }
 
        gSystem->FreeDirectory(dirPtr);
 
                        
                }
        }
 
        gSystem->FreeDirectory(dirPtr);
 
-       return kTRUE;
+       return result;
 }
 
 //_____________________________________________________________________________
 AliCDBEntry* AliCDBLocal::GetEntry(const AliCDBId& queryId) {
 // get AliCDBEntry from the database
 
 }
 
 //_____________________________________________________________________________
 AliCDBEntry* AliCDBLocal::GetEntry(const AliCDBId& queryId) {
 // get AliCDBEntry from the database
 
-       AliCDBId dataId(queryId.GetAliCDBPath(), -1, -1, -1, -1);
-        Bool_t result;
-
-       // look for a filename matching query requests (path, runRange, version, subVersion)
-       if (!queryId.HasVersion()) {
-               // if version is not specified, first check the selection criteria list
-               AliCDBId selectedId(queryId);
-               GetSelection(&selectedId);
-               result = GetId(selectedId, dataId);
-       } else {
-               result = GetId(queryId, dataId);
-       }
+       AliCDBId* dataId = GetEntryId(queryId);
 
 
-       if (!result || !dataId.IsSpecified()) return NULL;
+       if (!dataId || !dataId->IsSpecified()) return NULL;
 
        TString filename;
 
        TString filename;
-       if (!IdToFilename(dataId, filename)) {
+       if (!IdToFilename(*dataId, filename)) {
 
                AliDebug(2,Form("Bad data ID encountered! Subnormal error!"));
 
                AliDebug(2,Form("Bad data ID encountered! Subnormal error!"));
-                return NULL;
+               delete dataId;
+               return NULL;
        }
 
        TFile file(filename, "READ"); // open file
        if (!file.IsOpen()) {
                AliDebug(2,Form("Can't open file <%s>!", filename.Data()));
        }
 
        TFile file(filename, "READ"); // open file
        if (!file.IsOpen()) {
                AliDebug(2,Form("Can't open file <%s>!", filename.Data()));
-                return NULL;
+               delete dataId;
+               return NULL;
        }
 
        // get the only AliCDBEntry object from the file
        // the object in the file is an AliCDBEntry entry named "AliCDBEntry"
        }
 
        // get the only AliCDBEntry object from the file
        // the object in the file is an AliCDBEntry entry named "AliCDBEntry"
-       
+
        AliCDBEntry* anEntry = dynamic_cast<AliCDBEntry*> (file.Get("AliCDBEntry"));
        if (!anEntry) {
                AliDebug(2,Form("Bad storage data: No AliCDBEntry in file!"));
                file.Close();
        AliCDBEntry* anEntry = dynamic_cast<AliCDBEntry*> (file.Get("AliCDBEntry"));
        if (!anEntry) {
                AliDebug(2,Form("Bad storage data: No AliCDBEntry in file!"));
                file.Close();
+               delete dataId;
                return NULL;
        }
 
                return NULL;
        }
 
-       AliCDBId entryId = anEntry->GetId();
+       AliCDBId& entryId = anEntry->GetId();
 
        // The object's Id are not reset during storage
        // If object's Id runRange or version do not match with filename,
        // it means that someone renamed file by hand. In this case a warning msg is issued.
 
        anEntry-> SetLastStorage("local");
 
        // The object's Id are not reset during storage
        // If object's Id runRange or version do not match with filename,
        // it means that someone renamed file by hand. In this case a warning msg is issued.
 
        anEntry-> SetLastStorage("local");
-       if(!entryId.IsEqual(&dataId)){
+
+       if(!entryId.IsEqual(dataId)){
                AliWarning(Form("Mismatch between file name and object's Id!"));
                AliWarning(Form("Mismatch between file name and object's Id!"));
-               AliWarning(Form("File name: %s", dataId.ToString().Data()));
+               AliWarning(Form("File name: %s", dataId->ToString().Data()));
                AliWarning(Form("Object's Id: %s", entryId.ToString().Data()));
         }
 
                AliWarning(Form("Object's Id: %s", entryId.ToString().Data()));
         }
 
@@ -422,9 +550,34 @@ AliCDBEntry* AliCDBLocal::GetEntry(const AliCDBId& queryId) {
 
        // close file, return retieved entry
        file.Close();
 
        // close file, return retieved entry
        file.Close();
+       delete dataId;
        return anEntry;
 }
 
        return anEntry;
 }
 
+//_____________________________________________________________________________
+AliCDBId* AliCDBLocal::GetEntryId(const AliCDBId& queryId) {
+// get AliCDBId from the database
+
+       AliCDBId* dataId = 0;
+
+       // look for a filename matching query requests (path, runRange, version, subVersion)
+       if (!queryId.HasVersion()) {
+               // if version is not specified, first check the selection criteria list
+               AliCDBId selectedId(queryId);
+               GetSelection(&selectedId);
+               dataId = GetId(selectedId);
+       } else {
+               dataId = GetId(queryId);
+       }
+
+       if (dataId && !dataId->IsSpecified()) {
+               delete dataId;
+               return NULL;
+       }
+
+       return dataId;
+}
+
 //_____________________________________________________________________________
 void AliCDBLocal::GetEntriesForLevel0(const char* level0,
        const AliCDBId& queryId, TList* result) {
 //_____________________________________________________________________________
 void AliCDBLocal::GetEntriesForLevel0(const char* level0,
        const AliCDBId& queryId, TList* result) {
@@ -707,11 +860,14 @@ Int_t AliCDBLocal::GetLatestVersion(const char* path, Int_t run){
        }
 
        AliCDBId query(path, run, run, -1, -1);
        }
 
        AliCDBId query(path, run, run, -1, -1);
-       AliCDBId dataId;
+       AliCDBId* dataId = GetId(query);
+
+       if(!dataId) return -1;
 
 
-       GetId(query,dataId);
+       Int_t version = dataId->GetVersion();
+       delete dataId;
 
 
-       return dataId.GetVersion();
+       return version;
 
 }
 
 
 }
 
@@ -726,11 +882,14 @@ Int_t AliCDBLocal::GetLatestSubVersion(const char* path, Int_t run, Int_t versio
        }
 
        AliCDBId query(path, run, run, version, -1);
        }
 
        AliCDBId query(path, run, run, version, -1);
-       AliCDBId dataId;
+       AliCDBId *dataId = GetId(query);
+
+       if(!dataId) return -1;
 
 
-       GetId(query,dataId);
+       Int_t subVersion = dataId->GetSubVersion();
 
 
-       return dataId.GetSubVersion();
+       delete dataId;
+       return subVersion;
 
 }
 
 
 }
 
@@ -767,7 +926,7 @@ AliCDBParam* AliCDBLocalFactory::CreateParameter(const char* dbString) {
                pathname.Prepend(TString(gSystem->WorkingDirectory()) + '/');
        }
 
                pathname.Prepend(TString(gSystem->WorkingDirectory()) + '/');
        }
 
-       return new AliCDBLocalParam(pathname);       
+       return new AliCDBLocalParam(pathname);
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
index 8997905bc84f34ecd2ae8f99535844a8426ad6b8..3113d47776cd9e089fbbd23a432d5b87c9ac7822 100644 (file)
@@ -29,6 +29,7 @@ public:
 protected:
 
        virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
 protected:
 
        virtual AliCDBEntry*    GetEntry(const AliCDBId& queryId);
+       virtual AliCDBId*       GetEntryId(const AliCDBId& queryId);
         virtual TList*                 GetEntries(const AliCDBId& queryId);
         virtual Bool_t                 PutEntry(AliCDBEntry* entry);
        virtual TList*          GetIdListFromFile(const char* fileName);
         virtual TList*                 GetEntries(const AliCDBId& queryId);
         virtual Bool_t                 PutEntry(AliCDBEntry* entry);
        virtual TList*          GetIdListFromFile(const char* fileName);
@@ -44,7 +45,8 @@ private:
                        Int_t& version, Int_t& subVersion);
 
        Bool_t PrepareId(AliCDBId& id);
                        Int_t& version, Int_t& subVersion);
 
        Bool_t PrepareId(AliCDBId& id);
-       Bool_t GetId(const AliCDBId& query, AliCDBId& result);
+//     Bool_t GetId(const AliCDBId& query, AliCDBId& result);
+       AliCDBId* GetId(const AliCDBId& query);
 
        virtual void QueryValidFiles();
 
 
        virtual void QueryValidFiles();
 
index 7bac82ca2915debb39bc4e2257d279cc70bfda2a..8309231424c7510bb4f6b66827724db417059f86 100644 (file)
@@ -65,6 +65,8 @@ void AliCDBManager::Init() {
                fCondParam = CreateParameter(fgkCondUri);
                fRefParam = CreateParameter(fgkRefUri);
        }
                fCondParam = CreateParameter(fgkCondUri);
                fRefParam = CreateParameter(fgkRefUri);
        }
+
+       InitShortLived();
 }
 //_____________________________________________________________________________
 void AliCDBManager::Destroy() {
 }
 //_____________________________________________________________________________
 void AliCDBManager::Destroy() {
@@ -86,10 +88,12 @@ AliCDBManager::AliCDBManager():
   fActiveStorages(),
   fSpecificStorages(),
   fDefaultStorage(NULL),
   fActiveStorages(),
   fSpecificStorages(),
   fDefaultStorage(NULL),
+  fRemoteStorage(NULL),
   fDrainStorage(NULL),
   fEntryCache(),
   fCache(kTRUE),
   fDrainStorage(NULL),
   fEntryCache(),
   fCache(kTRUE),
-  fRun(-1)
+  fRun(-1),
+  fShortLived(0)
 {
 // default constuctor
        fFactories.SetOwner(1);
 {
 // default constuctor
        fFactories.SetOwner(1);
@@ -106,8 +110,10 @@ AliCDBManager::~AliCDBManager() {
        fFactories.Delete();
        fDrainStorage = 0x0;
        fDefaultStorage = 0x0;
        fFactories.Delete();
        fDrainStorage = 0x0;
        fDefaultStorage = 0x0;
+       fRemoteStorage = 0x0;
        delete fCondParam;
        delete fRefParam;
        delete fCondParam;
        delete fRefParam;
+       delete fShortLived; fShortLived = 0x0;
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
@@ -278,16 +284,40 @@ void AliCDBManager::SetDefaultStorage(const char* dbString) {
 //_____________________________________________________________________________
 void AliCDBManager::SetDefaultStorage(const AliCDBParam* param) {
 // set default storage from AliCDBParam object
 //_____________________________________________________________________________
 void AliCDBManager::SetDefaultStorage(const AliCDBParam* param) {
 // set default storage from AliCDBParam object
-       
+
        fDefaultStorage = GetStorage(param);
 }
 
 //_____________________________________________________________________________
 void AliCDBManager::SetDefaultStorage(AliCDBStorage* storage) {
 // set default storage from another active storage
        fDefaultStorage = GetStorage(param);
 }
 
 //_____________________________________________________________________________
 void AliCDBManager::SetDefaultStorage(AliCDBStorage* storage) {
 // set default storage from another active storage
-       
+
        fDefaultStorage = storage;
 }
        fDefaultStorage = storage;
 }
+//_____________________________________________________________________________
+void AliCDBManager::SetRemoteStorage(const char* dbString) {
+// sets remote storage from URI string
+// Remote storage is queried if it is activated and if object was not found in default storage
+
+       AliInfo(Form("Setting Default storage to: %s",dbString));
+       fRemoteStorage = GetStorage(dbString);
+}
+
+//_____________________________________________________________________________
+void AliCDBManager::SetRemoteStorage(const AliCDBParam* param) {
+// set remote storage from AliCDBParam object
+// Remote storage is queried if it is activated and if object was not found in default storage
+
+       fRemoteStorage = GetStorage(param);
+}
+
+//_____________________________________________________________________________
+void AliCDBManager::SetRemoteStorage(AliCDBStorage* storage) {
+// set remote storage from another active storage
+// Remote storage is queried if it is activated and if object was not found in default storage
+
+       fRemoteStorage = storage;
+}
 
 //_____________________________________________________________________________
 void AliCDBManager::SetSpecificStorage(const char* calibType, const char* dbString) {
 
 //_____________________________________________________________________________
 void AliCDBManager::SetSpecificStorage(const char* calibType, const char* dbString) {
@@ -372,7 +402,7 @@ AliCDBParam* AliCDBManager::SelectSpecificStorage(const TString& path) {
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, Int_t runNumber, 
+AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, Int_t runNumber,
        Int_t version, Int_t subVersion) {
 // get an AliCDBEntry object from the database
 
        Int_t version, Int_t subVersion) {
 // get an AliCDBEntry object from the database
 
@@ -389,7 +419,7 @@ AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, Int_t runNumber,
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, 
+AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path,
        const AliCDBRunRange& runRange, Int_t version,
        Int_t subVersion) {
 // get an AliCDBEntry object from the database!
        const AliCDBRunRange& runRange, Int_t version,
        Int_t subVersion) {
 // get an AliCDBEntry object from the database!
@@ -398,7 +428,7 @@ AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path,
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {       
+AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {
 // get an AliCDBEntry object from the database
        
        if(!fDefaultStorage) {
 // get an AliCDBEntry object from the database
        
        if(!fDefaultStorage) {
@@ -415,12 +445,12 @@ AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {
        
        // query is not specified if path contains wildcard or run range= [-1,-1]
        if (!query.IsSpecified()) {
        
        // query is not specified if path contains wildcard or run range= [-1,-1]
        if (!query.IsSpecified()) {
-               AliError(Form("Unspecified query: %s", 
+               AliError(Form("Unspecified query: %s",
                                query.ToString().Data()));
                 return NULL;
        }
 
                                query.ToString().Data()));
                 return NULL;
        }
 
-       if(fCache && query.GetFirstRun() != fRun)
+       if(fCache && query.GetFirstRun() != fRun)
                AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
 
 
                AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
 
 
@@ -438,26 +468,116 @@ AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {
        // Entry is not in cache -> retrieve it from CDB and cache it!!
        AliCDBStorage *aStorage=0;
        AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
        // Entry is not in cache -> retrieve it from CDB and cache it!!
        AliCDBStorage *aStorage=0;
        AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
+       Bool_t usedDefStorage=kTRUE;
 
        if(aPar) {
                aStorage=GetStorage(aPar);
                TString str = aPar->GetURI();
                AliDebug(2,Form("Looking into storage: %s",str.Data()));
 
        if(aPar) {
                aStorage=GetStorage(aPar);
                TString str = aPar->GetURI();
                AliDebug(2,Form("Looking into storage: %s",str.Data()));
-               
+               usedDefStorage=kFALSE;
+
        } else {
                aStorage=GetDefaultStorage();
                AliDebug(2,"Looking into default storage");
        }
        } else {
                aStorage=GetDefaultStorage();
                AliDebug(2,"Looking into default storage");
        }
-                       
+
        entry = aStorage->Get(query);
        entry = aStorage->Get(query);
-       if (!entry) return NULL;
 
 
-       if(fCache && (query.GetFirstRun() == fRun)){
+       if (!entry && usedDefStorage && IsRemoteStorageSet()) {
+               AliWarning(Form("Object not found in default storage: Looking into remote storage!"));
+               entry = fRemoteStorage->Get(query);
+       }
+
+       if(entry && fCache && (query.GetFirstRun() == fRun)){
                CacheEntry(query.GetPath(), entry);
        }
 
        return entry;
                CacheEntry(query.GetPath(), entry);
        }
 
        return entry;
+
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBManager::GetId(const AliCDBPath& path, Int_t runNumber,
+       Int_t version, Int_t subVersion) {
+// get the AliCDBId of the valid object from the database (does not retrieve the object)
+// User must delete returned object!
+
+       if(runNumber < 0){
+               // RunNumber is not specified. Try with fRun
+               if (fRun < 0){
+                       AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
+                       return NULL;
+               }
+               runNumber = fRun;
+       }
+
+       return GetId(AliCDBId(path, runNumber, runNumber, version, subVersion));
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBManager::GetId(const AliCDBPath& path,
+       const AliCDBRunRange& runRange, Int_t version,
+       Int_t subVersion) {
+// get the AliCDBId of the valid object from the database (does not retrieve the object)
+// User must delete returned object!
+
+       return GetId(AliCDBId(path, runRange, version, subVersion));
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBManager::GetId(const AliCDBId& query) {
+// get the AliCDBId of the valid object from the database (does not retrieve the object)
+// User must delete returned object!
+
+       if(!fDefaultStorage) {
+               AliError("No storage set!");
+               return NULL;
+       }
+
+       // check if query's path and runRange are valid
+       // query is invalid also if version is not specified and subversion is!
+       if (!query.IsValid()) {
+               AliError(Form("Invalid query: %s", query.ToString().Data()));
+               return NULL;
+       }
+       
+       // query is not specified if path contains wildcard or run range= [-1,-1]
+       if (!query.IsSpecified()) {
+               AliError(Form("Unspecified query: %s",
+                               query.ToString().Data()));
+                return NULL;
+       }
+
+       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());
+
+       if(entry) {
+               AliDebug(2, Form("Object %s retrieved from cache !!",query.GetPath().Data()));
+               return dynamic_cast<AliCDBId*> (entry->GetId().Clone());
+       }
+
+       // Entry is not in cache -> retrieve it from CDB and cache it!!
+       AliCDBStorage *aStorage=0;
+       AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
+
+       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");
+       }
+
+       return aStorage->GetId(query);
+
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
@@ -835,6 +955,61 @@ const char* AliCDBManager::GetDataTypeName(DataType type)
 
 }
 
 
 }
 
+//______________________________________________________________________________________________
+void AliCDBManager::InitShortLived()
+{
+  // Init the list of short-lived objects
+  // currently disabled
+
+       fShortLived=0x0;
+
+//     fShortLived = new TList();
+//     fShortLived->SetOwner(1);
+//
+//     fShortLived->Add(new TObjString("EMCAL/Calib/Data"));
+// 
+//     fShortLived->Add(new TObjString("HMPID/Calib/Nmean"));
+//     fShortLived->Add(new TObjString("HMPID/Calib/Qthre"));
+// 
+//     fShortLived->Add(new TObjString("ITS/Calib/CalibSPD"));
+// 
+//     fShortLived->Add(new TObjString("MUON/Calib/Gains"));
+//     fShortLived->Add(new TObjString("MUON/Calib/HV"));
+//     fShortLived->Add(new TObjString("MUON/Calib/Pedestals"));
+// 
+//     fShortLived->Add(new TObjString("PHOS/Calib/CpvGainPedestals"));
+//     fShortLived->Add(new TObjString("PHOS/Calib/EmcGainPedestals"));
+// 
+//     fShortLived->Add(new TObjString("PMD/Calib/Data"));
+// 
+//     fShortLived->Add(new TObjString("TRD/Calib/ChamberGainFactor"));
+//     fShortLived->Add(new TObjString("TRD/Calib/LocalGainFactor"));
+//     fShortLived->Add(new TObjString("TRD/Calib/ChamberT0"));
+//     fShortLived->Add(new TObjString("TRD/Calib/LocalT0"));
+//     fShortLived->Add(new TObjString("TRD/Calib/ChamberVdrift"));
+//     fShortLived->Add(new TObjString("TRD/Calib/LocalVdrift"));
+// 
+//     fShortLived->Add(new TObjString("ZDC/Calib/Data"));
+
+}
+
+//______________________________________________________________________________________________
+Bool_t AliCDBManager::IsShortLived(const char* path)
+{
+  // returns the name (string) of the data type
+
+       if(!fShortLived) return kFALSE;
+
+       AliCDBPath aPath(path);
+       if(!aPath.IsValid()){
+               AliError(Form("Not a valid path: %s", path));
+               return kFALSE;
+       }
+
+       return fShortLived->Contains(path);
+
+}
+
 ///////////////////////////////////////////////////////////
 // AliCDBManager Parameter class                         //
 // interface to specific AliCDBParameter class           //
 ///////////////////////////////////////////////////////////
 // AliCDBManager Parameter class                         //
 // interface to specific AliCDBParameter class           //
index 6ce8efeb771ec31b36d126fc06cf361011a4eb20..a5f72a0fcf418d457b52235981a53e9359aeb5c8 100644 (file)
@@ -45,11 +45,19 @@ class AliCDBManager: public TObject {
        void SetDefaultStorage(const char* dbString);
        void SetDefaultStorage(const AliCDBParam* param);
        void SetDefaultStorage(AliCDBStorage *storage);
        void SetDefaultStorage(const char* dbString);
        void SetDefaultStorage(const AliCDBParam* param);
        void SetDefaultStorage(AliCDBStorage *storage);
-       
+
        Bool_t IsDefaultStorageSet() const {return fDefaultStorage != 0;}
        AliCDBStorage* GetDefaultStorage() const {return fDefaultStorage;}
        void UnsetDefaultStorage() {fDefaultStorage = 0x0;}
 
        Bool_t IsDefaultStorageSet() const {return fDefaultStorage != 0;}
        AliCDBStorage* GetDefaultStorage() const {return fDefaultStorage;}
        void UnsetDefaultStorage() {fDefaultStorage = 0x0;}
 
+       void SetRemoteStorage(const char* dbString);
+       void SetRemoteStorage(const AliCDBParam* param);
+       void SetRemoteStorage(AliCDBStorage *storage);
+
+       Bool_t IsRemoteStorageSet() const {return fRemoteStorage != 0;}
+       AliCDBStorage* GetRemoteStorage() const {return fRemoteStorage;}
+       void UnsetRemoteStorage() {fRemoteStorage = 0x0;}
+
        void SetSpecificStorage(const char* calibType, const char* dbString);
        void SetSpecificStorage(const char* calibType, AliCDBParam* param);
 
        void SetSpecificStorage(const char* calibType, const char* dbString);
        void SetSpecificStorage(const char* calibType, AliCDBParam* param);
 
@@ -71,6 +79,12 @@ class AliCDBManager: public TObject {
        AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
                                 Int_t version = -1, Int_t subVersion = -1);
 
        AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
                                 Int_t version = -1, Int_t subVersion = -1);
 
+       AliCDBId* GetId(const AliCDBId& query);
+       AliCDBId* GetId(const AliCDBPath& path, Int_t runNumber=-1,
+                               Int_t version = -1, Int_t subVersion = -1);
+       AliCDBId* GetId(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=-1,
                                Int_t version = -1, Int_t subVersion = -1);
        TList* GetAll(const AliCDBId& query);
        TList* GetAll(const AliCDBPath& path, Int_t runNumber=-1,
                                Int_t version = -1, Int_t subVersion = -1);
@@ -87,8 +101,6 @@ class AliCDBManager: public TObject {
        void SetRun(Int_t run);
        Int_t GetRun() const {return fRun;}
 
        void SetRun(Int_t run);
        Int_t GetRun() const {return fRun;}
 
-       // AliCDBEntry* Get(const char* path);
-
        void DestroyActiveStorages();
        void DestroyActiveStorage(AliCDBStorage* storage);
 
        void DestroyActiveStorages();
        void DestroyActiveStorage(AliCDBStorage* storage);
 
@@ -102,6 +114,8 @@ class AliCDBManager: public TObject {
        void ClearCache();
        void UnloadFromCache(const char* path);
 
        void ClearCache();
        void UnloadFromCache(const char* path);
 
+       Bool_t IsShortLived(const char* path);
+
        static AliCDBManager* Instance();
 
  private:
        static AliCDBManager* Instance();
 
  private:
@@ -126,12 +140,15 @@ class AliCDBManager: public TObject {
        
 
        void Init();
        
 
        void Init();
-       
+       void InitShortLived();
+
+
        TList fFactories;               //! list of registered storage factories
        TMap fActiveStorages;           //! list of active storages
        TMap fSpecificStorages;         //! list of detector-specific storages
 
        AliCDBStorage *fDefaultStorage; //! pointer to default storage
        TList fFactories;               //! list of registered storage factories
        TMap fActiveStorages;           //! list of active storages
        TMap fSpecificStorages;         //! list of detector-specific storages
 
        AliCDBStorage *fDefaultStorage; //! pointer to default storage
+       AliCDBStorage *fRemoteStorage;  //! pointer to remote storage
        AliCDBStorage *fDrainStorage;   //! pointer to drain storage
 
        TMap fEntryCache;       //! cache of the retrieved objects
        AliCDBStorage *fDrainStorage;   //! pointer to drain storage
 
        TMap fEntryCache;       //! cache of the retrieved objects
@@ -139,6 +156,8 @@ class AliCDBManager: public TObject {
        Bool_t fCache;                  //! The cache flag
        Int_t fRun;                     //! The run number
 
        Bool_t fCache;                  //! The cache flag
        Int_t fRun;                     //! The run number
 
+       TList* fShortLived;     //! List of short lived objects
+
        ClassDef(AliCDBManager, 0);
 };
 
        ClassDef(AliCDBManager, 0);
 };
 
index c0f986f53e615b0725c941b522a1e321a4628c5e..390fd825ae970944126d80ccec6bd39fb15c8996 100644 (file)
@@ -251,7 +251,27 @@ Bool_t AliCDBPath::Level2Comprises(const TString& str) const {
 Bool_t AliCDBPath::Comprises(const AliCDBPath& other) const {
 // check if path is wildcard and comprises other
 
 Bool_t AliCDBPath::Comprises(const AliCDBPath& other) const {
 // check if path is wildcard and comprises other
 
-       return Level0Comprises(other.fLevel0) 
+       return Level0Comprises(other.fLevel0)
                && Level1Comprises(other.fLevel1)
                && Level2Comprises(other.fLevel2);
 }
                && Level1Comprises(other.fLevel1)
                && Level2Comprises(other.fLevel2);
 }
+
+//_____________________________________________________________________________
+const char* AliCDBPath::GetLevel(Int_t i) const {
+// return level i of the path
+
+       switch (i) {
+               case 0:
+                       return fLevel0.Data();
+                       break;
+               case 1:
+                       return fLevel1.Data();
+                       break;
+               case 2:
+                       return fLevel2.Data();
+                       break;
+               default:
+                       return 0;
+       }
+
+}
index 5ca8d32b722ecb04f32b5bfe1e7df2824a4f9c03..755f6633e5f706e8e37a9ac7262a2eeb33304d91 100644 (file)
@@ -35,16 +35,14 @@ public:
        virtual ~AliCDBPath();
 
 
        virtual ~AliCDBPath();
 
 
-       const TString& GetPath() const {return fPath;};
-       void  SetPath(const char* path) {fPath=path; InitPath();};
+       const TString& GetPath() const {return fPath;}
+       void  SetPath(const char* path) {fPath=path; InitPath();}
 
 
-       const TString& GetLevel0() const {return fLevel0;};
-       const TString& GetLevel1() const {return fLevel1;};
-       const TString& GetLevel2() const {return fLevel2;};
+       const char* GetLevel(Int_t i) const;
 
 
-       Bool_t IsValid() const {return fIsValid;};
+       Bool_t IsValid() const {return fIsValid;}
 
 
-       Bool_t IsWildcard() const {return fIsWildcard;};
+       Bool_t IsWildcard() const {return fIsWildcard;}
 
        Bool_t Level0Comprises(const TString& str) const;
        Bool_t Level1Comprises(const TString& str) const;
 
        Bool_t Level0Comprises(const TString& str) const;
        Bool_t Level1Comprises(const TString& str) const;
index a69e7e5d6de670d7ff79af69339ba002da191727..16283e4d30cbf686df179803068731696334f882 100644 (file)
@@ -203,7 +203,7 @@ void AliCDBStorage::PrintSelectionList(){
 //_____________________________________________________________________________
 AliCDBEntry* AliCDBStorage::Get(const AliCDBId& query) {
 // get an AliCDBEntry object from the database
 //_____________________________________________________________________________
 AliCDBEntry* AliCDBStorage::Get(const AliCDBId& query) {
 // get an AliCDBEntry object from the database
-       
+
        // check if query's path and runRange are valid
        // query is invalid also if version is not specified and subversion is!
        if (!query.IsValid()) {
        // check if query's path and runRange are valid
        // query is invalid also if version is not specified and subversion is!
        if (!query.IsValid()) {
@@ -211,9 +211,9 @@ AliCDBEntry* AliCDBStorage::Get(const AliCDBId& query) {
                return NULL;
        }
 
                return NULL;
        }
 
-       // query is not specified if path contains wildcard or runrange = [-1,-1] 
+       // query is not specified if path contains wildcard or runrange = [-1,-1]
        if (!query.IsSpecified()) {
        if (!query.IsSpecified()) {
-               AliError(Form("Unspecified query: %s", 
+               AliError(Form("Unspecified query: %s",
                                query.ToString().Data()));
                 return NULL;
        }
                                query.ToString().Data()));
                 return NULL;
        }
@@ -245,7 +245,7 @@ AliCDBEntry* AliCDBStorage::Get(const AliCDBId& query) {
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path, Int_t runNumber, 
+AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path, Int_t runNumber,
        Int_t version, Int_t subVersion) {
 // get an AliCDBEntry object from the database
 
        Int_t version, Int_t subVersion) {
 // get an AliCDBEntry object from the database
 
@@ -253,7 +253,7 @@ AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path, Int_t runNumber,
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path, 
+AliCDBEntry* AliCDBStorage::Get(const AliCDBPath& path,
        const AliCDBRunRange& runRange, Int_t version,
        Int_t subVersion) {
 // get an AliCDBEntry object from the database
        const AliCDBRunRange& runRange, Int_t version,
        Int_t subVersion) {
 // get an AliCDBEntry object from the database
@@ -325,6 +325,45 @@ TList* AliCDBStorage::GetAll(const AliCDBPath& path,
        return GetAll(AliCDBId(path, runRange, version, subVersion));
 }
 
        return GetAll(AliCDBId(path, runRange, version, subVersion));
 }
 
+//_____________________________________________________________________________
+AliCDBId* AliCDBStorage::GetId(const AliCDBId& query) {
+// get the Id of the valid object from the database (does not open the file)
+
+       // check if query's path and runRange are valid
+       // query is invalid also if version is not specified and subversion is!
+       if (!query.IsValid()) {
+               AliError(Form("Invalid query: %s", query.ToString().Data()));
+               return NULL;
+       }
+
+       // query is not specified if path contains wildcard or runrange = [-1,-1]
+       if (!query.IsSpecified()) {
+               AliError(Form("Unspecified query: %s",
+                               query.ToString().Data()));
+                return NULL;
+       }
+
+       AliCDBId* id = GetEntryId(query);
+
+       return id;
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBStorage::GetId(const AliCDBPath& path, Int_t runNumber,
+       Int_t version, Int_t subVersion) {
+// get the Id of the valid object from the database (does not open the file)
+
+       return GetId(AliCDBId(path, runNumber, runNumber, version, subVersion));
+}
+
+//_____________________________________________________________________________
+AliCDBId* AliCDBStorage::GetId(const AliCDBPath& path,
+       const AliCDBRunRange& runRange, Int_t version,
+       Int_t subVersion) {
+// get the Id of the valid object from the database (does not open the file)
+
+       return GetId(AliCDBId(path, runRange, version, subVersion));
+}
 
 //_____________________________________________________________________________
 Bool_t AliCDBStorage::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, AliCDBManager::DataType type) {
 
 //_____________________________________________________________________________
 Bool_t AliCDBStorage::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData, AliCDBManager::DataType type) {
index 312a5f709244d407b03f8218cc65faa3ab1f27a7..d8c3fcf558c93ab90032075affff043d01013c30 100644 (file)
@@ -67,7 +67,7 @@ public:
        void PrintSelectionList();
 
        AliCDBEntry* Get(const AliCDBId& query);
        void PrintSelectionList();
 
        AliCDBEntry* Get(const AliCDBId& query);
-       AliCDBEntry* Get(const AliCDBPath& path, Int_t runNumber, 
+       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);
                                Int_t version = -1, Int_t subVersion = -1);
        AliCDBEntry* Get(const AliCDBPath& path, const AliCDBRunRange& runRange,
                                 Int_t version = -1, Int_t subVersion = -1);
@@ -78,6 +78,12 @@ public:
        TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
                                 Int_t version = -1, Int_t subVersion = -1);
        
        TList* GetAll(const AliCDBPath& path, const AliCDBRunRange& runRange,
                                 Int_t version = -1, Int_t subVersion = -1);
        
+       AliCDBId* GetId(const AliCDBId& query);
+       AliCDBId* GetId(const AliCDBPath& path, Int_t runNumber,
+                               Int_t version = -1, Int_t subVersion = -1);
+       AliCDBId* GetId(const AliCDBPath& path, const AliCDBRunRange& runRange,
+                                Int_t version = -1, Int_t subVersion = -1);
+
        Bool_t Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData,
                                AliCDBManager::DataType type=AliCDBManager::kPrivate);
        Bool_t Put(AliCDBEntry* entry, AliCDBManager::DataType type=AliCDBManager::kPrivate);
        Bool_t Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData,
                                AliCDBManager::DataType type=AliCDBManager::kPrivate);
        Bool_t Put(AliCDBEntry* entry, AliCDBManager::DataType type=AliCDBManager::kPrivate);
@@ -100,6 +106,7 @@ protected:
        virtual ~AliCDBStorage();
        void    GetSelection(/*const*/ AliCDBId* id);
        virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
        virtual ~AliCDBStorage();
        void    GetSelection(/*const*/ AliCDBId* id);
        virtual AliCDBEntry* GetEntry(const AliCDBId& query) = 0;
+       virtual AliCDBId* GetEntryId(const AliCDBId& query) = 0;
        virtual TList* GetEntries(const AliCDBId& query) = 0;
        virtual Bool_t PutEntry(AliCDBEntry* entry) = 0;
        virtual TList *GetIdListFromFile(const char* fileName)=0;
        virtual TList* GetEntries(const AliCDBId& query) = 0;
        virtual Bool_t PutEntry(AliCDBEntry* entry) = 0;
        virtual TList *GetIdListFromFile(const char* fileName)=0;