KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVDataRepository.h
Go to the documentation of this file.
1 /*
2 $Id: KVDataRepository.h,v 1.12 2007/12/11 12:45:47 franklan Exp $
3 $Revision: 1.12 $
4 $Date: 2007/12/11 12:45:47 $
5 */
6 
9 
10 #ifndef __KVDATAREPOSITORY_H
11 #define __KVDATAREPOSITORY_H
12 
13 #include "KVBase.h"
14 #include "TString.h"
15 #include "TSystem.h"
16 #include "KVAvailableRunsFile.h"
17 #include "TEnv.h"
18 
19 class KVList;
20 class KVUniqueNameList;
21 class TFile;
22 class KVDataSet;
23 class KVDataSetManager;
24 
99 class KVDataRepository: public KVBase {
100 
101 protected:
102 
128  void SetFullPath(TString& path, const Char_t* protocol);
129  virtual const Char_t* GetReadProtocol(const Char_t* dataset, const Char_t* datatype);
131 
132  virtual int Chmod(const char* file, UInt_t mode);
133  virtual void PrepareXRDTunnel();
134 
136  TObject* OpenDataSetFile(const KVDataSet* ds, const Char_t* type, const TString& fname, Option_t* opt = "");
137 public:
138  virtual int CopyFile(const char* f, const char* t, Bool_t overwrite = kFALSE);
139  TSystem* FindHelper(const char* path, void* dirptr = 0);
140  Bool_t HelperIsConsistentWith(TSystem* helper, const char* path, void* dirptr = 0);
141 
144 
145  virtual Bool_t Init();
146 
147  virtual Bool_t CheckSubdirExists(const Char_t* dir,
148  const Char_t* subdir = 0);
149  virtual Bool_t GetFileInfo(const KVDataSet* dataset,
150  const Char_t* datatype,
151  const Char_t* runfile, FileStat_t& fs);
152  virtual Bool_t CheckFileStatus(const KVDataSet* dataset,
153  const Char_t* datatype,
154  const Char_t* runfile);
155 
156  virtual const Char_t* GetFullPathToOpenFile(const KVDataSet* dataset,
157  const Char_t* datatype,
158  const Char_t* runfile);
159 
160  virtual const Char_t* GetFullPathToTransferFile(const KVDataSet* dataset,
161  const Char_t* datatype,
162  const Char_t* runfile);
163 
165  virtual Bool_t IsRemote() const
166  {
167  return kFALSE;
168  };
170  virtual Bool_t IsConnected()
171  {
172  return kTRUE;
173  };
178  virtual Bool_t CanWrite() const
179  {
180  return fCanWrite;
181  }
182  virtual KVUniqueNameList* GetDirectoryListing(const KVDataSet* dataset,
183  const Char_t* datatype = "", const Char_t* subdir = "");
184 
185  virtual void CopyFileFromRepository(const KVDataSet* dataset,
186  const Char_t* datatype,
187  const Char_t* filename,
188  const Char_t* destination);
189  virtual int CopyFileToRepository(const Char_t* source,
190  const KVDataSet* dataset,
191  const Char_t* datatype,
192  const Char_t* filename);
193 
194  virtual TFile* CreateNewFile(const KVDataSet* dataset,
195  const Char_t* datatype,
196  const Char_t* filename);
197  virtual void CommitFile(TFile* file, const Char_t* datatype, const KVDataSet* dataset);
198 
199  virtual void MakeSubdirectory(const KVDataSet* dataset,
200  const Char_t* datatype = "");
201 
202  virtual void DeleteFile(const KVDataSet* dataset,
203  const Char_t* datatype,
204  const Char_t* filename, Bool_t confirm =
205  kTRUE);
206 
207  virtual void Print(Option_t* opt = "") const;
209  virtual const Char_t* GetFileTransferType() const
210  {
211  return fTransfertype;
212  };
214  virtual const Char_t* GetFileTransferExec() const
215  {
216  return fTransferExec;
217  };
219  virtual const Char_t* GetFileTransferServer() const
220  {
221  return fTransferserver;
222  };
224  virtual const Char_t* GetFileTransferUser() const
225  {
226  return fTransferuser;
227  };
229  virtual const Char_t* GetRootDirectory() const
230  {
231  return fLocalrootdir;
232  };
233 
234  virtual KVDataSetManager* GetDataSetManager() const;
235 
236  void cd();
237  static KVDataRepository* NewRepository(const Char_t* type);
238  virtual KVAvailableRunsFile* NewAvailableRunsFile(const Char_t*, const KVDataSet*);
239  virtual TObject* OpenDataSetRunFile(const KVDataSet* ds, const Char_t* type, Int_t run, Option_t* opt = "");
240  void CreateAllNeededSubdirectories(const KVDataSet* DataSet, const Char_t* DataType);
241 
243  {
244  ;
245  }
246 
247  ClassDef(KVDataRepository, 0) //Base class handling files in data repository
248 };
249 
252 
253 #ifdef __CCIN2P3_RFIO
254 #include "TRFIOFile.h"
255 class KVRFIOSystem : public TRFIOSystem {
256 public:
257  KVRFIOSystem(): TRFIOSystem() { };
258  virtual ~KVRFIOSystem() { };
259 
260  Int_t Unlink(const char* path);
261  int Chmod(const char* file, UInt_t mode);
262 
263  ClassDef(KVRFIOSystem, 0) // TRFIOSystem with fully-functioning Unlink and Chmod methods
264 };
265 #endif
266 #endif
int Int_t
unsigned int UInt_t
#define R__EXTERN
R__EXTERN KVDataRepository * gDataRepository
........ global variable
char Char_t
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
const char Option_t
#define ClassDef(name, id)
Handles lists of available runs for different datasets and types of data.
Base class for KaliVeda framework.
Definition: KVBase.h:135
Base class for managing repositories of experimental data.
virtual KVDataSetManager * GetDataSetManager() const
Return pointer to data set manager for this repository.
virtual int CopyFileToRepository(const Char_t *source, const KVDataSet *dataset, const Char_t *datatype, const Char_t *filename)
virtual int Chmod(const char *file, UInt_t mode)
virtual TObject * OpenDataSetRunFile(const KVDataSet *ds, const Char_t *type, Int_t run, Option_t *opt="")
virtual const Char_t * GetFileTransferExec() const
returns full path to executable used for remote file transfer
virtual Bool_t IsRemote() const
Returns kTRUE for remote repositories, kFALSE for local repositories.
virtual void CopyFileFromRepository(const KVDataSet *dataset, const Char_t *datatype, const Char_t *filename, const Char_t *destination)
virtual const Char_t * GetReadProtocol(const Char_t *dataset, const Char_t *datatype)
virtual const Char_t * GetFileTransferType() const
returns protocol used for remote file transfer
static KVDataRepository * NewRepository(const Char_t *type)
virtual void Print(Option_t *opt="") const
Print info on repository.
virtual int CopyFile(const char *f, const char *t, Bool_t overwrite=kFALSE)
virtual KVUniqueNameList * GetDirectoryListing(const KVDataSet *dataset, const Char_t *datatype="", const Char_t *subdir="")
virtual Bool_t CheckFileStatus(const KVDataSet *dataset, const Char_t *datatype, const Char_t *runfile)
KVDataSetManager * fDSM
handles datasets in repository
virtual Bool_t GetFileInfo(const KVDataSet *dataset, const Char_t *datatype, const Char_t *runfile, FileStat_t &fs)
virtual Bool_t CheckSubdirExists(const Char_t *dir, const Char_t *subdir=0)
virtual Bool_t Init()
virtual void PrepareXRDTunnel()
void SetFullPath(TString &path, const Char_t *protocol)
virtual KVAvailableRunsFile * NewAvailableRunsFile(const Char_t *, const KVDataSet *)
virtual void PrintAvailableDatasetsUpdateWarning() const
TSeqCollection * fHelpers
List of helper classes for alternative file/directory access.
void CreateAllNeededSubdirectories(const KVDataSet *DataSet, const Char_t *DataType)
virtual KVDataSetManager * NewDataSetManager()
Create and return pointer to new data set manager.
virtual Bool_t CanWrite() const
virtual ~ KVDataRepository()
Bool_t HelperIsConsistentWith(TSystem *helper, const char *path, void *dirptr=0)
TSystem * FindHelper(const char *path, void *dirptr=0)
virtual void CommitFile(TFile *file, const Char_t *datatype, const KVDataSet *dataset)
virtual void DeleteFile(const KVDataSet *dataset, const Char_t *datatype, const Char_t *filename, Bool_t confirm=kTRUE)
virtual TFile * CreateNewFile(const KVDataSet *dataset, const Char_t *datatype, const Char_t *filename)
KVDataRepository()
Default constructor.
virtual const Char_t * GetFullPathToTransferFile(const KVDataSet *dataset, const Char_t *datatype, const Char_t *runfile)
virtual const Char_t * GetFileTransferUser() const
returns user name used for remote file transfer
virtual Bool_t IsConnected()
Always returns kTRUE for local repositories.
virtual const Char_t * GetFileTransferServer() const
returns server url used for remote file transfer
const KVDataSet * fCommitDataSet
used by CreateNewFile and CommitFile
virtual void MakeSubdirectory(const KVDataSet *dataset, const Char_t *datatype="")
virtual const Char_t * GetFullPathToOpenFile(const KVDataSet *dataset, const Char_t *datatype, const Char_t *runfile)
virtual const Char_t * GetRootDirectory() const
returns root directory of data repository (fLocalrootdir)
TObject * OpenDataSetFile(const KVDataSet *ds, const Char_t *type, const TString &fname, Option_t *opt="")
Manage all datasets contained in a given data repository.
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition: KVDataSet.h:207
Extended TList class which owns its objects by default.
Definition: KVList.h:27
Optimised list in which named objects can only be placed once.