Logo ROOT  
Reference Guide
TAlienSystem.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Andreas Peters 15/05/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, 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_TAlienSystem
13 #define ROOT_TAlienSystem
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TAlienSystem //
18 // //
19 // TSystem Implementation of the AliEn GRID plugin. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef __CINT__
24 #include <stdio.h>
25 #endif
26 
27 #include "TSystem.h"
28 
29 class TAlienSystem : public TSystem {
30 
31 protected:
32  char fWorkingDirectory[1024];
33 
34 public:
35  TAlienSystem(const char *name = "Generic", const char *title = "Generic System");
36  virtual ~TAlienSystem();
37 
38  //---- Misc
39  virtual Bool_t Init();
40 
41  //---- Directories
42  virtual int MakeDirectory(const char *name);
43  virtual void *OpenDirectory(const char *name);
44  virtual void FreeDirectory(void *dirp);
45  virtual const char *GetDirEntry(void *dirp);
46  virtual void *GetDirPtr() const { return 0; }
47  virtual Bool_t ChangeDirectory(const char *path);
48  virtual const char *WorkingDirectory();
49  virtual const char *HomeDirectory(const char *userName = 0);
50  virtual int mkdir(const char *name, Bool_t recursive = kFALSE);
51  Bool_t cd(const char *path) { return ChangeDirectory(path); }
52  const char *pwd() { return WorkingDirectory(); }
53 
54  //---- Paths & Files
55  virtual int CopyFile(const char *from, const char *to, Bool_t overwrite = kFALSE);
56  virtual int Rename(const char *from, const char *to);
57  virtual int Link(const char *from, const char *to);
58  virtual int Symlink(const char *from, const char *to);
59  virtual int Unlink(const char *name);
60  int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
61  int GetPathInfo(const char *path, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
62  virtual int GetPathInfo(const char *path, FileStat_t &buf);
63  virtual int AlienFilestat(const char *fpath, FileStat_t &buf);
64  virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree);
65  virtual int Chmod(const char *file, UInt_t mode);
66  virtual int Umask(Int_t mask);
67  virtual int Utime(const char *file, Long_t modtime, Long_t actime);
68  virtual const char *FindFile(const char *search, TString& file, EAccessMode mode = kFileExists);
69  virtual Bool_t AccessPathName(const char *path, EAccessMode mode = kFileExists);
70 
71  //---- Users & Groups
72  virtual Int_t GetUid(const char *user = 0);
73  virtual Int_t GetGid(const char *group = 0);
74  virtual Int_t GetEffectiveUid();
75  virtual Int_t GetEffectiveGid();
76  virtual UserGroup_t *GetUserInfo(Int_t uid);
77  virtual UserGroup_t *GetUserInfo(const char *user = 0);
78  virtual UserGroup_t *GetGroupInfo(Int_t gid);
79  virtual UserGroup_t *GetGroupInfo(const char *group = 0);
80 
81  ClassDef(TAlienSystem,0) // System interface to the Alien Catalogue
82 };
83 
84 #endif
TAlienSystem::Rename
virtual int Rename(const char *from, const char *to)
Rename a file.
Definition: TAlienSystem.cxx:196
TAlienSystem::Unlink
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
Definition: TAlienSystem.cxx:224
TAlienSystem::Init
virtual Bool_t Init()
Initialize the OS interface.
Definition: TAlienSystem.cxx:50
TAlienSystem
Definition: TAlienSystem.h:29
TAlienSystem::FindFile
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TAlienSystem.cxx:394
TAlienSystem::mkdir
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
Definition: TAlienSystem.cxx:161
FileStat_t
Definition: TSystem.h:124
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TAlienSystem::WorkingDirectory
virtual const char * WorkingDirectory()
Return working directory.
Definition: TAlienSystem.cxx:135
TAlienSystem::GetGroupInfo
virtual UserGroup_t * GetGroupInfo(Int_t gid)
Returns all group info in the UserGroup_t structure.
Definition: TAlienSystem.cxx:502
TSystem
Definition: TSystem.h:266
TAlienSystem::FreeDirectory
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition: TAlienSystem.cxx:96
TAlienSystem::GetFsInfo
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: fs type, block size, number of blocks, number of free blocks.
Definition: TAlienSystem.cxx:351
TString
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TAlienSystem::Umask
virtual int Umask(Int_t mask)
Set the process file creation mode mask.
Definition: TAlienSystem.cxx:374
TAlienSystem::GetEffectiveUid
virtual Int_t GetEffectiveUid()
Returns the effective user id.
Definition: TAlienSystem.cxx:449
TAlienSystem::fWorkingDirectory
char fWorkingDirectory[1024]
Definition: TAlienSystem.h:38
bool
TAlienSystem::HomeDirectory
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
Definition: TAlienSystem.cxx:143
TAlienSystem::GetDirPtr
virtual void * GetDirPtr() const
Definition: TAlienSystem.h:52
TAlienSystem::OpenDirectory
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TAlienSystem.cxx:82
group
Definition: TWinNTSystem.h:59
TAlienSystem::~TAlienSystem
virtual ~TAlienSystem()
Delete the OS interface.
Definition: TAlienSystem.cxx:43
TSystem.h
TAlienSystem::Symlink
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
Definition: TAlienSystem.cxx:215
TAlienSystem::ChangeDirectory
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TAlienSystem.cxx:120
TAlienSystem::GetPathInfo
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TAlienSystem.cxx:242
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TAlienSystem::Link
virtual int Link(const char *from, const char *to)
Create a link from file1 to file2.
Definition: TAlienSystem.cxx:206
Long_t
long Long_t
Definition: RtypesCore.h:54
TAlienSystem::GetEffectiveGid
virtual Int_t GetEffectiveGid()
Returns the effective group id.
Definition: TAlienSystem.cxx:468
TAlienSystem::GetGid
virtual Int_t GetGid(const char *group=0)
Returns the group's id. If group = 0, returns current user's group.
Definition: TAlienSystem.cxx:458
TAlienSystem::Utime
virtual int Utime(const char *file, Long_t modtime, Long_t actime)
Set the a files modification and access times.
Definition: TAlienSystem.cxx:384
unsigned int
TAlienSystem::MakeDirectory
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TAlienSystem.cxx:60
TAlienSystem::CopyFile
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
Definition: TAlienSystem.cxx:187
TAlienSystem::cd
Bool_t cd(const char *path)
Definition: TAlienSystem.h:57
EAccessMode
EAccessMode
Definition: TSystem.h:43
TAlienSystem::AccessPathName
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TAlienSystem.cxx:406
TAlienSystem::GetUserInfo
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Definition: TAlienSystem.cxx:478
file
Definition: file.py:1
TAlienSystem::AlienFilestat
virtual int AlienFilestat(const char *fpath, FileStat_t &buf)
Get info about a file.
Definition: TAlienSystem.cxx:318
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
kFileExists
@ kFileExists
Definition: TSystem.h:44
UserGroup_t
Definition: TSystem.h:138
name
char name[80]
Definition: TGX11.cxx:110
TAlienSystem::pwd
const char * pwd()
Definition: TAlienSystem.h:58
TAlienSystem::Chmod
virtual int Chmod(const char *file, UInt_t mode)
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
Definition: TAlienSystem.cxx:360
TAlienSystem::TAlienSystem
TAlienSystem(const char *name="Generic", const char *title="Generic System")
Create a new OS interface.
Definition: TAlienSystem.cxx:35
TAlienSystem::GetDirEntry
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition: TAlienSystem.cxx:105
int
TAlienSystem::GetUid
virtual Int_t GetUid(const char *user=0)
Returns the user's id. If user = 0, returns current user's id.
Definition: TAlienSystem.cxx:439