xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 Env *GetEnv();
60 
61  //------------------------------------------------------------------------
63  //------------------------------------------------------------------------
64  static PostMaster *GetPostMaster();
65 
66  //------------------------------------------------------------------------
68  //------------------------------------------------------------------------
69  static Log *GetLog();
70 
71  //------------------------------------------------------------------------
75  //------------------------------------------------------------------------
76  static void SetLogLevel( const std::string &level );
77 
78  //------------------------------------------------------------------------
82  //------------------------------------------------------------------------
83  static bool SetLogFile( const std::string &filepath );
84 
85  //------------------------------------------------------------------------
106  //------------------------------------------------------------------------
107  static void SetLogMask( const std::string &level,
108  const std::string &mask );
109 
110  //------------------------------------------------------------------------
112  //------------------------------------------------------------------------
113  static ForkHandler *GetForkHandler();
114 
115  //------------------------------------------------------------------------
117  //------------------------------------------------------------------------
118  static FileTimer *GetFileTimer();
119 
120  //------------------------------------------------------------------------
122  //------------------------------------------------------------------------
123  static Monitor *GetMonitor();
124 
125  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
129 
130  //------------------------------------------------------------------------
132  //------------------------------------------------------------------------
134 
135  //------------------------------------------------------------------------
137  //------------------------------------------------------------------------
139 
140  //------------------------------------------------------------------------
144  //------------------------------------------------------------------------
145  static PlugInFactory *GetPlugInFactory( const std::string url );
146 
147  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  static void ReInitializeLogging();
151 
152  private:
153 
154  //------------------------------------------------------------------------
156  //------------------------------------------------------------------------
157  static void Initialize();
158 
159  //------------------------------------------------------------------------
161  //------------------------------------------------------------------------
162  static void Finalize();
163 
164 
165  static void SetUpLog();
166 
168  static Env *sEnv;
170  static Log *sLog;
173  static Monitor *sMonitor;
175  static bool sMonitorInitialized;
179  };
180 
181 }
182 
183 static struct EnvInitializer
184 {
185  EnvInitializer();
186  ~EnvInitializer();
187  static int counter;
188 } initializer;
189 
190 
191 #endif // __XRD_CL_DEFAULT_ENV_HH__
Definition: XrdClForkHandler.hh:35
static PostMaster * sPostMaster
Definition: XrdClDefaultEnv.hh:169
static TransportManager * sTransportManager
Definition: XrdClDefaultEnv.hh:177
Manage the checksum calc objects.
Definition: XrdClCheckSumManager.hh:41
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:173
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)
Definition: XrdOucPinLoader.hh:49
Manage client-side plug-ins and match them agains URLs.
Definition: XrdClPlugInManager.hh:41
static Log * GetLog()
Get default log.
Definition: XrdSysPthread.hh:165
static ForkHandler * GetForkHandler()
Get the fork handler.
static CheckSumManager * GetCheckSumManager()
Get checksum manager.
static XrdSysMutex sInitMutex
Definition: XrdClDefaultEnv.hh:167
Definition: XrdClDefaultEnv.hh:183
static PlugInFactory * GetPlugInFactory(const std::string url)
static int counter
Definition: XrdClDefaultEnv.hh:187
static Env * sEnv
Definition: XrdClDefaultEnv.hh:168
static void Initialize()
Initialize the environment.
static CheckSumManager * sCheckSumManager
Definition: XrdClDefaultEnv.hh:176
static PlugInManager * sPlugInManager
Definition: XrdClDefaultEnv.hh:178
static FileTimer * sFileTimer
Definition: XrdClDefaultEnv.hh:172
static struct EnvInitializer initializer
static void SetUpLog()
static bool SetLogFile(const std::string &filepath)
Plugin factory.
Definition: XrdClPlugInInterface.hh:548
static void SetLogMask(const std::string &level, const std::string &mask)
Definition: XrdClDefaultEnv.hh:45
static TransportManager * GetTransportManager()
Get transport manager.
Task generating timeout events for FileStateHandlers in recovery mode.
Definition: XrdClFileTimer.hh:32
Definition: XrdClEnv.hh:36
static Log * sLog
Definition: XrdClDefaultEnv.hh:170
DefaultEnv()
Constructor.
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:47
static PostMaster * GetPostMaster()
Get default post master.
static PlugInManager * GetPlugInManager()
Get plug-in manager.
static ForkHandler * sForkHandler
Definition: XrdClDefaultEnv.hh:171
static bool sMonitorInitialized
Definition: XrdClDefaultEnv.hh:175
Handle diagnostics.
Definition: XrdClLog.hh:101
static XrdOucPinLoader * sMonitorLibHandle
Definition: XrdClDefaultEnv.hh:174