presage  0.8.7
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
ProfileManager Class Reference

#include <profileManager.h>

Collaboration diagram for ProfileManager:
Collaboration graph
[legend]

List of all members.

Classes

struct  CachedLogMessage

Public Member Functions

 ProfileManager (const std::string="")
 ~ProfileManager ()
void save_profile () const
Configurationget_configuration ()
void set_autopersist (const std::string &value)

Static Public Attributes

static const char * LOGGER = "Presage.ProfileManager.LOGGER"
static const char * AUTOPERSIST = "Presage.ProfileManager.AUTOPERSIST"

Private Member Functions

void init_profiles (const std::string &profilename)
Profilecreate_profile_from_xml (const std::string &filename)
std::string get_user_home_dir () const
std::string get_system_etc_dir () const
void cache_log_message (Logger< char >::Level level, const std::string &message)
void flush_cached_log_messages ()
void refresh_config ()

Private Attributes

bool loaded_at_least_one_profile
std::list< CachedLogMessagecached_log_messages
Configurationconfig
Profilerw_profile
bool autopersist_config
Logger< char > logger

Detailed Description

Juggles configuration files and presage system initialization.

ProfileManager loads up a bunch of xml files containing configuration data and initializes a configuration object.

1. write config with data from /etc/presage.xml if it exists 2. overwrite config with data from /presage.xml if it exists 3. overwrite config with data from ~/.presage.xml if it exists 4. overwrite config with data from profile passed to constructor (if non-empty string)

Definition at line 51 of file profileManager.h.


Constructor & Destructor Documentation

ProfileManager::ProfileManager ( const std::string  profilename = "")

Constructor.

Initialises other modules.

Definition at line 55 of file profileManager.cpp.

References autopersist_config, config, init_profiles(), loaded_at_least_one_profile, and rw_profile.

Here is the call graph for this function:

Destructor.

Definition at line 70 of file profileManager.cpp.

References AUTOPERSIST, autopersist_config, config, Configuration::find(), flush_cached_log_messages(), Variable::get_value(), rw_profile, save_profile(), and set_autopersist().

Here is the call graph for this function:


Member Function Documentation

void ProfileManager::cache_log_message ( Logger< char >::Level  level,
const std::string &  message 
) [private]

Cache log message until logger level is read from configuration.

Definition at line 272 of file profileManager.cpp.

References cached_log_messages, and ProfileManager::CachedLogMessage::message.

Referenced by create_profile_from_xml().

Here is the caller graph for this function:

Profile * ProfileManager::create_profile_from_xml ( const std::string &  filename) [private]

Definition at line 84 of file profileManager.cpp.

References cache_log_message(), Profile::file_read_ok(), logger, and Logger< _charT, _Traits >::NOTICE.

Referenced by init_profiles().

Here is the call graph for this function:

Here is the caller graph for this function:

Flush cached log messages.

Definition at line 281 of file profileManager.cpp.

References cached_log_messages, endl(), and logger.

Referenced by refresh_config(), and ~ProfileManager().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 260 of file profileManager.cpp.

References config, and refresh_config().

Here is the call graph for this function:

std::string ProfileManager::get_system_etc_dir ( ) const [private]

Definition at line 152 of file profileManager.cpp.

Referenced by init_profiles().

Here is the caller graph for this function:

std::string ProfileManager::get_user_home_dir ( ) const [private]

Definition at line 204 of file profileManager.cpp.

References HOME.

Referenced by init_profiles().

Here is the caller graph for this function:

void ProfileManager::init_profiles ( const std::string &  profilename) [private]

Definition at line 113 of file profileManager.cpp.

References config, create_profile_from_xml(), DefaultProfile::DEFAULT_PROFILE_FILENAME, Profile::file_read_ok(), get_system_etc_dir(), get_user_home_dir(), loaded_at_least_one_profile, Profile::read_into_configuration(), and rw_profile.

Referenced by ProfileManager().

Here is the call graph for this function:

Here is the caller graph for this function:

void ProfileManager::refresh_config ( ) [private]

Refresh configuration variables

Definition at line 292 of file profileManager.cpp.

References config, Configuration::find(), flush_cached_log_messages(), Variable::get_value(), LOGGER, logger, and setlevel().

Referenced by get_configuration().

Here is the call graph for this function:

Here is the caller graph for this function:

Write profile to disk.

Returns true is file was saved successfully, false otherwise.

Definition at line 251 of file profileManager.cpp.

References config, endl(), logger, Profile::read_from_configuration(), rw_profile, and Profile::write_to_file().

Referenced by Presage::save_config(), and ~ProfileManager().

Here is the call graph for this function:

Here is the caller graph for this function:

void ProfileManager::set_autopersist ( const std::string &  value)

Definition at line 305 of file profileManager.cpp.

References autopersist_config, endl(), Utility::isTrue(), and logger.

Referenced by ~ProfileManager().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const char * ProfileManager::AUTOPERSIST = "Presage.ProfileManager.AUTOPERSIST" [static]

Definition at line 63 of file profileManager.h.

Referenced by ~ProfileManager().

Definition at line 101 of file profileManager.h.

Referenced by ProfileManager(), set_autopersist(), and ~ProfileManager().

Definition at line 97 of file profileManager.h.

Referenced by cache_log_message(), and flush_cached_log_messages().

Definition at line 73 of file profileManager.h.

Referenced by init_profiles(), and ProfileManager().

const char * ProfileManager::LOGGER = "Presage.ProfileManager.LOGGER" [static]

Definition at line 62 of file profileManager.h.

Referenced by refresh_config().

Logger<char> ProfileManager::logger [private]

Definition at line 100 of file profileManager.h.

Referenced by init_profiles(), ProfileManager(), save_profile(), and ~ProfileManager().


The documentation for this class was generated from the following files: