Fawkes API  Fawkes Development Version
xmlrpc_thread.h
00001 
00002 /***************************************************************************
00003  *  xmlrpc_thread.h - Thread that handles xml-rpc requests
00004  *
00005  *  Created: Sun Aug 30 12:44:30 2009
00006  *  Copyright  2006-2009  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_XMLRPC_XMLRPC_THREAD_H_
00024 #define __PLUGINS_XMLRPC_XMLRPC_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 #include <aspect/webview.h>
00034 
00035 #include <logging/cache.h>
00036 
00037 namespace fawkes {
00038   class NetworkService;
00039   class WebRequestDispatcher;
00040   class WebUrlManager;
00041   class WebServer;
00042 }
00043 
00044 class XmlRpcRequestProcessor;
00045 class XmlRpcPluginMethods;
00046 class XmlRpcLogMethods;
00047 
00048 class XmlRpcThread
00049 : public fawkes::Thread,
00050   public fawkes::LoggingAspect,
00051   public fawkes::ConfigurableAspect,
00052   public fawkes::BlackBoardAspect,
00053   public fawkes::NetworkAspect,
00054   public fawkes::LoggerAspect,
00055   public fawkes::PluginDirectorAspect,
00056   public fawkes::WebviewAspect
00057 {
00058  public:
00059   XmlRpcThread();
00060   ~XmlRpcThread();
00061 
00062   virtual void init();
00063   virtual void finalize();
00064   virtual void loop();
00065 
00066  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00067  protected: virtual void run() { Thread::run(); }
00068 
00069  private:
00070   fawkes::WebServer            *__webserver;
00071   fawkes::WebRequestDispatcher *__dispatcher;
00072   fawkes::WebUrlManager        *__url_manager;
00073 
00074   XmlRpcRequestProcessor       *__processor;
00075   XmlRpcPluginMethods          *__plugin_methods;
00076   XmlRpcLogMethods             *__log_methods;
00077 
00078   bool                          __custom_server;
00079   unsigned int                  __cfg_port;
00080 
00081   fawkes::CacheLogger           __cache_logger;
00082   fawkes::NetworkService       *__xmlrpc_service;
00083 };
00084 
00085 #endif