New version of the CDB classes. Run number added (A.Colla).
[u/mrichter/AliRoot.git] / STEER / AliCDBGrid.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 // AliCDBGrid                                                                                  //
19 // access class to a DataBase in an AliEn storage                                              //
20 //                                                                                             //
21 /////////////////////////////////////////////////////////////////////////////////////////////////
22
23
24 #include <TGrid.h>
25 #include <TGridResult.h>
26 #include <TFile.h>
27 #include <TKey.h>
28 #include <TROOT.h>
29 #include <TSystem.h>
30 #include <TObjArray.h>
31 #include <TObjString.h>
32 #include <TRegexp.h>
33
34 #include "AliLog.h"
35 #include "AliCDBEntry.h"
36 #include "AliCDBGrid.h"
37
38
39 ClassImp(AliCDBGrid)
40
41 //_____________________________________________________________________________
42 AliCDBGrid::AliCDBGrid(const char *gridUrl, const char *user, const char *dbFolder, const char *se) :
43 AliCDBStorage(),
44 fGridUrl(gridUrl),
45 fUser(user),
46 fDBFolder(dbFolder),
47 fSE(se)
48 {
49 // constructor //
50
51         // if the same Grid is alreay active, skip connection
52         if (!gGrid || fGridUrl != gGrid->GridUrl()  
53              || fUser != gGrid->GetUser()) {
54                 // connection to the Grid
55                 TGrid::Connect(fGridUrl.Data(),fUser.Data());
56         }
57
58         if(!gGrid) {
59                 AliError("Connection failed!");
60                 return;
61         }
62
63         TString initDir(gGrid->Pwd(0));
64         if (fDBFolder[0] != '/') {
65                 fDBFolder.Prepend(initDir);
66         }
67
68         // check DBFolder: trying to cd to DBFolder; if it does not exist, create it
69         if(!gGrid->Cd(fDBFolder.Data(),0)){
70                 AliDebug(2,Form("Creating new folder <%s> ...",fDBFolder.Data()));
71                 if(!gGrid->Mkdir(fDBFolder.Data(),"",0)){
72                         AliError(Form("Cannot create folder <%s> !",fDBFolder.Data())); 
73                 }
74         } else {
75                 AliDebug(2,Form("Folder <%s> found",fDBFolder.Data()));
76         }
77
78         // removes any '/' at the end of path, then append one '/'
79         while(fDBFolder.EndsWith("/")) fDBFolder.Remove(fDBFolder.Last('/')); 
80         fDBFolder+="/";
81
82         // return to the initial directory
83         gGrid->Cd(initDir.Data(),0);
84 }
85
86 //_____________________________________________________________________________
87 AliCDBGrid::~AliCDBGrid()
88 {
89 // destructor
90
91 }
92
93 //_____________________________________________________________________________
94 Bool_t AliCDBGrid::FilenameToId(const char* filename, AliCDBRunRange& runRange, 
95                                 Int_t& gridVersion) {
96 // build AliCDBId from filename numbers
97
98         Ssiz_t mSize;
99         
100         // valid filename: Run#firstRun_#lastRun_v#version.root
101         TRegexp keyPattern("^Run[0-9]+_[0-9]+_v[0-9]+.root$");
102         keyPattern.Index(filename, &mSize);
103         if (!mSize) {
104                 AliDebug(2,Form("Bad filename <%s>.", filename));
105                 return kFALSE;
106         }
107
108         TString idString(filename);
109         idString.Resize(idString.Length() - sizeof(".root") + 1);
110
111         TObjArray* strArray = (TObjArray*) idString.Tokenize("_");
112
113         TString firstRunString(((TObjString*) strArray->At(0))->GetString());
114         runRange.SetFirstRun(atoi(firstRunString.Data() + 3));
115         runRange.SetLastRun(atoi(((TObjString*) strArray->At(1))->GetString()));
116         
117         TString verString(((TObjString*) strArray->At(2))->GetString());
118         gridVersion = atoi(verString.Data() + 1);
119
120         delete strArray;
121
122         return kTRUE;
123 }
124
125 //_____________________________________________________________________________
126 Bool_t AliCDBGrid::IdToFilename(const AliCDBRunRange& runRange, Int_t gridVersion, 
127                                  TString& filename) {
128 // build file name from AliCDBId data (run range, version)
129
130         if (!runRange.IsValid()) {
131                 AliDebug(2,Form("Invalid run range <%d, %d>.", 
132                         runRange.GetFirstRun(), runRange.GetLastRun()));
133                 return kFALSE;
134         }
135
136         if (gridVersion < 0) {
137                 AliDebug(2,Form("Invalid version <%d>.", gridVersion));
138                 return kFALSE;
139         }
140  
141         filename += "Run";
142         filename += runRange.GetFirstRun();
143         filename += "_";
144         filename += runRange.GetLastRun();
145         filename += "_v";
146         filename += gridVersion;
147         filename += ".root";
148
149         return kTRUE;
150 }
151
152 //_____________________________________________________________________________
153 Bool_t AliCDBGrid::PrepareId(AliCDBId& id) {
154 // prepare id (version) of the object that will be stored (called by PutEntry)
155
156         TString initDir(gGrid->Pwd(0));
157         TString pathName= id.GetPath();
158
159         TString dirName(fDBFolder);
160
161         Bool_t dirExist=kFALSE;
162  
163         // go to the path; if directory does not exist, create it
164         TObjArray *arrName=pathName.Tokenize("/");
165         for(int i=0;i<arrName->GetEntries();i++){
166                 TString buffer((arrName->At(i))->GetName());
167                 dirName+=buffer; dirName+="/";
168                 dirExist=gGrid->Cd(dirName,0);
169                 if (!dirExist) {
170                         AliDebug(2,Form("Creating new folder <%s> ...",dirName.Data()));
171                         if(!gGrid->Mkdir(dirName,"",0)){
172                                 AliError(Form("Cannot create directory <%s> !",dirName.Data()));
173                                 gGrid->Cd(initDir.Data());
174                         return kFALSE;
175                         }
176                 }
177         }
178         delete arrName;
179         gGrid->Cd(initDir,0);
180
181         const char* filename;
182         AliCDBRunRange aRunRange; // the runRange got from filename 
183         AliCDBRunRange lastRunRange(-1,-1); // highest runRange found
184         Int_t aVersion; // the version got from filename 
185         Int_t lastVersion=0; // highest version found
186
187         TGridResult *res = gGrid->Ls(dirName);
188
189         //loop on the files in the directory, look for highest version
190         for(int i=0; i < res->GetEntries(); i++){
191                 filename=res->GetFileName(i);
192                 if (!FilenameToId(filename, aRunRange, aVersion)) continue;
193                 if (aRunRange.Overlaps(id.GetAliCDBRunRange()) && aVersion > lastVersion) {
194                         lastVersion = aVersion;
195                         lastRunRange = aRunRange;
196                 }
197
198         }
199         delete res; 
200  
201         id.SetVersion(lastVersion + 1);
202
203         TString lastStorage = id.GetLastStorage();
204         if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) && id.GetVersion() > 1 ){
205                 AliWarning(Form("A NEW object is being stored with version %d",
206                                         id.GetVersion()));
207                 AliWarning(Form("and it will hide previously stored object with version %d!",
208                                         id.GetVersion()-1));
209         }
210
211         if(!lastRunRange.IsAnyRange() && !(lastRunRange.IsEqual(&id.GetAliCDBRunRange()))) 
212                 AliWarning(Form("Run range modified w.r.t. previous version (Run%d_%d_v%d)",
213                         lastRunRange.GetFirstRun(), lastRunRange.GetLastRun(), id.GetVersion()));
214     
215         return kTRUE;
216 }
217
218 //_____________________________________________________________________________
219 Bool_t AliCDBGrid::GetId(const AliCDBId& query, AliCDBId& result) {
220 // look for filename matching query (called by GetEntry)
221
222         TString initDir(gGrid->Pwd(0));
223
224         TString dirName(fDBFolder);
225         dirName += query.GetPath(); // dirName = fDBFolder/idPath
226
227         if (!gGrid->Cd(dirName,0)) {
228                 AliError(Form("Directory <%s> not found", (query.GetPath()).Data()));
229                 AliError(Form("in DB folder %s", fDBFolder.Data()));
230                 return kFALSE;
231         }
232  
233         TGridResult *res = gGrid->Ls(dirName);
234
235         const char* filename;
236         AliCDBRunRange aRunRange; // the runRange got from filename
237         Int_t aVersion; // the version got from filename
238  
239         for(int i=0; i < res->GetEntries(); i++){
240                 filename=res->GetFileName(i);
241                 if (!FilenameToId(filename, aRunRange, aVersion)) continue;
242                 // aRunRange and aVersion filled from filename
243                 
244                 if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; 
245                 // aRunRange contains requested run!
246
247                 if (!query.HasVersion()){ // look for highest version
248                         if(result.GetVersion() > aVersion) continue;
249                         if(result.GetVersion() == aVersion) {
250                                 AliError(Form("More than one object valid for run %d, version %d!", 
251                                         query.GetFirstRun(), aVersion));
252                         return kFALSE; 
253                         }
254                         result.SetVersion(aVersion);
255                         result.SetFirstRun(aRunRange.GetFirstRun());
256                         result.SetLastRun(aRunRange.GetLastRun());
257
258                 } else { // look for specified version
259                         if(query.GetVersion() != aVersion) continue;
260                         if(result.GetVersion() == aVersion){
261                                 AliError(Form("More than one object valid for run %d, version %d!", 
262                                         query.GetFirstRun(), aVersion));
263                                         return kFALSE; 
264                         }
265                         result.SetVersion(aVersion);
266                         result.SetFirstRun(aRunRange.GetFirstRun());
267                         result.SetLastRun(aRunRange.GetLastRun());
268                 }
269         } // end loop on filenames
270         delete res;
271         
272         gGrid->Cd(initDir.Data(),0);
273  
274         return kTRUE;
275 }
276
277 //_____________________________________________________________________________
278 AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) {
279 // get AliCDBEntry from the database
280
281         AliCDBId dataId(queryId.GetAliCDBPath(), -1, -1, -1, -1);
282         Bool_t result;
283         
284         // look for a filename matching query requests (path, runRange, version, subVersion)
285         if (!queryId.HasVersion()) {
286                 // if version is not specified, first check the selection criteria list
287                 AliCDBId selectedId(queryId);
288                 GetSelection(&selectedId);
289                 result = GetId(selectedId,dataId);
290         } else {
291                 result = GetId(queryId,dataId);
292         }
293
294         if (!result || !dataId.IsSpecified()) return NULL;
295
296         TString filename;
297         if (!IdToFilename(dataId.GetAliCDBRunRange(), dataId.GetVersion(),filename)) {
298                 AliError("Bad data ID encountered! Subnormal error!");
299                 return NULL;
300         }
301
302         filename.Prepend("/alien" + fDBFolder + queryId.GetPath() + '/');
303         filename += "?se="; filename += fSE.Data(); 
304
305         AliInfo(Form("Opening file: %s",filename.Data()));
306         TFile *file = TFile::Open(filename);
307         if (!file) {
308                 AliError(Form("Can't open file <%s>!", filename.Data()));
309                 return NULL;
310         }
311
312         // get the only AliCDBEntry object from the file
313         // the object in the file is an AliCDBEntry entry named "AliCDBEntry"
314
315         TObject* anObject = file->Get("AliCDBEntry");
316
317         if (!anObject) {
318                 AliError("Bad storage data: NULL entry object!");
319                 return NULL;
320         }
321
322         if (AliCDBEntry::Class() != anObject->IsA()) {
323                 AliError("Bad storage data: Invalid entry object!");
324                 return NULL;
325         }
326
327         AliCDBId entryId = ((AliCDBEntry* ) anObject)->GetId();
328  
329         // The object's Id is not reset during storage
330         // If object's Id runRange or version do not match with filename,
331         // it means that someone renamed file by hand. In this case a warning msg is issued.
332  
333         ((AliCDBEntry*) anObject)->SetLastStorage("grid");
334  
335         if(!((entryId.GetAliCDBRunRange()).IsEqual(&dataId.GetAliCDBRunRange())) || 
336                 entryId.GetVersion() != dataId.GetVersion()){
337                 AliWarning(Form("Either RunRange or gridVersion in the object's metadata do noth match with fileName numbers:"));
338                 AliWarning(Form("someone renamed file by hand!"));
339         }
340
341         // close file, return retieved entry
342         file->Close(); delete file; file=0;
343         return (AliCDBEntry*) anObject;
344 }
345
346 //_____________________________________________________________________________
347 void AliCDBGrid::GetEntriesForLevel0(const char* level0,
348         const AliCDBId& queryId, TList* result) {
349 // multiple request (AliCDBStorage::GetAll)
350
351         TString level0Dir=fDBFolder;
352         level0Dir += level0;
353
354         if (!gGrid->Cd(level0Dir,0)) {
355                 AliError(Form("Level0 directory <%s> not found", level0Dir.Data()));
356                 return;
357         }
358
359         TGridResult *res = gGrid->Ls(level0Dir);
360         TString level1;
361         for(int i=0; i < res->GetEntries(); i++){
362                 level1=res->GetFileName(i);
363         if (queryId.GetAliCDBPath().Level1Comprises(level1))
364                 GetEntriesForLevel1(level0, level1, queryId, result);
365         }
366         delete res;
367 }
368
369 //_____________________________________________________________________________
370 void AliCDBGrid::GetEntriesForLevel1(const char* level0, const char* level1,
371         const AliCDBId& queryId, TList* result) {
372 // multiple request (AliCDBStorage::GetAll)
373
374         TString level1Dir=fDBFolder;
375         level1Dir += level0;
376         level1Dir += '/';
377         level1Dir += level1;
378
379         if (!gGrid->Cd(level1Dir,0)) {
380                 AliError(Form("Level1 directory <%s> not found", level1Dir.Data()));
381                 return;
382         }
383
384         TGridResult *res = gGrid->Ls(level1Dir);
385         TString level2;
386         for(int i=0; i < res->GetEntries(); i++){
387                 level2=res->GetFileName(i);
388                 if (queryId.GetAliCDBPath().Level2Comprises(level2)){
389                         AliCDBPath entryPath(level0, level1, level2);
390                         AliCDBId entryId(entryPath, 
391                                 queryId.GetAliCDBRunRange(),
392                                 queryId.GetVersion(), 
393                                 queryId.GetSubVersion());
394
395                         AliCDBEntry* anEntry = GetEntry(entryId);
396                         if (anEntry) result->Add(anEntry);
397
398                 }
399         }
400         delete res;
401 }
402
403 //_____________________________________________________________________________
404 TList* AliCDBGrid::GetEntries(const AliCDBId& queryId) {
405 // multiple request (AliCDBStorage::GetAll)
406
407         TList* result = new TList();
408         result->SetOwner();
409
410         TString initDir(gGrid->Pwd(0));
411
412         TGridResult *res = gGrid->Ls(fDBFolder);
413         TString level0;
414
415         for(int i=0; i < res->GetEntries(); i++){
416                 level0=res->GetFileName(i);
417                 if (queryId.GetAliCDBPath().Level0Comprises(level0)) 
418                         GetEntriesForLevel0(level0, queryId, result);                               
419         }        
420         delete res;
421  
422         gGrid->Cd(initDir.Data(),0);
423         return result;  
424 }
425
426 //_____________________________________________________________________________
427 Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry) {
428 // put an AliCDBEntry object into the database
429         
430         AliCDBId& id = entry->GetId();
431
432         // set version for the entry to be stored
433         if (!PrepareId(id)) return kFALSE;       
434
435         // build filename from entry's id
436         TString filename;
437         if (!IdToFilename(id.GetAliCDBRunRange(), id.GetVersion(), filename)) {
438                 AliError("Bad ID encountered! Subnormal error!");
439                 return kFALSE;
440         } 
441
442         filename.Prepend("/alien" + fDBFolder + id.GetPath() + '/');
443         TString filenameCopy(filename);
444         filename += "?se="; filename += fSE.Data(); 
445  
446         TDirectory* saveDir = gDirectory;
447
448         // open file
449         TFile *file = TFile::Open(filename,"CREATE");
450         if(!file || !file->IsWritable()){
451                 AliError(Form("Can't open file <%s>!", filename.Data()));    
452                 if(file && !file->IsWritable()) file->Close(); delete file; file=0;
453                 return kFALSE;
454         }
455   
456         file->cd(); 
457
458         entry->SetVersion(id.GetVersion());
459
460         // write object (key name: "AliCDBEntry")
461         Bool_t result = (entry->Write("AliCDBEntry") != 0); 
462         if (!result) AliError(Form("Can't write entry to file <%s>!",filename.Data()));
463
464
465         if (saveDir) saveDir->cd(); else gROOT->cd();
466         file->Close(); delete file; file=0;
467         if(result) {
468                 AliInfo(Form("CDB object stored into file %s",filenameCopy.Data()));
469                 AliInfo(Form("using S.E. %s", fSE.Data()));
470         }
471  
472         return result;
473 }
474
475 //_____________________________________________________________________________
476 TList* AliCDBGrid::GetIdListFromFile(const char* fileName){
477
478         TString turl(fileName);
479         turl.Prepend("/alien" + fDBFolder);
480         turl += "?se="; turl += fSE.Data(); 
481         TFile *file = TFile::Open(turl);
482         if (!file) {
483                 AliError(Form("Can't open selection file <%s>!", turl.Data()));
484                 return NULL;
485         }
486
487         TList *list = new TList();
488         list->SetOwner();
489         int i=0;
490         TString keycycle;
491         
492         AliCDBId *id;
493         while(1){
494                 i++;
495                 keycycle = "AliCDBId;";
496                 keycycle+=i;
497                 
498                 id = (AliCDBId*) file->Get(keycycle);
499                 if(!id) break;
500                 list->AddFirst(id);
501         }
502         file->Close(); delete file; file=0;
503         
504         return list;
505
506
507 }
508
509 //_____________________________________________________________________________
510 Bool_t AliCDBGrid::Contains(const char* path) const{
511 // check for path in storage's DBFolder
512
513         TString initDir(gGrid->Pwd(0));
514         TString dirName(fDBFolder);
515         dirName += path; // dirName = fDBFolder/path
516         Bool_t result=kFALSE;
517         if (gGrid->Cd(dirName,0)) result=kTRUE;
518         gGrid->Cd(initDir.Data(),0);
519         return result;
520 }
521
522 /////////////////////////////////////////////////////////////////////////////////////////////////
523 //                                                                                             //
524 // AliCDBGrid factory                                                                          //
525 //                                                                                             //
526 /////////////////////////////////////////////////////////////////////////////////////////////////
527
528 ClassImp(AliCDBGridFactory)
529
530 //_____________________________________________________________________________
531 Bool_t AliCDBGridFactory::Validate(const char* gridString) {
532 // check if the string is valid Grid URI
533
534         // pattern: alien://hostName:Port;user;dbPath;SE
535         // example of a valid pattern:
536         // "alien://aliendb4.cern.ch:9000;colla;DBTest;ALICE::CERN::Server"
537 //        TRegexp gridPattern("^alien://.+:[0-9]+;[a-zA-Z0-9_-.]+;.+;.+$");
538         TRegexp gridPattern("^alien://.+$");
539
540         return TString(gridString).Contains(gridPattern);
541 }
542
543 //_____________________________________________________________________________
544 AliCDBParam* AliCDBGridFactory::CreateParameter(const char* gridString) {
545 // create AliCDBGridParam class from the URI string
546
547         if (!Validate(gridString)) {
548                 return NULL;
549         }
550         //TString buffer(gridString + sizeof("alien://") - 1);
551         TString buffer(gridString);
552  
553         TString gridUrl         = "alien://"; 
554         TString user            = "";
555         TString dbFolder        = "DBGrid";
556         TString se              = "ALICE::CERN::se01";
557
558         TObjArray *arr = buffer.Tokenize('?');
559         TIter iter(arr);
560         TObjString *str;
561         
562         while((str = (TObjString*) iter.Next())){
563                 TString entry(str->String());
564                 Int_t indeq = entry.Index('=');
565                 if(indeq == -1) {
566                         if(entry.BeginsWith("alien://")) { // maybe it's a gridUrl!
567                                 gridUrl = entry;
568                                 continue;
569                         } else {
570                                 AliError(Form("Invalid entry! %s",entry.Data()));
571                                 continue;
572                         }
573                 }
574                 
575                 TString key = entry(0,indeq);
576                 TString value = entry(indeq+1,entry.Length()-indeq);
577
578                 if(key.Contains("grid",TString::kIgnoreCase)) {
579                         gridUrl += value;
580                 } 
581                 else if (key.Contains("user",TString::kIgnoreCase)){
582                         user = value;
583                 }
584                 else if (key.Contains("folder",TString::kIgnoreCase)){
585                         dbFolder = value;
586                 }
587                 else if (key.Contains("se",TString::kIgnoreCase)){
588                         se = value;
589                 }
590                 else{
591                         AliError(Form("Invalid entry! %s",entry.Data()));
592                 }
593         }
594         delete arr; arr=0;
595                 
596         AliInfo(Form("gridUrl:  %s",gridUrl.Data()));
597         AliInfo(Form("user:     %s",user.Data()));
598         AliInfo(Form("dbFolder: %s",dbFolder.Data()));
599         AliInfo(Form("s.e.:     %s",se.Data()));
600
601         return new AliCDBGridParam(gridUrl, user, dbFolder, se);       
602 }
603
604 //_____________________________________________________________________________
605 AliCDBStorage* AliCDBGridFactory::Create(const AliCDBParam* param) {
606 // create AliCDBGrid storage instance from parameters
607         
608         if (AliCDBGridParam::Class() == param->IsA()) {
609                 
610                 const AliCDBGridParam* gridParam = (const AliCDBGridParam*) param;
611                 AliCDBGrid *grid = new AliCDBGrid(gridParam->GridUrl(), 
612                                       gridParam->GetUser(), gridParam->GetDBFolder(),
613                                       gridParam->GetSE()); 
614
615                 if(gGrid) return grid;
616         }
617
618         return NULL;
619 }
620
621 /////////////////////////////////////////////////////////////////////////////////////////////////
622 //                                                                                             //
623 // AliCDBGrid Parameter class                                                                  //                                          //
624 //                                                                                             //
625 /////////////////////////////////////////////////////////////////////////////////////////////////
626
627 ClassImp(AliCDBGridParam)
628
629 //_____________________________________________________________________________
630 AliCDBGridParam::AliCDBGridParam() {
631 // default constructor
632
633 }
634
635 //_____________________________________________________________________________
636 AliCDBGridParam::AliCDBGridParam(const char* gridUrl, 
637                                 const char* user, 
638                                 const char* dbFolder, 
639                                 const char* se):
640  fGridUrl(gridUrl),
641  fUser(user),
642  fDBFolder(dbFolder),
643  fSE(se)
644 {
645 // constructor
646         
647         SetType("alien");
648
649         TString uri;
650         uri+=fGridUrl; uri+="?";
651         uri+="User=";   uri+=fUser; uri+="?"; 
652         uri+="DBFolder="; uri+=fDBFolder; uri+="?";
653         uri+="SE=";     uri+=fSE;
654         
655         SetURI(uri);
656 }
657
658 //_____________________________________________________________________________
659 AliCDBGridParam::~AliCDBGridParam() {
660 // destructor
661
662 }
663
664 //_____________________________________________________________________________
665 AliCDBParam* AliCDBGridParam::CloneParam() const {
666 // clone parameter
667
668         return new AliCDBGridParam(fGridUrl, fUser, fDBFolder, fSE);
669 }
670
671 //_____________________________________________________________________________
672 ULong_t AliCDBGridParam::Hash() const {
673 // return Hash function
674
675         return fGridUrl.Hash()+fUser.Hash()+fDBFolder.Hash()+fSE.Hash();
676 }
677
678 //_____________________________________________________________________________
679 Bool_t AliCDBGridParam::IsEqual(const TObject* obj) const {
680 // check if this object is equal to AliCDBParam obj
681
682         if (this == obj) {
683                 return kTRUE;
684         }
685
686         if (AliCDBGridParam::Class() != obj->IsA()) {
687                 return kFALSE;
688         }
689
690         AliCDBGridParam* other = (AliCDBGridParam*) obj;
691
692         if(fGridUrl != other->fGridUrl) return kFALSE;
693         if(fUser != other->fUser) return kFALSE;
694         if(fDBFolder != other->fDBFolder) return kFALSE;
695         if(fSE != other->fSE) return kFALSE;
696         return kTRUE;
697 }
698