Fawkes API  Fawkes Development Version
rrdweb_thread.cpp
00001 
00002 /***************************************************************************
00003  *  rrdweb_thread.cpp - RRD Webview Thread
00004  *
00005  *  Created: Tue Dec 21 01:05:45 2010
00006  *  Copyright  2006-2010  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #include "rrdweb_thread.h"
00024 #include "rrdweb_processor.h"
00025 
00026 #include <webview/url_manager.h>
00027 #include <webview/nav_manager.h>
00028 
00029 using namespace fawkes;
00030 
00031 #define RRD_URL_PREFIX "/rrd"
00032 
00033 /** @class RRDWebThread "rrd_thread.h"
00034  * RRD Webview Thread.
00035  * This thread queries RRD graphs from RRDManager obtained via RRDAspect
00036  * and displays them on a Webview page.
00037  *
00038  * @author Tim Niemueller
00039  */
00040 
00041 /** Constructor. */
00042 RRDWebThread::RRDWebThread()
00043   : Thread("RRDWebThread", Thread::OPMODE_WAITFORWAKEUP)
00044 {
00045 }
00046 
00047 
00048 /** Destructor. */
00049 RRDWebThread::~RRDWebThread()
00050 {
00051 }
00052 
00053 
00054 void
00055 RRDWebThread::init()
00056 {
00057   __processor  = new RRDWebRequestProcessor(rrd_manager, logger, RRD_URL_PREFIX);
00058   webview_url_manager->register_baseurl(RRD_URL_PREFIX, __processor);
00059   webview_nav_manager->add_nav_entry(RRD_URL_PREFIX, "RRD Graphs");
00060 }
00061 
00062 
00063 void
00064 RRDWebThread::finalize()
00065 {
00066   webview_url_manager->unregister_baseurl(RRD_URL_PREFIX);
00067   webview_nav_manager->remove_nav_entry(RRD_URL_PREFIX);
00068   delete __processor;
00069 }
00070 
00071 
00072 void
00073 RRDWebThread::loop()
00074 {
00075 }
00076