application_config Class Reference

Manages the initialization file for a set of registered applications. More...

#include <application_config.h>

Collaboration diagram for application_config:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 application_config (const istring &config_file, const istring &basename)
 manages application settings for in the "config_file".
virtual ~application_config ()
 IMPLEMENT_CLASS_NAME ("application_config")
bool product_exists (const istring &product)
 returns true if the section for "product" exists in the TOC.
istring find_program (const istring &product, const istring &app_name, int &level)
 seeks out the entry for the "product" and "app_name" in our info.
bool find_section (const istring &section_name, string_table &info_found)
 locates the entries for "section_name" and stores them in "info_found".
bool add_section (const istring &section_name, const string_table &info)
 puts a chunk of "info" into the section for "section_name".
bool replace_section (const istring &section_name, const string_table &info)
 replaces the section for "section_name" with "info".
bool add_program (const istring &product, const istring &app_name, const istring &full_path, int level)
 registers a program "app_name" into the "product" section.
bool remove_program (const istring &product, const istring &app_name)
 takes a previously registered "app_name" out of the list for "product".
bool add_startup_entry (const istring &product, const istring &app_name, const istring &parameters, int one_shot)
 establishes the "app_name" as a program launched at object startup.
bool remove_startup_entry (const istring &product, const istring &app_name)
 takes an existing entry for the "app_name" out of the startup section.

Static Public Member Functions

static const char * STARTUP_SECTION ()
 the section where startup info is stored.
static const char * STARTUP_APP_NAME ()
 a special placeholder name that will appear in the startup list.
static bool find_entry (const string_table &table, const istring &name, istring &location)
 returns true if the key "name" for a program is found in the "table".
static istring make_startup_entry (const istring &product, const istring &parms, bool one_shot)
 returns the appropriate string for a startup record.
static bool parse_startup_entry (const istring &info, istring &product, istring &parms, bool &one_shot)
 processes the items in "info" as an application startup list.

Detailed Description

Manages the initialization file for a set of registered applications.

This records the list of programs that are allowed to be executed as well as the list of applications launched at object startup time.

Definition at line 35 of file application_config.h.


Constructor & Destructor Documentation

application_config::application_config ( const istring config_file,
const istring basename 
)

manages application settings for in the "config_file".

the "basename" is used for the section name of a list of products that can be managed by this class. each product has a set of applications that are part of the product's full package.

Definition at line 56 of file application_config.cpp.

References symbol_table< contents >::add(), add_section(), find_section(), FUNCDEF, LOG, make_startup_entry(), STARTUP_APP_NAME(), and STARTUP_SECTION().

application_config::~application_config (  )  [virtual]

Definition at line 75 of file application_config.cpp.

References WHACK().


Member Function Documentation

application_config::IMPLEMENT_CLASS_NAME ( "application_config"   ) 

const char * application_config::STARTUP_SECTION (  )  [static]

the section where startup info is stored.

Definition at line 82 of file application_config.cpp.

Referenced by add_startup_entry(), application_config(), and remove_startup_entry().

const char * application_config::STARTUP_APP_NAME (  )  [static]

a special placeholder name that will appear in the startup list.

it is not to be executed like the other programs for startup.

Definition at line 85 of file application_config.cpp.

Referenced by application_config().

bool application_config::find_entry ( const string_table table,
const istring name,
istring location 
) [static]

returns true if the key "name" for a program is found in the "table".

the "location" is set to the value found in the table if successful.

Definition at line 238 of file application_config.cpp.

References symbol_table< contents >::find().

Referenced by remove_startup_entry().

istring application_config::make_startup_entry ( const istring product,
const istring parms,
bool  one_shot 
) [static]

returns the appropriate string for a startup record.

Definition at line 212 of file application_config.cpp.

References ASSIGN(), ONESHOT_HEADING(), PARMS_HEADING(), PRODUCT_HEADING(), SEPARATOR(), and istring::SPRINTF.

Referenced by add_startup_entry(), and application_config().

bool application_config::parse_startup_entry ( const istring info,
istring product,
istring parms,
bool &  one_shot 
) [static]

processes the items in "info" as an application startup list.

using a string "info" that was listed as the startup entry for an application, the "product", "parms" and "one_shot" bits are parsed out and returned.

