|
activemq-cpp-3.3.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 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 // Change listener on this class's Properties 00151 std::list<PropertyChangeListener*> listeners; 00152 00153 // Properties of the Log Manager 00154 util::Properties properties; 00155 00156 // Data structure for LogManager Internal data. 00157 Pointer<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: // Static Singleton Methods. 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 /*_DECAF_UTIL_LOGGING_LOGMANAGER_H_*/