servicemanager  2.4.3.28
 All Classes Namespaces Files Functions Variables Enumerations Enumerator
Public Member Functions | Public Attributes | List of all members
qi::ServiceManager Class Reference

ServiceManager Module. More...

#include <servicemanager.h>

Public Member Functions

 ServiceManager (qi::SessionPtr session)
 Launch service manager. More...
 
 ServiceManager (qi::SessionPtr session, const std::vector< std::string > &coreServices)
 Launch service manager. More...
 
 ~ServiceManager ()
 Unload service manager. More...
 
bool startService (const std::string &name)
 Start a service with his name. More...
 
bool stopService (const std::string &name)
 Stop service with his name. More...
 
bool restartService (const std::string &name)
 Restart a service with his name. More...
 
bool isServiceRunning (const std::string &name) const
 Check that the service named name is started or not. More...
 
std::vector
< qi::ServiceProcessInfo > 
services ()
 Get the list of all services. More...
 
qi::ServiceProcessInfo service (const std::string &name)
 Get information about one service named name. More...
 
size_t serviceMemoryUsage (const std::string &name)
 Get the memory used by service named name. More...
 

Public Attributes

qi::Signal< std::string,
qi::ServiceEventReason > 
serviceStarted
 Sent when a service is started. More...
 
qi::Signal< std::string,
qi::ServiceEventReason > 
serviceStopped
 Sent when a service is stopped. More...
 
qi::Signal< std::string > serviceAdded
 Signal sent when a new service is handled by ServiceManager. More...
 
qi::Signal< std::string > serviceRemoved
 Signal sent when a service is removed from serviceManager. More...
 
qi::Property< bool > enableLogging
 Enable or disable logging of services in QI_SERVICEMANAGER_LOGGING_PATH. More...
 

Detailed Description

ServiceManager Module.

ServiceManager allows you to control services installed by PackageManager.

Each std::string name given by user are processed. The best form is PackageName.ServiceName. The function checking the name throws if package or service does not exist. The other form allowed for compatibility, is ServiceName only. It is dangerous to use that because it may conflict. And you could have launch an other service. It throws if the service cannot be found in any package.

Definition at line 35 of file servicemanager.h.

Constructor & Destructor Documentation

qi::ServiceManager::ServiceManager ( qi::SessionPtr  session)

Launch service manager.

As soon as package manager is available, launch asynchronously autorun-services.

qi::ServiceManager::ServiceManager ( qi::SessionPtr  session,
const std::vector< std::string > &  coreServices 
)

Launch service manager.

As soon as package manager is available, launch asynchronously autorun-services.

qi::ServiceManager::~ServiceManager ( )

Unload service manager.

Stop all services.

Member Function Documentation

bool qi::ServiceManager::isServiceRunning ( const std::string &  name) const

Check that the service named name is started or not.

Returns
True if service is running, False otherwise.
Exceptions
std::runtime_errorif name is incorrect. See general description.
bool qi::ServiceManager::restartService ( const std::string &  name)

Restart a service with his name.

In fact, call stop and start.

If service is not already started, it is the same as qi::ServiceManager::startService.

qi::ServiceProcessInfo qi::ServiceManager::service ( const std::string &  name)

Get information about one service named name.

Exceptions
std::runtime_errorif name is incorrect. See general description.
size_t qi::ServiceManager::serviceMemoryUsage ( const std::string &  name)

Get the memory used by service named name.

Exceptions
std::runtime_errorif name is incorrect. See general description.
std::vector<qi::ServiceProcessInfo> qi::ServiceManager::services ( )

Get the list of all services.

bool qi::ServiceManager::startService ( const std::string &  name)

Start a service with his name.

Send signal qi::ServiceManager::serviceStarted if service is successfully launched.

Throw if name is incorrect. See general description.

Exceptions
std::runtime_errorIf service crashed during launch.
bool qi::ServiceManager::stopService ( const std::string &  name)

Stop service with his name.

Try to kill with sigTerm. After 1 second, kill with sigKill.

Send signal qi::ServiceManager::serviceStopped if service is successfully stopped. If service is sigTermed reason of the signal is proccessStopped, if it is sigKilled the reason is processCrashed.

Exceptions
std::runtime_errorIf name is incorrect. See general description.

Member Data Documentation

qi::Property<bool> qi::ServiceManager::enableLogging

Enable or disable logging of services in QI_SERVICEMANAGER_LOGGING_PATH.

Definition at line 147 of file servicemanager.h.

qi::Signal<std::string> qi::ServiceManager::serviceAdded

Signal sent when a new service is handled by ServiceManager.

Definition at line 137 of file servicemanager.h.

qi::Signal<std::string> qi::ServiceManager::serviceRemoved

Signal sent when a service is removed from serviceManager.

Definition at line 142 of file servicemanager.h.

qi::Signal<std::string, qi::ServiceEventReason> qi::ServiceManager::serviceStarted

Sent when a service is started.

Reason is always ProcessStartRequest.

Definition at line 124 of file servicemanager.h.

qi::Signal<std::string, qi::ServiceEventReason> qi::ServiceManager::serviceStopped

Sent when a service is stopped.

Reason can be ProcessStopRequest when the stop is regular. Or ProcessCrashed if an error occurred.

Definition at line 132 of file servicemanager.h.


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