summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-09-26 03:02:38 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-09-26 20:02:18 +0100
commit890cfb275d440ce52757ca887ad1a819f4ee1433 (patch)
tree95f01cf0eeb666a68ce3ad910b148b09f5708319
parentRestore mock database support (diff)
downloadproject2-890cfb275d440ce52757ca887ad1a819f4ee1433.tar.bz2
project2-890cfb275d440ce52757ca887ad1a819f4ee1433.tar.xz
project2-890cfb275d440ce52757ca887ad1a819f4ee1433.zip
Use AdHoc plugins for session containers
-rw-r--r--project2/cgi/cgiAppEngine.cpp2
-rw-r--r--project2/common/sessionContainer.cpp4
-rw-r--r--project2/common/sessionContainer.h3
-rw-r--r--project2/xml/sessionXml.cpp4
-rw-r--r--project2/xml/sessionXml.h2
5 files changed, 8 insertions, 7 deletions
diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp
index c569617..229926c 100644
--- a/project2/cgi/cgiAppEngine.cpp
+++ b/project2/cgi/cgiAppEngine.cpp
@@ -86,7 +86,7 @@ DECLARE_OPTIONS(CgiApplicationEngine, "Project2 CGI options")
"The present script to use when the requested script (or child) fails")
("cgi.dumpDataDoc", Options::value(&dumpdatadoc),
"Write a copy of the data document before sending it to the web server")
-("cgi.sessionModule", Options::function([](const VariableType & m) { sessionsContainer = SessionContainerLoader::createNew(m); }, "xml"),
+("cgi.sessionModule", Options::function([](const VariableType & m) { sessionsContainer = SessionContainerFactory::createNew(m); }, "xml"),
"The module with which to implement session management")
("cgi.sessionCookie", Options::value(&sessionCookie, "sessionID"),
"The name of the cookie for storing session IDs")
diff --git a/project2/common/sessionContainer.cpp b/project2/common/sessionContainer.cpp
index ae82dd9..1db2d36 100644
--- a/project2/common/sessionContainer.cpp
+++ b/project2/common/sessionContainer.cpp
@@ -1,6 +1,6 @@
#include <pch.hpp>
#include "sessionContainer.h"
-#include "instanceStore.impl.h"
+#include <factory.impl.h>
SessionContainer::SessionContainer()
{
@@ -28,5 +28,5 @@ SessionContainer::GetSession(const boost::uuids::uuid & id) const
return s;
}
-INSTANTIATESTORE(std::string, SessionContainerLoader);
+INSTANTIATEVOIDFACTORY(SessionContainer);
diff --git a/project2/common/sessionContainer.h b/project2/common/sessionContainer.h
index b842457..4f62e96 100644
--- a/project2/common/sessionContainer.h
+++ b/project2/common/sessionContainer.h
@@ -5,6 +5,7 @@
#include <intrusivePtrBase.h>
#include "session.h"
#include "options.h"
+#include <factory.h>
class SessionContainer : public IntrusivePtrBase {
public:
@@ -21,7 +22,7 @@ class SessionContainer : public IntrusivePtrBase {
virtual SessionPtr getSession(const boost::uuids::uuid & sid) const = 0;
};
typedef boost::intrusive_ptr<SessionContainer> SessionContainerPtr;
-typedef GenLoader<SessionContainer, std::string> SessionContainerLoader;
+typedef AdHoc::Factory<SessionContainer> SessionContainerFactory;
#endif
diff --git a/project2/xml/sessionXml.cpp b/project2/xml/sessionXml.cpp
index 866d5b2..c92fe85 100644
--- a/project2/xml/sessionXml.cpp
+++ b/project2/xml/sessionXml.cpp
@@ -10,7 +10,7 @@
#include "options.h"
#include "logger.h"
-class CustomSessionContainerLoaderXml : public SessionContainerLoader::For<SessionContainerXml> {
+class CustomSessionContainerFactoryXml : public SessionContainerFactory::For<SessionContainerXml>, public ComponentLoader {
public:
void onPeriodic() override
{
@@ -38,7 +38,7 @@ DECLARE_OPTIONS(SessionContainerXml, "Session XML options")
END_OPTIONS(SessionContainerXml)
boost::filesystem::path SessionContainerXml::xmlDir;
-DECLARE_CUSTOM_COMPONENT_LOADER("xml", SessionContainerXml, CustomSessionContainerLoaderXml, SessionContainerLoader);
+NAMEDPLUGIN("xml", CustomSessionContainerFactoryXml, SessionContainerFactory);
SessionContainerXml::SessionContainerXml()
{
diff --git a/project2/xml/sessionXml.h b/project2/xml/sessionXml.h
index 4288d9e..d3300bd 100644
--- a/project2/xml/sessionXml.h
+++ b/project2/xml/sessionXml.h
@@ -18,7 +18,7 @@ class SessionContainerXml : public SessionContainer {
private:
// Configurables
static boost::filesystem::path xmlDir;
- friend class CustomSessionContainerLoaderXml;
+ friend class CustomSessionContainerFactoryXml;
};
#endif