#include <ServiceManager.hpp>
Inherits pion::platform::PluginConfig< PluginType >< pion::server::PlatformService >.
Definition at line 48 of file ServiceManager.hpp.
Public Member Functions | |
| ServiceManager (const pion::platform::VocabularyManager &vocab_mgr, PlatformConfig &platform_config) | |
| virtual | ~ServiceManager () |
| virtual destructor | |
| void | shutdown (void) |
| shuts down the service manager -> stops all servers and threads and releases plugins | |
| virtual void | openConfigFile (void) |
| opens an existing config file and loads the data it contains | |
| virtual void | writeServersXML (std::ostream &out) const |
| bool | writeServerXML (std::ostream &out, const std::string &server_id) const |
| template<typename WorkFunction> | |
| void | post (WorkFunction work_func) |
| boost::asio::io_service & | getIOService (void) |
| returns an async I/O service used to schedule work | |
| boost::uint32_t | getNumThreads (void) const |
| returns the number of threads currently in use | |
| void | setNumThreads (const boost::uint32_t n) |
| sets the number of threads used all of the HTTP servers & services | |
| void | updateCodecs (void) |
| this notifies all the service plug-ins that the Codecs were updated | |
| void | updateDatabases (void) |
| this notifies all the service plug-ins that the Databases were updated | |
| void | updateReactors (void) |
| this notifies all the service plug-ins that the Reactors were updated | |
| unsigned int | getPort (void) const |
| returns port number the first server is listing to (for unit tests) | |
| std::string | addPlatformService (const xmlNodePtr config_ptr) |
| void | removePlatformService (const std::string &service_id) |
Static Public Member Functions | |
| static xmlNodePtr | createPlatformServiceConfig (const char *buf, std::size_t len) |
Protected Member Functions | |
| virtual void | addPluginNoLock (const std::string &plugin_id, const std::string &plugin_name, const xmlNodePtr config_ptr) |
Classes | |
| class | EmptyOptionNameException |
| exception thrown if the config file contains a WebService option with an empty name More... | |
| class | EmptyServerIdException |
| exception thrown if the config file contains a Server with an empty or missing identifier More... | |
| class | EmptyServiceIdException |
| exception thrown if the config file contains a Service with an empty or missing identifier More... | |
| class | EmptyServicePluginTypeException |
| exception thrown if the config file contains a Service with an empty or missing plug-in type More... | |
| class | EmptyServiceResourceException |
| exception thrown if the config file contains a Service with an empty or missing HTTP resource More... | |
| class | EmptyServiceServerIdException |
| exception thrown if the config file contains a Service with an empty or missing Server identifier More... | |
| class | MissingPortException |
| exception thrown if the config file contains a Server with a missing port number More... | |
| class | PlatformServiceNotFoundException |
| exception thrown if a PlatformService cannot be found More... | |
| class | RedirectMissingSourceException |
| exception thrown if the config file contains a Redirect element with no Source specified More... | |
| class | RedirectMissingTargetException |
| exception thrown if the config file contains a Redirect element with no Target specified More... | |
| class | SSLKeyException |
| exception thrown if there is an error loading an SSL key file More... | |
| class | UnknownAuthTypeException |
| exception thrown if the config file contains a unknown AuthType value More... | |
| class | WebServiceException |
| exception used to propagate exceptions thrown by web services More... | |
| pion::server::ServiceManager::ServiceManager | ( | const pion::platform::VocabularyManager & | vocab_mgr, | |
| PlatformConfig & | platform_config | |||
| ) |
constructs a new ServiceManager instance
| platform_config | reference to the global platform configuration manager |
Definition at line 61 of file ServiceManager.cpp.
References pion::server::PlatformConfig::getCodecFactory(), pion::server::PlatformConfig::getDatabaseManager(), pion::server::PlatformConfig::getReactionEngine(), pion::platform::PluginConfig< PluginType >::registerForUpdates(), pion::PionScheduler::setLogger(), pion::platform::ConfigManager::setLogger(), pion::PionScheduler::setNumThreads(), updateCodecs(), updateDatabases(), and updateReactors().
| std::string pion::server::ServiceManager::addPlatformService | ( | const xmlNodePtr | config_ptr | ) |
adds a new managed PlatformService
| config_ptr | pointer to a list of XML nodes containing PlatformService configuration parameters (must include a Plugin type) |
Definition at line 467 of file ServiceManager.cpp.
Referenced by pion::plugins::ConfigService::operator()().
| virtual void pion::server::ServiceManager::addPluginNoLock | ( | const std::string & | plugin_id, | |
| const std::string & | plugin_name, | |||
| const xmlNodePtr | config_ptr | |||
| ) | [inline, protected, virtual] |
adds a new plug-in object (without locking or config file updates). This function must be defined properly for any derived classes that wish to use openPluginConfig().
| plugin_id | unique identifier associated with the plug-in | |
| plugin_name | the name of the plug-in to load (searches plug-in directories and appends extensions) | |
| config_ptr | pointer to a list of XML nodes containing plug-in configuration parameters |
Implements pion::platform::PluginConfig< PluginType >.
Definition at line 248 of file ServiceManager.hpp.
References pion::net::WebService::getResource(), pion::server::PlatformService::getServerId(), pion::server::PlatformService::setConfig(), pion::platform::PlatformPlugin::setId(), pion::server::PlatformService::setPlatformConfig(), and pion::platform::PlatformPlugin::setServiceManager().
Referenced by openConfigFile().
| static xmlNodePtr pion::server::ServiceManager::createPlatformServiceConfig | ( | const char * | buf, | |
| std::size_t | len | |||
| ) | [inline, static] |
uses a memory buffer to generate XML configuration data for a PlatformService
| buf | pointer to a memory buffer containing configuration data | |
| len | number of bytes available in the memory buffer |
Definition at line 231 of file ServiceManager.hpp.
| void pion::server::ServiceManager::post | ( | WorkFunction | work_func | ) | [inline] |
schedules work to be performed by one of the pooled threads
| work_func | work function to be executed |
Definition at line 183 of file ServiceManager.hpp.
Referenced by pion::plugins::FeedService::operator()().
| void pion::server::ServiceManager::removePlatformService | ( | const std::string & | service_id | ) |
removes a managed PlatformService
| service_id | unique identifier associated with the PlatformService |
Definition at line 472 of file ServiceManager.cpp.
References pion::PluginManager< PLUGIN_TYPE >::get(), pion::net::WebService::getResource(), pion::server::PlatformService::getServerId(), and pion::platform::PluginConfig< PluginType >::m_plugins.
Referenced by pion::plugins::ConfigService::operator()().
| void pion::server::ServiceManager::writeServersXML | ( | std::ostream & | out | ) | const [virtual] |
writes the configurations for all servers to an output stream (as XML)
| out | the ostream to write the configuration tree into |
Definition at line 411 of file ServiceManager.cpp.
References pion::platform::ConfigManager::m_config_node_ptr.
Referenced by pion::plugins::ConfigService::operator()().
| bool pion::server::ServiceManager::writeServerXML | ( | std::ostream & | out, | |
| const std::string & | server_id | |||
| ) | const |
writes the configuration data for a particular server (as XML)
| out | the ostream to write the configuration tree into | |
| server_id | unique identifier associated with the HTTP server |
Definition at line 391 of file ServiceManager.cpp.
References pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, and pion::platform::ConfigManager::m_config_node_ptr.
Referenced by pion::plugins::ConfigService::operator()().
1.4.7