Logo ROOT   6.12/07
Reference Guide
TDataSetManagerAliEn.h
Go to the documentation of this file.
1 // @(#)root/proof:$Id: 511148a2a899e02c8f5b86a7d87caee2e5979f9d $
2 // Author: Dario Berzano, 26.11.12
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TDataSetManagerAliEn
13 #define ROOT_TDataSetManagerAliEn
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TDataSetManagerAliEn //
18 // //
19 // Implementation of TDataSetManager dynamically creating datasets //
20 // by querying the AliEn file catalog. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TDataSetManager.h"
25 
26 #include "TDataSetManagerFile.h"
27 
28 #include "TFileStager.h"
29 #include "TPRegexp.h"
30 #include "TObjString.h"
31 #include "TObjArray.h"
32 #include "TFileCollection.h"
33 #include "TFileInfo.h"
34 #include "TGridResult.h"
35 #include "TGrid.h"
36 #include "THashList.h"
37 #include "TSystem.h"
38 
40 
41 class TAliEnFind : public TObject {
42 
43  private:
44 
55 
56  inline virtual void InvalidateSearchId();
57  inline virtual void InvalidateGridResult();
58 
59  public:
60 
61  TAliEnFind(const TString &basePath = "", const TString &fileName = "",
62  const TString &anchor = "", const Bool_t archSubst = kFALSE,
63  const TString &treeName = "", const TString &regexp = "",
64  const TString &query = "");
65 
66  TAliEnFind(const TAliEnFind &src);
67  TAliEnFind &operator=(const TAliEnFind &rhs);
68 
69  virtual ~TAliEnFind();
70 
71  virtual TGridResult *GetGridResult(Bool_t forceNewQuery = kFALSE);
72 
73  virtual const TString &GetBasePath() const { return fBasePath; };
74  virtual const TString &GetFileName() const { return fFileName; };
75  virtual const TString &GetAnchor() const { return fAnchor; };
76  virtual const TString &GetTreeName() const { return fTreeName; };
77  virtual Bool_t GetArchSubst() const { return fArchSubst; };
78  virtual const TPMERegexp *GetRegexp() const { return fRegexp; };
79 
80  virtual void SetBasePath(const char *basePath);
81  virtual void SetFileName(const char *fileName);
82  virtual void SetAnchor(const char *anchor);
83  virtual void SetTreeName(const char *fileName);
84  virtual void SetArchSubst(Bool_t archSubst);
85  virtual void SetRegexp(const char *regexp);
86 
87  virtual const char *GetSearchId();
88  virtual TFileCollection *GetCollection(Bool_t forceNewQuery = kFALSE);
89  virtual void Print(Option_t* opt = "") const;
90 
91  ClassDef(TAliEnFind, 0); // Interface to the AliEn find command
92 
93 };
94 
96 
97  protected:
98 
104 
108 
109  static std::vector<Int_t> *ExpandRunSpec(TString &runSpec);
110 
111  static Bool_t ParseCustomFindUri(TString &uri, TString &basePath,
112  TString &fileName, TString &anchor, TString &query, TString &treeName,
113  TString &regexp);
114 
115  static Bool_t ParseOfficialDataUri(TString &uri, Bool_t sim,
116  TString &period, Int_t &year, std::vector<Int_t> *&runList,
117  Bool_t &esd, Int_t &aodNum, TString &pass);
118 
119  static TUrl *AliEnWhereIs(TUrl *alienUrl, TString &closeSE,
120  Bool_t onlyFromCloseSE);
121 
122  virtual void Init(TString cacheDir, TString urlTpl,
123  ULong_t cacheExpire_s);
124 
125  virtual TList *GetFindCommandsFromUri(TString &uri, EDataMode &dataMode, Bool_t &forceUpdate);
126 
127  public:
128 
130  TDataSetManagerAliEn(const char *cacheDir, const char *urlTpl,
131  ULong_t cacheExpire_s);
132  TDataSetManagerAliEn(const char *, const char *, const char *cfgStr);
133 
134  virtual ~TDataSetManagerAliEn();
135  virtual TFileCollection *GetDataSet(const char *uri, const char * = 0);
136  virtual Bool_t ExistsDataSet(const char *uri);
137 
138  // Not implemented functionalities
139  virtual Int_t RegisterDataSet(const char *, TFileCollection *,
140  const char *);
141  virtual TMap *GetDataSets(const char *, UInt_t);
142  virtual void ShowDataSets(const char * = "*", const char * = "");
143  virtual Bool_t RemoveDataSet(const char *uri);
144  virtual Int_t ScanDataSet(const char *, UInt_t);
145  virtual Int_t ShowCache(const char *);
146  virtual Int_t ClearCache(const char *);
147 
148  ClassDef(TDataSetManagerAliEn, 0) // Dataset to AliEn catalog interface
149 };
150 
151 #endif
virtual const TString & GetTreeName() const
virtual void SetRegexp(const char *regexp)
Int_t RemoveDataSet(const char *dsname)
RemoveDataSet wrapper.
virtual void SetArchSubst(Bool_t archSubst)
const char Option_t
Definition: RtypesCore.h:62
This class represents a WWW compatible URL.
Definition: TUrl.h:35
TFileCollection * GetDataSet(const char *ds, const char *server)
GetDataSet wrapper.
Definition: pq2wrappers.cxx:87
virtual void InvalidateGridResult()
virtual TGridResult * GetGridResult(Bool_t forceNewQuery=kFALSE)
Query the AliEn file catalog.
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t RegisterDataSet(const char *dsname, TFileCollection *fc, const char *opt)
RegisterDataSet wrapper.
TPMERegexp * fRegexp
virtual TFileCollection * GetCollection(Bool_t forceNewQuery=kFALSE)
virtual Bool_t GetArchSubst() const
#define ClassDef(name, id)
Definition: Rtypes.h:320
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Definition: TClassEdit.cxx:119
A doubly linked list.
Definition: TList.h:44
virtual const TString & GetAnchor() const
virtual const TPMERegexp * GetRegexp() const
virtual void SetFileName(const char *fileName)
Bool_t ExistsDataSet(const char *dsname)
ExistsDataSet wrapper.
virtual ~TAliEnFind()
Destructor.
unsigned int UInt_t
Definition: RtypesCore.h:42
TGridResult * fGridResult
TMap * GetDataSets(const char *owner, const char *server, const char *opt)
GetDataSets wrapper.
virtual void SetBasePath(const char *basePath)
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
TAliEnFind & operator=(const TAliEnFind &rhs)
Assignment operator. Cached query result is not copied.
virtual void Print(Option_t *opt="") const
This method must be overridden when a class wants to print itself.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
unsigned long ULong_t
Definition: RtypesCore.h:51
TAliEnFind(const TString &basePath="", const TString &fileName="", const TString &anchor="", const Bool_t archSubst=kFALSE, const TString &treeName="", const TString &regexp="", const TString &query="")
Constructor.
virtual const char * GetSearchId()
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void SetTreeName(const char *fileName)
virtual const TString & GetBasePath() const
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
Class that contains a list of TFileInfo&#39;s and accumulated meta data information about its entries...
virtual void InvalidateSearchId()
virtual const TString & GetFileName() const
virtual void SetAnchor(const char *anchor)
void ShowDataSets(const char *ds, const char *opt)
ShowDataSets wrapper.
Definition: pq2wrappers.cxx:70
TDataSetManagerFile * fCache