Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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; }
104  virtual TGridJDL *GetJDLGenerator()
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 
128 R__EXTERN TGrid *gGrid;
129 
130 #endif