summaryrefslogtreecommitdiff
path: root/project2/cgi
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-01 21:05:13 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-01 21:05:13 +0100
commitcd467d5978b4e232b66c0fd8041f7c193ead3d5b (patch)
tree0ef4692257fee9655deaea40bd1f3dbfe115c94d /project2/cgi
parentFix factory type in sqlMerge (diff)
downloadproject2-cd467d5978b4e232b66c0fd8041f7c193ead3d5b.tar.bz2
project2-cd467d5978b4e232b66c0fd8041f7c193ead3d5b.tar.xz
project2-cd467d5978b4e232b66c0fd8041f7c193ead3d5b.zip
Merge Plugable and ComponentLoader into new LifeCycle class
Diffstat (limited to 'project2/cgi')
-rw-r--r--project2/cgi/cgiAppEngine.cpp3
-rw-r--r--project2/cgi/cgiProgRouter.cpp2
-rw-r--r--project2/cgi/p2webCgi.cpp9
-rw-r--r--project2/cgi/p2webFCgi.cpp9
-rw-r--r--project2/cgi/testCgi.cpp9
5 files changed, 14 insertions, 18 deletions
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 <boost/lexical_cast.hpp>
#include <glibmm/exception.h>
#include <cxxabi.h>
-#include <plugable.h>
#include <glibmm/regex.h>
typedef boost::uuids::uuid SIDKey;
@@ -319,7 +318,7 @@ CgiApplicationEngine::process(std::ostream & IO, cgicc::CgiInput * cgii, const C
boost::function<std::string()> 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<ProgRouter>, public ComponentLoader {
+class ProgRouterFactory : public RouterFactory::For<ProgRouter>, 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 <boost/bind.hpp>
-#include <plugable.h>
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 <boost/bind.hpp>
#include <boost/filesystem/convenience.hpp>
-#include <plugable.h>
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 <options/showHelp.h>
-#include <plugable.h>
#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<std::string()> 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;