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 class PlugInManager; 00038 class PlugInFactory; 00039 00040 //---------------------------------------------------------------------------- 00044 //---------------------------------------------------------------------------- 00045 class DefaultEnv: public Env 00046 { 00047 public: 00048 //------------------------------------------------------------------------ 00050 //------------------------------------------------------------------------ 00051 DefaultEnv(); 00052 00053 //------------------------------------------------------------------------ 00055 //------------------------------------------------------------------------ 00056 static Env *GetEnv(); 00057 00058 //------------------------------------------------------------------------ 00060 //------------------------------------------------------------------------ 00061 static PostMaster *GetPostMaster(); 00062 00063 //------------------------------------------------------------------------ 00065 //------------------------------------------------------------------------ 00066 static Log *GetLog(); 00067 00068 //------------------------------------------------------------------------ 00072 //------------------------------------------------------------------------ 00073 static void SetLogLevel( const std::string &level ); 00074 00075 //------------------------------------------------------------------------ 00079 //------------------------------------------------------------------------ 00080 static bool SetLogFile( const std::string &filepath ); 00081 00082 //------------------------------------------------------------------------ 00103 //------------------------------------------------------------------------ 00104 static void SetLogMask( const std::string &level, 00105 const std::string &mask ); 00106 00107 //------------------------------------------------------------------------ 00109 //------------------------------------------------------------------------ 00110 static ForkHandler *GetForkHandler(); 00111 00112 //------------------------------------------------------------------------ 00114 //------------------------------------------------------------------------ 00115 static FileTimer *GetFileTimer(); 00116 00117 //------------------------------------------------------------------------ 00119 //------------------------------------------------------------------------ 00120 static Monitor *GetMonitor(); 00121 00122 //------------------------------------------------------------------------ 00124 //------------------------------------------------------------------------ 00125 static CheckSumManager *GetCheckSumManager(); 00126 00127 //------------------------------------------------------------------------ 00129 //------------------------------------------------------------------------ 00130 static TransportManager *GetTransportManager(); 00131 00132 //------------------------------------------------------------------------ 00134 //------------------------------------------------------------------------ 00135 static PlugInManager *GetPlugInManager(); 00136 00137 //------------------------------------------------------------------------ 00141 //------------------------------------------------------------------------ 00142 static PlugInFactory *GetPlugInFactory( const std::string url ); 00143 00144 //------------------------------------------------------------------------ 00146 //------------------------------------------------------------------------ 00147 static void Initialize(); 00148 00149 //------------------------------------------------------------------------ 00151 //------------------------------------------------------------------------ 00152 static void Finalize(); 00153 00154 //------------------------------------------------------------------------ 00156 //------------------------------------------------------------------------ 00157 static void ReInitializeLogging(); 00158 00159 private: 00160 static void SetUpLog(); 00161 00162 static XrdSysMutex sInitMutex; 00163 static Env *sEnv; 00164 static PostMaster *sPostMaster; 00165 static Log *sLog; 00166 static ForkHandler *sForkHandler; 00167 static FileTimer *sFileTimer; 00168 static Monitor *sMonitor; 00169 static XrdSysPlugin *sMonitorLibHandle; 00170 static bool sMonitorInitialized; 00171 static CheckSumManager *sCheckSumManager; 00172 static TransportManager *sTransportManager; 00173 static PlugInManager *sPlugInManager; 00174 }; 00175 } 00176 00177 #endif // __XRD_CL_DEFAULT_ENV_HH__