00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DECAF_UTIL_LOGGING_LOGMANAGER_H_
00018 #define _DECAF_UTIL_LOGGING_LOGMANAGER_H_
00019
00020 #include <map>
00021 #include <list>
00022 #include <string>
00023 #include <vector>
00024
00025 #include <decaf/lang/Pointer.h>
00026 #include <decaf/util/Properties.h>
00027 #include <decaf/util/concurrent/Mutex.h>
00028 #include <decaf/util/Config.h>
00029
00030 #include <decaf/io/IOException.h>
00031 #include <decaf/lang/exceptions/NullPointerException.h>
00032 #include <decaf/lang/exceptions/IllegalArgumentException.h>
00033
00034 namespace decaf{
00035 namespace lang{
00036 class Runtime;
00037 }
00038 namespace io{
00039 class InputStream;
00040 }
00041 namespace util{
00042 namespace logging{
00043
00044 class Logger;
00045 class LogManagerInternals;
00046 class PropertyChangeListener;
00047
00048 using decaf::lang::Pointer;
00049
00147 class DECAF_API LogManager {
00148 private:
00149
00150
00151 std::list<PropertyChangeListener*> listeners;
00152
00153
00154 util::Properties properties;
00155
00156
00157 LogManagerInternals* internal;
00158
00159 public:
00160
00161 virtual ~LogManager();
00162
00175 bool addLogger( Logger* logger );
00176
00183 Logger* getLogger( const std::string& name );
00184
00194 int getLoggerNames( const std::vector<std::string>& names );
00195
00201 void setProperties( const util::Properties& properties );
00202
00208 const util::Properties& getProperties() const {
00209 return properties;
00210 }
00211
00220 std::string getProperty( const std::string& name );
00221
00229 void addPropertyChangeListener( PropertyChangeListener* listener );
00230
00239 void removePropertyChangeListener( PropertyChangeListener* listener );
00240
00255 void readConfiguration();
00256
00271 void readConfiguration( decaf::io::InputStream* stream );
00272
00280 void reset();
00281
00282 public:
00283
00288 static LogManager& getLogManager();
00289
00290 private:
00291
00295 static void initialize();
00296
00300 static void shutdown();
00301
00302 protected:
00303
00307 LogManager();
00308
00313 LogManager( const LogManager& manager );
00314
00319 void operator=( const LogManager& manager );
00320
00321 private:
00322
00323 friend class decaf::lang::Runtime;
00324
00325 };
00326
00327 }}}
00328
00329 #endif