process_manager Class Reference

Provides methods for starting, stopping and checking on processes. More...

#include <process_manager.h>

Collaboration diagram for process_manager:

Collaboration graph
[legend]
List of all members.

Public Types

enum  outcomes {
  OKAY = common::OKAY, EXISTING = common::EXISTING, ACCESS_DENIED = common::ACCESS_DENIED, FILE_NOT_FOUND,
  exist, tell, FIRST_OUTCOME = FILE_NOT_FOUND, NO_PRODUCT,
  exist, NO_APPLICATION, product, NOT_RUNNING,
  active, list, BAD_PROGRAM, image,
  NO_ANCHOR, shutdown, LAUNCH_FAILED, reason,
  FROZEN, responsive, LAST_OUTCOME = FROZEN
}

Public Member Functions

 process_manager (application_config &config)
 the process_manager needs a configuration set to work with.
virtual ~process_manager ()
 IMPLEMENT_CLASS_NAME ("process_manager")
outcome launch_now (const istring &product, const istring &app_name, const istring &parameters)
 starts the application "app_name" now.
outcome launch_at_startup (const istring &product, const istring &app_name, const istring &parameters, int one_shot)
 records an entry for the "app_name" to be launched at startup.
outcome remove_from_startup (const istring &product, const istring &app_name)
 takes the "app_name" out of the startup list.
outcome query_application (const istring &product, const istring &app_name)
 retrieves the current state of the program with "app_name".
outcome zap_process (const istring &product, const istring &app_name, bool graceful)
 zaps the process named "app_name".
void add_gag_exclusion (const istring &exclusion)
 add an application that isn't subject to gagging.
void add_tracking_exclusion (const istring &exclusion)
 apps that aren't tracked when running.
outcome shut_down_launching_services (const istring &secret_word)
 closes down the ability of clients to launch applications.
outcome reenable_launching_services (const istring &secret_word)
 undoes the gagging that the above "shut_down" function does.
bool services_disabled () const
 returns true if the capability to launch new processes is revoked.
void push_timed_activities (process_entry_array &processes)
 keeps any periodic activities going.
void stop_everything ()
 closes down the operation of this object.

Static Public Member Functions

static const char * outcome_name (const outcome &to_name)
 returns the text associated with "to_name".

Detailed Description

Provides methods for starting, stopping and checking on processes.

This includes support for graceful shutdowns and background handling of exiting processes.

Definition at line 41 of file process_manager.h.


Member Enumeration Documentation

enum process_manager::outcomes

Enumerator:
OKAY 
EXISTING  the entry already exists and overwriting is disallowed.
ACCESS_DENIED  the requested operation was not permitted.
FILE_NOT_FOUND 
exist 
tell 
FIRST_OUTCOME 
NO_PRODUCT 
exist 
NO_APPLICATION 
product 
NOT_RUNNING 
active 
list 
BAD_PROGRAM 
image 
NO_ANCHOR 
shutdown 
LAUNCH_FAILED 
reason 
FROZEN 
responsive 
LAST_OUTCOME 

Definition at line 51 of file process_manager.h.


Constructor & Destructor Documentation

process_manager::process_manager ( application_config config  ) 

the process_manager needs a configuration set to work with.

Definition at line 117 of file process_manager.cpp.

References FUNCDEF, and NIL.

process_manager::~process_manager (  )  [virtual]

Definition at line 140 of file process_manager.cpp.

References FUNCDEF, LOG, stop_everything(), and WHACK().


Member Function Documentation

process_manager::IMPLEMENT_CLASS_NAME ( "process_manager"   ) 

const char * process_manager::outcome_name ( const outcome to_name  )  [static]

returns the text associated with "to_name".

Definition at line 164 of file process_manager.cpp.

References BAD_PROGRAM, FILE_NOT_FOUND, FROZEN, LAUNCH_FAILED, NO_ANCHOR, NO_APPLICATION, NO_PRODUCT, NOT_RUNNING, common::outcome_name(), and outcome::value().

outcome process_manager::launch_now ( const istring product,
const istring app_name,
const istring parameters 
)

starts the application "app_name" now.

causes the program with "app_name" that's listed for the "product" to be started with the "parameters". this can fail if the application isn't listed or if the program can't be found or if the process can't be created.

Definition at line 297 of file process_manager.cpp.

