Changeset 6018 for branches/newapi
- Timestamp:
- 01/11/08 05:32:54 (11 months ago)
- Location:
- branches/newapi/licq
- Files:
-
- 4 modified
-
licq/interface/daemon.h (modified) (2 diffs)
-
src/daemon.cpp (modified) (8 diffs)
-
src/daemon.h (modified) (3 diffs)
-
src/globals.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/newapi/licq/licq/interface/daemon.h
r5919 r6018 21 21 #define LICQ_DAEMON_H 22 22 23 #include "licq/event/event.h" 23 24 #include "licq/interface/plugin.h" 24 25 #include "licq/macros.h" … … 39 40 static Daemon* getInstance(); 40 41 41 virtual void getPluginInformation( 42 std::vector< boost::shared_ptr<const Licq::Plugin::Information> >* info) = 0; 42 virtual void sendEvent(Event::Ptr event) = 0; 43 virtual void sendEventToDaemon(Event::Ptr event) = 0; 44 virtual void sendEventToPlugin(Event::Ptr event, Plugin::Id id) = 0; 45 46 virtual void getPluginInformation(Plugin::InformationVector* info) = 0; 43 47 44 48 protected: -
branches/newapi/licq/src/daemon.cpp
r5951 r6018 19 19 20 20 #include "daemon.h" 21 #include "event/eventmanager.h" 22 #include "event/eventqueuename.h" 21 23 #include "globals.h" 22 24 #include "licq/exception/invalidargumentexception.h" … … 83 85 } 84 86 85 LicqDaemon::Daemon::Daemon() 86 : myLog(Globals::getDaemonLog()) 87 LicqDaemon::Daemon::Daemon(Licq::Log& log, 88 PluginManager* pluginManager, 89 EventManager* eventManager) 90 : myLog(log), 91 myPluginManager(pluginManager), 92 myEventManager(eventManager) 87 93 { 88 94 // Empty … … 167 173 if (vm.count("plugin")) 168 174 { 169 PluginManager* pluginManager = Globals::getPluginManager();170 171 175 std::vector<std::string> 172 176 plugins = vm["plugin"].as< std::vector<std::string> >(); … … 174 178 it != plugins.end(); ++it) 175 179 { 176 Licq::Plugin::Id id = pluginManager->loadPlugin(*it, 0, NULL);177 myLog.debug(tr(" Loaded plugin %1% with id %2%") % *it % id);180 Licq::Plugin::Id id = myPluginManager->startPlugin(*it, 0, NULL); 181 myLog.debug(tr("Started plugin %1% with id %2%") % *it % id); 178 182 } 179 183 } … … 188 192 } 189 193 190 void LicqDaemon::Daemon::getPluginInformation( 191 std::vector< boost::shared_ptr<const Licq::Plugin::Information> >* info) 192 { 193 Globals::getPluginManager()->getPluginInformation(info); 194 void LicqDaemon::Daemon::sendEvent(Licq::Event::Ptr event) 195 { 196 myEventManager->sendEvent(event->getName(), event); 197 } 198 199 void LicqDaemon::Daemon::sendEventToDaemon(Licq::Event::Ptr event) 200 { 201 myEventManager->sendEvent(EventQueueName::daemon, event); 202 } 203 204 void LicqDaemon::Daemon::sendEventToPlugin(Licq::Event::Ptr event, 205 Licq::Plugin::Id id) 206 { 207 myEventManager->sendEvent(EventQueueName::getPluginPrivate(id), event); 208 } 209 210 void LicqDaemon::Daemon:: 211 getPluginInformation(Licq::Plugin::InformationVector* info) 212 { 213 myPluginManager->getPluginInformation(info); 194 214 } 195 215 … … 228 248 void LicqDaemon::Daemon::setupDefaultPluginPaths(bool reload) 229 249 { 230 PluginCache* cache = Globals::getPluginManager()->getPluginCache();250 PluginCache* cache = myPluginManager->getPluginCache(); 231 251 cache->addSearchPath(myBaseDir + "plugins/"); 232 252 … … 239 259 setupDefaultPluginPaths(false); 240 260 241 PluginCache* cache = Globals::getPluginManager()->getPluginCache();261 PluginCache* cache = myPluginManager->getPluginCache(); 242 262 for (std::vector<std::string>::const_iterator it = paths.begin(); 243 263 it != paths.end(); ++it) … … 251 271 void LicqDaemon::Daemon::printAvailablePlugins(std::ostream& os) const 252 272 { 253 PluginCache* cache = Globals::getPluginManager()->getPluginCache();273 PluginCache* cache = myPluginManager->getPluginCache(); 254 274 255 275 const size_t size = cache->getSize(); -
branches/newapi/licq/src/daemon.h
r5926 r6018 27 27 #include <vector> 28 28 29 namespace Licq 30 { 31 class Log; 32 } 33 29 34 namespace LicqDaemon 30 35 { 31 36 37 class EventManager; 38 class PluginManager; 32 39 class StreamLogSink; 33 40 … … 37 44 static Daemon* getInstance(); 38 45 39 Daemon( );46 Daemon(Licq::Log& log, PluginManager* pluginManager, EventManager* eventManager); 40 47 ~Daemon(); 41 48 … … 45 52 const std::string& getBaseDir() const; 46 53 47 void getPluginInformation( 48 std::vector< boost::shared_ptr<const Licq::Plugin::Information> >* info); 54 // From Licq::Daemon 55 void sendEvent(Licq::Event::Ptr event); 56 void sendEventToDaemon(Licq::Event::Ptr event); 57 void sendEventToPlugin(Licq::Event::Ptr event, Licq::Plugin::Id id); 58 59 void getPluginInformation(Licq::Plugin::InformationVector* info); 49 60 50 61 private: 51 class Licq::Log& myLog; 62 Licq::Log& myLog; 63 PluginManager* myPluginManager; 64 EventManager* myEventManager; 52 65 53 66 std::string myBaseDir; -
branches/newapi/licq/src/globals.cpp
r5952 r6018 69 69 myDaemonLog = new Log("licq", myLogDistributor); 70 70 71 // EventManager 72 myEventManager = new EventManagerImpl(); 73 71 74 // Create and configure PluginManager 72 75 myPluginLoader = new PluginLoaderImpl(); 73 76 myPluginCache = new PluginCacheImpl(*myPluginLoader); 74 myPluginManager = new PluginManagerImpl(*myPluginCache, *myLogDistributor); 75 76 // EventManager 77 myEventManager = new EventManagerImpl(); 77 myPluginManager = 78 new PluginManagerImpl(*myEventManager, *myPluginCache, *myLogDistributor); 78 79 79 80 // Create Daemon 80 myDaemon = new Daemon( );81 myDaemon = new Daemon(*myDaemonLog, myPluginManager, myEventManager); 81 82 } 82 83
