00001 00002 /*************************************************************************** 00003 * webview_thread.h - Thread that handles web interface requests 00004 * 00005 * Created: Mon Oct 13 17:49:52 2008 (I5 Developer's Day) 00006 * Copyright 2006-2008 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 #ifndef __PLUGINS_WEBVIEW_WEBVIEW_THREAD_H_ 00024 #define __PLUGINS_WEBVIEW_WEBVIEW_THREAD_H_ 00025 00026 #include <core/threading/thread.h> 00027 #include <aspect/logging.h> 00028 #include <aspect/configurable.h> 00029 #include <aspect/blackboard.h> 00030 #include <aspect/network.h> 00031 #include <aspect/logger.h> 00032 #include <aspect/plugin_director.h> 00033 00034 #include <utils/logging/cache.h> 00035 00036 namespace fawkes { 00037 class NetworkService; 00038 class WebServer; 00039 class WebRequestDispatcher; 00040 } 00041 00042 class WebviewStaticRequestProcessor; 00043 class WebviewBlackBoardRequestProcessor; 00044 class WebviewStartPageRequestProcessor; 00045 class WebviewPluginsRequestProcessor; 00046 class WebviewServiceBrowseHandler; 00047 class WebviewFooterGenerator; 00048 class WebviewHeaderGenerator; 00049 00050 class WebviewThread 00051 : public fawkes::Thread, 00052 public fawkes::LoggingAspect, 00053 public fawkes::ConfigurableAspect, 00054 public fawkes::BlackBoardAspect, 00055 public fawkes::NetworkAspect, 00056 public fawkes::LoggerAspect, 00057 public fawkes::PluginDirectorAspect 00058 { 00059 public: 00060 WebviewThread(); 00061 ~WebviewThread(); 00062 00063 virtual void init(); 00064 virtual void finalize(); 00065 virtual void loop(); 00066 00067 static const char *STATIC_URL_PREFIX; 00068 static const char *BLACKBOARD_URL_PREFIX; 00069 static const char *PLUGINS_URL_PREFIX; 00070 00071 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */ 00072 protected: virtual void run() { Thread::run(); } 00073 00074 private: 00075 fawkes::WebServer *__webserver; 00076 fawkes::WebRequestDispatcher *__dispatcher; 00077 00078 WebviewStaticRequestProcessor *__static_processor; 00079 WebviewStartPageRequestProcessor *__startpage_processor; 00080 WebviewBlackBoardRequestProcessor *__blackboard_processor; 00081 WebviewPluginsRequestProcessor *__plugins_processor; 00082 WebviewServiceBrowseHandler *__service_browse_handler; 00083 WebviewHeaderGenerator *__header_gen; 00084 WebviewFooterGenerator *__footer_gen; 00085 00086 unsigned int __cfg_port; 00087 00088 fawkes::CacheLogger __cache_logger; 00089 fawkes::NetworkService *__webview_service; 00090 }; 00091 00092 00093 #endif