Logo ROOT   6.12/07
Reference Guide
TGrid.cxx
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TGrid //
15 // //
16 // Abstract base class defining interface to common GRID services. //
17 // //
18 // To open a connection to a GRID use the static method Connect(). //
19 // The argument of Connect() is of the form: //
20 // <grid>[://<host>][:<port>], e.g. //
21 // alien, alien://alice.cern.ch, globus://glsvr1.cern.ch, ... //
22 // Depending on the <grid> specified an appropriate plugin library //
23 // will be loaded which will provide the real interface. //
24 // //
25 // Related classes are TGridResult. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #include "TGrid.h"
30 #include "TROOT.h"
31 #include "TPluginManager.h"
32 #include "TError.h"
33 
34 TGrid *gGrid = 0;
35 
36 
38 
39 ////////////////////////////////////////////////////////////////////////////////
40 /// The grid should be of the form: <grid>://<host>[:<port>],
41 /// e.g.: alien://alice.cern.ch, globus://glsrv1.cern.ch, ...
42 /// The uid is the username and pw the password that should be used for
43 /// the connection. Depending on the <grid> the shared library (plugin)
44 /// for the selected system will be loaded. When the connection could not
45 /// be opened 0 is returned. For AliEn the supported options are:
46 /// -domain=<domain name>
47 /// -debug=<debug level from 1 to 10>
48 /// Example: "-domain=cern.ch -debug=5"
49 
50 TGrid *TGrid::Connect(const char *grid, const char *uid, const char *pw,
51  const char *options)
52 {
54  TGrid *g = 0;
55 
56  if (!grid) {
57  ::Error("TGrid::Connect", "no grid specified");
58  return 0;
59  }
60  if (!uid)
61  uid = "";
62  if (!pw)
63  pw = "";
64  if (!options)
65  options = "";
66 
67  if ((h = gROOT->GetPluginManager()->FindHandler("TGrid", grid))) {
68  if (h->LoadPlugin() == -1)
69  return 0;
70  g = (TGrid *) h->ExecPlugin(4, grid, uid, pw, options);
71  }
72 
73  return g;
74 }
TH1 * h
Definition: legend2.C:5
#define gROOT
Definition: TROOT.h:402
Int_t LoadPlugin()
Load the plugin library for this handler.
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:50
TGrid * gGrid
Definition: TGrid.cxx:34
Long_t ExecPlugin(int nargs, const T &... params)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
#define ClassImp(name)
Definition: Rtypes.h:359
Definition: TGrid.h:45
static constexpr double g