// @(#)root/net:$Id$
// Author: Fons Rademakers   3/1/2002

/*************************************************************************
 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGrid                                                                //
//                                                                      //
// Abstract base class defining interface to common GRID services.      //
//                                                                      //
// To open a connection to a GRID use the static method Connect().      //
// The argument of Connect() is of the form:                            //
//    <grid>[://<host>][:<port>], e.g.                                  //
// alien, alien://alice.cern.ch, globus://glsvr1.cern.ch, ...           //
// Depending on the <grid> specified an appropriate plugin library      //
// will be loaded which will provide the real interface.                //
//                                                                      //
// Related classes are TGridResult.                                     //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TGrid.h"
#include "TROOT.h"
#include "TPluginManager.h"
#include "TError.h"

TGrid *gGrid = 0;


ClassImp(TGrid)

//______________________________________________________________________________
TGrid *TGrid::Connect(const char *grid, const char *uid, const char *pw,
                      const char *options)
{
   // The grid should be of the form:  <grid>://<host>[:<port>],
   // e.g.:  alien://alice.cern.ch, globus://glsrv1.cern.ch, ...
   // The uid is the username and pw the password that should be used for
   // the connection. Depending on the <grid> the shared library (plugin)
   // for the selected system will be loaded. When the connection could not
   // be opened 0 is returned. For AliEn the supported options are:
   // -domain=<domain name>
   // -debug=<debug level from 1 to 10>
   // Example: "-domain=cern.ch -debug=5"

   TPluginHandler *h;
   TGrid *g = 0;

   if (!grid) {
      ::Error("TGrid::Connect", "no grid specified");
      return 0;
   }
   if (!uid)
      uid = "";
   if (!pw)
      pw = "";
   if (!options)
      options = "";

   if ((h = gROOT->GetPluginManager()->FindHandler("TGrid", grid))) {
      if (h->LoadPlugin() == -1)
         return 0;
      g = (TGrid *) h->ExecPlugin(4, grid, uid, pw, options);
   }

   return g;
}
 TGrid.cxx:1
 TGrid.cxx:2
 TGrid.cxx:3
 TGrid.cxx:4
 TGrid.cxx:5
 TGrid.cxx:6
 TGrid.cxx:7
 TGrid.cxx:8
 TGrid.cxx:9
 TGrid.cxx:10
 TGrid.cxx:11
 TGrid.cxx:12
 TGrid.cxx:13
 TGrid.cxx:14
 TGrid.cxx:15
 TGrid.cxx:16
 TGrid.cxx:17
 TGrid.cxx:18
 TGrid.cxx:19
 TGrid.cxx:20
 TGrid.cxx:21
 TGrid.cxx:22
 TGrid.cxx:23
 TGrid.cxx:24
 TGrid.cxx:25
 TGrid.cxx:26
 TGrid.cxx:27
 TGrid.cxx:28
 TGrid.cxx:29
 TGrid.cxx:30
 TGrid.cxx:31
 TGrid.cxx:32
 TGrid.cxx:33
 TGrid.cxx:34
 TGrid.cxx:35
 TGrid.cxx:36
 TGrid.cxx:37
 TGrid.cxx:38
 TGrid.cxx:39
 TGrid.cxx:40
 TGrid.cxx:41
 TGrid.cxx:42
 TGrid.cxx:43
 TGrid.cxx:44
 TGrid.cxx:45
 TGrid.cxx:46
 TGrid.cxx:47
 TGrid.cxx:48
 TGrid.cxx:49
 TGrid.cxx:50
 TGrid.cxx:51
 TGrid.cxx:52
 TGrid.cxx:53
 TGrid.cxx:54
 TGrid.cxx:55
 TGrid.cxx:56
 TGrid.cxx:57
 TGrid.cxx:58
 TGrid.cxx:59
 TGrid.cxx:60
 TGrid.cxx:61
 TGrid.cxx:62
 TGrid.cxx:63
 TGrid.cxx:64
 TGrid.cxx:65
 TGrid.cxx:66
 TGrid.cxx:67
 TGrid.cxx:68
 TGrid.cxx:69
 TGrid.cxx:70
 TGrid.cxx:71
 TGrid.cxx:72
 TGrid.cxx:73
 TGrid.cxx:74