Definition at line 221 of file application_config.cpp.

References ASSIGN(), istring::convert(), tokenizer::find(), FUNCDEF, ONESHOT_HEADING(), PARMS_HEADING(), tokenizer::parse(), PRODUCT_HEADING(), and SEPARATOR().

bool application_config::product_exists ( const istring product  ) 

returns true if the section for "product" exists in the TOC.

Definition at line 88 of file application_config.cpp.

References section_manager::section_exists().

Referenced by process_manager::launch_at_startup(), process_manager::launch_now(), process_manager::query_application(), process_manager::remove_from_startup(), and process_manager::zap_process().

istring application_config::find_program ( const istring product,
const istring app_name,
int &  level 
)

seeks out the entry for the "product" and "app_name" in our info.

the returned string will either be empty (on failure) or will contain the full path to the application (on success). the "level" will specify the ordering of shutdown, where larger levels are shut down first.

Definition at line 95 of file application_config.cpp.

References section_manager::config(), istring::convert(), istring::find(), istring::iequals(), configurator::load(), section_manager::make_section_heading(), negative(), parser_bits::substitute_env_vars(), and istring::zap().

Referenced by process_manager::launch_at_startup(), process_manager::launch_now(), process_manager::query_application(), process_manager::remove_from_startup(), and process_manager::zap_process().

bool application_config::find_section ( const istring section_name,
string_table info_found 
)

locates the entries for "section_name" and stores them in "info_found".

Definition at line 185 of file application_config.cpp.

References section_manager::find_section(), FUNCDEF, LOG, and symbol_table< contents >::reset().

Referenced by add_program(), add_startup_entry(), application_config(), remove_program(), and remove_startup_entry().

bool application_config::add_section ( const istring section_name,
const string_table info 
)

puts a chunk of "info" into the section for "section_name".

this fails if the section already exists.

Definition at line 198 of file application_config.cpp.

References section_manager::add_section().

Referenced by add_program(), application_config(), and remove_startup_entry().

bool application_config::replace_section ( const istring section_name,
const string_table info 
)

replaces the section for "section_name" with "info".

this fails if the section does not already exist.

Definition at line 205 of file application_config.cpp.

References section_manager::replace_section().

Referenced by add_program(), add_startup_entry(), remove_program(), and remove_startup_entry().

bool application_config::add_program ( const istring product,
const istring app_name,
const istring full_path,
int  level 
)

registers a program "app_name" into the "product" section.

the "full_path" specifies where to find the program and the "level" gives the application an ordering for shutdown. higher levels are shut down before lower ones.

Definition at line 135 of file application_config.cpp.

References symbol_table< contents >::add(), add_section(), find_section(), FUNCDEF, LOG, symbol_table< contents >::name(), replace_section(), istring::s(), section_manager::section_exists(), symbol_table< contents >::symbols(), and symbol_table< contents >::whack().

bool application_config::remove_program ( const istring product,
const istring app_name 
)

takes a previously registered "app_name" out of the list for "product".

Definition at line 170 of file application_config.cpp.

References find_section(), FUNCDEF, replace_section(), and symbol_table< contents >::whack().

bool application_config::add_startup_entry ( const istring product,
const istring app_name,
const istring parameters,
int  one_shot 
)

establishes the "app_name" as a program launched at object startup.

adds an entry to the startup section for a program that will be launched when the application manager restarts.

Definition at line 249 of file application_config.cpp.

References symbol_table< contents >::add(), find_section(), FUNCDEF, LOG, make_startup_entry(), replace_section(), and STARTUP_SECTION().

Referenced by process_manager::launch_at_startup().

bool application_config::remove_startup_entry ( const istring product,
const istring app_name 
)

takes an existing entry for the "app_name" out of the startup section.

COMPLAIN_PRODUCT;

Definition at line 276 of file application_config.cpp.

References add_section(), find_entry(), find_section(), FUNCDEF, LOG, replace_section(), STARTUP_SECTION(), and symbol_table< contents >::whack().

Referenced by process_manager::remove_from_startup().


The documentation for this class was generated from the following files:
Generated on Fri Sep 5 04:30:20 2008 for HOOPLE Libraries by  doxygen 1.5.1