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 
27 namespace XrdCl
28 {
29  class PostMaster;
30  class Log;
31  class ForkHandler;
32  class Monitor;
33  class CheckSumManager;
34  class TransportManager;
35  class FileTimer;
36  class PlugInManager;
37  class PlugInFactory;
38 
39  //----------------------------------------------------------------------------
43  //----------------------------------------------------------------------------
44  class DefaultEnv: public Env
45  {
46  public:
47  //------------------------------------------------------------------------
49  //------------------------------------------------------------------------
50  DefaultEnv();
51 
52  //------------------------------------------------------------------------
54  //------------------------------------------------------------------------
55  static Env *GetEnv();
56 
57  //------------------------------------------------------------------------
59  //------------------------------------------------------------------------
60  static PostMaster *GetPostMaster();
61 
62  //------------------------------------------------------------------------
64  //------------------------------------------------------------------------
65  static Log *GetLog();
66 
67  //------------------------------------------------------------------------
71  //------------------------------------------------------------------------
72  static void SetLogLevel( const std::string &level );
73 
74  //------------------------------------------------------------------------
78  //------------------------------------------------------------------------
79  static bool SetLogFile( const std::string &filepath );
80 
81  //------------------------------------------------------------------------
102  //------------------------------------------------------------------------
103  static void SetLogMask( const std::string &level,
104  const std::string &mask );
105 
106  //------------------------------------------------------------------------
108  //------------------------------------------------------------------------
109  static ForkHandler *GetForkHandler();
110 
111  //------------------------------------------------------------------------
113  //------------------------------------------------------------------------
114  static FileTimer *GetFileTimer();
115 
116  //------------------------------------------------------------------------
118  //------------------------------------------------------------------------
119  static Monitor *GetMonitor();
120 
121  //------------------------------------------------------------------------
123  //------------------------------------------------------------------------
124  static CheckSumManager *GetCheckSumManager();
125 
126  //------------------------------------------------------------------------
128  //------------------------------------------------------------------------
130 
131  //------------------------------------------------------------------------
133  //------------------------------------------------------------------------
134  static PlugInManager *GetPlugInManager();
135 
136  //------------------------------------------------------------------------
140  //------------------------------------------------------------------------
141  static PlugInFactory *GetPlugInFactory( const std::string url );
142 
143  //------------------------------------------------------------------------
145  //------------------------------------------------------------------------
146  static void Initialize();
147 
148  //------------------------------------------------------------------------
150  //------------------------------------------------------------------------
151  static void Finalize();
152 
153  //------------------------------------------------------------------------
155  //------------------------------------------------------------------------
156  static void ReInitializeLogging();
157 
158  private:
159  static void SetUpLog();
160 
162  static Env *sEnv;
164  static Log *sLog;
165  static ForkHandler *sForkHandler;
166  static FileTimer *sFileTimer;
167  static Monitor *sMonitor;
168  static XrdOucPinLoader *sMonitorLibHandle;
169  static bool sMonitorInitialized;
170  static CheckSumManager *sCheckSumManager;
172  static PlugInManager *sPlugInManager;
173  };
174 }
175 
176 static struct EnvInitializer
177 {
178  EnvInitializer();
179  ~EnvInitializer();
180  static int counter;
181 } initializer;
182 
183 #endif // __XRD_CL_DEFAULT_ENV_HH__
static PostMaster * sPostMaster
Definition: XrdClDefaultEnv.hh:163
static TransportManager * sTransportManager
Definition: XrdClDefaultEnv.hh:171
An abstract class to describe the client-side monitoring plugin interface.
Definition: XrdClMonitor.hh:53
static FileTimer * GetFileTimer()
Get file timer task.
Manage transport handler objects.
Definition: XrdClTransportManager.hh:32
static Monitor * sMonitor
Definition: XrdClDefaultEnv.hh:167
static Env * GetEnv()
Get default client environment.
static Monitor * GetMonitor()
Get the monitor object.
static void Finalize()
Finalize the environment.
static void ReInitializeLogging()
Re-initialize the logging.
static void SetLogLevel(const std::string &level)
static Log * GetLog()
Get default log.
Definition: XrdSysPthread.hh:140
static ForkHandler * GetForkHandler()
Get the fork handler.
static CheckSumManager * GetCheckSumManager()
Get checksum manager.
static XrdSysMutex sInitMutex
Definition: XrdClDefaultEnv.hh:161
Definition: XrdClDefaultEnv.hh:176
static PlugInFactory * GetPlugInFactory(const std::string url)
static int counter
Definition: XrdClDefaultEnv.hh:180
static Env * sEnv
Definition: XrdClDefaultEnv.hh:162
static void Initialize()
Initialize the environment.
static CheckSumManager * sCheckSumManager
Definition: XrdClDefaultEnv.hh:170
static PlugInManager * sPlugInManager
Definition: XrdClDefaultEnv.hh:172
static FileTimer * sFileTimer
Definition: XrdClDefaultEnv.hh:166
static struct EnvInitializer initializer
static void SetUpLog()
static bool SetLogFile(const std::string &filepath)
static void SetLogMask(const std::string &level, const std::string &mask)
Definition: XrdClDefaultEnv.hh:44
static TransportManager * GetTransportManager()
Get transport manager.
Definition: XrdClEnv.hh:36
static Log * sLog
Definition: XrdClDefaultEnv.hh:164
DefaultEnv()
Constructor.
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:42
static PostMaster * GetPostMaster()
Get default post master.
static PlugInManager * GetPlugInManager()
Get plug-in manager.
static ForkHandler * sForkHandler
Definition: XrdClDefaultEnv.hh:165
static bool sMonitorInitialized
Definition: XrdClDefaultEnv.hh:169
static XrdOucPinLoader * sMonitorLibHandle
Definition: XrdClDefaultEnv.hh:168