Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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. alien://alice.cern.ch //
21// Depending on the <grid> specified an appropriate plugin library //
22// will be loaded which will provide the real interface. //
23// //
24// Related classes are TGridResult. //
25// //
26//////////////////////////////////////////////////////////////////////////
27
28#include "TGrid.h"
29#include "TROOT.h"
30#include "TPluginManager.h"
31#include "TError.h"
32
34
35
36
37////////////////////////////////////////////////////////////////////////////////
38/// The grid should be of the form: `<grid>://<host>[:<port>]`,
39/// e.g.: alien://alice.cern.ch
40/// The uid is the username and pw the password that should be used for
41/// the connection. Depending on the `<grid>` the shared library (plugin)
42/// for the selected system will be loaded. When the connection could not
43/// be opened 0 is returned. For AliEn the supported options are:
44/// -domain=`<domain name>`
45/// -debug=`<debug level from 1 to 10>`
46/// Example: "-domain=cern.ch -debug=5"
47
48TGrid *TGrid::Connect(const char *grid, const char *uid, const char *pw,
49 const char *options)
50{
52 TGrid *g = 0;
53
54 if (!grid) {
55 ::Error("TGrid::Connect", "no grid specified");
56 return 0;
57 }
58 if (!uid)
59 uid = "";
60 if (!pw)
61 pw = "";
62 if (!options)
63 options = "";
64
65 if ((h = gROOT->GetPluginManager()->FindHandler("TGrid", grid))) {
66 if (h->LoadPlugin() == -1) {
67 ::Error("TGrid::Connect", "Loading Plugin failed");
68 return 0;
69 }
70 g = (TGrid *) h->ExecPlugin(4, grid, uid, pw, options);
71 } else {
72 ::Error("TGrid::Connect", "Could not find plugin to handle TGrid");
73 }
74
75 return g;
76}
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
TGrid * gGrid
Definition TGrid.cxx:33
#define gROOT
Definition TROOT.h:411
Definition TGrid.h:44
static TGrid * Connect(const char *grid, const char *uid=nullptr, const char *pw=nullptr, const char *options=nullptr)
The grid should be of the form: <grid>://<host>[:<port>], e.g.: alien://alice.cern....
Definition TGrid.cxx:48
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071