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