Logo ROOT   6.08/07
Reference Guide
TGrid.h
Go to the documentation of this file.
1 // @(#)root/net:$Id$
2 // Author: Fons Rademakers 3/1/2002
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, 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_TGrid
13 #define ROOT_TGrid
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TGrid //
18 // //
19 // Abstract base class defining interface to common GRID services. //
20 // //
21 // To open a connection to a GRID use the static method Connect(). //
22 // The argument of Connect() is of the form: //
23 // <grid>://<host>[:<port>], e.g. //
24 // alien://alice.cern.ch, globus://glsvr1.cern.ch, ... //
25 // Depending on the <grid> specified an appropriate plugin library //
26 // will be loaded which will provide the real interface. //
27 // //
28 // Related classes are TGridResult. //
29 // //
30 //////////////////////////////////////////////////////////////////////////
31 
32 #ifndef ROOT_TObject
33 #include "TObject.h"
34 #endif
35 
36 #ifndef ROOT_TString
37 #include "TString.h"
38 #endif
39 
40 #ifndef ROOT_TGridJob
41 #include "TGridJob.h"
42 #endif
43 
44 class TGridResult;
45 class TGridJDL;
46 class TGridJob;
47 class TGridCollection;
48 class TGridJobStatusList;
49 
50 
51 class TGrid : public TObject {
52 
53 protected:
54  TString fGridUrl; // the GRID url used to create the grid connection
55  TString fGrid; // type of GRID (AliEn, Globus, ...)
56  TString fHost; // GRID portal to which we are connected
57  TString fUser; // user name
58  TString fPw; // user passwd
59  TString fOptions; // options specified
60  Int_t fPort; // port to which we are connected
61 
62 public:
63  TGrid() : fGridUrl(), fGrid(), fHost(), fUser(), fPw(), fOptions(), fPort(-1) { }
64  virtual ~TGrid() { }
65 
66  const char *GridUrl() const { return fGridUrl; }
67  const char *GetGrid() const { return fGrid; }
68  const char *GetHost() const { return fHost; }
69  const char *GetUser() const { return fUser; }
70  const char *GetPw() const { return fPw; }
71  const char *GetOptions() const { return fOptions; }
72  Int_t GetPort() const { return fPort; }
73  virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; }
74 
75  virtual void Shell() { MayNotUse("Shell"); }
76  virtual void Stdout() { MayNotUse("Stdout"); }
77  virtual void Stderr() { MayNotUse("Stderr"); }
78 
79  virtual TGridResult *Command(const char * /*command*/,
80  Bool_t /*interactive*/ = kFALSE,
81  UInt_t /*stream*/ = 2)
82  { MayNotUse("Command"); return 0; }
83 
84  virtual TGridResult *Query(const char * /*path*/, const char * /*pattern*/,
85  const char * /*conditions*/ = "", const char * /*options*/ = "")
86  { MayNotUse("Query"); return 0; }
87 
88  virtual TGridResult *LocateSites() { MayNotUse("LocalSites"); return 0; }
89 
90  //--- Catalogue Interface
91  virtual TGridResult *Ls(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
92  { MayNotUse("Ls"); return 0; }
93  virtual const char *Pwd(Bool_t /*verbose*/ =kFALSE)
94  { MayNotUse("Pwd"); return 0; }
95  virtual const char *GetHomeDirectory()
96  { MayNotUse("GetHomeDirectory"); return 0; }
97  virtual Bool_t Cd(const char* /*ldn*/ ="",Bool_t /*verbose*/ =kFALSE)
98  { MayNotUse("Cd"); return kFALSE; }
99  virtual Int_t Mkdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
100  { MayNotUse("Mkdir"); return kFALSE; }
101  virtual Bool_t Rmdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
102  { MayNotUse("Mkdir"); return kFALSE; }
103  virtual Bool_t Register(const char* /*lfn*/ , const char* /*turl*/ , Long_t /*size*/ =-1, const char* /*se*/ =0, const char* /*guid*/ =0, Bool_t /*verbose*/ =kFALSE)
104  { MayNotUse("Mkdir"); return kFALSE; }
105  virtual Bool_t Rm(const char* /*lfn*/ , Option_t* /*option*/ ="", Bool_t /*verbose*/ =kFALSE)
106  { MayNotUse("Mkdir"); return kFALSE; }
107 
108  //--- Job Submission Interface
109  virtual TGridJob *Submit(const char * /*jdl*/)
110  { MayNotUse("Submit"); return 0; }
112  { MayNotUse("GetJDLGenerator"); return 0; }
113  virtual TGridCollection *OpenCollection(const char *, UInt_t /*maxentries*/ = 1000000)
114  { MayNotUse("OpenCollection"); return 0; }
115  virtual TGridCollection *OpenCollectionQuery(TGridResult * /*queryresult*/,Bool_t /*nogrouping*/ = kFALSE)
116  { MayNotUse("OpenCollection"); return 0; }
117  virtual TGridJobStatusList* Ps(const char* /*options*/, Bool_t /*verbose*/ = kTRUE)
118  { MayNotUse("Ps"); return 0; }
119  virtual Bool_t KillById(TString /*jobid*/)
120  { MayNotUse("KillById"); return kFALSE; }
121  virtual Bool_t ResubmitById(TString /*jobid*/)
122  { MayNotUse("ResubmitById"); return 0; }
123  virtual Bool_t Kill(TGridJob *gridjob)
124  { return ((gridjob)?KillById(gridjob->GetJobID()):kFALSE); }
125  virtual Bool_t Resubmit(TGridJob* gridjob)
126  { return ((gridjob)?ResubmitById(gridjob->GetJobID()):kFALSE); }
127 
128  //--- Load desired plugin and setup conection to GRID
129  static TGrid *Connect(const char *grid, const char *uid = 0,
130  const char *pw = 0, const char *options = 0);
131 
132  ClassDef(TGrid,0) // ABC defining interface to GRID services
133 };
134 
136 
137 #endif
TString fPw
Definition: TGrid.h:58
TString fUser
Definition: TGrid.h:57
virtual Bool_t IsConnected() const
Definition: TGrid.h:73
TGrid()
Definition: TGrid.h:63
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t Kill(TGridJob *gridjob)
Definition: TGrid.h:123
R__EXTERN TGrid * gGrid
Definition: TGrid.h:135
virtual Bool_t Rmdir(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:101
virtual TString GetJobID()
Definition: TGridJob.h:44
virtual void Shell()
Definition: TGrid.h:75
TString fGridUrl
Definition: TGrid.h:54
Basic string class.
Definition: TString.h:137
const char * GetHost() const
Definition: TGrid.h:68
const char * GetOptions() const
Definition: TGrid.h:71
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TGridJobStatusList * Ps(const char *, Bool_t=kTRUE)
Definition: TGrid.h:117
virtual Bool_t Register(const char *, const char *, Long_t=-1, const char *=0, const char *=0, Bool_t=kFALSE)
Definition: TGrid.h:103
virtual Bool_t Cd(const char *="", Bool_t=kFALSE)
Definition: TGrid.h:97
virtual TGridResult * LocateSites()
Definition: TGrid.h:88
virtual TGridResult * Query(const char *, const char *, const char *="", const char *="")
Definition: TGrid.h:84
static TGrid * Connect(const char *grid, const char *uid=0, const char *pw=0, const char *options=0)
The grid should be of the form: <grid>://<host>[:<port>], e.g.
Definition: TGrid.cxx:50
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Int_t Mkdir(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:99
virtual TGridCollection * OpenCollectionQuery(TGridResult *, Bool_t=kFALSE)
Definition: TGrid.h:115
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition: TObject.cxx:978
Int_t GetPort() const
Definition: TGrid.h:72
virtual ~TGrid()
Definition: TGrid.h:64
virtual const char * Pwd(Bool_t=kFALSE)
Definition: TGrid.h:93
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual TGridJob * Submit(const char *)
Definition: TGrid.h:109
Int_t fPort
Definition: TGrid.h:60
virtual TGridCollection * OpenCollection(const char *, UInt_t=1000000)
Definition: TGrid.h:113
virtual void Stderr()
Definition: TGrid.h:77
virtual Bool_t Resubmit(TGridJob *gridjob)
Definition: TGrid.h:125
const char * GetPw() const
Definition: TGrid.h:70
virtual const char * GetHomeDirectory()
Definition: TGrid.h:95
long Long_t
Definition: RtypesCore.h:50
const char * GetGrid() const
Definition: TGrid.h:67
TString fOptions
Definition: TGrid.h:59
virtual Bool_t ResubmitById(TString)
Definition: TGrid.h:121
TString fGrid
Definition: TGrid.h:55
Mother of all ROOT objects.
Definition: TObject.h:37
#define R__EXTERN
Definition: DllImport.h:27
virtual TGridJDL * GetJDLGenerator()
Definition: TGrid.h:111
virtual Bool_t Rm(const char *, Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:105
virtual TGridResult * Ls(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:91
const char * GetUser() const
Definition: TGrid.h:69
Definition: TGrid.h:51
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Bool_t KillById(TString)
Definition: TGrid.h:119
virtual TGridResult * Command(const char *, Bool_t=kFALSE, UInt_t=2)
Definition: TGrid.h:79
const char * GridUrl() const
Definition: TGrid.h:66
virtual void Stdout()
Definition: TGrid.h:76
TString fHost
Definition: TGrid.h:56