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 #include "XrdVersion.hh" 00025 00026 class XrdSysPlugin; 00027 00028 namespace XrdCl 00029 { 00030 class PostMaster; 00031 class Log; 00032 class ForkHandler; 00033 class Monitor; 00034 class CheckSumManager; 00035 class TransportManager; 00036 class FileTimer; 00037 00038 //---------------------------------------------------------------------------- 00042 //---------------------------------------------------------------------------- 00043 class DefaultEnv: public Env 00044 { 00045 public: 00046 //------------------------------------------------------------------------ 00048 //------------------------------------------------------------------------ 00049 DefaultEnv(); 00050 00051 //------------------------------------------------------------------------ 00053 //------------------------------------------------------------------------ 00054 static Env *GetEnv(); 00055 00056 //------------------------------------------------------------------------ 00058 //------------------------------------------------------------------------ 00059 static PostMaster *GetPostMaster(); 00060 00061 //------------------------------------------------------------------------ 00063 //------------------------------------------------------------------------ 00064 static Log *GetLog(); 00065 00066 //------------------------------------------------------------------------ 00070 //------------------------------------------------------------------------ 00071 static void SetLogLevel( const std::string &level ); 00072 00073 //------------------------------------------------------------------------ 00077 //------------------------------------------------------------------------ 00078 static bool SetLogFile( const std::string &filepath ); 00079 00080 //------------------------------------------------------------------------ 00101 //------------------------------------------------------------------------ 00102 static void SetLogMask( const std::string &level, 00103 const std::string &mask ); 00104 00105 //------------------------------------------------------------------------ 00107 //------------------------------------------------------------------------ 00108 static ForkHandler *GetForkHandler(); 00109 00110 //------------------------------------------------------------------------ 00112 //------------------------------------------------------------------------ 00113 static FileTimer *GetFileTimer(); 00114 00115 //------------------------------------------------------------------------ 00117 //------------------------------------------------------------------------ 00118 static Monitor *GetMonitor(); 00119 00120 //------------------------------------------------------------------------ 00122 //------------------------------------------------------------------------ 00123 static CheckSumManager *GetCheckSumManager(); 00124 00125 //------------------------------------------------------------------------ 00127 //------------------------------------------------------------------------ 00128 static TransportManager *GetTransportManager(); 00129 00130 //------------------------------------------------------------------------ 00132 //------------------------------------------------------------------------ 00133 static void Initialize(); 00134 00135 //------------------------------------------------------------------------ 00137 //------------------------------------------------------------------------ 00138 static void Finalize(); 00139 00140 //------------------------------------------------------------------------ 00142 //------------------------------------------------------------------------ 00143 static void ReInitializeLogging(); 00144 00145 private: 00146 static void SetUpLog(); 00147 00148 static XrdSysMutex sInitMutex; 00149 static Env *sEnv; 00150 static PostMaster *sPostMaster; 00151 static Log *sLog; 00152 static ForkHandler *sForkHandler; 00153 static FileTimer *sFileTimer; 00154 static Monitor *sMonitor; 00155 static XrdSysPlugin *sMonitorLibHandle; 00156 static bool sMonitorInitialized; 00157 static CheckSumManager *sCheckSumManager; 00158 static TransportManager *sTransportManager; 00159 }; 00160 } 00161 00162 #endif // __XRD_CL_DEFAULT_ENV_HH__