Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
XrdROOT.h
Go to the documentation of this file.
1// @(#)root/proofd:$Id$
2// Author: G. Ganis June 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, 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#ifndef ROOT_XrdROOT
13#define ROOT_XrdROOT
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// XrdProofdProtocol //
18// //
19// Authors: G. Ganis, CERN, 2007 //
20// //
21// Class describing a ROOT version //
22// //
23//////////////////////////////////////////////////////////////////////////
24#include <list>
25
26#include "Xrd/XrdProtocol.hh"
27#include "XProofProtocol.h"
28#include "XrdOuc/XrdOucString.hh"
29
30#include "XrdProofdConfig.h"
31
33class XrdSysLogger;
34
35class XrdROOT {
36friend class XrdROOTMgr;
37private:
39 XrdOucString fDir;
40 XrdOucString fBinDir;
41 XrdOucString fDataDir;
42 XrdOucString fIncDir;
43 XrdOucString fLibDir;
44 XrdOucString fTag;
45 XrdOucString fExport;
46 XrdOucString fPrgmSrv;
47 kXR_int16 fSrvProtVers;
48
49 XrdOucString fRelease;
50 XrdOucString fGitCommit;
52
56
57 int CheckDir(const char *dir);
59
60public:
61 XrdROOT(const char *dir, const char *tag, const char *bindir = 0,
62 const char *incdir = 0, const char *libdir = 0, const char *datadir = 0);
64
65 const char *Dir() const { return fDir.c_str(); }
66 const char *BinDir() const { return fBinDir.c_str(); }
67 const char *DataDir() const { return fDataDir.c_str(); }
68 const char *IncDir() const { return fIncDir.c_str(); }
69 const char *LibDir() const { return fLibDir.c_str(); }
70 const char *Export() const { return fExport.c_str(); }
71 const char *GitCommit() const { return fGitCommit.c_str(); }
72 bool IsParked() const { return ((fStatus == 2) ? 1: 0); }
73 bool IsValid() const { return ((fStatus == 1) ? 1: 0); }
74 bool IsInvalid() const { return ((fStatus == -1) ? 1: 0); }
75 bool Match(const char *dir, const char *tag)
76 { return ((fTag == tag && fDir == dir) ? 1 : 0); }
77 bool MatchTag(const char *tag) { return ((fTag == tag) ? 1 : 0); }
78 void Park() { fStatus = 2; }
79 const char *PrgmSrv() const { return fPrgmSrv.c_str(); }
80 const char *Release() const { return fRelease.c_str(); }
81 void SetValid(kXR_int16 vers = -1);
82 kXR_int16 SrvProtVers() const { return fSrvProtVers; }
83 const char *Tag() const { return fTag.c_str(); }
84 int VersionCode() const { return fVersionCode; }
85 int VrsMajor() const { return fVrsMajor; }
86 int VrsMinor() const { return fVrsMinor; }
87 int VrsPatch() const { return fVrsPatch; }
88
89 static int GetVersionCode(const char *release);
90 static int GetVersionCode(int maj, int min, int patch);
91 static int ParseReleaseString(const char *release, int &maj, int &min, int &patch);
92};
93
94//
95// Manage XrdROOT instances
96
98
100 XrdSysLogger *fLogger; // Error logger
101 XrdOucString fLogDir; // Path to dir with validation logs
102
103 std::list<XrdROOT *> fROOT; // ROOT versions; the first is the default
104
105 int Validate(XrdROOT *r, XrdScheduler *sched);
106
107 void RegisterDirectives();
108 int DoDirectiveRootSys(char *, XrdOucStream *, bool);
109
110public:
111 XrdROOTMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e);
112 virtual ~XrdROOTMgr() { }
113
114 int Config(bool rcf = 0);
116 char *val, XrdOucStream *cfg, bool rcf);
117
118 XrdROOT *DefaultVersion() const { return fROOT.front(); }
119 XrdOucString ExportVersions(XrdROOT *def);
120 XrdROOT *GetVersion(const char *tag);
121 void SetLogDir(const char *d);
122};
123
124
125#endif
ROOT::R::TRInterface & r
Definition Object.C:4
#define d(i)
Definition RSha256.hxx:102
#define e(i)
Definition RSha256.hxx:103
int Validate(XrdROOT *r, XrdScheduler *sched)
Start a trial server application to test forking and get the version of the protocol run by the PROOF...
Definition XrdROOT.cxx:524
XrdROOT * GetVersion(const char *tag)
Return pointer to the ROOT version corresponding to 'tag' or 0 if not found.
Definition XrdROOT.cxx:738
XrdSysLogger * fLogger
Definition XrdROOT.h:100
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
Definition XrdROOT.cxx:441
void RegisterDirectives()
Register directives for configuration.
Definition XrdROOT.cxx:433
XrdROOT * DefaultVersion() const
Definition XrdROOT.h:118
XrdOucString ExportVersions(XrdROOT *def)
Return a string describing the available versions, with the default version 'def' markde with a '*'.
Definition XrdROOT.cxx:714
XrdOucString fLogDir
Definition XrdROOT.h:101
std::list< XrdROOT * > fROOT
Definition XrdROOT.h:103
virtual ~XrdROOTMgr()
Definition XrdROOT.h:112
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
Definition XrdROOT.cxx:356
void SetLogDir(const char *d)
Set the log dir.
Definition XrdROOT.cxx:334
int DoDirectiveRootSys(char *, XrdOucStream *, bool)
Process 'rootsys' directive.
Definition XrdROOT.cxx:460
XrdProofdManager * fMgr
Definition XrdROOT.h:99
int VrsPatch() const
Definition XrdROOT.h:87
int fVrsMinor
Definition XrdROOT.h:54
bool Match(const char *dir, const char *tag)
Definition XrdROOT.h:75
bool IsValid() const
Definition XrdROOT.h:73
XrdOucString fGitCommit
Definition XrdROOT.h:50
const char * IncDir() const
Definition XrdROOT.h:68
const char * BinDir() const
Definition XrdROOT.h:66
static int GetVersionCode(const char *release)
Translate 'release' into a version code integer following the rules in $ROOTSYS/include/RVersion....
Definition XrdROOT.cxx:275
const char * Export() const
Definition XrdROOT.h:70
int fStatus
Definition XrdROOT.h:38
const char * Tag() const
Definition XrdROOT.h:83
static int ParseReleaseString(const char *release, int &maj, int &min, int &patch)
Extract from 'release' its major, minor and patch numerical components; 'release' must be in the form...
Definition XrdROOT.cxx:296
int fVrsMajor
Definition XrdROOT.h:53
const char * LibDir() const
Definition XrdROOT.h:69
int VrsMajor() const
Definition XrdROOT.h:85
bool IsInvalid() const
Definition XrdROOT.h:74
XrdOucString fRelease
Definition XrdROOT.h:49
int VersionCode() const
Definition XrdROOT.h:84
const char * PrgmSrv() const
Definition XrdROOT.h:79
int CheckDir(const char *dir)
Check if 'dir' exists Return 0 on succes, -1 on failure.
Definition XrdROOT.cxx:123
XrdOucString fIncDir
Definition XrdROOT.h:42
kXR_int16 fSrvProtVers
Definition XrdROOT.h:47
bool MatchTag(const char *tag)
Definition XrdROOT.h:77
int fVersionCode
Definition XrdROOT.h:51
kXR_int16 SrvProtVers() const
Definition XrdROOT.h:82
XrdOucString fPrgmSrv
Definition XrdROOT.h:46
XrdOucString fExport
Definition XrdROOT.h:45
int fVrsPatch
Definition XrdROOT.h:55
int ParseROOTVersionInfo()
Extract ROOT version information associated with 'dir'.
Definition XrdROOT.cxx:171
XrdOucString fTag
Definition XrdROOT.h:44
const char * GitCommit() const
Definition XrdROOT.h:71
void SetValid(kXR_int16 vers=-1)
Set valid, save protocol and finalize the export string.
Definition XrdROOT.cxx:149
const char * Dir() const
Definition XrdROOT.h:65
bool IsParked() const
Definition XrdROOT.h:72
XrdOucString fBinDir
Definition XrdROOT.h:40
XrdOucString fDir
Definition XrdROOT.h:39
XrdOucString fDataDir
Definition XrdROOT.h:41
const char * DataDir() const
Definition XrdROOT.h:67
void Park()
Definition XrdROOT.h:78
const char * Release() const
Definition XrdROOT.h:80
XrdOucString fLibDir
Definition XrdROOT.h:43
~XrdROOT()
Definition XrdROOT.h:63
int VrsMinor() const
Definition XrdROOT.h:86