]>
Commit | Line | Data |
---|---|---|
9e1ceb13 | 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 | **************************************************************************/ | |
fdf65bb5 | 15 | //------------------------------------------------------------------------- |
16 | // Implementation of AliCDBManager and AliCDBParam classe | |
17 | // Author: Alberto Colla | |
18 | // e-mail: Alberto.Colla@cern.ch | |
19 | //------------------------------------------------------------------------- | |
9e1ceb13 | 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" | |
02c4845e | 27 | #include "AliCDBEntry.h" |
28 | #include "AliCDBMetaData.h" | |
9e1ceb13 | 29 | |
02c4845e | 30 | #include <TObjString.h> |
9e1ceb13 | 31 | #include <TSystem.h> |
32 | ||
33 | ClassImp(AliCDBParam) | |
34 | ||
35 | ClassImp(AliCDBManager) | |
36 | ||
37 | AliCDBManager* AliCDBManager::fgInstance = 0x0; | |
38 | ||
39 | //_____________________________________________________________________________ | |
40 | AliCDBManager* AliCDBManager::Instance() { | |
41 | // returns AliCDBManager instance (singleton) | |
42 | ||
43 | if (!fgInstance) { | |
44 | fgInstance = new AliCDBManager(); | |
45 | fgInstance->Init(); | |
46 | } | |
47 | ||
48 | return fgInstance; | |
49 | } | |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | void AliCDBManager::Init() { | |
53 | // factory registering | |
54 | ||
55 | RegisterFactory(new AliCDBDumpFactory()); | |
56 | RegisterFactory(new AliCDBLocalFactory()); | |
57 | // AliCDBGridFactory is registered only if AliEn libraries are enabled in Root | |
58 | if(!gSystem->Exec("root-config --has-alien |grep yes 2>&1 > /dev/null")){ // returns 0 if yes | |
59 | AliInfo("AliEn classes enabled in Root. AliCDBGrid factory registered."); | |
60 | RegisterFactory(new AliCDBGridFactory()); | |
61 | } | |
62 | } | |
63 | //_____________________________________________________________________________ | |
64 | void AliCDBManager::Destroy() { | |
65 | // delete ALCDBManager instance and active storages | |
66 | ||
67 | if (fgInstance) { | |
4b5e0dce | 68 | //fgInstance->Delete(); |
9e1ceb13 | 69 | delete fgInstance; |
70 | fgInstance = 0x0; | |
71 | } | |
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | AliCDBManager::AliCDBManager(): | |
76 | fDefaultStorage(NULL), | |
4b5e0dce | 77 | fDrainStorage(NULL), |
6a63c2e2 | 78 | fCache(kTRUE), |
81b958cb | 79 | fRun(-1) |
9e1ceb13 | 80 | { |
81 | // default constuctor | |
4b5e0dce | 82 | fFactories.SetOwner(1); |
83 | fEntryCache.SetOwner(1); | |
9e1ceb13 | 84 | } |
85 | ||
86 | //_____________________________________________________________________________ | |
87 | AliCDBManager::~AliCDBManager() { | |
88 | // destructor | |
4b5e0dce | 89 | ClearCache(); |
9e1ceb13 | 90 | DestroyActiveStorages(); |
b05400be | 91 | fDrainStorage = 0x0; |
92 | fDefaultStorage = 0x0; | |
9e1ceb13 | 93 | } |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | AliCDBStorage* AliCDBManager::GetActiveStorage(const AliCDBParam* param) { | |
97 | // get a storage object from the list of active storages | |
98 | ||
99 | return (AliCDBStorage*) fActiveStorages.GetValue(param); | |
100 | } | |
101 | ||
102 | //_____________________________________________________________________________ | |
103 | void AliCDBManager::PutActiveStorage(AliCDBParam* param, AliCDBStorage* storage){ | |
104 | // put a storage object into the list of active storages | |
105 | ||
106 | fActiveStorages.Add(param, storage); | |
107 | AliDebug(1, Form("Active storages: %d", fActiveStorages.GetEntries())); | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | void AliCDBManager::RegisterFactory(AliCDBStorageFactory* factory) { | |
112 | // add a storage factory to the list of registerd factories | |
113 | ||
114 | if (!fFactories.Contains(factory)) { | |
115 | fFactories.Add(factory); | |
116 | } | |
117 | } | |
118 | ||
119 | //_____________________________________________________________________________ | |
fdf65bb5 | 120 | Bool_t AliCDBManager::HasStorage(const char* dbString) const { |
9e1ceb13 | 121 | // check if dbString is a URI valid for one of the registered factories |
122 | ||
123 | TIter iter(&fFactories); | |
124 | ||
125 | AliCDBStorageFactory* factory; | |
126 | while ((factory = (AliCDBStorageFactory*) iter.Next())) { | |
127 | ||
128 | if (factory->Validate(dbString)) { | |
129 | return kTRUE; | |
130 | } | |
131 | } | |
132 | ||
133 | return kFALSE; | |
134 | } | |
135 | ||
136 | //_____________________________________________________________________________ | |
fdf65bb5 | 137 | AliCDBParam* AliCDBManager::CreateParameter(const char* dbString) const { |
9e1ceb13 | 138 | // create AliCDBParam object from URI string |
139 | ||
140 | TIter iter(&fFactories); | |
141 | ||
142 | AliCDBStorageFactory* factory; | |
143 | while ((factory = (AliCDBStorageFactory*) iter.Next())) { | |
144 | ||
145 | AliCDBParam* param = factory->CreateParameter(dbString); | |
146 | if (param) { | |
147 | return param; | |
148 | } | |
149 | } | |
150 | ||
151 | return NULL; | |
152 | } | |
153 | ||
154 | //_____________________________________________________________________________ | |
155 | AliCDBStorage* AliCDBManager::GetStorage(const char* dbString) { | |
156 | // get storage object from URI string | |
157 | ||
158 | AliCDBParam* param = CreateParameter(dbString); | |
159 | if (!param) { | |
160 | return NULL; | |
82096dfc | 161 | } |
9e1ceb13 | 162 | |
163 | AliCDBStorage* aStorage = GetStorage(param); | |
164 | ||
165 | delete param; | |
166 | ||
167 | return aStorage; | |
168 | } | |
169 | ||
170 | //_____________________________________________________________________________ | |
171 | AliCDBStorage* AliCDBManager::GetStorage(const AliCDBParam* param) { | |
172 | // get storage object from AliCDBParam object | |
173 | ||
82096dfc | 174 | // if the list of active storages already contains |
9e1ceb13 | 175 | // the requested storage, return it |
176 | AliCDBStorage* aStorage = GetActiveStorage(param); | |
177 | if (aStorage) { | |
178 | return aStorage; | |
179 | } | |
180 | ||
181 | TIter iter(&fFactories); | |
182 | ||
183 | AliCDBStorageFactory* factory; | |
917a098b | 184 | |
9e1ceb13 | 185 | // loop on the list of registered factories |
186 | while ((factory = (AliCDBStorageFactory*) iter.Next())) { | |
187 | ||
188 | // each factory tries to create its storage from the parameter | |
189 | aStorage = factory->Create(param); | |
190 | if (aStorage) { | |
191 | PutActiveStorage(param->CloneParam(), aStorage); | |
917a098b | 192 | aStorage->SetURI(param->GetURI()); |
9e1ceb13 | 193 | return aStorage; |
194 | } | |
195 | } | |
196 | ||
197 | return NULL; | |
198 | } | |
199 | ||
200 | //_____________________________________________________________________________ | |
201 | TList* AliCDBManager::GetActiveStorages() { | |
202 | // return list of active storages | |
203 | ||
204 | TList* result = new TList(); | |
205 | ||
917a098b | 206 | TIter iter(fActiveStorages.GetTable()); |
9e1ceb13 | 207 | TPair* aPair; |
208 | while ((aPair = (TPair*) iter.Next())) { | |
209 | result->Add(aPair->Value()); | |
210 | } | |
211 | ||
212 | return result; | |
213 | } | |
214 | ||
215 | //_____________________________________________________________________________ | |
216 | void AliCDBManager::SetDrain(const char* dbString) { | |
217 | // set drain storage from URI string | |
218 | ||
219 | fDrainStorage = GetStorage(dbString); | |
220 | } | |
221 | ||
222 | //_____________________________________________________________________________ | |
223 | void AliCDBManager::SetDrain(const AliCDBParam* param) { | |
224 | // set drain storage from AliCDBParam | |
225 | ||
226 | fDrainStorage = GetStorage(param); | |
227 | } | |
228 | ||
229 | //_____________________________________________________________________________ | |
230 | void AliCDBManager::SetDrain(AliCDBStorage* storage) { | |
231 | // set drain storage from another active storage | |
232 | ||
233 | fDrainStorage = storage; | |
234 | } | |
235 | ||
236 | //_____________________________________________________________________________ | |
237 | Bool_t AliCDBManager::Drain(AliCDBEntry *entry) { | |
238 | // drain retrieved object to drain storage | |
239 | ||
240 | AliInfo("Draining into drain storage..."); | |
241 | return fDrainStorage->Put(entry); | |
242 | } | |
243 | ||
9e1ceb13 | 244 | //_____________________________________________________________________________ |
245 | void AliCDBManager::SetDefaultStorage(const char* dbString) { | |
246 | // sets default storage from URI string | |
247 | ||
82096dfc | 248 | AliInfo(Form("Setting Default storage to: %s",dbString)); |
249 | fDefaultStorage = GetStorage(dbString); | |
9e1ceb13 | 250 | } |
251 | ||
252 | //_____________________________________________________________________________ | |
253 | void AliCDBManager::SetDefaultStorage(const AliCDBParam* param) { | |
254 | // set default storage from AliCDBParam object | |
255 | ||
9e1ceb13 | 256 | fDrainStorage = GetStorage(param); |
257 | } | |
258 | ||
259 | //_____________________________________________________________________________ | |
260 | void AliCDBManager::SetDefaultStorage(AliCDBStorage* storage) { | |
261 | // set default storage from another active storage | |
262 | ||
9e1ceb13 | 263 | fDefaultStorage = storage; |
264 | } | |
265 | ||
02c4845e | 266 | //_____________________________________________________________________________ |
024cf675 | 267 | void AliCDBManager::SetSpecificStorage(const char* calibType, const char* dbString) { |
268 | // sets storage specific for detector or calibration type (works with AliCDBManager::Get(...)) | |
02c4845e | 269 | |
270 | AliCDBParam *aPar = CreateParameter(dbString); | |
271 | if(!aPar) return; | |
024cf675 | 272 | SetSpecificStorage(calibType, aPar); |
02c4845e | 273 | delete aPar; |
274 | } | |
275 | ||
276 | //_____________________________________________________________________________ | |
024cf675 | 277 | void AliCDBManager::SetSpecificStorage(const char* calibType, AliCDBParam* param) { |
278 | // sets storage specific for detector or calibration type (works with AliCDBManager::Get(...)) | |
279 | // Default storage should be defined prior to any specific storages, e.g.: | |
280 | // AliCDBManager::instance()->SetDefaultStorage("alien://"); | |
281 | // AliCDBManager::instance()->SetSpecificStorage("TPC","local://DB_TPC"); | |
282 | // AliCDBManager::instance()->SetSpecificStorage("RICH/Align","local://DB_TPCAlign"); | |
02c4845e | 283 | |
284 | if(!fDefaultStorage) { | |
285 | AliError("Please activate a default storage first!"); | |
286 | return; | |
287 | } | |
288 | ||
024cf675 | 289 | TObjString *objCalibType = new TObjString(calibType); |
290 | if(fSpecificStorages.Contains(objCalibType)){ | |
291 | AliWarning(Form("%s storage already activated! It will be replaced by the new one", | |
292 | calibType)); | |
293 | fSpecificStorages.Remove(objCalibType); | |
02c4845e | 294 | } |
295 | GetStorage(param); | |
024cf675 | 296 | fSpecificStorages.Add(objCalibType, param->CloneParam()); |
02c4845e | 297 | } |
298 | ||
299 | //_____________________________________________________________________________ | |
024cf675 | 300 | AliCDBStorage* AliCDBManager::GetSpecificStorage(const char* calibType) { |
301 | // get storage specific for detector or calibration type | |
4b5e0dce | 302 | |
024cf675 | 303 | AliCDBParam *checkPar = (AliCDBParam*) fSpecificStorages.GetValue(calibType); |
02c4845e | 304 | if(!checkPar){ |
024cf675 | 305 | AliError(Form("%s storage not found!",calibType)); |
02c4845e | 306 | return NULL; |
307 | } else { | |
308 | return GetStorage(checkPar); | |
309 | } | |
310 | ||
311 | } | |
312 | ||
024cf675 | 313 | //_____________________________________________________________________________ |
314 | AliCDBParam* AliCDBManager::SelectSpecificStorage(const TString& path) { | |
82096dfc | 315 | // select storage valid for path from the list of specific storages |
024cf675 | 316 | |
317 | TIter iter(&fSpecificStorages); | |
318 | TObjString *aCalibType; | |
319 | AliCDBParam* aPar=0; | |
320 | while((aCalibType = (TObjString*) iter.Next())){ | |
321 | if(path.Contains(aCalibType->String(), TString::kIgnoreCase)) { | |
322 | aPar = (AliCDBParam*) fSpecificStorages.GetValue(aCalibType); | |
323 | break; | |
324 | } | |
325 | } | |
326 | return aPar; | |
327 | } | |
328 | ||
02c4845e | 329 | //_____________________________________________________________________________ |
330 | AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, Int_t runNumber, | |
331 | Int_t version, Int_t subVersion) { | |
332 | // get an AliCDBEntry object from the database | |
333 | ||
024cf675 | 334 | if(runNumber < 0){ |
335 | // RunNumber is not specified. Try with fRun | |
336 | if (fRun < 0){ | |
337 | AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun."); | |
338 | return NULL; | |
339 | } | |
340 | runNumber = fRun; | |
341 | } | |
342 | ||
02c4845e | 343 | return Get(AliCDBId(path, runNumber, runNumber, version, subVersion)); |
344 | } | |
345 | ||
346 | //_____________________________________________________________________________ | |
347 | AliCDBEntry* AliCDBManager::Get(const AliCDBPath& path, | |
348 | const AliCDBRunRange& runRange, Int_t version, | |
349 | Int_t subVersion) { | |
350 | // get an AliCDBEntry object from the database! | |
351 | ||
352 | return Get(AliCDBId(path, runRange, version, subVersion)); | |
353 | } | |
354 | ||
355 | //_____________________________________________________________________________ | |
356 | AliCDBEntry* AliCDBManager::Get(const AliCDBId& query) { | |
357 | // get an AliCDBEntry object from the database | |
358 | ||
359 | if(!fDefaultStorage) { | |
360 | AliError("No storage set!"); | |
361 | return NULL; | |
362 | } | |
363 | ||
364 | // check if query's path and runRange are valid | |
365 | // query is invalid also if version is not specified and subversion is! | |
366 | if (!query.IsValid()) { | |
367 | AliError(Form("Invalid query: %s", query.ToString().Data())); | |
368 | return NULL; | |
369 | } | |
024cf675 | 370 | |
371 | // query is not specified if path contains wildcard or run range= [-1,-1] | |
372 | if (!query.IsSpecified()) { | |
02c4845e | 373 | AliError(Form("Unspecified query: %s", |
374 | query.ToString().Data())); | |
375 | return NULL; | |
376 | } | |
377 | ||
024cf675 | 378 | if(fCache && query.GetFirstRun() != fRun) |
379 | AliWarning("Run number explicitly set in query: CDB cache temporarily disabled!"); | |
380 | ||
381 | ||
382 | AliCDBEntry *entry=0; | |
383 | ||
024cf675 | 384 | // first look into map of cached objects |
385 | if(query.GetFirstRun() == fRun) | |
386 | entry = (AliCDBEntry*) fEntryCache.GetValue(query.GetPath()); | |
387 | ||
388 | if(entry) { | |
6a63c2e2 | 389 | AliDebug(2,Form("Object %s retrieved from cache !!",query.GetPath().Data())); |
024cf675 | 390 | return entry; |
391 | } | |
392 | ||
393 | // Entry is not in cache -> retrieve it from CDB and cache it!! | |
394 | AliCDBStorage *aStorage=0; | |
395 | AliCDBParam *aPar=SelectSpecificStorage(query.GetPath()); | |
02c4845e | 396 | |
397 | if(aPar) { | |
398 | aStorage=GetStorage(aPar); | |
399 | TString str = aPar->GetURI(); | |
400 | AliDebug(2,Form("Looking into storage: %s",str.Data())); | |
401 | ||
402 | } else { | |
403 | aStorage=GetDefaultStorage(); | |
404 | AliDebug(2,"Looking into default storage"); | |
405 | } | |
406 | ||
024cf675 | 407 | entry = aStorage->Get(query); |
408 | if (!entry) return NULL; | |
409 | ||
410 | if(fCache && (query.GetFirstRun() == fRun)){ | |
6a63c2e2 | 411 | AliDebug(2,Form("Caching entry %s !",query.GetPath().Data())); |
024cf675 | 412 | CacheEntry(query.GetPath(), entry); |
413 | } | |
414 | ||
415 | return entry; | |
416 | ||
02c4845e | 417 | } |
418 | ||
419 | //_____________________________________________________________________________ | |
420 | TList* AliCDBManager::GetAll(const AliCDBPath& path, Int_t runNumber, | |
421 | Int_t version, Int_t subVersion) { | |
422 | // get multiple AliCDBEntry objects from the database | |
423 | ||
afd8dbf4 | 424 | if(runNumber < 0){ |
425 | // RunNumber is not specified. Try with fRun | |
426 | if (fRun < 0){ | |
427 | AliError("Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun."); | |
428 | return NULL; | |
429 | } | |
430 | runNumber = fRun; | |
431 | } | |
432 | ||
02c4845e | 433 | return GetAll(AliCDBId(path, runNumber, runNumber, version, |
434 | subVersion)); | |
435 | } | |
436 | ||
437 | //_____________________________________________________________________________ | |
438 | TList* AliCDBManager::GetAll(const AliCDBPath& path, | |
439 | const AliCDBRunRange& runRange, Int_t version, Int_t subVersion) { | |
440 | // get multiple AliCDBEntry objects from the database | |
441 | ||
442 | return GetAll(AliCDBId(path, runRange, version, subVersion)); | |
443 | } | |
444 | ||
445 | //_____________________________________________________________________________ | |
446 | TList* AliCDBManager::GetAll(const AliCDBId& query) { | |
447 | // get multiple AliCDBEntry objects from the database | |
024cf675 | 448 | // Warning: this method works correctly only for queries of the type "Detector/*" |
449 | // and not for more specific queries e.g. "Detector/Calib/*" ! | |
02c4845e | 450 | |
451 | if(!fDefaultStorage) { | |
452 | AliError("No storage set!"); | |
453 | return NULL; | |
454 | } | |
455 | ||
456 | if (!query.IsValid()) { | |
457 | AliError(Form("Invalid query: %s", query.ToString().Data())); | |
458 | return NULL; | |
459 | } | |
460 | ||
afd8dbf4 | 461 | if((fSpecificStorages.GetEntries()>0) && query.GetPath().BeginsWith('*')){ |
462 | // if specific storages are active a query with "*" is ambiguous | |
463 | AliError("Query too generic in this context!"); | |
02c4845e | 464 | return NULL; |
465 | } | |
466 | ||
467 | if (query.IsAnyRange()) { | |
468 | AliError(Form("Unspecified run or runrange: %s", | |
469 | query.ToString().Data())); | |
470 | return NULL; | |
471 | } | |
472 | ||
473 | TObjString objStrLev0(query.GetLevel0()); | |
474 | AliCDBParam *aPar = (AliCDBParam*) fSpecificStorages.GetValue(&objStrLev0); | |
024cf675 | 475 | |
476 | AliCDBStorage *aStorage; | |
02c4845e | 477 | if(aPar) { |
478 | aStorage=GetStorage(aPar); | |
479 | TString str = aPar->GetURI(); | |
480 | AliDebug(2,Form("Looking into storage: %s",str.Data())); | |
481 | ||
482 | } else { | |
483 | aStorage=GetDefaultStorage(); | |
484 | AliDebug(2,"Looking into default storage"); | |
485 | } | |
486 | ||
487 | TList *result = aStorage->GetAll(query); | |
488 | ||
489 | return result; | |
490 | } | |
491 | ||
492 | //_____________________________________________________________________________ | |
493 | Bool_t AliCDBManager::Put(TObject* object, AliCDBId& id, AliCDBMetaData* metaData){ | |
494 | // store an AliCDBEntry object into the database | |
495 | ||
496 | AliCDBEntry anEntry(object, id, metaData); | |
497 | return Put(&anEntry); | |
498 | ||
499 | } | |
500 | ||
501 | ||
502 | //_____________________________________________________________________________ | |
503 | Bool_t AliCDBManager::Put(AliCDBEntry* entry){ | |
504 | // store an AliCDBEntry object into the database | |
505 | ||
506 | if(!fDefaultStorage) { | |
507 | AliError("No storage set!"); | |
508 | return kFALSE; | |
509 | } | |
510 | ||
511 | if (!entry){ | |
512 | AliError("No entry!"); | |
513 | return kFALSE; | |
514 | } | |
515 | ||
516 | if (!entry->GetId().IsValid()) { | |
517 | AliError(Form("Invalid entry ID: %s", | |
518 | entry->GetId().ToString().Data())); | |
519 | return kFALSE; | |
520 | } | |
521 | ||
522 | if (!entry->GetId().IsSpecified()) { | |
523 | AliError(Form("Unspecified entry ID: %s", | |
524 | entry->GetId().ToString().Data())); | |
525 | return kFALSE; | |
526 | } | |
527 | ||
528 | AliCDBId id = entry->GetId(); | |
024cf675 | 529 | AliCDBParam *aPar = SelectSpecificStorage(id.GetPath()); |
530 | ||
02c4845e | 531 | AliCDBStorage *aStorage; |
532 | ||
533 | if(aPar) { | |
534 | aStorage=GetStorage(aPar); | |
535 | TString str = aPar->GetURI(); | |
536 | AliDebug(2,Form("Storing object into storage: %s",str.Data())); | |
537 | ||
538 | } else { | |
539 | aStorage=GetDefaultStorage(); | |
540 | AliDebug(2,"Storing object into default storage"); | |
541 | } | |
542 | ||
543 | return aStorage->Put(entry); | |
544 | ||
545 | ||
546 | } | |
9e1ceb13 | 547 | |
4b5e0dce | 548 | //_____________________________________________________________________________ |
549 | void AliCDBManager::CacheEntry(const char* path, AliCDBEntry* entry) | |
550 | { | |
551 | // cache AliCDBEntry. Cache is valid until run number is changed. | |
552 | ||
553 | AliDebug(2,Form("Filling cache with entry %s",path)); | |
554 | fEntryCache.Add(new TObjString(path), entry); | |
555 | AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries())); | |
556 | ||
557 | } | |
558 | ||
917a098b | 559 | //_____________________________________________________________________________ |
560 | void AliCDBManager::Print(Option_t* /*option*/) const | |
561 | { | |
562 | // Print list of active storages and their URIs | |
563 | AliInfo(Form("Run number: %d\n",fRun)); | |
564 | ||
565 | TString output; | |
566 | output = "Cache is "; | |
567 | if(!fCache) output += "NOT "; | |
568 | output += "ACTIVE\n"; | |
569 | AliInfo(output.Data()); | |
570 | ||
571 | if(fDefaultStorage) { | |
572 | AliInfo("*** Default Storage: ***"); | |
573 | output = Form("%s\n",fDefaultStorage->GetURI().Data()); | |
574 | AliInfo(output.Data()); | |
575 | } | |
576 | if(fSpecificStorages.GetEntries()>0) { | |
577 | AliInfo("*** Specific Storages: ***"); | |
578 | TIter iter(fSpecificStorages.GetTable()); | |
579 | TPair *aPair; | |
580 | while((aPair = (TPair*) iter.Next())){ | |
581 | output = Form("Key: %s - Storage: %s", | |
582 | ((TObjString*) aPair->Key())->GetName(), | |
583 | ((AliCDBParam*) aPair->Value())->GetURI().Data()); | |
584 | AliInfo(output.Data()); | |
585 | } | |
586 | printf("\n"); | |
587 | } | |
588 | if(fDrainStorage) { | |
589 | AliInfo("*** Drain Storage: ***"); | |
590 | output = Form("%s\n",fDrainStorage->GetURI().Data()); | |
591 | AliInfo(output.Data()); | |
592 | } | |
593 | AliInfo(Form("Total number of active storages: %d",fActiveStorages.GetEntries())); | |
594 | ||
595 | } | |
596 | ||
4b5e0dce | 597 | //_____________________________________________________________________________ |
598 | void AliCDBManager::SetRun(Long64_t run) | |
599 | { | |
917a098b | 600 | // Sets current run number. |
4b5e0dce | 601 | // When the run number changes the caching is cleared. |
4b5e0dce | 602 | |
603 | if (fRun == run) | |
604 | return; | |
605 | ||
606 | fRun = run; | |
607 | ClearCache(); | |
608 | } | |
609 | ||
610 | //_____________________________________________________________________________ | |
611 | void AliCDBManager::ClearCache(){ | |
612 | // clear AliCDBEntry cache | |
613 | ||
614 | AliDebug(2,Form("Clearing cache!")); | |
615 | fEntryCache.DeleteAll(); | |
616 | AliDebug(2,Form("Cache entries: %d",fEntryCache.GetEntries())); | |
617 | ||
618 | } | |
619 | ||
9e1ceb13 | 620 | //_____________________________________________________________________________ |
621 | void AliCDBManager::DestroyActiveStorages() { | |
622 | // delete list of active storages | |
623 | ||
624 | fActiveStorages.DeleteAll(); | |
02c4845e | 625 | fSpecificStorages.DeleteAll(); |
9e1ceb13 | 626 | } |
627 | ||
628 | //_____________________________________________________________________________ | |
629 | void AliCDBManager::DestroyActiveStorage(AliCDBStorage* /*storage*/) { | |
b05400be | 630 | // destroys active storage |
631 | ||
632 | /* | |
917a098b | 633 | TIter iter(fActiveStorages.GetTable()); |
b05400be | 634 | TPair* aPair; |
635 | while ((aPair = (TPair*) iter.Next())) { | |
636 | if(storage == (AliCDBStorage*) aPair->Value()) | |
637 | delete fActiveStorages.Remove(aPair->Key()); | |
638 | storage->Delete(); storage=0x0; | |
639 | } | |
640 | */ | |
9e1ceb13 | 641 | |
642 | } | |
643 | ||
644 | /////////////////////////////////////////////////////////// | |
645 | // AliCDBManager Parameter class // | |
646 | // interface to specific AliCDBParameter class // | |
647 | // (AliCDBGridParam, AliCDBLocalParam, AliCDBDumpParam) // | |
648 | /////////////////////////////////////////////////////////// | |
649 | ||
650 | AliCDBParam::AliCDBParam() { | |
651 | // constructor | |
652 | ||
653 | } | |
654 | ||
655 | //_____________________________________________________________________________ | |
656 | AliCDBParam::~AliCDBParam() { | |
657 | // destructor | |
658 | ||
659 | } | |
660 |