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 XrdOucPinLoader;
27 struct EnvInitializer;
28 
29 namespace XrdCl
30 {
31  class PostMaster;
32  class Log;
33  class ForkHandler;
34  class Monitor;
35  class CheckSumManager;
36  class TransportManager;
37  class FileTimer;
38  class PlugInManager;
39  class PlugInFactory;
40 
41  //----------------------------------------------------------------------------
45  //----------------------------------------------------------------------------
46  class DefaultEnv: public Env
47  {
48  friend struct ::EnvInitializer;
49 
50  //------------------------------------------------------------------------
52  //------------------------------------------------------------------------
54 
55  public:
56 
57  //------------------------------------------------------------------------
59  //------------------------------------------------------------------------
60  inline static std::string GetVersion()
61  {
62  return XrdVERSION;
63  }
64 
65  //------------------------------------------------------------------------
67  //------------------------------------------------------------------------
68  static Env *GetEnv();
69 
70  //------------------------------------------------------------------------
72  //------------------------------------------------------------------------
74 
75  //------------------------------------------------------------------------
77  //------------------------------------------------------------------------
78  static Log *GetLog();
79 
80  //------------------------------------------------------------------------
84  //------------------------------------------------------------------------
85  static void SetLogLevel( const std::string &level );
86 
87  //------------------------------------------------------------------------
91  //------------------------------------------------------------------------
92  static bool SetLogFile( const std::string &filepath );
93 
94  //------------------------------------------------------------------------
115  //------------------------------------------------------------------------
116  static void SetLogMask( const std::string &level,
117  const std::string &mask );
118 
119  //------------------------------------------------------------------------
121  //------------------------------------------------------------------------
123 
124  //------------------------------------------------------------------------
126  //------------------------------------------------------------------------
128 
129  //------------------------------------------------------------------------
131  //------------------------------------------------------------------------
132  static Monitor *GetMonitor();
133 
134  //------------------------------------------------------------------------
136  //------------------------------------------------------------------------
138 
139  //------------------------------------------------------------------------
141  //------------------------------------------------------------------------
143 
144  //------------------------------------------------------------------------
146  //------------------------------------------------------------------------
148 
149  //------------------------------------------------------------------------
153  //------------------------------------------------------------------------
154  static PlugInFactory *GetPlugInFactory( const std::string url );
155 
156  //------------------------------------------------------------------------
158  //------------------------------------------------------------------------
159  static void ReInitializeLogging();
160 
161  private:
162 
163  //------------------------------------------------------------------------
165  //------------------------------------------------------------------------
166  static void Initialize();
167 
168  //------------------------------------------------------------------------
170  //------------------------------------------------------------------------
171  static void Finalize();
172 
173 
174  static void SetUpLog();
175 
177  static Env *sEnv;
179  static Log *sLog;
182  static Monitor *sMonitor;
184  static bool sMonitorInitialized;
188  };
189 
190 }
191 
192 static struct EnvInitializer
193 {
196  static int counter;
198 
199 
200 #endif // __XRD_CL_DEFAULT_ENV_HH__
XrdCl::Env
Definition: XrdClEnv.hh:38
XrdCl::DefaultEnv::ReInitializeLogging
static void ReInitializeLogging()
Re-initialize the logging.
XrdSysMutex
Definition: XrdSysPthread.hh:165
XrdSysPthread.hh
XrdCl::DefaultEnv::GetMonitor
static Monitor * GetMonitor()
Get the monitor object.
XrdCl::DefaultEnv::sLog
static Log * sLog
Definition: XrdClDefaultEnv.hh:179
XrdCl::DefaultEnv::GetPlugInManager
static PlugInManager * GetPlugInManager()
Get plug-in manager.
EnvInitializer::EnvInitializer
EnvInitializer()
initializer
static struct EnvInitializer initializer
XrdCl::Log
Handle diagnostics.
Definition: XrdClLog.hh:101
XrdCl::DefaultEnv::sMonitorInitialized
static bool sMonitorInitialized
Definition: XrdClDefaultEnv.hh:184
XrdCl::DefaultEnv::GetLog
static Log * GetLog()
Get default log.
XrdCl::DefaultEnv::sCheckSumManager
static CheckSumManager * sCheckSumManager
Definition: XrdClDefaultEnv.hh:185
XrdOucPinLoader
Definition: XrdOucPinLoader.hh:50
XrdCl::DefaultEnv::GetCheckSumManager
static CheckSumManager * GetCheckSumManager()
Get checksum manager.
XrdClEnv.hh
XrdCl::DefaultEnv::GetPlugInFactory
static PlugInFactory * GetPlugInFactory(const std::string url)
XrdCl::DefaultEnv
Definition: XrdClDefaultEnv.hh:47
EnvInitializer::counter
static int counter
Definition: XrdClDefaultEnv.hh:196
XrdCl::DefaultEnv::GetFileTimer
static FileTimer * GetFileTimer()
Get file timer task.
XrdCl::CheckSumManager
Manage the checksum calc objects.
Definition: XrdClCheckSumManager.hh:42
XrdCl::DefaultEnv::GetVersion
static std::string GetVersion()
Get client version.
Definition: XrdClDefaultEnv.hh:60
XrdCl::DefaultEnv::DefaultEnv
DefaultEnv()
Constructor.
XrdCl::DefaultEnv::Finalize
static void Finalize()
Finalize the environment.
XrdCl::DefaultEnv::GetForkHandler
static ForkHandler * GetForkHandler()
Get the fork handler.
XrdCl::DefaultEnv::sInitMutex
static XrdSysMutex sInitMutex
Definition: XrdClDefaultEnv.hh:176
XrdCl::DefaultEnv::sMonitorLibHandle
static XrdOucPinLoader * sMonitorLibHandle
Definition: XrdClDefaultEnv.hh:183
EnvInitializer
Definition: XrdClDefaultEnv.hh:193
XrdCl::FileTimer
Task generating timeout events for FileStateHandlers in recovery mode.
Definition: XrdClFileTimer.hh:33
XrdCl::DefaultEnv::Initialize
static void Initialize()
Initialize the environment.
XrdCl::DefaultEnv::sTransportManager
static TransportManager * sTransportManager
Definition: XrdClDefaultEnv.hh:186
XrdCl::DefaultEnv::sForkHandler
static ForkHandler * sForkHandler
Definition: XrdClDefaultEnv.hh:180
XrdCl
Definition: XrdClAnyObject.hh:26
XrdCl::DefaultEnv::SetLogLevel
static void SetLogLevel(const std::string &level)
XrdCl::DefaultEnv::GetPostMaster
static PostMaster * GetPostMaster()
Get default post master.
XrdCl::DefaultEnv::SetLogFile
static bool SetLogFile(const std::string &filepath)
XrdCl::DefaultEnv::sPostMaster
static PostMaster * sPostMaster
Definition: XrdClDefaultEnv.hh:178
XrdCl::TransportManager
Manage transport handler objects.
Definition: XrdClTransportManager.hh:33
XrdCl::DefaultEnv::GetEnv
static Env * GetEnv()
Get default client environment.
XrdCl::DefaultEnv::sPlugInManager
static PlugInManager * sPlugInManager
Definition: XrdClDefaultEnv.hh:187
XrdCl::Monitor
An abstract class to describe the client-side monitoring plugin interface.
Definition: XrdClMonitor.hh:54
XrdCl::DefaultEnv::GetTransportManager
static TransportManager * GetTransportManager()
Get transport manager.
XrdCl::DefaultEnv::SetUpLog
static void SetUpLog()
XrdCl::DefaultEnv::sEnv
static Env * sEnv
Definition: XrdClDefaultEnv.hh:177
EnvInitializer::~EnvInitializer
~EnvInitializer()
XrdCl::DefaultEnv::SetLogMask
static void SetLogMask(const std::string &level, const std::string &mask)
XrdCl::DefaultEnv::sFileTimer
static FileTimer * sFileTimer
Definition: XrdClDefaultEnv.hh:181
XrdCl::PlugInFactory
Plugin factory.
Definition: XrdClPlugInInterface.hh:549
XrdCl::DefaultEnv::sMonitor
static Monitor * sMonitor
Definition: XrdClDefaultEnv.hh:182
XrdCl::ForkHandler
Definition: XrdClForkHandler.hh:36
XrdCl::PlugInManager
Manage client-side plug-ins and match them agains URLs.
Definition: XrdClPlugInManager.hh:42
XrdCl::PostMaster
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:48