Logo ROOT  
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
TDataSetManager.h
TDataSetManagerAliEn::fCache
TDataSetManagerFile * fCache
Definition: TDataSetManagerAliEn.h:101
TAliEnFind::fArchSubst
Bool_t fArchSubst
Definition: TDataSetManagerAliEn.h:51
TAliEnFind::~TAliEnFind
virtual ~TAliEnFind()
Destructor.
Definition: TDataSetManagerAliEn.cxx:87
TPMERegexp
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
kDataLocal
@ kDataLocal
Definition: TDataSetManagerAliEn.h:39
TAliEnFind::GetAnchor
virtual const TString & GetAnchor() const
Definition: TDataSetManagerAliEn.h:75
TDataSetManagerFile
Definition: TDataSetManagerFile.h:30
TAliEnFind::operator=
TAliEnFind & operator=(const TAliEnFind &rhs)
Assignment operator. Cached query result is not copied.
Definition: TDataSetManagerAliEn.cxx:65
TDataSetManagerAliEn::ShowDataSets
virtual void ShowDataSets(const char *="*", const char *="")
Prints formatted information about the dataset 'uri'.
Definition: TDataSetManagerAliEn.cxx:1280
TAliEnFind::GetRegexp
virtual const TPMERegexp * GetRegexp() const
Definition: TDataSetManagerAliEn.h:78
Option_t
const char Option_t
Definition: RtypesCore.h:66
TDataSetManagerAliEn::fReadFromSE
Bool_t fReadFromSE
Definition: TDataSetManagerAliEn.h:103
TDataSetManagerAliEn::ScanDataSet
virtual Int_t ScanDataSet(const char *, UInt_t)
Scans the dataset indicated by <uri> and returns the number of missing files.
Definition: TDataSetManagerAliEn.cxx:1295
kDataCache
@ kDataCache
Definition: TDataSetManagerAliEn.h:39
TObjString.h
TAliEnFind::Print
virtual void Print(Option_t *opt="") const
This method must be overridden when a class wants to print itself.
Definition: TDataSetManagerAliEn.cxx:244
TAliEnFind::GetFileName
virtual const TString & GetFileName() const
Definition: TDataSetManagerAliEn.h:74
TDataSetManagerAliEn::RemoveDataSet
virtual Bool_t RemoveDataSet(const char *uri)
Removes the indicated dataset.
Definition: TDataSetManagerAliEn.cxx:1287
TDataSetManagerAliEn::ParseOfficialDataUri
static Bool_t ParseOfficialDataUri(TString &uri, Bool_t sim, TString &period, Int_t &year, std::vector< Int_t > *&runList, Bool_t &esd, Int_t &aodNum, TString &pass)
Definition: TDataSetManagerAliEn.cxx:721
TDataSetManagerAliEn::ParseCustomFindUri
static Bool_t ParseCustomFindUri(TString &uri, TString &basePath, TString &fileName, TString &anchor, TString &query, TString &treeName, TString &regexp)
Definition: TDataSetManagerAliEn.cxx:636
TDataSetManagerAliEn::ExpandRunSpec
static std::vector< Int_t > * ExpandRunSpec(TString &runSpec)
Definition: TDataSetManagerAliEn.cxx:908
Int_t
int Int_t
Definition: RtypesCore.h:45
TAliEnFind::fGridResult
TGridResult * fGridResult
Definition: TDataSetManagerAliEn.h:54
TDataSetManagerAliEn::kfNoopRedirUrl
const TUrl * kfNoopRedirUrl
Definition: TDataSetManagerAliEn.h:105
TDataSetManagerAliEn::fCacheExpire_s
Long_t fCacheExpire_s
Definition: TDataSetManagerAliEn.h:102
TAliEnFind::SetBasePath
virtual void SetBasePath(const char *basePath)
Definition: TDataSetManagerAliEn.cxx:255
TAliEnFind::TAliEnFind
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.
Definition: TDataSetManagerAliEn.cxx:29
TDataSetManagerAliEn::ClearCache
virtual Int_t ClearCache(const char *)
Clear cached information matching uri.
Definition: TDataSetManagerAliEn.cxx:1311
TDataSetManager
Definition: TDataSetManager.h:38
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TAliEnFind::GetSearchId
virtual const char * GetSearchId()
Definition: TDataSetManagerAliEn.cxx:187
TAliEnFind::SetAnchor
virtual void SetAnchor(const char *anchor)
Definition: TDataSetManagerAliEn.cxx:275
bool
TAliEnFind::SetTreeName
virtual void SetTreeName(const char *fileName)
Definition: TDataSetManagerAliEn.cxx:285
TAliEnFind::InvalidateSearchId
virtual void InvalidateSearchId()
Definition: TDataSetManagerAliEn.cxx:321
TAliEnFind::SetArchSubst
virtual void SetArchSubst(Bool_t archSubst)
Definition: TDataSetManagerAliEn.cxx:294
TAliEnFind::fAnchor
TString fAnchor
Definition: TDataSetManagerAliEn.h:49
TDataSetManagerAliEn::fUrlRe
TPMERegexp * fUrlRe
Definition: TDataSetManagerAliEn.h:99
TGrid.h
TDataSetManagerAliEn::RegisterDataSet
virtual Int_t RegisterDataSet(const char *, TFileCollection *, const char *)
Register a dataset, perfoming quota checkings, if needed.
Definition: TDataSetManagerAliEn.cxx:1263
TAliEnFind::GetBasePath
virtual const TString & GetBasePath() const
Definition: TDataSetManagerAliEn.h:73
TPRegexp.h
TGridResult.h
TSystem.h
TDataSetManagerAliEn::ShowCache
virtual Int_t ShowCache(const char *)
Show cached information matching uri.
Definition: TDataSetManagerAliEn.cxx:1303
TFileInfo.h
TGridResult
Definition: TGridResult.h:31
TAliEnFind::InvalidateGridResult
virtual void InvalidateGridResult()
Definition: TDataSetManagerAliEn.cxx:329
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
Long_t
long Long_t
Definition: RtypesCore.h:54
TAliEnFind::fQuery
TString fQuery
Definition: TDataSetManagerAliEn.h:50
TAliEnFind::SetRegexp
virtual void SetRegexp(const char *regexp)
Definition: TDataSetManagerAliEn.cxx:304
TDataSetManagerFile.h
TDataSetManagerAliEn::Init
virtual void Init(TString cacheDir, TString urlTpl, ULong_t cacheExpire_s)
Definition: TDataSetManagerAliEn.cxx:341
TFileCollection.h
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TDataSetManagerAliEn::AliEnWhereIs
static TUrl * AliEnWhereIs(TUrl *alienUrl, TString &closeSE, Bool_t onlyFromCloseSE)
Definition: TDataSetManagerAliEn.cxx:816
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TDataSetManagerAliEn
Definition: TDataSetManagerAliEn.h:95
TUrl
This class represents a WWW compatible URL.
Definition: TUrl.h:33
TDataSetManagerAliEn::fUrlTpl
TString fUrlTpl
Definition: TDataSetManagerAliEn.h:100
TDataSetManagerAliEn::ExistsDataSet
virtual Bool_t ExistsDataSet(const char *uri)
Checks if the indicated dataset exits.
Definition: TDataSetManagerAliEn.cxx:1253
TAliEnFind::GetTreeName
virtual const TString & GetTreeName() const
Definition: TDataSetManagerAliEn.h:76
THashList.h
TAliEnFind
Definition: TDataSetManagerAliEn.h:41
TAliEnFind::fBasePath
TString fBasePath
Definition: TDataSetManagerAliEn.h:45
TObjArray.h
TAliEnFind::fRegexp
TPMERegexp * fRegexp
Definition: TDataSetManagerAliEn.h:52
TAliEnFind::fSearchId
TString fSearchId
Definition: TDataSetManagerAliEn.h:53
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TAliEnFind::fFileName
TString fFileName
Definition: TDataSetManagerAliEn.h:46
TAliEnFind::GetGridResult
virtual TGridResult * GetGridResult(Bool_t forceNewQuery=kFALSE)
Query the AliEn file catalog.
Definition: TDataSetManagerAliEn.cxx:96
TDataSetManagerAliEn::GetFindCommandsFromUri
virtual TList * GetFindCommandsFromUri(TString &uri, EDataMode &dataMode, Bool_t &forceUpdate)
Parse kind.
Definition: TDataSetManagerAliEn.cxx:437
TDataSetManagerAliEn::TDataSetManagerAliEn
TDataSetManagerAliEn()
Definition: TDataSetManagerAliEn.h:129
TFileStager.h
TAliEnFind::fRegexpRaw
TString fRegexpRaw
Definition: TDataSetManagerAliEn.h:48
EDataMode
EDataMode
Definition: TDataSetManagerAliEn.h:39
TDataSetManagerAliEn::GetDataSet
virtual TFileCollection * GetDataSet(const char *uri, const char *=0)
Utility function used in various methods for user dataset upload.
Definition: TDataSetManagerAliEn.cxx:976
TDataSetManagerAliEn::kfNoopUnknownUrl
const TUrl * kfNoopUnknownUrl
Definition: TDataSetManagerAliEn.h:106
TAliEnFind::SetFileName
virtual void SetFileName(const char *fileName)
Definition: TDataSetManagerAliEn.cxx:265
TAliEnFind::fTreeName
TString fTreeName
Definition: TDataSetManagerAliEn.h:47
kDataRemote
@ kDataRemote
Definition: TDataSetManagerAliEn.h:39
TDataSetManagerAliEn::~TDataSetManagerAliEn
virtual ~TDataSetManagerAliEn()
Definition: TDataSetManagerAliEn.cxx:425
TDataSetManagerAliEn::kfNoopNoneUrl
const TUrl * kfNoopNoneUrl
Definition: TDataSetManagerAliEn.h:107
TAliEnFind::GetCollection
virtual TFileCollection * GetCollection(Bool_t forceNewQuery=kFALSE)
Definition: TDataSetManagerAliEn.cxx:209
TAliEnFind::GetArchSubst
virtual Bool_t GetArchSubst() const
Definition: TDataSetManagerAliEn.h:77
TList
A doubly linked list.
Definition: TList.h:44
int
TFileCollection
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
Definition: TFileCollection.h:39
TMap
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
TDataSetManagerAliEn::GetDataSets
virtual TMap * GetDataSets(const char *, UInt_t)
Returns all datasets for the <group> and <user> specified by <uri>.
Definition: TDataSetManagerAliEn.cxx:1272