KaliVeda  1.13/01
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 #include "KVList.h"
19 #include "KVUniqueNameList.h"
20 class TFile;
21 class KVDataSet;
22 class KVDataSetManager;
23 
98 class KVDataRepository: public KVBase {
99 
100 protected:
101 
127  void SetFullPath(TString& path, const Char_t* protocol);
128  virtual const Char_t* GetReadProtocol(const Char_t* dataset, const Char_t* datatype);
130 
131  virtual int Chmod(const char* file, UInt_t mode);
132  virtual void PrepareXRDTunnel();
133 
135  TObject* OpenDataSetFile(const KVDataSet* ds, const Char_t* type, const TString& fname, Option_t* opt = "");
136 public:
137  virtual int CopyFile(const char* f, const char* t, Bool_t overwrite = kFALSE);
138  TSystem* FindHelper(const char* path, void* dirptr = 0);
139  Bool_t HelperIsConsistentWith(TSystem* helper, const char* path, void* dirptr = 0);
140 
143 
144  virtual Bool_t Init();
145 
146  virtual Bool_t CheckSubdirExists(const Char_t* dir,
147  const Char_t* subdir = 0);
148  virtual Bool_t GetFileInfo(const KVDataSet* dataset,
149  const Char_t* datatype,
150  const Char_t* runfile, FileStat_t& fs);
151  virtual Bool_t CheckFileStatus(const KVDataSet* dataset,
152  const Char_t* datatype,
153  const Char_t* runfile);
154 
155  virtual const Char_t* GetFullPathToOpenFile(const KVDataSet* dataset,
156  const Char_t* datatype,
157  const Char_t* runfile);
158 
159  virtual const Char_t* GetFullPathToTransferFile(const KVDataSet* dataset,
160  const Char_t* datatype,
161  const Char_t* runfile);
162 
164  virtual Bool_t IsRemote() const
165  {
166  return kFALSE;
167  };
169  virtual Bool_t IsConnected()
170  {
171  return kTRUE;
172  };
177  virtual Bool_t CanWrite() const
178  {
179  return fCanWrite;
180  }
181  virtual KVUniqueNameList* GetDirectoryListing(const KVDataSet* dataset,
182  const Char_t* datatype = "", const Char_t* subdir = "");
183 
184  virtual void CopyFileFromRepository(const KVDataSet* dataset,
185  const Char_t* datatype,
186  const Char_t* filename,
187  const Char_t* destination);
188  virtual int CopyFileToRepository(const Char_t* source,
189  const KVDataSet* dataset,
190  const Char_t* datatype,
191  const Char_t* filename);
192 
193  virtual TFile* CreateNewFile(const KVDataSet* dataset,
194  const Char_t* datatype,
195  const Char_t* filename);
196  virtual void CommitFile(TFile* file, const Char_t* datatype, const KVDataSet* dataset);
197 
198  virtual void MakeSubdirectory(const KVDataSet* dataset,
199  const Char_t* datatype = "");
200 
201  virtual void DeleteFile(const KVDataSet* dataset,
202  const Char_t* datatype,
203  const Char_t* filename, Bool_t confirm =
204  kTRUE);
205 
206  virtual void Print(Option_t* opt = "") const;
208  virtual const Char_t* GetFileTransferType() const
209  {
210  return fTransfertype;
211  };
213  virtual const Char_t* GetFileTransferExec() const
214  {
215  return fTransferExec;
216  };
218  virtual const Char_t* GetFileTransferServer() const
219  {
220  return fTransferserver;
221  };
223  virtual const Char_t* GetFileTransferUser() const
224  {
225  return fTransferuser;
226  };
228  virtual const Char_t* GetRootDirectory() const
229  {
230  return fLocalrootdir;
231  };
232 
233  virtual KVDataSetManager* GetDataSetManager() const;
234 
235  void cd();
236  static KVDataRepository* NewRepository(const Char_t* type);
237  virtual KVAvailableRunsFile* NewAvailableRunsFile(const Char_t*, const KVDataSet*);
238  virtual TObject* OpenDataSetRunFile(const KVDataSet* ds, const Char_t* type, Int_t run, Option_t* opt = "");
239  void CreateAllNeededSubdirectories(const KVDataSet* DataSet, const Char_t* DataType);
240 
242  {
243  ;
244  }
245 
246  ClassDef(KVDataRepository, 0) //Base class handling files in data repository
247 };
248 
251 
252 #ifdef __CCIN2P3_RFIO
253 #include "TRFIOFile.h"
254 class KVRFIOSystem : public TRFIOSystem {
255 public:
256  KVRFIOSystem(): TRFIOSystem() { };
257  virtual ~KVRFIOSystem() { };
258 
259  Int_t Unlink(const char* path);
260  int Chmod(const char* file, UInt_t mode);
261 
262  ClassDef(KVRFIOSystem, 0) // TRFIOSystem with fully-functioning Unlink and Chmod methods
263 };
264 #endif
265 #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:141
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
Optimised list in which named objects can only be placed once.