#include <SchedulerDaemon.h>
Inheritance diagram for LiveSupport::Scheduler::SchedulerDaemon:
This class is responsible for starting, running and stopping the Scheduler daemon.
The SchedulerDaemon has to configured by an XML element called scheduler. This element contains configuration elements for the compontents used by the scheduler. The configuration file looks like the following:
<scheduler>
<user login="userid" password="pwd" />
<connectionManagerFactory>
...
</connectionManagerFactory>
<authenticationClientFactory>
...
</authenticationClientFactory>
<storageClientFactory>
...
</storageClientFactory>
<scheduleFactory>
...
</scheduleFactory>
<playLogFactory>
...
</playLogFactory>
<backupFactory>
...
</backupFactory>
<xmlRpcDaemon>
...
</xmlRpcDaemon>
</scheduler>
The user element holds creditentials for accessing the storage, configured below.
For details on the included elements, see the corresponding documentation for XmlRpcDaemon, StorageClientFactory, ConnectionManagerFactory ScheduleFactory and AuthenticationClientFactory.
The DTD for the above element is the following:
<!ELEMENT scheduler (user,
connectionManagerFactory,
authenticationClientFactory,
storageClientFactory,
scheduleFactory,
playLogFactory,
backupFactory,
audioPlayer,
xmlRpcDaemon) >
AuthenticationClientFactory
StorageClientFactory
Definition at line 173 of file SchedulerDaemon.h.
Public Member Functions | |
virtual | ~SchedulerDaemon (void) throw () |
Virtual destructor. | |
void | configure (const xmlpp::Element &element) throw (std::invalid_argument, std::logic_error) |
Configure the scheduler daemon based on the XML element supplied. | |
Ptr< ConnectionManagerInterface >::Ref | getConnectionManager (void) throw () |
Return the connection manager used by the scheduler. | |
Ptr< StorageClientInterface >::Ref | getStorage (void) throw () |
Return the storage client used by the scheduler. | |
Ptr< AuthenticationClientInterface >::Ref | getAuthentication (void) throw () |
Return the authentication client used by the scheduler. | |
Ptr< ScheduleInterface >::Ref | getSchedule (void) throw () |
Return the schedule used by the scheduler. | |
Ptr< PlayLogInterface >::Ref | getPlayLog (void) throw () |
Return the play log used by the scheduler. | |
Ptr< AudioPlayerInterface >::Ref | getAudioPlayer (void) throw () |
Return the audio player used by the scheduler. | |
virtual void | shutdown (void) throw (std::logic_error) |
Shut down the daemon. | |
virtual void | update (void) throw (std::logic_error) |
Re-read the scheduled events. | |
Static Public Member Functions | |
static Ptr< SchedulerDaemon >::Ref | getInstance (void) throw () |
Return a pointer to the singleton instance of SchedulerDaemon. | |
Protected Member Functions | |
virtual void | registerXmlRpcFunctions (Ptr< XmlRpc::XmlRpcServer >::Ref xmlRpcServer) throw (std::logic_error) |
Register your XML-RPC functions by implementing this function. | |
virtual void | startup (void) throw (std::logic_error) |
Execute any calls when the daemon is starting up. |
SchedulerDaemon::~SchedulerDaemon | ( | void | ) | throw () [virtual] |
void SchedulerDaemon::configure | ( | const xmlpp::Element & | element | ) | throw (std::invalid_argument, std::logic_error) [virtual] |
Configure the scheduler daemon based on the XML element supplied.
element | the XML element to configure the scheduler daemon from. |
std::invalid_argument | if the supplied XML element contains bad configuraiton information | |
std::logic_error | if the scheduler daemon has already been configured. |
Implements LiveSupport::Core::Configurable.
Definition at line 161 of file SchedulerDaemon.cxx.
References confElement, LiveSupport::Scheduler::XmlRpcDaemon::getConfigElementName(), LiveSupport::Scheduler::BackupFactory::getConfigElementName(), LiveSupport::Scheduler::PlayLogFactory::getConfigElementName(), LiveSupport::Scheduler::ScheduleFactory::getConfigElementName(), LiveSupport::PlaylistExecutor::AudioPlayerFactory::getConfigElementName(), LiveSupport::StorageClient::StorageClientFactory::getConfigElementName(), LiveSupport::Authentication::AuthenticationClientFactory::getConfigElementName(), LiveSupport::Db::ConnectionManagerFactory::getConfigElementName(), LiveSupport::Scheduler::BackupFactory::getInstance(), LiveSupport::Scheduler::PlayLogFactory::getInstance(), LiveSupport::Scheduler::ScheduleFactory::getInstance(), LiveSupport::PlaylistExecutor::AudioPlayerFactory::getInstance(), LiveSupport::StorageClient::StorageClientFactory::getInstance(), LiveSupport::Authentication::AuthenticationClientFactory::getInstance(), LiveSupport::Db::ConnectionManagerFactory::getInstance(), userConfigElementName, userLoginAttrName, and userPasswordAttrName.
Ptr<AudioPlayerInterface>::Ref LiveSupport::Scheduler::SchedulerDaemon::getAudioPlayer | ( | void | ) | throw () [inline] |
Return the audio player used by the scheduler.
Definition at line 433 of file SchedulerDaemon.h.
Ptr<AuthenticationClientInterface>::Ref LiveSupport::Scheduler::SchedulerDaemon::getAuthentication | ( | void | ) | throw () [inline] |
Return the authentication client used by the scheduler.
Definition at line 400 of file SchedulerDaemon.h.
Ptr<ConnectionManagerInterface>::Ref LiveSupport::Scheduler::SchedulerDaemon::getConnectionManager | ( | void | ) | throw () [inline] |
Return the connection manager used by the scheduler.
Definition at line 378 of file SchedulerDaemon.h.
Ptr< SchedulerDaemon >::Ref SchedulerDaemon::getInstance | ( | void | ) | throw () [static] |
Return a pointer to the singleton instance of SchedulerDaemon.
Definition at line 147 of file SchedulerDaemon.cxx.
Ptr<PlayLogInterface>::Ref LiveSupport::Scheduler::SchedulerDaemon::getPlayLog | ( | void | ) | throw () [inline] |
Return the play log used by the scheduler.
Definition at line 422 of file SchedulerDaemon.h.
Ptr<ScheduleInterface>::Ref LiveSupport::Scheduler::SchedulerDaemon::getSchedule | ( | void | ) | throw () [inline] |
Return the schedule used by the scheduler.
Definition at line 411 of file SchedulerDaemon.h.
Ptr<StorageClientInterface>::Ref LiveSupport::Scheduler::SchedulerDaemon::getStorage | ( | void | ) | throw () [inline] |
Return the storage client used by the scheduler.
Definition at line 389 of file SchedulerDaemon.h.
void SchedulerDaemon::registerXmlRpcFunctions | ( | Ptr< XmlRpc::XmlRpcServer >::Ref | xmlRpcServer | ) | throw (std::logic_error) [protected, virtual] |
Register your XML-RPC functions by implementing this function.
Definition at line 283 of file SchedulerDaemon.cxx.
void SchedulerDaemon::shutdown | ( | void | ) | throw (std::logic_error) [virtual] |
Shut down the daemon.
This function is public only because the signal handler needs visibility to this function, which will call it. A call to stop() will trigger a signal that will call shutdown().
std::logic_error | if the daemon has not yet been configured. |
Reimplemented from LiveSupport::Scheduler::XmlRpcDaemon.
Definition at line 349 of file SchedulerDaemon.cxx.
References LiveSupport::Scheduler::XmlRpcDaemon::shutdown().
void SchedulerDaemon::startup | ( | void | ) | throw (std::logic_error) [protected, virtual] |
Execute any calls when the daemon is starting up.
All resources allocated here should be freed up in shutdown().
std::logic_error | if startup could not succeed. |
Reimplemented from LiveSupport::Scheduler::XmlRpcDaemon.
Definition at line 309 of file SchedulerDaemon.cxx.
References LiveSupport::Scheduler::XmlRpcDaemon::startup(), and LiveSupport::Core::XmlRpcException::what().
void SchedulerDaemon::update | ( | void | ) | throw (std::logic_error) [virtual] |
Re-read the scheduled events.
Call this when the events in the schedule under the event container have changed.
std::logic_error | if the daemon has not yet been configured. |
Definition at line 364 of file SchedulerDaemon.cxx.