xrootd
XrdClDefaultEnv.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 
19 #ifndef __XRD_CL_DEFAULT_ENV_HH__
20 #define __XRD_CL_DEFAULT_ENV_HH__
21 
22 #include "XrdSys/XrdSysPthread.hh"
23 #include "XrdCl/XrdClEnv.hh"
24 #include "XrdVersion.hh"
25 
26 class XrdSysPlugin;
27 
28 namespace XrdCl
29 {
30  class PostMaster;
31  class Log;
32  class ForkHandler;
33  class Monitor;
34  class CheckSumManager;
35  class TransportManager;
36  class FileTimer;
37 
38  //----------------------------------------------------------------------------
42  //----------------------------------------------------------------------------
43  class DefaultEnv: public Env
44  {
45  public:
46  //------------------------------------------------------------------------
48  //------------------------------------------------------------------------
49  DefaultEnv();
50 
51  //------------------------------------------------------------------------
53  //------------------------------------------------------------------------
54  static Env *GetEnv();
55 
56  //------------------------------------------------------------------------
58  //------------------------------------------------------------------------
59  static PostMaster *GetPostMaster();
60 
61  //------------------------------------------------------------------------
63  //------------------------------------------------------------------------
64  static Log *GetLog();
65 
66  //------------------------------------------------------------------------
70  //------------------------------------------------------------------------
71  static void SetLogLevel( const std::string &level );
72 
73  //------------------------------------------------------------------------
77  //------------------------------------------------------------------------
78  static bool SetLogFile( const std::string &filepath );
79 
80  //------------------------------------------------------------------------
101  //------------------------------------------------------------------------
102  static void SetLogMask( const std::string &level,
103  const std::string &mask );
104 
105  //------------------------------------------------------------------------
107  //------------------------------------------------------------------------
108  static ForkHandler *GetForkHandler();
109 
110  //------------------------------------------------------------------------
112  //------------------------------------------------------------------------
113  static FileTimer *GetFileTimer();
114 
115  //------------------------------------------------------------------------
117  //------------------------------------------------------------------------
118  static Monitor *GetMonitor();
119 
120  //------------------------------------------------------------------------
122  //------------------------------------------------------------------------
123  static CheckSumManager *GetCheckSumManager();
124 
125  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
129 
130  //------------------------------------------------------------------------
132  //------------------------------------------------------------------------
133  static void Initialize();
134 
135  //------------------------------------------------------------------------
137  //------------------------------------------------------------------------
138  static void Finalize();
139 
140  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
143  static void ReInitializeLogging();
144 
145  private:
146  static void SetUpLog();
147 
149  static Env *sEnv;
151  static Log *sLog;
152  static ForkHandler *sForkHandler;
153  static FileTimer *sFileTimer;
154  static Monitor *sMonitor;
156  static bool sMonitorInitialized;
157  static CheckSumManager *sCheckSumManager;
159  };
160 }
161 
162 #endif // __XRD_CL_DEFAULT_ENV_HH__