00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // XRootD is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // XRootD is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00017 //------------------------------------------------------------------------------ 00018 00019 #ifndef __XRD_CL_DEFAULT_ENV_HH__ 00020 #define __XRD_CL_DEFAULT_ENV_HH__ 00021 00022 #include "XrdSys/XrdSysPthread.hh" 00023 #include "XrdCl/XrdClEnv.hh" 00024 00025 class XrdOucPinLoader; 00026 00027 namespace XrdCl 00028 { 00029 class PostMaster; 00030 class Log; 00031 class ForkHandler; 00032 class Monitor; 00033 class CheckSumManager; 00034 class TransportManager; 00035 class FileTimer; 00036 class PlugInManager; 00037 class PlugInFactory; 00038 00039 //---------------------------------------------------------------------------- 00043 //---------------------------------------------------------------------------- 00044 class DefaultEnv: public Env 00045 { 00046 public: 00047 //------------------------------------------------------------------------ 00049 //------------------------------------------------------------------------ 00050 DefaultEnv(); 00051 00052 //------------------------------------------------------------------------ 00054 //------------------------------------------------------------------------ 00055 static Env *GetEnv(); 00056 00057 //------------------------------------------------------------------------ 00059 //------------------------------------------------------------------------ 00060 static PostMaster *GetPostMaster(); 00061 00062 //------------------------------------------------------------------------ 00064 //------------------------------------------------------------------------ 00065 static Log *GetLog(); 00066 00067 //------------------------------------------------------------------------ 00071 //------------------------------------------------------------------------ 00072 static void SetLogLevel( const std::string &level ); 00073 00074 //------------------------------------------------------------------------ 00078 //------------------------------------------------------------------------ 00079 static bool SetLogFile( const std::string &filepath ); 00080 00081 //------------------------------------------------------------------------ 00102 //------------------------------------------------------------------------ 00103 static void SetLogMask( const std::string &level, 00104 const std::string &mask ); 00105 00106 //------------------------------------------------------------------------ 00108 //------------------------------------------------------------------------ 00109 static ForkHandler *GetForkHandler(); 00110 00111 //------------------------------------------------------------------------ 00113 //------------------------------------------------------------------------ 00114 static FileTimer *GetFileTimer(); 00115 00116 //------------------------------------------------------------------------ 00118 //------------------------------------------------------------------------ 00119 static Monitor *GetMonitor(); 00120 00121 //------------------------------------------------------------------------ 00123 //------------------------------------------------------------------------ 00124 static CheckSumManager *GetCheckSumManager(); 00125 00126 //------------------------------------------------------------------------ 00128 //------------------------------------------------------------------------ 00129 static TransportManager *GetTransportManager(); 00130 00131 //------------------------------------------------------------------------ 00133 //------------------------------------------------------------------------ 00134 static PlugInManager *GetPlugInManager(); 00135 00136 //------------------------------------------------------------------------ 00140 //------------------------------------------------------------------------ 00141 static PlugInFactory *GetPlugInFactory( const std::string url ); 00142 00143 //------------------------------------------------------------------------ 00145 //------------------------------------------------------------------------ 00146 static void Initialize(); 00147 00148 //------------------------------------------------------------------------ 00150 //------------------------------------------------------------------------ 00151 static void Finalize(); 00152 00153 //------------------------------------------------------------------------ 00155 //------------------------------------------------------------------------ 00156 static void ReInitializeLogging(); 00157 00158 private: 00159 static void SetUpLog(); 00160 00161 static XrdSysMutex sInitMutex; 00162 static Env *sEnv; 00163 static PostMaster *sPostMaster; 00164 static Log *sLog; 00165 static ForkHandler *sForkHandler; 00166 static FileTimer *sFileTimer; 00167 static Monitor *sMonitor; 00168 static XrdOucPinLoader *sMonitorLibHandle; 00169 static bool sMonitorInitialized; 00170 static CheckSumManager *sCheckSumManager; 00171 static TransportManager *sTransportManager; 00172 static PlugInManager *sPlugInManager; 00173 }; 00174 } 00175 00176 #endif // __XRD_CL_DEFAULT_ENV_HH__