00001 // @(#)root/net:$Id: TGrid.cxx 23091 2008-04-09 15:04:27Z 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 ////////////////////////////////////////////////////////////////////////// 00013 // // 00014 // TGrid // 00015 // // 00016 // Abstract base class defining interface to common GRID services. // 00017 // // 00018 // To open a connection to a GRID use the static method Connect(). // 00019 // The argument of Connect() is of the form: // 00020 // <grid>[://<host>][:<port>], e.g. // 00021 // alien, alien://alice.cern.ch, globus://glsvr1.cern.ch, ... // 00022 // Depending on the <grid> specified an appropriate plugin library // 00023 // will be loaded which will provide the real interface. // 00024 // // 00025 // Related classes are TGridResult. // 00026 // // 00027 ////////////////////////////////////////////////////////////////////////// 00028 00029 #include "TGrid.h" 00030 #include "TROOT.h" 00031 #include "TPluginManager.h" 00032 #include "TError.h" 00033 00034 TGrid *gGrid = 0; 00035 00036 00037 ClassImp(TGrid) 00038 00039 //______________________________________________________________________________ 00040 TGrid *TGrid::Connect(const char *grid, const char *uid, const char *pw, 00041 const char *options) 00042 { 00043 // The grid should be of the form: <grid>://<host>[:<port>], 00044 // e.g.: alien://alice.cern.ch, globus://glsrv1.cern.ch, ... 00045 // The uid is the username and pw the password that should be used for 00046 // the connection. Depending on the <grid> the shared library (plugin) 00047 // for the selected system will be loaded. When the connection could not 00048 // be opened 0 is returned. For AliEn the supported options are: 00049 // -domain=<domain name> 00050 // -debug=<debug level from 1 to 10> 00051 // Example: "-domain=cern.ch -debug=5" 00052 00053 TPluginHandler *h; 00054 TGrid *g = 0; 00055 00056 if (!grid) { 00057 ::Error("TGrid::Connect", "no grid specified"); 00058 return 0; 00059 } 00060 if (!uid) 00061 uid = ""; 00062 if (!pw) 00063 pw = ""; 00064 if (!options) 00065 options = ""; 00066 00067 if ((h = gROOT->GetPluginManager()->FindHandler("TGrid", grid))) { 00068 if (h->LoadPlugin() == -1) 00069 return 0; 00070 g = (TGrid *) h->ExecPlugin(4, grid, uid, pw, options); 00071 } 00072 00073 return g; 00074 }