Logo ROOT   6.14/05
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 #include "TObject.h"
33 
34 #include "TString.h"
35 
36 #include "TGridJob.h"
37 
38 class TGridResult;
39 class TGridJDL;
40 class TGridJob;
41 class TGridCollection;
42 class TGridJobStatusList;
43 
44 
45 class TGrid : public TObject {
46 
47 protected:
48  TString fGridUrl; // the GRID url used to create the grid connection
49  TString fGrid; // type of GRID (AliEn, Globus, ...)
50  TString fHost; // GRID portal to which we are connected
51  TString fUser; // user name
52  TString fPw; // user passwd
53  TString fOptions; // options specified
54  Int_t fPort; // port to which we are connected
55 
56 public:
57  TGrid() : fGridUrl(), fGrid(), fHost(), fUser(), fPw(), fOptions(), fPort(-1) { }
58  virtual ~TGrid() { }
59 
60  const char *GridUrl() const { return fGridUrl; }
61  const char *GetGrid() const { return fGrid; }
62  const char *GetHost() const { return fHost; }
63  const char *GetUser() const { return fUser; }
64  const char *GetPw() const { return fPw; }
65  const char *GetOptions() const { return fOptions; }
66  Int_t GetPort() const { return fPort; }
67  virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; }
68 
69  virtual void Shell() { MayNotUse("Shell"); }
70  virtual void Stdout() { MayNotUse("Stdout"); }
71  virtual void Stderr() { MayNotUse("Stderr"); }
72 
73  virtual TGridResult *Command(const char * /*command*/,
74  Bool_t /*interactive*/ = kFALSE,
75  UInt_t /*stream*/ = 2)
76  { MayNotUse("Command"); return 0; }
77 
78  virtual TGridResult *Query(const char * /*path*/, const char * /*pattern*/,
79  const char * /*conditions*/ = "", const char * /*options*/ = "")
80  { MayNotUse("Query"); return 0; }
81 
82  virtual TGridResult *LocateSites() { MayNotUse("LocalSites"); return 0; }
83 
84  //--- Catalogue Interface
85  virtual TGridResult *Ls(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
86  { MayNotUse("Ls"); return 0; }
87  virtual const char *Pwd(Bool_t /*verbose*/ =kFALSE)
88  { MayNotUse("Pwd"); return 0; }
89  virtual const char *GetHomeDirectory()
90  { MayNotUse("GetHomeDirectory"); return 0; }
91  virtual Bool_t Cd(const char* /*ldn*/ ="",Bool_t /*verbose*/ =kFALSE)
92  { MayNotUse("Cd"); return kFALSE; }
93  virtual Int_t Mkdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
94  { MayNotUse("Mkdir"); return kFALSE; }
95  virtual Bool_t Rmdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
96  { MayNotUse("Mkdir"); return kFALSE; }
97  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)
98  { MayNotUse("Mkdir"); return kFALSE; }
99  virtual Bool_t Rm(const char* /*lfn*/ , Option_t* /*option*/ ="", Bool_t /*verbose*/ =kFALSE)
100  { MayNotUse("Mkdir"); return kFALSE; }
101 
102  //--- Job Submission Interface
103  virtual TGridJob *Submit(const char * /*jdl*/)
104  { MayNotUse("Submit"); return 0; }
106  { MayNotUse("GetJDLGenerator"); return 0; }
107  virtual TGridCollection *OpenCollection(const char *, UInt_t /*maxentries*/ = 1000000)
108  { MayNotUse("OpenCollection"); return 0; }
109  virtual TGridCollection *OpenCollectionQuery(TGridResult * /*queryresult*/,Bool_t /*nogrouping*/ = kFALSE)
110  { MayNotUse("OpenCollection"); return 0; }
111  virtual TGridJobStatusList* Ps(const char* /*options*/, Bool_t /*verbose*/ = kTRUE)
112  { MayNotUse("Ps"); return 0; }
113  virtual Bool_t KillById(TString /*jobid*/)
114  { MayNotUse("KillById"); return kFALSE; }
115  virtual Bool_t ResubmitById(TString /*jobid*/)
116  { MayNotUse("ResubmitById"); return 0; }
117  virtual Bool_t Kill(TGridJob *gridjob)
118  { return ((gridjob)?KillById(gridjob->GetJobID()):kFALSE); }
119  virtual Bool_t Resubmit(TGridJob* gridjob)
120  { return ((gridjob)?ResubmitById(gridjob->GetJobID()):kFALSE); }
121 
122  //--- Load desired plugin and setup conection to GRID
123  static TGrid *Connect(const char *grid, const char *uid = 0,
124  const char *pw = 0, const char *options = 0);
125 
126  ClassDef(TGrid,0) // ABC defining interface to GRID services
127 };
128 
130 
131 #endif
TString fPw
Definition: TGrid.h:52
TString fUser
Definition: TGrid.h:51
virtual Bool_t IsConnected() const
Definition: TGrid.h:67
TGrid()
Definition: TGrid.h:57
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t Kill(TGridJob *gridjob)
Definition: TGrid.h:117
R__EXTERN TGrid * gGrid
Definition: TGrid.h:129
virtual Bool_t Rmdir(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:95
virtual TString GetJobID()
Definition: TGridJob.h:40
virtual void Shell()
Definition: TGrid.h:69
TString fGridUrl
Definition: TGrid.h:48
Basic string class.
Definition: TString.h:131
const char * GetHost() const
Definition: TGrid.h:62
const char * GetOptions() const
Definition: TGrid.h:65
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual TGridJobStatusList * Ps(const char *, Bool_t=kTRUE)
Definition: TGrid.h:111
virtual Bool_t Register(const char *, const char *, Long_t=-1, const char *=0, const char *=0, Bool_t=kFALSE)
Definition: TGrid.h:97
virtual Bool_t Cd(const char *="", Bool_t=kFALSE)
Definition: TGrid.h:91
virtual TGridResult * LocateSites()
Definition: TGrid.h:82
virtual TGridResult * Query(const char *, const char *, const char *="", const char *="")
Definition: TGrid.h:78
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:320
virtual Int_t Mkdir(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:93
virtual TGridCollection * OpenCollectionQuery(TGridResult *, Bool_t=kFALSE)
Definition: TGrid.h:109
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:933
Int_t GetPort() const
Definition: TGrid.h:66
virtual ~TGrid()
Definition: TGrid.h:58
virtual const char * Pwd(Bool_t=kFALSE)
Definition: TGrid.h:87
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual TGridJob * Submit(const char *)
Definition: TGrid.h:103
Int_t fPort
Definition: TGrid.h:54
virtual TGridCollection * OpenCollection(const char *, UInt_t=1000000)
Definition: TGrid.h:107
virtual void Stderr()
Definition: TGrid.h:71
virtual Bool_t Resubmit(TGridJob *gridjob)
Definition: TGrid.h:119
const char * GetPw() const
Definition: TGrid.h:64
virtual const char * GetHomeDirectory()
Definition: TGrid.h:89
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
const char * GetGrid() const
Definition: TGrid.h:61
TString fOptions
Definition: TGrid.h:53
virtual Bool_t ResubmitById(TString)
Definition: TGrid.h:115
TString fGrid
Definition: TGrid.h:49
Mother of all ROOT objects.
Definition: TObject.h:37
#define R__EXTERN
Definition: DllImport.h:27
virtual TGridJDL * GetJDLGenerator()
Definition: TGrid.h:105
virtual Bool_t Rm(const char *, Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:99
virtual TGridResult * Ls(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:85
const char * GetUser() const
Definition: TGrid.h:63
Definition: TGrid.h:45
virtual Bool_t KillById(TString)
Definition: TGrid.h:113
virtual TGridResult * Command(const char *, Bool_t=kFALSE, UInt_t=2)
Definition: TGrid.h:73
const char * GridUrl() const
Definition: TGrid.h:60
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void Stdout()
Definition: TGrid.h:70
TString fHost
Definition: TGrid.h:50