3bd1d765ea624252e3eb60126818e4ad698d4938
[u/mrichter/AliRoot.git] / STEER / AliCDBDump.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 /////////////////////////////////////////////////////////////////////
17 //                                                                 //
18 //  class AliCDBDump                                               //
19 //  access class to a DataBase in a dump storage (single file)     //
20 //                                                                 //
21 /////////////////////////////////////////////////////////////////////
22
23 #include <TSystem.h>
24 #include <TKey.h>
25 #include <TFile.h>
26 #include <TRegexp.h>
27 #include <TObjString.h>
28 #include <TList.h>
29
30 #include "AliCDBDump.h"
31 #include "AliCDBEntry.h"
32 #include "AliLog.h"
33
34 ClassImp(AliCDBDump)
35
36 //_____________________________________________________________________________
37 AliCDBDump::AliCDBDump(const char* dbFile, Bool_t readOnly):
38 fFile(NULL), fReadOnly(readOnly) {
39 // constructor
40
41         // opening file
42         fFile = TFile::Open(dbFile, fReadOnly ? "READ" : "UPDATE");     
43         if (!fFile) {
44                 AliError(Form("Can't open file <%s>!" , dbFile));
45         } else {
46                 AliDebug(2,Form("File <%s> opened",dbFile));
47                 if(fReadOnly) AliDebug(2,Form("in read-only mode"));
48         }
49 }
50
51 //_____________________________________________________________________________
52 AliCDBDump::~AliCDBDump() {
53 // destructor
54
55         if (fFile) {
56                 fFile->Close();
57                 delete fFile;
58         }
59 }
60
61
62 //_____________________________________________________________________________
63 Bool_t AliCDBDump::KeyNameToId(const char* keyname, AliCDBRunRange& runRange,
64         Int_t& version, Int_t& subVersion) {
65 // build AliCDBId from keyname numbers
66
67         Ssiz_t mSize;
68
69         // valid keyname: Run#firstRun_#lastRun_v#version_s#subVersion.root
70         TRegexp keyPattern("^Run[0-9]+_[0-9]+_v[0-9]+_s[0-9]+$");
71         keyPattern.Index(keyname, &mSize);
72         if (!mSize) {
73                 AliDebug(2,Form("Bad keyname <%s>.", keyname));
74                 return kFALSE;
75         }
76
77         TObjArray* strArray = (TObjArray*) TString(keyname).Tokenize("_");
78
79         TString firstRunString(((TObjString*) strArray->At(0))->GetString());
80         runRange.SetFirstRun(atoi(firstRunString.Data() + 3));
81         runRange.SetLastRun(atoi(((TObjString*) strArray->At(1))->GetString()));
82         
83         TString verString(((TObjString*) strArray->At(2))->GetString());
84         version = atoi(verString.Data() + 1);
85
86         TString subVerString(((TObjString*) strArray->At(3))->GetString());
87         subVersion = atoi(subVerString.Data() + 1);
88
89         delete strArray;
90
91         return kTRUE;
92 }
93
94 //_____________________________________________________________________________
95 Bool_t AliCDBDump::IdToKeyName(const AliCDBRunRange& runRange, Int_t version,
96         Int_t subVersion, TString& keyname) {
97 // build key name from AliCDBId data (run range, version, subVersion)
98
99         if (!runRange.IsValid()) {
100                 AliDebug(2,Form("Invalid run range <%d, %d>.",
101                         runRange.GetFirstRun(), runRange.GetLastRun()));
102                 return kFALSE;
103         }
104
105         if (version < 0) {
106                 AliDebug(2,Form("Invalid version <%d>.", version));
107                 return kFALSE;
108         }
109
110         if (subVersion < 0) {
111                 AliDebug(2,Form("Invalid subversion <%s>.", subVersion));
112                 return kFALSE;
113         }
114     
115         keyname += "Run";
116         keyname += runRange.GetFirstRun();
117         keyname += "_";
118         keyname += runRange.GetLastRun();
119         keyname += "_v";
120         keyname += version;
121         keyname += "_s";
122         keyname += subVersion;
123
124         return kTRUE;
125 }
126
127 //_____________________________________________________________________________
128 Bool_t AliCDBDump::MkDir(const TString& path) {
129 // descend into TDirectory, making TDirectories if they don't exist 
130         TObjArray* strArray = (TObjArray*) path.Tokenize("/");
131         
132         TIter iter(strArray);
133         TObjString* str;
134
135         while ((str = (TObjString*) iter.Next())) {
136                 
137                 TString dirName(str->GetString());
138                 if (!dirName.Length()) {
139                         continue;
140                 }
141
142                 if (gDirectory->cd(dirName)) {
143                         continue;
144                 }
145
146                 TDirectory* aDir = gDirectory->mkdir(dirName, "");
147                 if (!aDir) {
148                         AliError(Form("Can't create directory <%s>!", 
149                                         dirName.Data()));
150                         delete strArray;
151
152                         return kFALSE;
153                 }
154
155                 aDir->cd();
156         }       
157         
158         delete strArray;
159
160         return kTRUE;
161 }
162
163 //_____________________________________________________________________________
164 Bool_t AliCDBDump::PrepareId(AliCDBId& id) {
165 // prepare id (version, subVersion) of the object that will be stored (called by PutEntry)
166
167         AliCDBRunRange aRunRange; // the runRange got from filename 
168         AliCDBRunRange lastRunRange(-1,-1); // highest runRange found
169         Int_t aVersion, aSubVersion; // the version subVersion got from filename
170         Int_t lastVersion = 0, lastSubVersion = -1; // highest version and subVersion found
171
172         
173         TIter iter(gDirectory->GetListOfKeys());
174         TKey* key;
175
176         if (!id.HasVersion()) { // version not specified: look for highest version & subVersion 
177                                 
178                 while ((key = (TKey*) iter.Next())) { // loop on keys
179
180                         const char* keyName = key->GetName();
181         
182                         if (!KeyNameToId(keyName, aRunRange, aVersion, 
183                            aSubVersion)) {
184                                 AliDebug(2,Form(
185                                         "Bad keyname <%s>!I'll skip it.", keyName));
186                                 continue;
187                         }
188                         
189                         if (!aRunRange.Overlaps(id.GetAliCDBRunRange())) continue;
190                         if(aVersion < lastVersion) continue;
191                         if(aVersion > lastVersion) lastSubVersion = -1;
192                         if(aSubVersion < lastSubVersion) continue;
193                         lastVersion = aVersion;
194                         lastSubVersion = aSubVersion;
195                         lastRunRange = aRunRange;
196                 }
197
198                 id.SetVersion(lastVersion);
199                 id.SetSubVersion(lastSubVersion + 1);
200
201         } else { // version specified, look for highest subVersion only
202                 
203                 while ((key = (TKey*) iter.Next())) { // loop on the keys
204
205                         const char* keyName = key->GetName();
206         
207                         if (!KeyNameToId(keyName, aRunRange, aVersion, 
208                            aSubVersion)) {
209                                 AliDebug(2,Form(
210                                         "Bad keyname <%s>!I'll skip it.", keyName));
211                                 continue;
212                         }
213
214                         if (aRunRange.Overlaps(id.GetAliCDBRunRange()) 
215                                 && aVersion == id.GetVersion()
216                                 && aSubVersion > lastSubVersion) {
217                                 lastSubVersion = aSubVersion;
218                                 lastRunRange = aRunRange;
219                         }
220         
221                 }
222                 
223                 id.SetSubVersion(lastSubVersion + 1);
224         }
225
226         TString lastStorage = id.GetLastStorage();
227         if(lastStorage.Contains(TString("grid"), TString::kIgnoreCase) &&
228            id.GetSubVersion() > 0 ){
229                 AliError(Form("Grid to Dump Storage error! local object with version v%d_s%d found:",id.GetVersion(), id.GetSubVersion()-1));
230                 AliError(Form("This object has been already transferred from Grid (check v%d_s0)!",id.GetVersion()));
231                 return kFALSE;
232         }
233
234         if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) &&
235            id.GetSubVersion() > 0 ){
236                 AliWarning(Form("A NEW object is being stored with version v%d_s%d",
237                                         id.GetVersion(),id.GetSubVersion()));
238                 AliWarning(Form("and it will hide previously stored object with v%d_s%d!",
239                                         id.GetVersion(),id.GetSubVersion()-1));
240         }
241
242         if(!lastRunRange.IsAnyRange() && !(lastRunRange.IsEqual(& id.GetAliCDBRunRange()))) 
243                 AliWarning(Form("Run range modified w.r.t. previous version (Run%d_%d_v%d_s%d)",
244                         lastRunRange.GetFirstRun(), lastRunRange.GetLastRun(), 
245                         id.GetVersion(), id.GetSubVersion()-1));
246
247         return kTRUE;
248
249 }
250
251
252 //_____________________________________________________________________________
253 AliCDBId AliCDBDump::GetId(const AliCDBId& query) {
254 // look for filename matching query (called by GetEntry)
255
256         AliCDBId result(query.GetAliCDBPath(), -1, -1, -1, -1);
257
258         AliCDBRunRange aRunRange; // the runRange got from filename
259         Int_t aVersion, aSubVersion; // the version and subVersion got from filename
260
261         TIter iter(gDirectory->GetListOfKeys());
262         TKey* key;
263
264         if (!query.HasVersion()) { // neither version and subversion specified -> look for highest version and subVersion
265                 
266                 while ((key = (TKey*) iter.Next())) { // loop on the keys
267                         
268                         if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
269                         // aRunRange, aVersion, aSubVersion filled from filename
270
271                         if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
272                         // aRunRange contains requested run!
273                         
274                         if (result.GetVersion() < aVersion) {
275                                 result.SetVersion(aVersion);
276                                 result.SetSubVersion(aSubVersion);
277
278                                 result.SetFirstRun(
279                                         aRunRange.GetFirstRun());
280                                 result.SetLastRun(
281                                         aRunRange.GetLastRun());
282
283                         } else if (result.GetVersion() == aVersion 
284                                 && result.GetSubVersion() 
285                                         < aSubVersion) {
286
287                                 result.SetSubVersion(aSubVersion);
288
289                                 result.SetFirstRun(
290                                         aRunRange.GetFirstRun());
291                                 result.SetLastRun(
292                                         aRunRange.GetLastRun());
293                         } else if (result.GetVersion() == aVersion
294                                 && result.GetSubVersion() == aSubVersion){
295                                 AliError(Form("More than one object valid for run %d, version %d_%d!", 
296                                         query.GetFirstRun(), aVersion, aSubVersion));
297                                 result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
298                                 return result; 
299                                 }
300                 }
301                 
302         } else if (!query.HasSubVersion()) { // version specified but not subversion -> look for highest subVersion
303
304                 result.SetVersion(query.GetVersion());
305
306                 while ((key = (TKey*) iter.Next())) { // loop on the keys
307                         
308                         if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
309                         // aRunRange, aVersion, aSubVersion filled from filename
310
311                        if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; 
312                         // aRunRange contains requested run!
313                         
314                         if(query.GetVersion() != aVersion) continue;
315                         // aVersion is requested version!
316                         
317                         if(result.GetSubVersion() == aSubVersion){
318                                 AliError(Form("More than one object valid for run %d, version %d_%d!", 
319                                         query.GetFirstRun(), aVersion, aSubVersion));
320                                 result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
321                                 return result; 
322                         }
323                         if( result.GetSubVersion() < aSubVersion) {
324
325                                 result.SetSubVersion(aSubVersion);
326
327                                 result.SetFirstRun(
328                                         aRunRange.GetFirstRun());
329                                 result.SetLastRun(
330                                         aRunRange.GetLastRun());
331                         } 
332                 }
333
334         } else { // both version and subversion specified
335
336                 while ((key = (TKey*) iter.Next())) { // loop on the keys
337                         
338                         if (!KeyNameToId(key->GetName(), aRunRange, aVersion, aSubVersion)) continue;
339                         // aRunRange, aVersion, aSubVersion filled from filename
340                         
341                         if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue;
342                         // aRunRange contains requested run!
343
344                         if(query.GetVersion() != aVersion || query.GetSubVersion() != aSubVersion) continue; 
345                         // aVersion and aSubVersion are requested version and subVersion!
346
347                         if(result.GetVersion() == aVersion && result.GetSubVersion() == aSubVersion){
348                                 AliError(Form("More than one object valid for run %d, version %d_%d!", 
349                                         query.GetFirstRun(), aVersion, aSubVersion));
350                                 result.SetRunRange(-1,-1); result.SetVersion(-1); result.SetSubVersion(-1);
351                                 return result; 
352                         }
353                         result.SetVersion(aVersion);
354                         result.SetSubVersion(aSubVersion);
355                         result.SetFirstRun(aRunRange.GetFirstRun());
356                         result.SetLastRun(aRunRange.GetLastRun());
357                         
358                 }
359         }
360
361         return result;
362 }
363
364 //_____________________________________________________________________________
365 AliCDBEntry* AliCDBDump::GetEntry(const AliCDBId& query) {
366 // get AliCDBEntry from the database
367
368         TDirectory::TContext context(gDirectory, fFile);
369
370         if (!(fFile && fFile->IsOpen())) {
371                 AliError("AliCDBDump storage is not initialized properly");
372                 return NULL;
373         }
374
375         if (!gDirectory->cd(query.GetPath())) {
376                 return NULL;
377         }
378
379         AliCDBId dataId;
380
381         // look for a filename matching query requests (path, runRange, version, subVersion)
382         if (!query.HasVersion()) {
383                 // if version is not specified, first check the selection criteria list
384                 dataId = GetId(GetSelection(query));
385         } else {
386                 dataId = GetId(query);
387         }
388
389         if (!dataId.IsSpecified()) {
390                 return NULL;
391         }
392         
393         TString keyname;
394         if (!IdToKeyName(dataId.GetAliCDBRunRange(), dataId.GetVersion(), 
395                 dataId.GetSubVersion(), keyname)) {
396                 AliError("Bad ID encountered! Subnormal error!");
397                 return NULL;
398         }
399
400         // get the only AliCDBEntry object from the file
401         // the object in the file is an AliCDBEntry entry named keyname 
402         // keyName = Run#firstRun_#lastRun_v#version_s#subVersion
403
404         TObject* anObject = gDirectory->Get(keyname);
405         if (!anObject) {
406                 AliError("Bad storage data: NULL entry object!");
407                 return NULL;
408         } 
409
410         if (AliCDBEntry::Class() != anObject->IsA()) {
411                 AliError("Bad storage data: Invalid entry object!");
412                 return NULL;
413         }
414
415         ((AliCDBEntry*) anObject)->SetLastStorage("dump");
416         
417         return (AliCDBEntry*) anObject;
418 }
419
420 //_____________________________________________________________________________
421 void AliCDBDump::GetEntriesForLevel0(const AliCDBId& queryId, TList* result) {
422 // multiple request (AliCDBStorage::GetAll)
423
424         TDirectory* saveDir = gDirectory;
425
426         TIter iter(gDirectory->GetListOfKeys());
427         TKey* key;
428
429         while ((key = (TKey*) iter.Next())) {
430                 
431                 TString keyNameStr(key->GetName());
432                 if (queryId.GetAliCDBPath().Level1Comprises(keyNameStr)) {
433                         gDirectory->cd(keyNameStr);
434                         GetEntriesForLevel1(queryId, result);
435                         
436                         saveDir->cd();
437                 }
438         }
439 }
440
441 //_____________________________________________________________________________
442 void AliCDBDump::GetEntriesForLevel1(const AliCDBId& queryId, TList* result) {
443 // multiple request (AliCDBStorage::GetAll)
444
445         TIter iter(gDirectory->GetListOfKeys());
446         TKey* key;
447
448         TDirectory* level0Dir = (TDirectory*) gDirectory->GetMother();
449
450         while ((key = (TKey*) iter.Next())) {
451
452                 TString keyNameStr(key->GetName());
453                 if (queryId.GetAliCDBPath().Level2Comprises(keyNameStr)) {
454                         
455                         AliCDBPath aPath(level0Dir->GetName(), 
456                                         gDirectory->GetName(), keyNameStr);
457                         AliCDBId anId(aPath, queryId.GetAliCDBRunRange(), 
458                                         queryId.GetVersion(), -1);
459
460                         AliCDBEntry* anEntry = GetEntry(anId);
461                         if (anEntry) {
462                                 result->Add(anEntry);
463                         }
464         
465                 }
466         }
467
468 }
469
470                         
471 //_____________________________________________________________________________
472 TList* AliCDBDump::GetEntries(const AliCDBId& queryId) {
473 // multiple request (AliCDBStorage::GetAll)
474
475         TDirectory::TContext context(gDirectory, fFile);
476
477         if (!(fFile && fFile->IsOpen())) {
478                 AliError("AliCDBDump storage is not initialized properly");
479                 return NULL;
480         }
481
482         TList* result = new TList();
483         result->SetOwner();
484
485         TIter iter(gDirectory->GetListOfKeys());
486         TKey* key;
487
488         while ((key = (TKey*) iter.Next())) {
489                 
490                 TString keyNameStr(key->GetName());
491                 if (queryId.GetAliCDBPath().Level0Comprises(keyNameStr)) {
492                         gDirectory->cd(keyNameStr);
493                         GetEntriesForLevel0(queryId, result);
494
495                         fFile->cd();
496                 }
497         }
498
499         return result;
500 }
501
502 //_____________________________________________________________________________
503 Bool_t AliCDBDump::PutEntry(AliCDBEntry* entry) {
504 // put an AliCDBEntry object into the database
505
506         TDirectory::TContext context(gDirectory, fFile);
507
508         if (!(fFile && fFile->IsOpen())) {
509                 AliError("AliCDBDump storage is not initialized properly");
510                 return kFALSE;
511         }
512
513         if (fReadOnly) {
514                 AliError("AliCDBDump storage is read only!");
515                 return kFALSE;
516         }
517
518         AliCDBId& id = entry->GetId();
519         
520         if (!gDirectory->cd(id.GetPath())) {
521                 if (!MkDir(id.GetPath())) {
522                         AliError(Form("Can't open directory <%s>!", 
523                                         id.GetPath().Data()));
524                         return kFALSE;
525                 }
526         }
527
528         // set version and subVersion for the entry to be stored
529         if (!PrepareId(id)) {
530                 return kFALSE;          
531         }
532
533         // build keyname from entry's id
534         TString keyname;
535         if (!IdToKeyName(id.GetAliCDBRunRange(), id.GetVersion(), id.GetSubVersion(), keyname)) {
536                 AliError("Invalid ID encountered! Subnormal error!");
537                 return kFALSE;
538         }       
539
540         // write object (key name: Run#firstRun_#lastRun_v#version_s#subVersion)
541         Bool_t result = gDirectory->WriteTObject(entry, keyname);
542         if (!result) {
543                 AliError(Form("Can't write entry to file: %s", 
544                                 fFile->GetName()));
545         }
546
547         if(result) {
548                 AliInfo(Form("CDB object stored into file %s",fFile->GetName()));
549                 AliInfo(Form("TDirectory/key name: %s/%s",id.GetPath().Data(),keyname.Data()));
550         }
551
552         return result;
553 }
554 //_____________________________________________________________________________
555 TList* AliCDBDump::GetIdListFromFile(const char* fileName){
556
557         TString turl(fileName);
558         if (turl[0] != '/') {
559                 turl.Prepend(TString(gSystem->WorkingDirectory()) + '/');
560         }
561         TFile *file = TFile::Open(turl);
562         if (!file) {
563                 AliError(Form("Can't open selection file <%s>!", turl.Data()));
564                 return NULL;
565         }
566         file->cd();
567
568         TList *list = new TList();
569         list->SetOwner();
570         int i=0;
571         TString keycycle;
572         
573         AliCDBId *id;
574         while(1){
575                 i++;
576                 keycycle = "AliCDBId;";
577                 keycycle+=i;
578                 
579                 id = (AliCDBId*) file->Get(keycycle);
580                 if(!id) break;
581                 list->AddFirst(id);
582         }
583         file->Close(); delete file; file=0;     
584         return list;
585 }
586
587 //_____________________________________________________________________________
588 Bool_t AliCDBDump::Contains(const char* path) const{
589 // check for path in storage
590
591         TDirectory::TContext context(gDirectory, fFile);
592         if (!(fFile && fFile->IsOpen())) {
593                 AliError("AliCDBDump storage is not initialized properly");
594                 return kFALSE;
595         }
596         
597         return gDirectory->cd(path);
598
599 }
600
601 /////////////////////////////////////////////////////////////////////////////////////////////////
602 //                                                                                             //
603 // AliCDBDump factory                                                                          //
604 //                                                                                             //
605 /////////////////////////////////////////////////////////////////////////////////////////////////
606
607 ClassImp(AliCDBDumpFactory)
608
609 //_____________________________________________________________________________
610 Bool_t AliCDBDumpFactory::Validate(const char* dbString) {
611 // check if the string is valid dump URI
612
613         TRegexp dbPattern("^dump://.+$");
614
615         return TString(dbString).Contains(dbPattern);
616 }
617
618 //_____________________________________________________________________________
619 AliCDBParam* AliCDBDumpFactory::CreateParameter(const char* dbString) {
620 // create AliCDBDumpParam class from the URI string
621
622         if (!Validate(dbString)) {
623                 return NULL;
624         }
625
626         TString pathname(dbString + sizeof("dump://") - 1);
627
628         Bool_t readOnly;
629
630         if (pathname.Contains(TRegexp(";ReadOnly$"))) {
631                 pathname.Resize(pathname.Length() - sizeof(";ReadOnly") + 1);
632                 readOnly = kTRUE;
633         } else {
634                 readOnly = kFALSE;
635         }
636
637         gSystem->ExpandPathName(pathname);
638         
639         if (pathname[0] != '/') {
640                 pathname.Prepend(TString(gSystem->WorkingDirectory()) + '/');
641         }
642
643         return new AliCDBDumpParam(pathname, readOnly);
644 }
645
646 //_____________________________________________________________________________
647 AliCDBStorage* AliCDBDumpFactory::Create(const AliCDBParam* param) {
648 // create AliCDBDump storage instance from parameters
649
650         if (AliCDBDumpParam::Class() == param->IsA()) {
651
652                 const AliCDBDumpParam* dumpParam = 
653                         (const AliCDBDumpParam*) param;
654
655                 return new AliCDBDump(dumpParam->GetPath(), 
656                                 dumpParam->IsReadOnly());
657         }
658
659         return NULL;
660 }
661
662 /////////////////////////////////////////////////////////////////////////////////////////////////
663 //                                                                                             //
664 // AliCDBDump parameter class                                                                  //
665 //                                                                                             //
666 /////////////////////////////////////////////////////////////////////////////////////////////////
667
668 ClassImp(AliCDBDumpParam)
669
670 //_____________________________________________________________________________
671 AliCDBDumpParam::AliCDBDumpParam() {
672 // default constructor
673
674 }
675
676 //_____________________________________________________________________________
677 AliCDBDumpParam::AliCDBDumpParam(const char* dbPath, Bool_t readOnly):
678         fDBPath(dbPath), fReadOnly(readOnly)
679 {
680 // constructor
681
682         TString uri;
683         uri += "dump://";
684         uri += dbPath;
685
686         if (fReadOnly) {
687                 uri += ";ReadOnly";
688         }
689         
690         SetURI(uri);
691         SetType("dump");
692 }
693
694 //_____________________________________________________________________________
695 AliCDBDumpParam::~AliCDBDumpParam() {
696 // destructor
697
698 }
699
700 //_____________________________________________________________________________
701 AliCDBParam* AliCDBDumpParam::CloneParam() const {
702 // clone parameter
703
704         return new AliCDBDumpParam(fDBPath, fReadOnly);
705 }
706
707 //_____________________________________________________________________________
708 ULong_t AliCDBDumpParam::Hash() const {
709 // return Hash function
710
711         return fDBPath.Hash();
712 }
713
714 //_____________________________________________________________________________
715 Bool_t AliCDBDumpParam::IsEqual(const TObject* obj) const {
716 // check if this object is equal to AliCDBParam obj
717         
718         if (this == obj) {
719                 return kTRUE;
720         }
721
722         if (AliCDBDumpParam::Class() != obj->IsA()) {
723                 return kFALSE;
724         }
725
726         AliCDBDumpParam* other = (AliCDBDumpParam*) obj;
727
728         return fDBPath == other->fDBPath;
729 }