References BAD_PROGRAM, COMPLAIN_APPLICATION, COMPLAIN_PRODUCT, basis::set< contents >::elements(), filename::exists(), FILE_NOT_FOUND, application_config::find_program(), FUNCDEF, portable::HIDE_APP_WINDOW, LAUNCH_FAILED, portable::launch_process(), istring::length(), LOCK_CONFIG, LOCK_KIDS, LOG, MAXIMUM_INITIAL_APP_WAIT, basis::set< contents >::member(), NO_APPLICATION, NO_ERROR, NO_PRODUCT, OKAY, log_base::platform_ending(), product, application_config::product_exists(), portable::RETURN_IMMEDIATELY, portable::sleep_ms(), and portable::system_error_text().

outcome process_manager::launch_at_startup ( const istring product,
const istring app_name,
const istring parameters,
int  one_shot 
)

records an entry for the "app_name" to be launched at startup.

this does not launch the application now. if "one_shot" is true, the application will only be started once and then removed from the list.

Definition at line 422 of file process_manager.cpp.

References application_config::add_startup_entry(), COMPLAIN_APPLICATION, COMPLAIN_PRODUCT, EXISTING, application_config::find_program(), FUNCDEF, LOCK_CONFIG, LOG, NO_APPLICATION, NO_PRODUCT, OKAY, product, and application_config::product_exists().

outcome process_manager::remove_from_startup ( const istring product,
const istring app_name 
)

takes the "app_name" out of the startup list.

Definition at line 454 of file process_manager.cpp.

References COMPLAIN_APPLICATION, COMPLAIN_PRODUCT, application_config::find_program(), FUNCDEF, LOCK_CONFIG, LOG, NO_APPLICATION, NO_PRODUCT, OKAY, product, application_config::product_exists(), and application_config::remove_startup_entry().

outcome process_manager::query_application ( const istring product,
const istring app_name 
)

retrieves the current state of the program with "app_name".

Definition at line 486 of file process_manager.cpp.

References COMPLAIN_APPLICATION, COMPLAIN_PRODUCT, application_config::find_program(), FUNCDEF, LOCK_CONFIG, LOG, NO_APPLICATION, NO_PRODUCT, NOT_RUNNING, OKAY, product, application_config::product_exists(), and istring::to_lower().

outcome process_manager::zap_process ( const istring product,
const istring app_name,
bool  graceful 
)

zaps the process named "app_name".

if "graceful" is true, then the clean shutdown process is attempted. otherwise the application is harshly terminated.

Definition at line 580 of file process_manager.cpp.

References ACCESS_DENIED, COMPLAIN_APPLICATION, COMPLAIN_PRODUCT, basis::set< contents >::elements(), application_config::find_program(), FUNCDEF, LOCK_CONFIG, LOG, basis::set< contents >::member(), NO_APPLICATION, NO_PRODUCT, NOT_RUNNING, OKAY, product, application_config::product_exists(), istring::SPRINTF, and process_control::zap_process().

void process_manager::add_gag_exclusion ( const istring exclusion  ) 

add an application that isn't subject to gagging.

if the process_manager is gagged, the excluded applications can still be started.

Definition at line 158 of file process_manager.cpp.

void process_manager::add_tracking_exclusion ( const istring exclusion  ) 

apps that aren't tracked when running.

if a zap is attempted on one of these applications, then the process is not shut down.

Definition at line 161 of file process_manager.cpp.

outcome process_manager::shut_down_launching_services ( const istring secret_word  ) 

closes down the ability of clients to launch applications.

the checking and shut down functions continue to operate. this is intended for use prior to a restart of the application controller, in order to ensure that no remote clients can start new servers on this machine.

Definition at line 654 of file process_manager.cpp.

References BAD_PROGRAM, FUNCDEF, LOG, and OKAY.

outcome process_manager::reenable_launching_services ( const istring secret_word  ) 

undoes the gagging that the above "shut_down" function does.

this allows the process_manager to continue operating normally.

Definition at line 668 of file process_manager.cpp.

References BAD_PROGRAM, FUNCDEF, LOG, and OKAY.

bool process_manager::services_disabled (  )  const [inline]

returns true if the capability to launch new processes is revoked.

Definition at line 127 of file process_manager.h.

void process_manager::push_timed_activities ( process_entry_array processes  ) 

keeps any periodic activities going.

this includes such tasks as zapping processes that have gone beyond their time limit for graceful shutdown.

Definition at line 691 of file process_manager.cpp.

References process_control::find_process_in_list(), FUNCDEF, GET_PROCESSES, GRACEFUL_SLACK, LOCK_KIDS, LOCK_ZOMBIES, LOG, basis::set< contents >::member(), and process_control::zap_process().

void process_manager::stop_everything (  ) 

closes down the operation of this object.

Definition at line 179 of file process_manager.cpp.

Referenced by ~process_manager().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 04:30:56 2008 for HOOPLE Libraries by  doxygen 1.5.1