From cd467d5978b4e232b66c0fd8041f7c193ead3d5b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 1 Oct 2015 21:05:13 +0100 Subject: Merge Plugable and ComponentLoader into new LifeCycle class --- project2/basics/caches/memoryCache.cpp | 2 +- project2/basics/options/showHelp.cpp | 2 +- project2/basics/options/showHelp.h | 4 +-- project2/cgi/cgiAppEngine.cpp | 3 +- project2/cgi/cgiProgRouter.cpp | 2 +- project2/cgi/p2webCgi.cpp | 9 +++--- project2/cgi/p2webFCgi.cpp | 9 +++--- project2/cgi/testCgi.cpp | 9 +++--- project2/common/componentLoader.cpp | 39 ------------------------ project2/common/componentLoader.h | 21 ------------- project2/common/library.cpp | 2 +- project2/common/lifeCycle.cpp | 50 +++++++++++++++++++++++++++++++ project2/common/lifeCycle.h | 25 ++++++++++++++++ project2/common/logger.h | 4 +-- project2/common/optionsSource.cpp | 5 ++-- project2/common/plugable.cpp | 14 --------- project2/common/plugable.h | 14 --------- project2/common/scriptLoader.cpp | 3 -- project2/common/scriptLoader.h | 1 - project2/common/scriptStorage.h | 3 +- project2/common/scripts.h | 1 - project2/compression/decompressStream.cpp | 1 - project2/console/consoleAppEngine.cpp | 5 ++-- project2/console/p2consoleMain.cpp | 7 ++--- project2/daemon/p2daemonAppEngine.cpp | 3 +- project2/daemon/p2daemonMain.cpp | 5 ++-- project2/files/presenterCache.cpp | 2 +- project2/ice/iceDaemon.cpp | 2 +- project2/ice/iceDataSource.cpp | 2 +- project2/sql/rdbmsDataSource.cpp | 2 +- project2/sql/sqlCache.cpp | 2 +- project2/xml/sessionXml.cpp | 2 +- project2/xml/xmlCache.cpp | 2 +- project2/xml/xmlDocumentCache.cpp | 4 +-- 34 files changed, 117 insertions(+), 144 deletions(-) delete mode 100644 project2/common/componentLoader.cpp delete mode 100644 project2/common/componentLoader.h create mode 100644 project2/common/lifeCycle.cpp create mode 100644 project2/common/lifeCycle.h delete mode 100644 project2/common/plugable.cpp delete mode 100644 project2/common/plugable.h diff --git a/project2/basics/caches/memoryCache.cpp b/project2/basics/caches/memoryCache.cpp index 5d58a47..0f3ddf6 100644 --- a/project2/basics/caches/memoryCache.cpp +++ b/project2/basics/caches/memoryCache.cpp @@ -145,7 +145,7 @@ class MemoryCache : public RowSetCache { time_t MemoryCache::CacheLife; MemoryCache::CacheStore MemoryCache::Store; -class CustomMemoryCacheLoader : public RowSetCacheFactory::For, public ComponentLoader { +class CustomMemoryCacheLoader : public RowSetCacheFactory::For, public LifeCycle { public: void onPeriodic() override { typedef MemoryCache::CacheStore::index::type::iterator iter; diff --git a/project2/basics/options/showHelp.cpp b/project2/basics/options/showHelp.cpp index 81c9150..395baed 100644 --- a/project2/basics/options/showHelp.cpp +++ b/project2/basics/options/showHelp.cpp @@ -29,5 +29,5 @@ ShowHelpComponent::Option() } bool ShowHelpComponent::showHelp; -NAMEDPLUGIN("ShowHelpComponent", ShowHelpComponent, ComponentLoader); +NAMEDPLUGIN("ShowHelpComponent", ShowHelpComponent, LifeCycle); diff --git a/project2/basics/options/showHelp.h b/project2/basics/options/showHelp.h index 75fb4cb..c42a736 100644 --- a/project2/basics/options/showHelp.h +++ b/project2/basics/options/showHelp.h @@ -1,10 +1,10 @@ #ifndef SHOWHELP_H #define SHOWHELP_H -#include #include +#include -class ShowHelpComponent : public ComponentLoader { +class ShowHelpComponent : public LifeCycle { public: void onConfigLoad() override; static Options::TargetPtr Option(); diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp index a263a38..a69fa9e 100644 --- a/project2/cgi/cgiAppEngine.cpp +++ b/project2/cgi/cgiAppEngine.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include typedef boost::uuids::uuid SIDKey; @@ -319,7 +318,7 @@ CgiApplicationEngine::process(std::ostream & IO, cgicc::CgiInput * cgii, const C boost::function sn = boost::bind(&CgiEnvInput::getenv, &cgienv, "SERVER_NAME"); OptionsSource::loadSources(boost::bind(&CgiApplicationEngine::derivedPlatform, sn)); CgiRequestContext crc(cgii, cgienv); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBefore, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBefore, _1)); Logger()->messagebf(LOG_DEBUG, "%s: Processing request (%s)", __FUNCTION__, crc.getRedirectURL()); process(IO, &crc); Logger()->messagef(LOG_DEBUG, "%s: Completed request", __FUNCTION__); diff --git a/project2/cgi/cgiProgRouter.cpp b/project2/cgi/cgiProgRouter.cpp index da04be6..2b72652 100644 --- a/project2/cgi/cgiProgRouter.cpp +++ b/project2/cgi/cgiProgRouter.cpp @@ -130,7 +130,7 @@ class RoutingTable { NAMEDFACTORY("route", RoutingTable::Route, RoutingTable::RouteFactory); class ProgRouter; -class ProgRouterFactory : public RouterFactory::For, public ComponentLoader { +class ProgRouterFactory : public RouterFactory::For, public LifeCycle { public: void onBefore() override { diff --git a/project2/cgi/p2webCgi.cpp b/project2/cgi/p2webCgi.cpp index a59621d..33e1b8b 100644 --- a/project2/cgi/p2webCgi.cpp +++ b/project2/cgi/p2webCgi.cpp @@ -1,6 +1,5 @@ #include "cgiAppEngine.h" #include -#include class GetEnv : public CgiEnvInput { public: @@ -15,12 +14,12 @@ class GetEnv : public CgiEnvInput { int main(void) { - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1)); CgiApplicationEngine app; GetEnv ge; app.process(std::cout, NULL, ge); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIteration, _1)); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIteration, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onPeriodic, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIdle, _1)); } diff --git a/project2/cgi/p2webFCgi.cpp b/project2/cgi/p2webFCgi.cpp index e31986d..fae6cca 100644 --- a/project2/cgi/p2webFCgi.cpp +++ b/project2/cgi/p2webFCgi.cpp @@ -2,7 +2,6 @@ #include "cgiAppEngine.h" #include #include -#include time_t lastPeriodic = 0; time_t periodicDelay = 600; @@ -12,7 +11,7 @@ void p2webPeriodic() { time(&lastPeriodic); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onPeriodic, _1)); } static @@ -22,7 +21,7 @@ p2webGoingIdle(int) if (time(NULL) > lastPeriodic + periodicDelay) { p2webPeriodic(); } - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIdle, _1)); } int @@ -41,7 +40,7 @@ main(void) fprintf(stderr, "Failed to set signal handler\n"); } alarm(60); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1)); CgiApplicationEngine app; while (FCGX_Accept_r(&request) == 0) { alarm(0); @@ -49,7 +48,7 @@ main(void) boost::filesystem::current_path(boost::filesystem::initial_path()); app.process(IO, &IO, IO); FCGX_Finish_r(&request); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIteration, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIteration, _1)); if (time(NULL) > lastPeriodic + periodicDelay) { p2webPeriodic(); } diff --git a/project2/cgi/testCgi.cpp b/project2/cgi/testCgi.cpp index 3c79a77..7f9df28 100644 --- a/project2/cgi/testCgi.cpp +++ b/project2/cgi/testCgi.cpp @@ -8,7 +8,6 @@ #include "cgiRequestContext.h" #include "cgiAppEngine.h" #include -#include #define TESTOPT(name, def, desc) \ (name, Options::value(optStore().insert(OptStore::value_type(name, StrPtr(new std::string()))).first->second.get(), def), desc) @@ -52,7 +51,7 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput { } void run() { - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1)); CgiApplicationEngine app; boost::function sn = boost::bind(&CgiEnvInput::getenv, this, "SERVER_NAME"); OptionsSource::loadSources(boost::bind(&CgiApplicationEngine::derivedPlatform, sn)); @@ -80,11 +79,11 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput { optStore()["QUERY_STRING"] = StrPtr(new std::string()); } app.process(std::cout, this, *this); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIteration, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIteration, _1)); } - Plugable::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onPeriodic, _1)); } - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIdle, _1)); } INITOPTIONS; diff --git a/project2/common/componentLoader.cpp b/project2/common/componentLoader.cpp deleted file mode 100644 index 5506ed2..0000000 --- a/project2/common/componentLoader.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "componentLoader.h" -#include - -ComponentLoader::~ComponentLoader() -{ -} - -void -ComponentLoader::onBegin() -{ -} - -void -ComponentLoader::onBefore() -{ -} - -void -ComponentLoader::onIdle() -{ -} - -void -ComponentLoader::onIteration() -{ -} - -void -ComponentLoader::onPeriodic() -{ -} - -void -ComponentLoader::onConfigLoad() -{ -} - -INSTANTIATEPLUGINOF(ComponentLoader); - diff --git a/project2/common/componentLoader.h b/project2/common/componentLoader.h deleted file mode 100644 index d3cff99..0000000 --- a/project2/common/componentLoader.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef COMPONENTLOADER_H -#define COMPONENTLOADER_H - -#include - -/// Helper for loading and maintaining Project2 components -class ComponentLoader : public virtual AdHoc::AbstractPluginImplementation { - public: - virtual ~ComponentLoader() = 0; - virtual void onBegin(); // App engine start up (before settings are processed) - virtual void onBefore(); // Before the app engine processes a request (after settings are processed) - virtual void onIdle(); // When the app engine goes idle - virtual void onIteration(); // When the app engine has completed an iteration - virtual void onPeriodic(); // When the app engine feels like it - virtual void onConfigLoad(); // When the environment reloads the configuration - virtual bool cacheable() const { return true; } // The component can be cached for next run -}; -typedef AdHoc::PluginOf LifeCycleComponentPlugin; - -#endif - diff --git a/project2/common/library.cpp b/project2/common/library.cpp index ce753bd..136e9d4 100644 --- a/project2/common/library.cpp +++ b/project2/common/library.cpp @@ -23,7 +23,7 @@ Library::~Library() } STORAGEOF(Library) libraries; -class LibraryLoader : public ScriptNodeFactory::For, public ComponentLoader { +class LibraryLoader : public ScriptNodeFactory::For, public LifeCycle { public: void onIteration() override { diff --git a/project2/common/lifeCycle.cpp b/project2/common/lifeCycle.cpp new file mode 100644 index 0000000..60ed172 --- /dev/null +++ b/project2/common/lifeCycle.cpp @@ -0,0 +1,50 @@ +#include "lifeCycle.h" +#include +#include + +LifeCycle::~LifeCycle() +{ +} + +void +LifeCycle::onBegin() +{ +} + +void +LifeCycle::onBefore() +{ +} + +void +LifeCycle::onIdle() +{ +} + +void +LifeCycle::onIteration() +{ +} + +void +LifeCycle::onPeriodic() +{ +} + +void +LifeCycle::onConfigLoad() +{ +} + +void +LifeCycle::onAllComponents(const boost::function & func) +{ + for(auto p : AdHoc::PluginManager::getDefault()->getAll()) { + if (auto c = dynamic_cast(p->implementation())) { + func(c); + } + } +} + +INSTANTIATEPLUGINOF(LifeCycle); + diff --git a/project2/common/lifeCycle.h b/project2/common/lifeCycle.h new file mode 100644 index 0000000..2a6b5b2 --- /dev/null +++ b/project2/common/lifeCycle.h @@ -0,0 +1,25 @@ +#ifndef LIFECYCLE_H +#define LIFECYCLE_H + +#include +#include + +/// Helper for loading and maintaining Project2 components +class LifeCycle : public virtual AdHoc::AbstractPluginImplementation { + public: + virtual ~LifeCycle() = 0; + + virtual void onBegin(); // App engine start up (before settings are processed) + virtual void onBefore(); // Before the app engine processes a request (after settings are processed) + virtual void onIdle(); // When the app engine goes idle + virtual void onIteration(); // When the app engine has completed an iteration + virtual void onPeriodic(); // When the app engine feels like it + virtual void onConfigLoad(); // When the environment reloads the configuration + virtual bool cacheable() const { return true; } // The component can be cached for next run + + static void onAllComponents(const boost::function & func); +}; +typedef AdHoc::PluginOf LifeCycleComponentPlugin; + +#endif + diff --git a/project2/common/logger.h b/project2/common/logger.h index cc4409f..9b7d868 100644 --- a/project2/common/logger.h +++ b/project2/common/logger.h @@ -8,9 +8,9 @@ #include #include #include "intrusivePtrBase.h" -#include "componentLoader.h" #include #include +#include "lifeCycle.h" /// Base class for classes providing a logging facility class LogDriverBase : public virtual IntrusivePtrBase { @@ -69,7 +69,7 @@ class Logger { }; template -class LogDriverFactoryImpl : public LogDriverFactory, public ComponentLoader { +class LogDriverFactoryImpl : public LogDriverFactory, public LifeCycle { public: LogDriverFactoryImpl() : level(LoggerType::level) diff --git a/project2/common/optionsSource.cpp b/project2/common/optionsSource.cpp index f10ff4f..56e983c 100644 --- a/project2/common/optionsSource.cpp +++ b/project2/common/optionsSource.cpp @@ -1,7 +1,6 @@ #include "optionsSource.h" #include "logger.h" #include -#include class DefaultConfigConsumer : public ConfigConsumer { public: @@ -43,7 +42,7 @@ OptionsSource::loadSources(const Options::CurrentPlatform & platform) } } } - Plugable::onAllComponents(boost::bind(&ComponentLoader::onConfigLoad, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onConfigLoad, _1)); loadedTime = boost::posix_time::microsec_clock::universal_time(); Logger()->messagebf(LOG_DEBUG, "Loaded configuration at %s", loadedTime); @@ -59,7 +58,7 @@ OptionsSource::loadSource(const Options::CurrentPlatform & platform, OptionsSour DefaultConfigConsumer dcc; opts->loadInto(dcc, platform); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onConfigLoad, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onConfigLoad, _1)); loadedTime = boost::posix_time::microsec_clock::universal_time(); Logger()->messagebf(LOG_DEBUG, "Loaded configuration at %s", loadedTime); diff --git a/project2/common/plugable.cpp b/project2/common/plugable.cpp deleted file mode 100644 index deb7910..0000000 --- a/project2/common/plugable.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "plugable.h" -#include "componentLoader.h" -#include - -void -Plugable::onAllComponents(const boost::function & func) -{ - for(auto p : AdHoc::PluginManager::getDefault()->getAll()) { - if (auto c = dynamic_cast(p->implementation())) { - func(c); - } - } -} - diff --git a/project2/common/plugable.h b/project2/common/plugable.h deleted file mode 100644 index 8e3889f..0000000 --- a/project2/common/plugable.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef PLUGABLE_H -#define PLUGABLE_H - -#include - -class ComponentLoader; - -class Plugable { - public: - static void onAllComponents(const boost::function & func); -}; - -#endif - diff --git a/project2/common/scriptLoader.cpp b/project2/common/scriptLoader.cpp index 17ebd19..e3abd86 100644 --- a/project2/common/scriptLoader.cpp +++ b/project2/common/scriptLoader.cpp @@ -8,9 +8,6 @@ #include "appInstance.h" #include -typedef std::map > ElementLoaderMap; -typedef std::set > ComponentLoaderSet; - LoaderBase::LoaderBase() : recursive(true) { diff --git a/project2/common/scriptLoader.h b/project2/common/scriptLoader.h index 032d6c7..fed7cef 100644 --- a/project2/common/scriptLoader.h +++ b/project2/common/scriptLoader.h @@ -12,7 +12,6 @@ #include #include -class ComponentLoader; class CommonObjects; class Storer; class ScriptReader; diff --git a/project2/common/scriptStorage.h b/project2/common/scriptStorage.h index 9947633..c4155f2 100644 --- a/project2/common/scriptStorage.h +++ b/project2/common/scriptStorage.h @@ -5,6 +5,7 @@ #include "scriptLoader.h" #include "exceptions.h" #include "scripts.h" +#include "lifeCycle.h" #include #include #include @@ -54,7 +55,7 @@ class StorerBase : public Storer { } bool cacheable(ScriptNodePtr p) const { auto f = AdHoc::PluginManager::getDefault()->get(p->get_name()); - if (auto c = dynamic_cast(f->implementation())) { + if (auto c = dynamic_cast(f->implementation())) { return c->cacheable(); } return true; diff --git a/project2/common/scripts.h b/project2/common/scripts.h index e3fab9c..2442558 100644 --- a/project2/common/scripts.h +++ b/project2/common/scripts.h @@ -11,7 +11,6 @@ #include "exceptions.h" #include "variableType.h" #include "options.h" -#include "componentLoader.h" #include SimpleMessageException(ValueNotFound); diff --git a/project2/compression/decompressStream.cpp b/project2/compression/decompressStream.cpp index 68f8869..7d4023b 100644 --- a/project2/compression/decompressStream.cpp +++ b/project2/compression/decompressStream.cpp @@ -1,5 +1,4 @@ #include "stream.h" -#include "componentLoader.h" #include "decompressor.h" #include "scripts.h" #include "variables.h" diff --git a/project2/console/consoleAppEngine.cpp b/project2/console/consoleAppEngine.cpp index 41bf14c..df7010f 100644 --- a/project2/console/consoleAppEngine.cpp +++ b/project2/console/consoleAppEngine.cpp @@ -12,7 +12,6 @@ #include #include #include -#include StaticMessageException(InvalidScriptName, "Script name should be group/name"); SimpleMessageException(UnknownPlatformAlias); @@ -107,14 +106,14 @@ void ConsoleApplicationEngine::process() { for (const auto & todo : todolist) { - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBefore, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBefore, _1)); Logger()->messagebf(LOG_DEBUG, "%s: Beginning script '%s/%s'", __FUNCTION__, todo.get<0>(), todo.get<1>()); Logger()->messagef(LOG_DEBUG, "%s: Processing file", __FUNCTION__); process(ScriptReader::resolveScript(todo.get<0>(), todo.get<1>(), false)); Logger()->messagef(LOG_DEBUG, "%s: Complete", __FUNCTION__); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIteration, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIteration, _1)); } } diff --git a/project2/console/p2consoleMain.cpp b/project2/console/p2consoleMain.cpp index 03771f0..3c86600 100644 --- a/project2/console/p2consoleMain.cpp +++ b/project2/console/p2consoleMain.cpp @@ -2,21 +2,20 @@ #include #include "claOptions.h" #include "consoleAppEngine.h" -#include int main(int argc, char ** argv) { AdHoc::PluginManager::getDefault()->add( new CommandLineArguments(argc, argv, &ConsoleApplicationEngine::appendScript), "", __FILE__, __LINE__); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1)); ConsoleApplicationEngine app; OptionsSource::loadSources([] { return ConsoleApplicationEngine::reqPlatform;} ); app.process(); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onPeriodic, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIdle, _1)); } diff --git a/project2/daemon/p2daemonAppEngine.cpp b/project2/daemon/p2daemonAppEngine.cpp index 6d07201..27dff10 100644 --- a/project2/daemon/p2daemonAppEngine.cpp +++ b/project2/daemon/p2daemonAppEngine.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include "pidfile.h" #include "tempPrivs.h" @@ -124,7 +123,7 @@ bool DaemonAppEngine::periodicCallback() { Logger()->messagebf(LOG_DEBUG, "%s: firing component periodics.", __PRETTY_FUNCTION__); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onPeriodic, _1)); return true; } diff --git a/project2/daemon/p2daemonMain.cpp b/project2/daemon/p2daemonMain.cpp index e65f941..21eb748 100644 --- a/project2/daemon/p2daemonMain.cpp +++ b/project2/daemon/p2daemonMain.cpp @@ -5,7 +5,6 @@ #include #include #include -#include SimpleMessageException(UnsupportedArguments); @@ -45,7 +44,7 @@ daemonize() int main(int argc, char ** argv) { - Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1)); AdHoc::PluginManager::getDefault()->add( new CommandLineArguments(argc, argv, [](const char * a) { throw UnsupportedArguments(a); }), "_2", __FILE__, __LINE__); @@ -57,6 +56,6 @@ main(int argc, char ** argv) } dae.process(); - Plugable::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); + LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIdle, _1)); } diff --git a/project2/files/presenterCache.cpp b/project2/files/presenterCache.cpp index 87d1223..4066058 100644 --- a/project2/files/presenterCache.cpp +++ b/project2/files/presenterCache.cpp @@ -247,7 +247,7 @@ DECLARE_OPTIONS(FilePresenterCache, "File Presenter Cache options") "The name of the component used to provide a unique request ID") END_OPTIONS(FilePresenterCache) -class FilePresenterCacheLoader : public ComponentLoader { +class FilePresenterCacheLoader : public LifeCycle { public: FilePresenterCacheLoader() { diff --git a/project2/ice/iceDaemon.cpp b/project2/ice/iceDaemon.cpp index cf1c446..e6769b5 100644 --- a/project2/ice/iceDaemon.cpp +++ b/project2/ice/iceDaemon.cpp @@ -24,7 +24,7 @@ std::string IceDaemon::viewRoot; std::string IceDaemon::taskRoot; IceBase::Libs IceDaemon::libs; -class IceDaemonFactory : public DaemonFactory::For, public ComponentLoader { +class IceDaemonFactory : public DaemonFactory::For, public LifeCycle { public: void onConfigLoad() override { IceBase::FinaliseLoad(IceDaemon::libs); diff --git a/project2/ice/iceDataSource.cpp b/project2/ice/iceDataSource.cpp index 734eedc..8c15173 100644 --- a/project2/ice/iceDataSource.cpp +++ b/project2/ice/iceDataSource.cpp @@ -44,7 +44,7 @@ IceDataSource::ClearSlice() libs.clear(); } -class IceDataSourceLoader : public DataSourceFactory::For, public ComponentLoader { +class IceDataSourceLoader : public DataSourceFactory::For, public LifeCycle { public: void onConfigLoad() override { IceBase::FinaliseLoad(IceDataSource::libs); diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp index 9b295d3..aa5bee4 100644 --- a/project2/sql/rdbmsDataSource.cpp +++ b/project2/sql/rdbmsDataSource.cpp @@ -8,7 +8,7 @@ #define LOCK(l) std::lock_guard _lock##l(l) /// Specialized ElementLoader for instances of RdbmsDataSource; handles persistent DB connections -class RdbmsDataSourceLoader : public ComponentLoader { +class RdbmsDataSourceLoader : public LifeCycle { public: void onIdle() override { diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp index 6e5bd20..24a6b80 100644 --- a/project2/sql/sqlCache.cpp +++ b/project2/sql/sqlCache.cpp @@ -264,7 +264,7 @@ std::string SqlCache::DataSource; std::string SqlCache::HeaderTable; time_t SqlCache::CacheLife; -class CustomSqlCacheLoader : public RowSetCacheFactory::For, public ComponentLoader { +class CustomSqlCacheLoader : public RowSetCacheFactory::For, public LifeCycle { public: void onIdle() override { diff --git a/project2/xml/sessionXml.cpp b/project2/xml/sessionXml.cpp index c92fe85..403e91a 100644 --- a/project2/xml/sessionXml.cpp +++ b/project2/xml/sessionXml.cpp @@ -10,7 +10,7 @@ #include "options.h" #include "logger.h" -class CustomSessionContainerFactoryXml : public SessionContainerFactory::For, public ComponentLoader { +class CustomSessionContainerFactoryXml : public SessionContainerFactory::For, public LifeCycle { public: void onPeriodic() override { diff --git a/project2/xml/xmlCache.cpp b/project2/xml/xmlCache.cpp index 6104730..40adec9 100644 --- a/project2/xml/xmlCache.cpp +++ b/project2/xml/xmlCache.cpp @@ -84,7 +84,7 @@ boost::filesystem::path XmlCache::Store; std::string XmlCache::FileName; time_t XmlCache::CacheLife; -class CustomXmlCacheFactory : public AdHoc::Factory::For, public ComponentLoader { +class CustomXmlCacheFactory : public AdHoc::Factory::For, public LifeCycle { public: void onIdle() override { diff --git a/project2/xml/xmlDocumentCache.cpp b/project2/xml/xmlDocumentCache.cpp index f37924d..98e4993 100644 --- a/project2/xml/xmlDocumentCache.cpp +++ b/project2/xml/xmlDocumentCache.cpp @@ -58,7 +58,7 @@ XmlDocumentCache::queue(const Glib::ustring & url, const char *, ExecContext *) } } -class XmlDocumentCacheClearer : public ComponentLoader { +class XmlDocumentCacheClearer : public LifeCycle { public: typedef bool KeyType; @@ -69,5 +69,5 @@ class XmlDocumentCacheClearer : public ComponentLoader { Logger()->messagef(LOG_DEBUG, "%s: Cleared XML document cache", __PRETTY_FUNCTION__); } }; -NAMEDPLUGIN("XmlDocumentCacheClearer", XmlDocumentCacheClearer, ComponentLoader); +NAMEDPLUGIN("XmlDocumentCacheClearer", XmlDocumentCacheClearer, LifeCycle); -- cgit v1.2.3