]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBManager.cxx
Modified classes for ODCB access in AliReconstruction, and the file
[u/mrichter/AliRoot.git] / STEER / AliCDBManager.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 //-------------------------------------------------------------------------
16 //   Implementation of AliCDBManager and AliCDBParam classe
17 //   Author: Alberto Colla 
18 //   e-mail: Alberto.Colla@cern.ch
19 //-------------------------------------------------------------------------
20
21 #include "AliCDBManager.h"
22 #include "AliCDBStorage.h"
23 #include "AliLog.h"
24 #include "AliCDBDump.h"
25 #include "AliCDBLocal.h"
26 #include "AliCDBGrid.h"
27 #include "AliCDBEntry.h"
28 #include "AliCDBMetaData.h"
29
30 #include <TObjString.h>
31 #include <TSystem.h>
32
33 ClassImp(AliCDBParam)
34
35 ClassImp(AliCDBManager)
36
37 //TODO OCDB and Reference folder should not be fully hardcoded but built from run number (or year/LHC period)
38 TString AliCDBManager::fgkCondUri("alien://folder=/alice/cern.ch/user/a/aliprod/testCDB/CDB?user=aliprod");
39 TString AliCDBManager::fgkRefUri("alien://folder=/alice/cern.ch/user/a/aliprod/testCDB/Reference?user=aliprod");
40 AliCDBManager* AliCDBManager::fgInstance = 0x0;
41
42 //_____________________________________________________________________________
43 AliCDBManager* AliCDBManager::Instance()
44 {
45 // returns AliCDBManager instance (singleton)
46
47         if (!fgInstance) {
48                 fgInstance = new AliCDBManager();
49                 fgInstance->Init();
50         }
51
52         return fgInstance;
53 }
54
55 //_____________________________________________________________________________
56 void AliCDBManager::Init() {
57 // factory registering
58
59         RegisterFactory(new AliCDBDumpFactory());
60         RegisterFactory(new AliCDBLocalFactory()); 
61         // AliCDBGridFactory is registered only if AliEn libraries are enabled in Root
62         if(!gSystem->Exec("root-config --has-alien |grep yes 2>&1 > /dev/null")){ // returns 0 if yes
63                 AliInfo("AliEn classes enabled in Root. AliCDBGrid factory registered.");
64                 RegisterFactory(new AliCDBGridFactory());
65                 fCondParam = CreateParameter(fgkCondUri);
66                 fRefParam = CreateParameter(fgkRefUri);
67         }
68 }
69 //_____________________________________________________________________________
70 void AliCDBManager::Destroy() {
71 // delete ALCDBManager instance and active storages
72
73         if (fgInstance) {
74                 //fgInstance->Delete();
75                 delete fgInstance;
76                 fgInstance = 0x0;
77         }
78 }
79
80 //_____________________________________________________________________________
81 AliCDBManager::AliCDBManager():
82   TObject(),
83   fCondParam(0),
84   fRefParam(0),
85   fFactories(),
86   fActiveStorages(),
87   fSpecificStorages(),
88   fDefaultStorage(NULL),
89   fDrainStorage(NULL),
90   fEntryCache(),
91   fCache(kTRUE),
92   fRun(-1)
93 {
94 // default constuctor
95         fFactories.SetOwner(1);
96         fActiveStorages.SetOwner(1);
97         fSpecificStorages.SetOwner(1);
98         fEntryCache.SetOwner(1);
99 }
100
101 //_____________________________________________________________________________
102 AliCDBManager::~AliCDBManager() {
103 // destructor
104         ClearCache();
105         DestroyActiveStorages();
106         fFactories.Delete();
107         fDrainStorage = 0x0;
108         fDefaultStorage = 0x0;
109         delete fCondParam;
110         delete fRefParam;
111 }
112
113 //_____________________________________________________________________________
114 void AliCDBManager::PutActiveStorage(AliCDBParam* param, AliCDBStorage* storage){
115 // put a storage object into the list of active storages
116
117         fActiveStorages.Add(param, storage);
118         AliDebug(1, Form("Active storages: %d", fActiveStorages.GetEntries()));
119 }
120
121 //_____________________________________________________________________________
122 void AliCDBManager::RegisterFactory(AliCDBStorageFactory* factory) {
123 // add a storage factory to the list of registerd factories
124  
125         if (!fFactories.Contains(factory)) {
126                 fFactories.Add(factory);
127         }
128 }
129
130 //_____________________________________________________________________________
131 Bool_t AliCDBManager::HasStorage(const char* dbString) const {
132 // check if dbString is a URI valid for one of the registered factories 
133
134         TIter iter(&fFactories);
135
136         AliCDBStorageFactory* factory=0;
137         while ((factory = (AliCDBStorageFactory*) iter.Next())) {
138
139                 if (factory->Validate(dbString)) {
140                         return kTRUE;
141                 }       
142         }
143
144         return kFALSE;
145 }
146
147 //_____________________________________________________________________________
148 AliCDBParam* AliCDBManager::CreateParameter(const char* dbString) const {
149 // create AliCDBParam object from URI string
150
151         TIter iter(&fFactories);
152
153         AliCDBStorageFactory* factory=0;
154         while ((factory = (AliCDBStorageFactory*) iter.Next())) {
155                 AliCDBParam* param = factory->CreateParameter(dbString);
156                 if(param) return param;
157         }
158
159         return NULL;
160 }
161
162 //_____________________________________________________________________________
163 AliCDBStorage* AliCDBManager::GetStorage(const char* dbString) {
164 // get storage object from URI string
165         
166         AliCDBParam* param = CreateParameter(dbString);
167         if (!param) {
168                 AliError(Form("Failed to activate requested storage! Check URI: %s", dbString));
169                 return NULL;
170         }
171
172         AliCDBStorage* aStorage = GetStorage(param);
173
174         delete param;
175         return aStorage;
176 }
177
178 //_____________________________________________________________________________
179 AliCDBStorage* AliCDBManager::GetStorage(const AliCDBParam* param) {
180 // get storage object from AliCDBParam object
181
182         // if the list of active storages already contains
183         // the requested storage, return it
184         AliCDBStorage* aStorage = GetActiveStorage(param);
185         if (aStorage) {
186                 return aStorage;
187         }
188
189         TIter iter(&fFactories);
190
191         AliCDBStorageFactory* factory=0;
192
193         // loop on the list of registered factories
194         while ((factory = (AliCDBStorageFactory*) iter.Next())) {
195
196                 // each factory tries to create its storage from the parameter
197                 aStorage = factory->Create(param);
198                 if (aStorage) {
199                         PutActiveStorage(param->CloneParam(), aStorage);
200                         aStorage->SetURI(param->GetURI());
201                         if(fRun >= 0) {
202                                 aStorage->QueryCDB(fRun);
203                         }
204                         return aStorage;
205                 }
206         }
207
208         AliError(Form("Failed to activate requested storage! Check URI: %s", param->GetURI().Data()));
209
210         return NULL;
211 }
212
213 //_____________________________________________________________________________
214 AliCDBStorage* AliCDBManager::GetActiveStorage(const AliCDBParam* param) {
215 // get a storage object from the list of active storages
216
217         return dynamic_cast<AliCDBStorage*> (fActiveStorages.GetValue(param));
218 }
219
220 //_____________________________________________________________________________
221 TList* AliCDBManager::GetActiveStorages() {
222 // return list of active storages
223 // user has responsibility to delete returned object
224
225         TList* result = new TList();
226
227         TIter iter(fActiveStorages.GetTable());
228         TPair* aPair=0;
229         while ((aPair = (TPair*) iter.Next())) {
230                 result->Add(aPair->Value());
231         }
232
233         return result;
234 }
235
236 //_____________________________________________________________________________
237 void AliCDBManager::SetDrain(const char* dbString) {
238 // set drain storage from URI string
239
240         fDrainStorage = GetStorage(dbString);   
241 }
242
243 //_____________________________________________________________________________
244 void AliCDBManager::SetDrain(const AliCDBParam* param) {
245 // set drain storage from AliCDBParam
246
247         fDrainStorage = GetStorage(param);
248 }
249
250 //_____________________________________________________________________________
251 void AliCDBManager::SetDrain(AliCDBStorage* storage) {
252 // set drain storage from another active storage
253         
254         fDrainStorage = storage;
255 }
256
257 //_____________________________________________________________________________
258 Bool_t AliCDBManager::Drain(AliCDBEntry *entry) {
259 // drain retrieved object to drain storage
260
261         AliDebug(2, "Draining into drain storage...");
262         return fDrainStorage->Put(entry);
263 }
264
265 //_____________________________________________________________________________
266 void AliCDBManager::SetDefaultStorage(const char* dbString) {
267 // sets default storage from URI string
268
269         AliInfo(Form("Setting Default storage to: %s",dbString));
270         fDefaultStorage = GetStorage(dbString);
271 }
272
273 //_____________________________________________________________________________
274 void AliCDBManager::SetDefaultStorage(const AliCDBParam* param) {
275 // set default storage from AliCDBParam object
276         
277         fDefaultStorage = GetStorage(param);
278 }
279
280 //_____________________________________________________________________________
281 void AliCDBManager::SetDefaultStorage(AliCDBStorage* storage) {
282 // set default storage from another active storage
283         
284         fDefaultStorage = storage;
285 }
286
287 //_____________________________________________________________________________
288 void AliCDBManager::SetSpecificStorage(const char* calibType, const char* dbString) {
289 // sets storage specific for detector or calibration type (works with AliCDBManager::Get(...))
290
291         AliCDBParam *aPar = CreateParameter(dbString);
292         if(!aPar) return;
293         SetSpecificStorage(calibType, aPar);
294         delete aPar;
295 }
296
297 //_____________________________________________________________________________
298 void AliCDBManager::SetSpecificStorage(const char* calibType, AliCDBParam* param) {
299 // sets storage specific for detector or calibration type (works with AliCDBManager::Get(...))
300 // Default storage should be defined prior to any specific storages, e.g.:
301 // AliCDBManager::instance()->SetDefaultStorage("alien://");
302 // AliCDBManager::instance()->SetSpecificStorage("TPC/*","local://DB_TPC");
303 // AliCDBManager::instance()->SetSpecificStorage("*/Align/*","local://DB_TPCAlign");
304 // calibType must be a valid CDB path! (3 level folder structure)
305
306         if(!fDefaultStorage) {
307                 AliError("Please activate a default storage first!");
308                 return;
309         }
310         
311         AliCDBPath aPath(calibType);
312         if(!aPath.IsValid()){
313                 AliError(Form("Not a valid path: %s", calibType));
314                 return;
315         }
316
317         TObjString *objCalibType = new TObjString(aPath.GetPath());
318         if(fSpecificStorages.Contains(objCalibType)){
319                 AliWarning(Form("Storage \"%s\" already activated! It will be replaced by the new one",
320                                         calibType));
321                 delete fSpecificStorages.Remove(objCalibType);
322         }
323         GetStorage(param);
324         fSpecificStorages.Add(objCalibType, param->CloneParam());
325 }
326
327 //_____________________________________________________________________________
328 AliCDBStorage* AliCDBManager::GetSpecificStorage(const char* calibType) {
329 // get storage specific for detector or calibration type 
330
331         AliCDBParam *checkPar = (AliCDBParam*) fSpecificStorages.GetValue(calibType);
332         if(!checkPar){
333                 AliError(Form("%s storage not found!", calibType));
334                 return NULL;
335         } else {
336                 return GetStorage(checkPar);
337         }
338         
339 }
340
341 //_____________________________________________________________________________
342 AliCDBParam* AliCDBManager::SelectSpecificStorage(const TString& path) {
343 // select storage valid for path from the list of specific storages
344
345         AliCDBPath aPath(path);
346         if(!aPath.IsValid()){
347                 AliError(Form("Not a valid path: %s", path.Data()));
348                 return NULL;
349         }
350
351         TIter iter(&fSpecificStorages);
352         TObjString *aCalibType=0;
353         AliCDBParam* aPar=0;
354         while((aCalibType = (TObjString*) iter.Next())){
355                 AliCDBPath calibTypePath(aCalibType->GetName());
356                 if(calibTypePath.Comprises(aPath)) {
357                         aPar = (AliCDBParam*) fSpecificStorages.GetValue(aCalibType);
358                         break;
359                 }
360         }
361         return aPar;
362 }
363
364 //_____________________________________________________________________________
365 AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, Int_t runNumber, 
366         Int_t version, Int_t subVersion) {
367 // get an AliCDBEntry object from the database
368
369         if(runNumber < 0){
370                 // RunNumber is not specified. Try with fRun
371                 if (fRun < 0){
372                         AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
373                         return NULL;
374                 }
375                 runNumber = fRun;
376         }
377
378         return Get(AliCDBId(path, runNumber, runNumber, version, subVersion));
379 }
380
381 //_____________________________________________________________________________
382 AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, 
383         const AliCDBRunRange& runRange, Int_t version,
384         Int_t subVersion) {
385 // get an AliCDBEntry object from the database!
386
387         return Get(AliCDBId(path, runRange, version, subVersion));
388 }
389
390 //_____________________________________________________________________________
391 AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) {        
392 // get an AliCDBEntry object from the database
393         
394         if(!fDefaultStorage) {
395                 AliError("No storage set!");
396                 return NULL;
397         }
398
399         // check if query's path and runRange are valid
400         // query is invalid also if version is not specified and subversion is!
401         if (!query.IsValid()) {
402                 AliError(Form("Invalid query: %s", query.ToString().Data()));
403                 return NULL;
404         }
405         
406         // query is not specified if path contains wildcard or run range= [-1,-1]
407         if (!query.IsSpecified()) {
408                 AliError(Form("Unspecified query: %s", 
409                                 query.ToString().Data()));
410                 return NULL;
411         }
412
413         if(fCache && query.GetFirstRun() != fRun)
414                 AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!");
415
416
417         AliCDBEntry *entry=0;
418
419         // first look into map of cached objects
420         if(fCache && query.GetFirstRun() == fRun)
421                 entry = (AliCDBEntry*) fEntryCache.GetValue(query.GetPath());
422
423         if(entry) {
424                 AliDebug(2, Form("Object %s retrieved from cache !!",query.GetPath().Data()));
425                 return entry;
426         }
427         
428         // Entry is not in cache -> retrieve it from CDB and cache it!!   
429         AliCDBStorage *aStorage=0;
430         AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
431
432         if(aPar) {
433                 aStorage=GetStorage(aPar);
434                 TString str = aPar->GetURI();
435                 AliDebug(2,Form("Looking into storage: %s",str.Data()));
436                 
437         } else {
438                 aStorage=GetDefaultStorage();
439                 AliDebug(2,"Looking into default storage");     
440         }
441                         
442         entry = aStorage->Get(query);
443         if (!entry) return NULL;
444
445         if(fCache && (query.GetFirstRun() == fRun)){
446                 AliDebug(2,Form("Caching entry %s !",query.GetPath().Data()));
447                 CacheEntry(query.GetPath(), entry);
448         }
449
450         return entry;
451                 
452 }
453
454 //_____________________________________________________________________________
455 TList* AliCDBManager::GetAll(const AliCDBPath& path, Int_t runNumber,
456         Int_t version, Int_t subVersion) {
457 // get multiple AliCDBEntry objects from the database
458
459         if(runNumber < 0){
460                 // RunNumber is not specified. Try with fRun
461                 if (fRun < 0){
462                         AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
463                         return NULL;
464                 }
465                 runNumber = fRun;
466         }
467
468         return GetAll(AliCDBId(path, runNumber, runNumber, version,     
469                         subVersion));
470 }
471
472 //_____________________________________________________________________________
473 TList* AliCDBManager::GetAll(const AliCDBPath& path,
474         const AliCDBRunRange& runRange, Int_t version, Int_t subVersion) {
475 // get multiple AliCDBEntry objects from the database
476
477         return GetAll(AliCDBId(path, runRange, version, subVersion));
478 }
479
480 //_____________________________________________________________________________
481 TList* AliCDBManager::GetAll(const AliCDBId& query) {
482 // get multiple AliCDBEntry objects from the database
483 // Warning: this method works correctly only for queries of the type "Detector/*"
484 //              and not for more specific queries e.g. "Detector/Calib/*" !
485 // Warning #2: Entries are cached, but GetAll will keep on retrieving objects from OCDB!
486 //              To get an object from cache use Get() function
487
488         if(!fDefaultStorage) {
489                 AliError("No storage set!");
490                 return NULL;
491         }
492
493         if (!query.IsValid()) {
494                 AliError(Form("Invalid query: %s", query.ToString().Data()));
495                 return NULL;
496         }
497
498         if((fSpecificStorages.GetEntries()>0) && query.GetPath().BeginsWith('*')){
499                 // if specific storages are active a query with "*" is ambiguous
500                 AliError("Query too generic in this context!");
501                 return NULL;
502         }
503
504         if (query.IsAnyRange()) {
505                 AliError(Form("Unspecified run or runrange: %s",
506                                 query.ToString().Data()));
507                 return NULL;
508         }
509
510         TObjString objStrLev0(query.GetLevel0());
511         //AliCDBParam *aPar = (AliCDBParam*) fSpecificStorages.GetValue(&objStrLev0);
512         AliCDBParam *aPar=SelectSpecificStorage(query.GetPath());
513
514         AliCDBStorage *aStorage;
515         if(aPar) {
516                 aStorage=GetStorage(aPar);
517                 TString str = aPar->GetURI();
518                 AliDebug(2,Form("Looking into storage: %s",str.Data()));
519
520         } else {
521                 aStorage=GetDefaultStorage();
522                 AliDebug(2,"Looking into default storage");
523         }
524
525         TList *result = aStorage->GetAll(query);
526         if(!result) return 0;
527
528         // caching entries
529         if(fCache && (query.GetFirstRun() == fRun)){
530
531                 TIter iter(result);
532                 AliCDBEntry* entry=0;
533                 while((entry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
534                         const AliCDBId& anId = entry->GetId();
535                         AliDebug(2,Form("Caching entry %s !", anId.GetPath().Data()));
536                         CacheEntry(anId.GetPath(), entry);
537                 }
538         }
539
540         return result;
541 }
542
543 //_____________________________________________________________________________
544 Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id,  AliCDBMetaData* metaData, DataType type){
545 // store an AliCDBEntry object into the database
546
547         AliCDBEntry anEntry(object, id, metaData);
548         return Put(&anEntry, type);
549
550 }
551
552
553 //_____________________________________________________________________________
554 Bool_t AliCDBManager::Put(AliCDBEntry* entry, DataType type){
555 // store an AliCDBEntry object into the database
556
557         if(type == kPrivate && !fDefaultStorage) {
558                 AliError("No storage set!");
559                 return kFALSE;
560         }
561
562         if (!entry){
563                 AliError("No entry!");
564                 return kFALSE;
565         }
566
567         if (!entry->GetId().IsValid()) {
568                 AliError(Form("Invalid entry ID: %s", 
569                         entry->GetId().ToString().Data()));
570                 return kFALSE;
571         }       
572
573         if (!entry->GetId().IsSpecified()) {
574                 AliError(Form("Unspecified entry ID: %s", 
575                         entry->GetId().ToString().Data()));
576                 return kFALSE;
577         }
578
579         AliCDBId id = entry->GetId();
580         AliCDBParam *aPar = SelectSpecificStorage(id.GetPath());
581
582         AliCDBStorage *aStorage;
583         
584         if(aPar) {
585                 aStorage=GetStorage(aPar);
586         } else {
587                 switch(type){
588                         case kCondition:
589                                 aStorage = GetStorage(fCondParam);
590                                 break;
591                         case kReference:
592                                 aStorage = GetStorage(fRefParam);
593                                 break;
594                         case kPrivate:
595                                 aStorage = GetDefaultStorage();
596                                 break;
597                 }
598         }
599
600         AliDebug(2,Form("Storing object into storage: %s", aStorage->GetURI().Data()));
601
602         return aStorage->Put(entry, type);
603
604
605 }
606
607 //_____________________________________________________________________________
608 void AliCDBManager::CacheEntry(const char* path, AliCDBEntry* entry)
609 {
610 // cache AliCDBEntry. Cache is valid until run number is changed.
611
612         AliDebug(2,Form("Filling cache with entry %s",path));
613         fEntryCache.Add(new TObjString(path), entry);
614         AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries()));
615
616 }
617
618 //_____________________________________________________________________________
619 void AliCDBManager::Print(Option_t* /*option*/) const
620 {
621 // Print list of active storages and their URIs
622
623         TString output=Form("Run number = %d; ",fRun);
624         output += "Cache is ";
625         if(!fCache) output += "NOT ";
626         output += Form("ACTIVE; Number of active storages: %d\n",fActiveStorages.GetEntries());
627
628         if(fDefaultStorage) {
629                 output += Form("\t*** Default Storage URI: \"%s\"\n",fDefaultStorage->GetURI().Data());
630 //              AliInfo(output.Data());
631         }
632         if(fSpecificStorages.GetEntries()>0) {
633                 TIter iter(fSpecificStorages.GetTable());
634                 TPair *aPair=0;
635                 Int_t i=1;
636                 while((aPair = (TPair*) iter.Next())){
637                         output += Form("\t*** Specific storage %d: Path \"%s\" -> URI \"%s\"\n",
638                                 i++, ((TObjString*) aPair->Key())->GetName(),
639                                 ((AliCDBParam*) aPair->Value())->GetURI().Data());
640                 }
641         }
642         if(fDrainStorage) {
643                 output += Form("*** Drain Storage URI: %s\n",fDrainStorage->GetURI().Data());
644         }
645         AliInfo(output.Data());
646 }
647
648 //_____________________________________________________________________________
649 void AliCDBManager::SetRun(Int_t run)
650 {
651 // Sets current run number.
652 // When the run number changes the caching is cleared.
653   
654         if (fRun == run)
655                 return;
656   
657         fRun = run;
658         ClearCache();
659         QueryCDB();
660 }
661
662 //_____________________________________________________________________________
663 void AliCDBManager::ClearCache(){
664 // clear AliCDBEntry cache
665
666         AliDebug(2,Form("Clearing cache!"));
667         fEntryCache.DeleteAll();
668         AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries()));
669
670 }
671
672 //_____________________________________________________________________________
673 void AliCDBManager::DestroyActiveStorages() {
674 // delete list of active storages
675
676         fActiveStorages.DeleteAll();
677         fSpecificStorages.DeleteAll();
678 }
679
680 //_____________________________________________________________________________
681 void AliCDBManager::DestroyActiveStorage(AliCDBStorage* /*storage*/) {
682 // destroys active storage
683
684 /*
685         TIter iter(fActiveStorages.GetTable());
686         TPair* aPair;
687         while ((aPair = (TPair*) iter.Next())) {
688                 if(storage == (AliCDBStorage*) aPair->Value())
689                         delete fActiveStorages.Remove(aPair->Key());
690                         storage->Delete(); storage=0x0;
691         }
692 */
693
694 }
695
696 //_____________________________________________________________________________
697 void AliCDBManager::QueryCDB() {
698 // query default and specific storages for files valid for fRun. Every storage loads the Ids into its list.
699
700         if (fRun < 0){
701                 AliError("Run number not yet set! Use AliCDBManager::SetRun.");
702         return;
703         }
704         if (!fDefaultStorage){
705                 AliError("Default storage is not set! Use AliCDBManager::SetDefaultStorage");
706         return;
707         }
708         if(fDefaultStorage->GetType() == "alien"){
709                 fDefaultStorage->QueryCDB(fRun);
710         } else {
711                 AliDebug(2,"Skipping query for valid files, it used only in grid...");
712         }
713
714         TIter iter(&fSpecificStorages);
715         TObjString *aCalibType=0;
716         AliCDBParam* aPar=0;
717         while((aCalibType = dynamic_cast<TObjString*> (iter.Next()))){
718                 aPar = (AliCDBParam*) fSpecificStorages.GetValue(aCalibType);
719                 if(aPar) {
720                         AliDebug(2,Form("Querying specific storage %s",aCalibType->GetName()));
721                         AliCDBStorage *aStorage = GetStorage(aPar);
722                         if(aStorage->GetType() == "alien"){
723                                 aStorage->QueryCDB(fRun,aCalibType->GetName());
724                         } else {
725                                 AliDebug(2,
726                                         "Skipping query for valid files, it is used only in grid...");
727                         }
728                 }
729         }
730 }
731
732 //______________________________________________________________________________________________
733 const char* AliCDBManager::GetDataTypeName(DataType type)
734 {
735   // returns the name (string) of the data type
736
737       switch (type){
738             case kCondition: return "Conditions";
739             case kReference: return "Reference";
740             case kPrivate: return "Private";
741      }
742      return 0;
743
744 }
745
746 ///////////////////////////////////////////////////////////
747 // AliCDBManager Parameter class                         //
748 // interface to specific AliCDBParameter class           //
749 // (AliCDBGridParam, AliCDBLocalParam, AliCDBDumpParam)  //
750 ///////////////////////////////////////////////////////////
751
752 AliCDBParam::AliCDBParam():
753   fType(),
754   fURI()
755 {
756 // constructor
757
758 }
759
760 //_____________________________________________________________________________
761 AliCDBParam::~AliCDBParam() {
762 // destructor
763
764 }
765