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
37class TGridResult;
38class TGridJDL;
39class TGridJob;
40class TGridCollection;
42
43
44class TGrid : public TObject {
45
46protected:
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
55public:
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
#define R__EXTERN
Definition: DllImport.h:27
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
R__EXTERN TGrid * gGrid
Definition: TGrid.h:128
virtual TString GetJobID()
Definition: TGridJob.h:40
Definition: TGrid.h:44
virtual TGridJob * Submit(const char *)
Definition: TGrid.h:102
const char * GridUrl() const
Definition: TGrid.h:59
virtual Bool_t Rm(const char *, Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:98
const char * GetHost() const
Definition: TGrid.h:61
TGrid()
Definition: TGrid.h:56
TString fGrid
Definition: TGrid.h:48
const char * GetGrid() const
Definition: TGrid.h:60
virtual TGridResult * Query(const char *, const char *, const char *="", const char *="")
Definition: TGrid.h:77
virtual TGridJDL * GetJDLGenerator()
Definition: TGrid.h:104
virtual TGridResult * Ls(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:84
virtual Bool_t Cd(const char *="", Bool_t=kFALSE)
Definition: TGrid.h:90
const char * GetUser() const
Definition: TGrid.h:62
TString fPw
Definition: TGrid.h:51
virtual TGridJobStatusList * Ps(const char *, Bool_t=kTRUE)
Definition: TGrid.h:110
const char * GetPw() const
Definition: TGrid.h:63
TString fOptions
Definition: TGrid.h:52
virtual TGridCollection * OpenCollection(const char *, UInt_t=1000000)
Definition: TGrid.h:106
virtual void Shell()
Definition: TGrid.h:68
virtual TGridResult * LocateSites()
Definition: TGrid.h:81
virtual const char * Pwd(Bool_t=kFALSE)
Definition: TGrid.h:86
const char * GetOptions() const
Definition: TGrid.h:64
virtual Int_t Mkdir(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:92
virtual ~TGrid()
Definition: TGrid.h:57
virtual void Stderr()
Definition: TGrid.h:70
virtual Bool_t Register(const char *, const char *, Long_t=-1, const char *=0, const char *=0, Bool_t=kFALSE)
Definition: TGrid.h:96
Int_t fPort
Definition: TGrid.h:53
virtual TGridResult * Command(const char *, Bool_t=kFALSE, UInt_t=2)
Definition: TGrid.h:72
virtual Bool_t Rmdir(const char *="", Option_t *="", Bool_t=kFALSE)
Definition: TGrid.h:94
TString fHost
Definition: TGrid.h:49
virtual Bool_t IsConnected() const
Definition: TGrid.h:66
virtual Bool_t KillById(TString)
Definition: TGrid.h:112
virtual TGridCollection * OpenCollectionQuery(TGridResult *, Bool_t=kFALSE)
Definition: TGrid.h:108
virtual Bool_t ResubmitById(TString)
Definition: TGrid.h:114
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
TString fUser
Definition: TGrid.h:50
virtual Bool_t Kill(TGridJob *gridjob)
Definition: TGrid.h:116
virtual void Stdout()
Definition: TGrid.h:69
virtual Bool_t Resubmit(TGridJob *gridjob)
Definition: TGrid.h:118
Int_t GetPort() const
Definition: TGrid.h:65
TString fGridUrl
Definition: TGrid.h:47
virtual const char * GetHomeDirectory()
Definition: TGrid.h:88
Mother of all ROOT objects.
Definition: TObject.h:37
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
Basic string class.
Definition: TString.h:131