summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Factory.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-02-20 21:13:02 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-02-20 21:13:02 (GMT)
commita56f28b0db56ff3e39f0b50e4c55c52b7aeec696 (patch)
tree41cf67ea5cee9593e86272ab55367653fbd1c2f3 /src/uscxml/Factory.cpp
parent7c779099b3acd1fa969dde718299484ebe0d2775 (diff)
downloaduscxml-a56f28b0db56ff3e39f0b50e4c55c52b7aeec696.zip
uscxml-a56f28b0db56ff3e39f0b50e4c55c52b7aeec696.tar.gz
uscxml-a56f28b0db56ff3e39f0b50e4c55c52b7aeec696.tar.bz2
See detailled log
- Builds on windows again - All HTTP requests are no passed into interpreter - New response element to reply with data - Moved basichttp URL - New HTTP servlet invoker to register additional URLs - More bugfixes than I care to mention
Diffstat (limited to 'src/uscxml/Factory.cpp')
-rw-r--r--src/uscxml/Factory.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 4481257..d299e7b 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -11,6 +11,7 @@
# include "uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h"
# include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h"
+# include "uscxml/plugins/invoker/http/HTTPServletInvoker.h"
# include "uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h"
# include "uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h"
@@ -39,6 +40,10 @@
# include "uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h"
# endif
+# include "uscxml/plugins/element/fetch/FetchElement.h"
+# include "uscxml/plugins/element/response/ResponseElement.h"
+
+
#endif
namespace uscxml {
@@ -129,6 +134,10 @@ Factory::Factory() {
registerInvoker(invoker);
}
{
+ HTTPServletInvoker* invoker = new HTTPServletInvoker();
+ registerInvoker(invoker);
+ }
+ {
HeartbeatInvoker* invoker = new HeartbeatInvoker();
registerInvoker(invoker);
}
@@ -141,6 +150,15 @@ Factory::Factory() {
registerIOProcessor(ioProcessor);
}
+ {
+ FetchElement* element = new FetchElement();
+ registerExecutableContent(element);
+ }
+ {
+ ResponseElement* element = new ResponseElement();
+ registerExecutableContent(element);
+ }
+
#endif
}
@@ -189,6 +207,13 @@ void Factory::registerInvoker(InvokerImpl* invoker) {
}
}
+void Factory::registerExecutableContent(ExecutableContentImpl* executableContent) {
+ std::string localName = executableContent->getLocalName();
+ std::string nameSpace = executableContent->getNamespace();
+ _executableContent[std::make_pair(localName, nameSpace)] = executableContent;
+}
+
+
boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, Interpreter* interpreter) {
Factory* factory = getInstance();
if (factory->_invokerAliases.find(type) == factory->_invokerAliases.end()) {
@@ -198,7 +223,7 @@ boost::shared_ptr<InvokerImpl> Factory::createInvoker(const std::string& type, I
std::string canonicalName = factory->_invokerAliases[type];
if (factory->_invokers.find(canonicalName) == factory->_invokers.end()) {
- LOG(ERROR) << "Invoker " << type << " known as " << canonicalName << " but not prototype is available in factory";
+ LOG(ERROR) << "Invoker " << type << " known as " << canonicalName << " but no prototype is available in factory";
return boost::shared_ptr<InvokerImpl>();
}
@@ -214,7 +239,7 @@ boost::shared_ptr<DataModelImpl> Factory::createDataModel(const std::string& typ
std::string canonicalName = factory->_dataModelAliases[type];
if (factory->_dataModels.find(canonicalName) == factory->_dataModels.end()) {
- LOG(ERROR) << "DataModel " << type << " known as " << canonicalName << " but not prototype is available in factory";
+ LOG(ERROR) << "DataModel " << type << " known as " << canonicalName << " but no prototype is available in factory";
return boost::shared_ptr<DataModelImpl>();
}
@@ -230,13 +255,23 @@ boost::shared_ptr<IOProcessorImpl> Factory::createIOProcessor(const std::string&
std::string canonicalName = factory->_ioProcessorAliases[type];
if (factory->_ioProcessors.find(canonicalName) == factory->_ioProcessors.end()) {
- LOG(ERROR) << "IOProcessor " << type << " known as " << canonicalName << " but not prototype is available in factory";
+ LOG(ERROR) << "IOProcessor " << type << " known as " << canonicalName << " but no prototype is available in factory";
return boost::shared_ptr<IOProcessorImpl>();
}
return factory->_ioProcessors[canonicalName]->create(interpreter);
}
+boost::shared_ptr<ExecutableContentImpl> Factory::createExecutableContent(const std::string& localName, const std::string& nameSpace, Interpreter* interpreter) {
+ Factory* factory = getInstance();
+ std::string actualNameSpace = (nameSpace.length() == 0 ? "http://www.w3.org/2005/07/scxml" : nameSpace);
+ if (factory->_executableContent.find(std::make_pair(localName, actualNameSpace)) == factory->_executableContent.end()) {
+ LOG(ERROR) << "Executable content " << localName << " in " << actualNameSpace << " not available in factory";
+ return boost::shared_ptr<ExecutableContentImpl>();
+ }
+ return factory->_executableContent[std::make_pair(localName, actualNameSpace)]->create(interpreter);
+}
+
Factory* Factory::getInstance() {
if (_instance == NULL) {