feisty meow concerns codebase  2.140
processes::configured_applications Class Reference

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

#include <configured_applications.h>

Public Member Functions

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

Static Public Member Functions

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

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 33 of file configured_applications.h.

Constructor & Destructor Documentation

◆ configured_applications()

processes::configured_applications::configured_applications ( const basis::astring config_file,
const basis::astring 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 63 of file configured_applications.cpp.

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

◆ ~configured_applications()

processes::configured_applications::~configured_applications ( )
virtual

Definition at line 82 of file configured_applications.cpp.

References basis::WHACK().

Member Function Documentation

◆ add_program()

bool processes::configured_applications::add_program ( const basis::astring product,
const basis::astring app_name,
const basis::astring 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 142 of file configured_applications.cpp.

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

◆ add_section()

bool processes::configured_applications::add_section ( const basis::astring section_name,
const structures::string_table info 
)

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

this fails if the section already exists.

Definition at line 207 of file configured_applications.cpp.

References configuration::section_manager::add_section().

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

◆ add_startup_entry()

bool processes::configured_applications::add_startup_entry ( const basis::astring product,
const basis::astring app_name,
const basis::astring 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 259 of file configured_applications.cpp.

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

Referenced by application::launch_manager::launch_at_startup().

◆ DEFINE_CLASS_NAME()

processes::configured_applications::DEFINE_CLASS_NAME ( "configured_applications"  )

◆ find_entry()

bool processes::configured_applications::find_entry ( const structures::string_table table,
const basis::astring name,
basis::astring 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 248 of file configured_applications.cpp.

References structures::symbol_table< contents >::find().

Referenced by remove_startup_entry().

◆ find_program()

astring processes::configured_applications::find_program ( const basis::astring product,
const basis::astring 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 102 of file configured_applications.cpp.

References configuration::section_manager::config(), basis::astring::convert(), basis::astring::find(), basis::astring::iequals(), configuration::configurator::load(), configuration::section_manager::make_section_heading(), basis::negative(), and basis::astring::zap().

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

◆ find_section()

bool processes::configured_applications::find_section ( const basis::astring section_name,
structures::string_table info_found 
)

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

Definition at line 194 of file configured_applications.cpp.

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

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

◆ make_startup_entry()

astring processes::configured_applications::make_startup_entry ( const basis::astring product,
const basis::astring parms,
bool  one_shot 
)
static

◆ parse_startup_entry()

bool processes::configured_applications::parse_startup_entry ( const basis::astring info,
basis::astring product,
basis::astring 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 230 of file configured_applications.cpp.

References processes::ASSIGN_TOKEN(), basis::astring::convert(), configuration::variable_tokenizer::find(), FUNCDEF, processes::ONESHOT_HEADING(), processes::PARMS_HEADING(), configuration::variable_tokenizer::parse(), processes::PRODUCT_HEADING(), and processes::SEPARATOR_TOKEN().

◆ product_exists()

◆ remove_program()

bool processes::configured_applications::remove_program ( const basis::astring product,
const basis::astring app_name 
)

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

Definition at line 179 of file configured_applications.cpp.

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

◆ remove_startup_entry()

bool processes::configured_applications::remove_startup_entry ( const basis::astring product,
const basis::astring app_name 
)

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

COMPLAIN_PRODUCT;

Definition at line 286 of file configured_applications.cpp.

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

Referenced by application::launch_manager::remove_from_startup().

◆ replace_section()

bool processes::configured_applications::replace_section ( const basis::astring section_name,
const structures::string_table info 
)

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

this fails if the section does not already exist.

Definition at line 214 of file configured_applications.cpp.

References configuration::section_manager::replace_section().

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

◆ STARTUP_APP_NAME()

const char * processes::configured_applications::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 92 of file configured_applications.cpp.

Referenced by configured_applications().

◆ STARTUP_SECTION()

const char * processes::configured_applications::STARTUP_SECTION ( )
static

the section where startup info is stored.

Definition at line 89 of file configured_applications.cpp.

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


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