00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TAlienCollection
00013 #define ROOT_TAlienCollection
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ROOT_TGridCollection
00028 #include "TGridCollection.h"
00029 #endif
00030 #ifndef ROOT_TString
00031 #include "TString.h"
00032 #endif
00033 #ifndef ROOT_TList
00034 #include "TList.h"
00035 #endif
00036 #ifndef ROOT_TFileStager
00037 #include "TFileStager.h"
00038 #endif
00039
00040
00041 class TFileCollection;
00042
00043 class TAlienCollection : public TGridCollection {
00044
00045 private:
00046 TString fXmlFile;
00047 TList *fFileGroupList;
00048 TIter *fFileGroupListIter;
00049 TMap *fCurrent;
00050 UInt_t fNofGroups;
00051 UInt_t fNofGroupfiles;
00052 Bool_t fHasSUrls;
00053 Bool_t fHasSelection;
00054 Bool_t fHasOnline;
00055 TString fLastOutFileName;
00056 TFileStager *fFileStager;
00057 TString fExportUrl;
00058 TString fInfoComment;
00059 TString fCollectionName;
00060 TList *fTagFilterList;
00061
00062 virtual void ParseXML(UInt_t maxentries);
00063 Bool_t ExportXML(TFile * file, Bool_t selected, Bool_t online,
00064 const char *name, const char *comment);
00065
00066 public:
00067 TAlienCollection() : fFileGroupList(0), fFileGroupListIter(0), fCurrent(0),
00068 fNofGroups(0), fNofGroupfiles(0), fHasSUrls(0), fHasSelection(0),
00069 fFileStager(0), fExportUrl(""), fInfoComment(""), fCollectionName("unnamed"), fTagFilterList(0)
00070 { }
00071 TAlienCollection(TList *eventlist, UInt_t ngroups = 0,
00072 UInt_t ngroupfiles = 0);
00073 TAlienCollection(const char *localCollectionFile, UInt_t maxentries);
00074
00075 virtual ~TAlienCollection();
00076
00077 TFileCollection* GetFileCollection(const char* name = "", const char* title = "") const;
00078
00079 void Reset();
00080 TMap *Next();
00081 Bool_t Remove(TMap * map);
00082 const char *GetTURL(const char *name = "") ;
00083 const char *GetSURL(const char *name = "") ;
00084 const char *GetLFN(const char *name = "") ;
00085 Long64_t GetSize(const char *name = "") ;
00086 Bool_t IsOnline(const char *name = "") ;
00087 Bool_t IsSelected(const char *name = "") ;
00088 void Status();
00089 void SetTag(const char *tag, const char *value, TMap * tagmap);
00090 Bool_t SelectFile(const char *name, Int_t = -1, Int_t = -1);
00091 Bool_t DeselectFile(const char *name, Int_t = -1, Int_t = -1);
00092 Bool_t InvertSelection();
00093 Bool_t DownscaleSelection(UInt_t scaler = 2);
00094 Bool_t ExportXML(const char *exporturl, Bool_t selected, Bool_t online,
00095 const char *name, const char *comment);
00096 const char *GetExportUrl() {
00097 if (fExportUrl.Length()) return fExportUrl; else return 0;
00098 }
00099
00100 Bool_t SetExportUrl(const char *exporturl = 0);
00101
00102 void Print(Option_t * opt) const;
00103 TFile *OpenFile(const char *filename) ;
00104
00105 TEntryList *GetEntryList(const char *name) ;
00106
00107 TList *GetFileGroupList() const { return fFileGroupList; }
00108
00109 UInt_t GetNofGroups() const { return fNofGroups; }
00110
00111 UInt_t GetNofGroupfiles() const { return fNofGroupfiles; }
00112
00113 Bool_t OverlapCollection(TGridCollection *comparator);
00114 void Add(TGridCollection *addcollection);
00115 Bool_t Stage(Bool_t bulk = kFALSE, Option_t* option = "");
00116 Bool_t Prepare(Bool_t bulk = kFALSE) { return Stage(bulk,"option=0"); }
00117
00118 Bool_t CheckIfOnline(Bool_t bulk = kFALSE);
00119 TDSet *GetDataset(const char *type, const char *objname = "*", const char *dir = "/");
00120
00121 TGridResult *GetGridResult(const char *filename = "",
00122 Bool_t onlyonline = kTRUE,
00123 Bool_t publicaccess = kFALSE);
00124
00125 Bool_t LookupSUrls(Bool_t verbose = kTRUE);
00126
00127 TList *GetTagFilterList() const { return fTagFilterList; }
00128
00129 void SetTagFilterList(TList * filterlist) { if (fTagFilterList)
00130 delete fTagFilterList; fTagFilterList = filterlist;
00131 }
00132
00133 const char* GetCollectionName() const { return fCollectionName.Data(); }
00134 const char* GetInfoComment() const { return fInfoComment.Data(); }
00135
00136 static TGridCollection *Open(const char *collectionurl,
00137 UInt_t maxentries = 1000000);
00138 static TGridCollection *OpenQuery(TGridResult * queryresult,
00139 Bool_t nogrouping = kFALSE);
00140 static TAlienCollection *OpenAlienCollection(TGridResult * queryresult,
00141 Option_t* option = "");
00142
00143 const char *GetOutputFileName(const char *infile, Bool_t rename = kTRUE, const char *suffix="root");
00144
00145 ClassDef(TAlienCollection, 1)
00146 };
00147
00148 #endif