TGrid.h

Go to the documentation of this file.
00001 // @(#)root/net:$Id: TGrid.h 31993 2010-01-12 14:34:41Z rdm $
00002 // Author: Fons Rademakers   3/1/2002
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGrid
00013 #define ROOT_TGrid
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TGrid                                                                //
00018 //                                                                      //
00019 // Abstract base class defining interface to common GRID services.      //
00020 //                                                                      //
00021 // To open a connection to a GRID use the static method Connect().      //
00022 // The argument of Connect() is of the form:                            //
00023 //    <grid>://<host>[:<port>], e.g.                                    //
00024 // alien://alice.cern.ch, globus://glsvr1.cern.ch, ...                  //
00025 // Depending on the <grid> specified an appropriate plugin library      //
00026 // will be loaded which will provide the real interface.                //
00027 //                                                                      //
00028 // Related classes are TGridResult.                                     //
00029 //                                                                      //
00030 //////////////////////////////////////////////////////////////////////////
00031 
00032 #ifndef ROOT_TObject
00033 #include "TObject.h"
00034 #endif
00035 
00036 #ifndef ROOT_TString
00037 #include "TString.h"
00038 #endif
00039 
00040 #ifndef ROOT_TGridJob
00041 #include "TGridJob.h"
00042 #endif
00043 
00044 class TGridResult;
00045 class TGridJDL;
00046 class TGridJob;
00047 class TGridCollection;
00048 class TGridJobStatusList;
00049 
00050 
00051 class TGrid : public TObject {
00052 
00053 protected:
00054    TString        fGridUrl; // the GRID url used to create the grid connection
00055    TString        fGrid;    // type of GRID (AliEn, Globus, ...)
00056    TString        fHost;    // GRID portal to which we are connected
00057    TString        fUser;    // user name
00058    TString        fPw;      // user passwd
00059    TString        fOptions; // options specified
00060    Int_t          fPort;    // port to which we are connected
00061 
00062 public:
00063    TGrid() : fGridUrl(), fGrid(), fHost(), fUser(), fPw(), fOptions(), fPort(-1) { }
00064    virtual ~TGrid() { }
00065 
00066    const char    *GridUrl() const { return fGridUrl; }
00067    const char    *GetGrid() const { return fGrid; }
00068    const char    *GetHost() const { return fHost; }
00069    const char    *GetUser() const { return fUser; }
00070    const char    *GetPw() const { return fPw; }
00071    const char    *GetOptions() const { return fOptions; }
00072    Int_t          GetPort() const { return fPort; }
00073    virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; }
00074 
00075    virtual void Shell() { MayNotUse("Shell"); }
00076    virtual void Stdout() { MayNotUse("Stdout"); }
00077    virtual void Stderr() { MayNotUse("Stderr"); }
00078 
00079    virtual TGridResult *Command(const char * /*command*/,
00080                                 Bool_t /*interactive*/ = kFALSE,
00081                                 UInt_t /*stream*/ = 2)
00082       { MayNotUse("Command"); return 0; }
00083 
00084    virtual TGridResult *Query(const char * /*path*/, const char * /*pattern*/,
00085                               const char * /*conditions*/ = "", const char * /*options*/ = "")
00086       { MayNotUse("Query"); return 0; }
00087 
00088    virtual TGridResult *LocateSites() { MayNotUse("LocalSites"); return 0; }
00089 
00090    //--- Catalogue Interface
00091    virtual TGridResult *Ls(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
00092       { MayNotUse("Ls"); return 0; }
00093    virtual const char  *Pwd(Bool_t /*verbose*/ =kFALSE)
00094       { MayNotUse("Pwd"); return 0; }
00095    virtual const char  *GetHomeDirectory()
00096       { MayNotUse("GetHomeDirectory"); return 0; }
00097    virtual Bool_t Cd(const char* /*ldn*/ ="",Bool_t /*verbose*/ =kFALSE)
00098       { MayNotUse("Cd"); return kFALSE; }
00099    virtual Int_t  Mkdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
00100       { MayNotUse("Mkdir"); return kFALSE; }
00101    virtual Bool_t Rmdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
00102       { MayNotUse("Mkdir"); return kFALSE; }
00103    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)
00104       { MayNotUse("Mkdir"); return kFALSE; }
00105    virtual Bool_t Rm(const char* /*lfn*/ , Option_t* /*option*/ ="", Bool_t /*verbose*/ =kFALSE)
00106       { MayNotUse("Mkdir"); return kFALSE; }
00107 
00108    //--- Job Submission Interface
00109    virtual TGridJob *Submit(const char * /*jdl*/)
00110       { MayNotUse("Submit"); return 0; }
00111    virtual TGridJDL *GetJDLGenerator()
00112       { MayNotUse("GetJDLGenerator"); return 0; }
00113    virtual TGridCollection *OpenCollection(const char *, UInt_t /*maxentries*/ = 1000000)
00114       { MayNotUse("OpenCollection"); return 0; }
00115    virtual TGridCollection *OpenCollectionQuery(TGridResult * /*queryresult*/,Bool_t /*nogrouping*/ = kFALSE)
00116       { MayNotUse("OpenCollection"); return 0; }
00117    virtual TGridJobStatusList* Ps(const char* /*options*/, Bool_t /*verbose*/ = kTRUE)
00118       { MayNotUse("Ps"); return 0; }
00119    virtual Bool_t KillById(TString /*jobid*/)
00120       { MayNotUse("KillById"); return kFALSE; }
00121    virtual Bool_t ResubmitById(TString /*jobid*/)
00122       { MayNotUse("ResubmitById"); return 0; }
00123    virtual Bool_t Kill(TGridJob *gridjob)
00124       { return ((gridjob)?KillById(gridjob->GetJobID()):kFALSE); }
00125    virtual Bool_t Resubmit(TGridJob* gridjob)
00126       { return ((gridjob)?ResubmitById(gridjob->GetJobID()):kFALSE); }
00127 
00128    //--- Load desired plugin and setup conection to GRID
00129    static TGrid *Connect(const char *grid, const char *uid = 0,
00130                          const char *pw = 0, const char *options = 0);
00131 
00132    ClassDef(TGrid,0)  // ABC defining interface to GRID services
00133 };
00134 
00135 R__EXTERN TGrid *gGrid;
00136 
00137 #endif

Generated on Tue Jul 5 14:26:57 2011 for ROOT_528-00b_version by  doxygen 1.5.1