diff --git a/livesupport/products/scheduler/src/SchedulerDaemon.cxx b/livesupport/products/scheduler/src/SchedulerDaemon.cxx index 6391e60ef..d50072c47 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemon.cxx +++ b/livesupport/products/scheduler/src/SchedulerDaemon.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.30 $ + Version : $Revision: 1.31 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $ ------------------------------------------------------------------------------*/ @@ -312,11 +312,7 @@ SchedulerDaemon :: install(void) throw (std::exception) { // TODO: check if we have already been configured Ptr::Ref sf = ScheduleFactory::getInstance(); - try { - sf->install(); - } catch (std::exception &e) { - std::cerr << e.what() << std::endl; - } + sf->install(); Ptr::Ref plf = PlayLogFactory::getInstance(); plf->install(); } @@ -331,6 +327,10 @@ SchedulerDaemon :: isInstalled(void) throw (std::exception) // TODO: check if we have already been configured Ptr::Ref sf = ScheduleFactory::getInstance(); Ptr::Ref plf = PlayLogFactory::getInstance(); + + if (!sf.get() || !plf.get()) { + throw std::logic_error("coudln't initialize factories"); + } return sf->isInstalled() && plf->isInstalled(); } @@ -347,6 +347,7 @@ SchedulerDaemon :: uninstall(void) throw (std::exception) try { plf->uninstall(); } catch (std::exception &e) { + // TODO: don't print but throw it instead std::cerr << e.what() << std::endl; } @@ -359,25 +360,29 @@ SchedulerDaemon :: uninstall(void) throw (std::exception) * Execute daemon startup functions. *----------------------------------------------------------------------------*/ void -SchedulerDaemon :: startup (void) throw () +SchedulerDaemon :: startup (void) throw (std::logic_error) { - if (!isInstalled()) { - install(); + try { + if (!isInstalled()) { + install(); + } + } catch (std::exception &e) { + throw std::logic_error(std::string("database installation problem: ") + + e.what()); } try { sessionId = authentication->login(login, password); } catch (XmlRpcException &e) { - // TODO: mark error - std::cerr << "authentication problem: " << e.what() << std::endl; + throw std::logic_error(std::string("authentication problem: ") + + e.what()); } try { audioPlayer->initialize(); } catch (std::exception &e) { - // TODO: mark error - std::cerr << "audio player initialization problem: " << e.what() - << std::endl; + throw std::logic_error(std::string("audio player initialization " + "problem: ") + e.what()); } if (!eventScheduler.get()) { Ptr::Ref eventContainer; diff --git a/livesupport/products/scheduler/src/SchedulerDaemon.h b/livesupport/products/scheduler/src/SchedulerDaemon.h index fbc43c965..642f0a5c7 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemon.h +++ b/livesupport/products/scheduler/src/SchedulerDaemon.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.21 $ + Author : $Author: maroy $ + Version : $Revision: 1.22 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $ ------------------------------------------------------------------------------*/ @@ -166,8 +166,8 @@ using namespace LiveSupport::PlaylistExecutor; * xmlRpcDaemon) > * * - * @author $Author: fgerlits $ - * @version $Revision: 1.21 $ + * @author $Author: maroy $ + * @version $Revision: 1.22 $ * @see ConnectionManagerFactory * @see AuthenticationClientFactory * @see StorageClientFactory @@ -366,10 +366,11 @@ class SchedulerDaemon : public Installable, * Execute any calls when the daemon is starting up. * All resources allocated here should be freed up in shutdown(). * + * @exception std::logic_error if startup could not succeed. * @see #shutdown */ virtual void - startup (void) throw (); + startup (void) throw (std::logic_error); public: diff --git a/livesupport/products/scheduler/src/XmlRpcDaemon.cxx b/livesupport/products/scheduler/src/XmlRpcDaemon.cxx index 5fff310d5..cacfcf973 100644 --- a/livesupport/products/scheduler/src/XmlRpcDaemon.cxx +++ b/livesupport/products/scheduler/src/XmlRpcDaemon.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/XmlRpcDaemon.cxx,v $ ------------------------------------------------------------------------------*/ @@ -289,7 +289,7 @@ XmlRpcDaemon :: start (void) throw (std::logic_error) * Execute any daemon startup calls. *----------------------------------------------------------------------------*/ void -XmlRpcDaemon :: startup (void) throw () +XmlRpcDaemon :: startup (void) throw (std::logic_error) { // and now our own XML-RPC methods registerXmlRpcFunctions(xmlRpcServer); diff --git a/livesupport/products/scheduler/src/XmlRpcDaemon.h b/livesupport/products/scheduler/src/XmlRpcDaemon.h index b3f429612..ad81ba806 100644 --- a/livesupport/products/scheduler/src/XmlRpcDaemon.h +++ b/livesupport/products/scheduler/src/XmlRpcDaemon.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/XmlRpcDaemon.h,v $ ------------------------------------------------------------------------------*/ @@ -119,7 +119,7 @@ using namespace LiveSupport::Core; * * * @author $Author: maroy $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class XmlRpcDaemon { @@ -254,10 +254,11 @@ class XmlRpcDaemon * This function will only return when the daemon ha stopped * running. * + * @exception std::logic_error if startup could not succeed. * @see #shutdown */ virtual void - startup (void) throw (); + startup (void) throw (std::logic_error); public: