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 fEtcDir;
43 XrdOucString fIncDir;
44 XrdOucString fLibDir;
45 XrdOucString fTag;
46 XrdOucString fExport;
47 XrdOucString fPrgmSrv;
48 kXR_int16 fSrvProtVers;
49
50 XrdOucString fRelease;
51 XrdOucString fGitCommit;
53
57
58 int CheckDir(const char *dir);
60
61public:
62 XrdROOT(const char *dir, const char *tag, const char *bindir = 0,
63 const char *incdir = 0, const char *libdir = 0, const char *datadir = 0,
64 const char *etcdir = 0);
66
67 const char *Dir() const { return fDir.c_str(); }
68 const char *BinDir() const { return fBinDir.c_str(); }
69 const char *DataDir() const { return fDataDir.c_str(); }
70 const char *EtcDir() const { return fEtcDir.c_str(); }
71 const char *IncDir() const { return fIncDir.c_str(); }
72 const char *LibDir() const { return fLibDir.c_str(); }
73 const char *Export() const { return fExport.c_str(); }
74 const char *GitCommit() const { return fGitCommit.c_str(); }
75 bool IsParked() const { return ((fStatus == 2) ? 1: 0); }
76 bool IsValid() const { return ((fStatus == 1) ? 1: 0); }
77 bool IsInvalid() const { return ((fStatus == -1) ? 1: 0); }
78 bool Match(const char *dir, const char *tag)
79 { return ((fTag == tag && fDir == dir) ? 1 : 0); }
80 bool MatchTag(const char *tag) { return ((fTag == tag) ? 1 : 0); }
81 void Park() { fStatus = 2; }
82 const char *PrgmSrv() const { return fPrgmSrv.c_str(); }
83 const char *Release() const { return fRelease.c_str(); }
84 void SetValid(kXR_int16 vers = -1);
85 kXR_int16 SrvProtVers() const { return fSrvProtVers; }
86 const char *Tag() const { return fTag.c_str(); }
87 int VersionCode() const { return fVersionCode; }
88 int VrsMajor() const { return fVrsMajor; }
89 int VrsMinor() const { return fVrsMinor; }
90 int VrsPatch() const { return fVrsPatch; }
91
92 static int GetVersionCode(const char *release);
93 static int GetVersionCode(int maj, int min, int patch);
94 static int ParseReleaseString(const char *release, int &maj, int &min, int &patch);
95};
96
97//
98// Manage XrdROOT instances
99
101
103 XrdSysLogger *fLogger; // Error logger
104 XrdOucString fLogDir; // Path to dir with validation logs
105
106 std::list<XrdROOT *> fROOT; // ROOT versions; the first is the default
107
108 int Validate(XrdROOT *r, XrdScheduler *sched);
109
110 void RegisterDirectives();
111 int DoDirectiveRootSys(char *, XrdOucStream *, bool);
112
113public:
114 XrdROOTMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e);
115 virtual ~XrdROOTMgr() { }
116
117 int Config(bool rcf = 0);
119 char *val, XrdOucStream *cfg, bool rcf);
120
121 XrdROOT *DefaultVersion() const { return fROOT.front(); }
122 XrdOucString ExportVersions(XrdROOT *def);
123 XrdROOT *GetVersion(const char *tag);
124 void SetLogDir(const char *d);
125};
126
127
128#endif
#define d(i)
Definition RSha256.hxx:102
#define e(i)
Definition RSha256.hxx:103
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
#define XrdSysError
Definition XpdSysError.h:8
#define XrdSysLogger
Definition XpdSysLogger.h:8
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:456
XrdROOT * GetVersion(const char *tag)
Return pointer to the ROOT version corresponding to 'tag' or 0 if not found.
Definition XrdROOT.cxx:670
XrdSysLogger * fLogger
Definition XrdROOT.h:103
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
Definition XrdROOT.cxx:373
void RegisterDirectives()
Register directives for configuration.
Definition XrdROOT.cxx:365
XrdROOT * DefaultVersion() const
Definition XrdROOT.h:121
XrdOucString ExportVersions(XrdROOT *def)
Return a string describing the available versions, with the default version 'def' markde with a '*'.
Definition XrdROOT.cxx:646
XrdOucString fLogDir
Definition XrdROOT.h:104
std::list< XrdROOT * > fROOT
Definition XrdROOT.h:106
virtual ~XrdROOTMgr()
Definition XrdROOT.h:115
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
Definition XrdROOT.cxx:287
void SetLogDir(const char *d)
Set the log dir.
Definition XrdROOT.cxx:265
int DoDirectiveRootSys(char *, XrdOucStream *, bool)
Process 'rootsys' directive.
Definition XrdROOT.cxx:392
XrdProofdManager * fMgr
Definition XrdROOT.h:102
int VrsPatch() const
Definition XrdROOT.h:90
int fVrsMinor
Definition XrdROOT.h:55
bool Match(const char *dir, const char *tag)
Definition XrdROOT.h:78
bool IsValid() const
Definition XrdROOT.h:76
XrdOucString fGitCommit
Definition XrdROOT.h:51
const char * EtcDir() const
Definition XrdROOT.h:70
const char * IncDir() const
Definition XrdROOT.h:71
const char * BinDir() const
Definition XrdROOT.h:68
static int GetVersionCode(const char *release)
Translate 'release' into a version code integer following the rules in $ROOTSYS/include/RVersion....
Definition XrdROOT.cxx:206
const char * Export() const
Definition XrdROOT.h:73
int fStatus
Definition XrdROOT.h:38
const char * Tag() const
Definition XrdROOT.h:86
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:227
int fVrsMajor
Definition XrdROOT.h:54
const char * LibDir() const
Definition XrdROOT.h:72
int VrsMajor() const
Definition XrdROOT.h:88
bool IsInvalid() const
Definition XrdROOT.h:77
XrdOucString fRelease
Definition XrdROOT.h:50
int VersionCode() const
Definition XrdROOT.h:87
const char * PrgmSrv() const
Definition XrdROOT.h:82
int CheckDir(const char *dir)
Check if 'dir' exists Return 0 on succes, -1 on failure.
Definition XrdROOT.cxx:114
XrdOucString fIncDir
Definition XrdROOT.h:43
kXR_int16 fSrvProtVers
Definition XrdROOT.h:48
bool MatchTag(const char *tag)
Definition XrdROOT.h:80
int fVersionCode
Definition XrdROOT.h:52
kXR_int16 SrvProtVers() const
Definition XrdROOT.h:85
XrdOucString fPrgmSrv
Definition XrdROOT.h:47
XrdOucString fExport
Definition XrdROOT.h:46
int fVrsPatch
Definition XrdROOT.h:56
int ParseROOTVersionInfo()
Extract ROOT version information associated with 'dir'.
Definition XrdROOT.cxx:162
XrdOucString fTag
Definition XrdROOT.h:45
const char * GitCommit() const
Definition XrdROOT.h:74
XrdOucString fEtcDir
Definition XrdROOT.h:42
void SetValid(kXR_int16 vers=-1)
Set valid, save protocol and finalize the export string.
Definition XrdROOT.cxx:140
const char * Dir() const
Definition XrdROOT.h:67
bool IsParked() const
Definition XrdROOT.h:75
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:69
void Park()
Definition XrdROOT.h:81
const char * Release() const
Definition XrdROOT.h:83
XrdOucString fLibDir
Definition XrdROOT.h:44
~XrdROOT()
Definition XrdROOT.h:65
int VrsMinor() const
Definition XrdROOT.h:89