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 
25 class XrdOucPinLoader;
26 struct EnvInitializer;
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  class PlugInManager;
38  class PlugInFactory;
39 
40  //----------------------------------------------------------------------------
44  //----------------------------------------------------------------------------
45  class DefaultEnv: public Env
46  {
47  friend struct ::EnvInitializer;
48 
49  //------------------------------------------------------------------------
51  //------------------------------------------------------------------------
52  DefaultEnv();
53 
54  public:
55 
56  //------------------------------------------------------------------------
58  //------------------------------------------------------------------------
59  static std::string GetVersion();
60 
61  //------------------------------------------------------------------------
63  //------------------------------------------------------------------------
64  static Env *GetEnv();
65 
66  //------------------------------------------------------------------------
68  //------------------------------------------------------------------------
69  static PostMaster *GetPostMaster();
70 
71  //------------------------------------------------------------------------
73  //------------------------------------------------------------------------
74  static Log *GetLog();
75 
76  //------------------------------------------------------------------------
80  //------------------------------------------------------------------------
81  static void SetLogLevel( const std::string &level );
82 
83  //------------------------------------------------------------------------
87  //------------------------------------------------------------------------
88  static bool SetLogFile( const std::string &filepath );
89 
90  //------------------------------------------------------------------------
111  //------------------------------------------------------------------------
112  static void SetLogMask( const std::string &level,
113  const std::string &mask );
114 
115  //------------------------------------------------------------------------
117  //------------------------------------------------------------------------
118  static ForkHandler *GetForkHandler();
119 
120  //------------------------------------------------------------------------
122  //------------------------------------------------------------------------
123  static FileTimer *GetFileTimer();
124 
125  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
128  static Monitor *GetMonitor();
129 
130  //------------------------------------------------------------------------
132  //------------------------------------------------------------------------
134 
135  //------------------------------------------------------------------------
137  //------------------------------------------------------------------------
139 
140  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
144 
145  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  static PlugInFactory *GetPlugInFactory( const std::string url );
151 
152  //------------------------------------------------------------------------
154  //------------------------------------------------------------------------
155  static void ReInitializeLogging();
156 
157  private:
158 
159  //------------------------------------------------------------------------
161  //------------------------------------------------------------------------
162  static void Initialize();
163 
164  //------------------------------------------------------------------------
166  //------------------------------------------------------------------------
167  static void Finalize();
168 
169 
170  static void SetUpLog();
171 
172  static XrdSysMutex sInitMutex;
173  static Env *sEnv;
174  static PostMaster *sPostMaster;
175  static Log *sLog;
176  static ForkHandler *sForkHandler;
177  static FileTimer *sFileTimer;
178  static Monitor *sMonitor;
179  static XrdOucPinLoader *sMonitorLibHandle;
180  static bool sMonitorInitialized;
181  static CheckSumManager *sCheckSumManager;
182  static TransportManager *sTransportManager;
183  static PlugInManager *sPlugInManager;
184  };
185 
186 }
187 
188 static struct EnvInitializer
189 {
190  EnvInitializer();
191  ~EnvInitializer();
192  static int counter;
194 
195 
196 #endif // __XRD_CL_DEFAULT_ENV_HH__
static struct EnvInitializer initializer
Manage the checksum calc objects.
static PlugInManager * GetPlugInManager()
Get plug-in manager.
static bool SetLogFile(const std::string &filepath)
static std::string GetVersion()
Get client version.
static CheckSumManager * GetCheckSumManager()
Get checksum manager.
static Monitor * GetMonitor()
Get the monitor object.
static TransportManager * GetTransportManager()
Get transport manager.
static PlugInFactory * GetPlugInFactory(const std::string url)
static Log * GetLog()
Get default log.
static PostMaster * GetPostMaster()
Get default post master.
static void SetLogLevel(const std::string &level)
static void SetLogMask(const std::string &level, const std::string &mask)
Set log mask.
static FileTimer * GetFileTimer()
Get file timer task.
static ForkHandler * GetForkHandler()
Get the fork handler.
static Env * GetEnv()
Get default client environment.
static void ReInitializeLogging()
Re-initialize the logging.
Task generating timeout events for FileStateHandlers in recovery mode.
Handle diagnostics.
Definition: XrdClLog.hh:101
An abstract class to describe the client-side monitoring plugin interface.
Definition: XrdClMonitor.hh:56
Manage client-side plug-ins and match them agains URLs.
A hub for dispatching and receiving messages.
Manage transport handler objects.
XrdSysError Log
Definition: XrdConfig.cc:113
static int counter