diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-14 08:43:05 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-14 08:43:05 (GMT) |
commit | 01e7e16d34b23b1198455809860abe4e43d9606a (patch) | |
tree | 8b184a60e812a2cd835d15cb304d6a46792ca9e3 /src | |
parent | a22c9ab9c1a72bee6802dc8ada771930253f140b (diff) | |
download | uscxml-01e7e16d34b23b1198455809860abe4e43d9606a.zip uscxml-01e7e16d34b23b1198455809860abe4e43d9606a.tar.gz uscxml-01e7e16d34b23b1198455809860abe4e43d9606a.tar.bz2 |
Apps working again
Diffstat (limited to 'src')
-rw-r--r-- | src/uscxml/Factory.cpp | 4 | ||||
-rw-r--r-- | src/uscxml/Interpreter.cpp | 3 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterDraft6.cpp | 12 | ||||
-rw-r--r-- | src/uscxml/plugins/element/postpone/PostponeElement.cpp | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/element/respond/RespondElement.cpp (renamed from src/uscxml/plugins/element/response/ResponseElement.cpp) | 34 | ||||
-rw-r--r-- | src/uscxml/plugins/element/respond/RespondElement.h (renamed from src/uscxml/plugins/element/response/ResponseElement.h) | 16 |
6 files changed, 35 insertions, 36 deletions
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp index c74196a..76da139 100644 --- a/src/uscxml/Factory.cpp +++ b/src/uscxml/Factory.cpp @@ -52,7 +52,7 @@ # include "uscxml/plugins/element/fetch/FetchElement.h" -# include "uscxml/plugins/element/response/ResponseElement.h" +# include "uscxml/plugins/element/respond/RespondElement.h" # include "uscxml/plugins/element/postpone/PostponeElement.h" @@ -194,7 +194,7 @@ Factory::Factory() { registerExecutableContent(element); } { - ResponseElement* element = new ResponseElement(); + RespondElement* element = new RespondElement(); registerExecutableContent(element); } { diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 27fd10b..de2b8b5 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -1191,7 +1191,8 @@ void InterpreterImpl::executeContent(const Arabica::DOM::Node<std::string>& cont if (_executableContent.find(content) == _executableContent.end()) { execContent = Factory::createExecutableContent(content.getLocalName(), content.getNamespaceURI(), this); if (!execContent) { - LOG(ERROR) << "No custom executable content known for " << content.getLocalName() << " in " << content.getNamespaceURI(); + LOG(ERROR) << "No custom executable content known for '" + << content.getLocalName() << "' in namespace '" << content.getNamespaceURI() << "'"; return; } _executableContent[content] = execContent; diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp index d3019d9..ef40362 100644 --- a/src/uscxml/interpreter/InterpreterDraft6.cpp +++ b/src/uscxml/interpreter/InterpreterDraft6.cpp @@ -379,14 +379,12 @@ bool InterpreterDraft6::isEnabledTransition(const Node<std::string>& transition, std::vector<std::string> eventNames = tokenizeIdRefs(eventName); - if (eventNames.size() > 0 && hasConditionMatch(transition)) { - std::vector<std::string>::iterator eventIter = eventNames.begin(); - while(eventIter != eventNames.end()) { - if(nameMatch(*eventIter, event)) { - return true; - } - eventIter++; + std::vector<std::string>::iterator eventIter = eventNames.begin(); + while(eventIter != eventNames.end()) { + if(nameMatch(*eventIter, event) && hasConditionMatch(transition)) { + return true; } + eventIter++; } return false; } diff --git a/src/uscxml/plugins/element/postpone/PostponeElement.cpp b/src/uscxml/plugins/element/postpone/PostponeElement.cpp index 54f2499..3c1d1b8 100644 --- a/src/uscxml/plugins/element/postpone/PostponeElement.cpp +++ b/src/uscxml/plugins/element/postpone/PostponeElement.cpp @@ -112,7 +112,7 @@ void PostponeElement::Resubmitter::onStableConfiguration(Interpreter interpreter // LOG(INFO) << " -> is TRUE"; eventIter->event.name += ".postponed"; interpreter.receive(eventIter->event, true); - _postponedEvents.erase(eventIter); + _postponedEvents.erase(eventIter++); dispatched = true; } // LOG(INFO) << " -> is FALSE"; diff --git a/src/uscxml/plugins/element/response/ResponseElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp index 675bc1e..3c47b83 100644 --- a/src/uscxml/plugins/element/response/ResponseElement.cpp +++ b/src/uscxml/plugins/element/respond/RespondElement.cpp @@ -1,4 +1,4 @@ -#include "ResponseElement.h" +#include "RespondElement.h" #include "uscxml/plugins/invoker/http/HTTPServletInvoker.h" #include <glog/logging.h> @@ -11,35 +11,35 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR bool connect(pluma::Host& host) { - host.add( new ResponseElementProvider() ); + host.add( new RespondElementProvider() ); return true; } #endif -boost::shared_ptr<ExecutableContentImpl> ResponseElement::create(InterpreterImpl* interpreter) { - boost::shared_ptr<ResponseElement> invoker = boost::shared_ptr<ResponseElement>(new ResponseElement()); +boost::shared_ptr<ExecutableContentImpl> RespondElement::create(InterpreterImpl* interpreter) { + boost::shared_ptr<RespondElement> invoker = boost::shared_ptr<RespondElement>(new RespondElement()); invoker->_interpreter = interpreter; return invoker; } -void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) { +void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) { // try to get the request id - if (!HAS_ATTR(node, "request") && !HAS_ATTR(node, "requestexpr")) { - LOG(ERROR) << "Response element requires request or requestexpr"; + if (!HAS_ATTR(node, "to")) { + LOG(ERROR) << "Respond element requires to attribute"; return; } - if (HAS_ATTR(node, "requestexpr") && !_interpreter->getDataModel()) { - LOG(ERROR) << "Response element with requestexpr requires datamodel"; + if (HAS_ATTR(node, "to") && !_interpreter->getDataModel()) { + LOG(ERROR) << "Respond element with to requires datamodel"; return; } - std::string requestId = (HAS_ATTR(node, "request") ? ATTR(node, "request") : _interpreter->getDataModel().evalAsString(ATTR(node, "requestexpr"))); + std::string requestId = _interpreter->getDataModel().evalAsString(ATTR(node, "to")); // try to get the request object InterpreterServlet* servlet = _interpreter->getHTTPServlet(); tthread::lock_guard<tthread::recursive_mutex> lock(servlet->getMutex()); if (servlet->getRequests().find(requestId) == servlet->getRequests().end()) { - LOG(ERROR) << "No matching HTTP request for response element"; + LOG(ERROR) << "No matching HTTP request for respond element"; return; } @@ -52,7 +52,7 @@ void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) // get the status or default to 200 std::string statusStr = (HAS_ATTR(node, "status") ? ATTR(node, "status") : "200"); if (!isNumeric(statusStr.c_str(), 10)) { - LOG(ERROR) << "Response element with non-numeric status " << statusStr; + LOG(ERROR) << "Respond element with non-numeric status " << statusStr; return; } httpReply.status = strTo<int>(statusStr);; @@ -66,7 +66,7 @@ void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) std::string contentValue = _interpreter->getDataModel().evalAsString(ATTR(contents[0], "expr")); httpReply.content = contentValue; } catch (Event e) { - LOG(ERROR) << "Syntax error with expr in content child of response element:" << std::endl << e << std::endl; + LOG(ERROR) << "Syntax error with expr in content child of Respond element:" << std::endl << e << std::endl; return; } } else { @@ -80,7 +80,7 @@ void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) try { file = "file://" + _interpreter->getDataModel().evalAsString(ATTR(contents[0], "fileexpr")); } catch (Event e) { - LOG(ERROR) << "Syntax error with fileexpr in content child of response element:" << std::endl << e << std::endl; + LOG(ERROR) << "Syntax error with fileexpr in content child of Respond element:" << std::endl << e << std::endl; return; } } @@ -117,7 +117,7 @@ void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) try { name = _interpreter->getDataModel().evalAsString(ATTR(headers[i], "nameexpr")); } catch (Event e) { - LOG(ERROR) << "Syntax error with nameexpr in header child of response element:" << std::endl << e << std::endl; + LOG(ERROR) << "Syntax error with nameexpr in header child of Respond element:" << std::endl << e << std::endl; return; } } else { @@ -137,7 +137,7 @@ void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) try { value = _interpreter->getDataModel().evalAsString(ATTR(headers[i], "expr")); } catch (Event e) { - LOG(ERROR) << "Syntax error with expr in header child of response element:" << std::endl << e << std::endl; + LOG(ERROR) << "Syntax error with expr in header child of Respond element:" << std::endl << e << std::endl; return; } } else { @@ -157,7 +157,7 @@ void ResponseElement::enterElement(const Arabica::DOM::Node<std::string>& node) servlet->getRequests().erase(requestId); } -void ResponseElement::exitElement(const Arabica::DOM::Node<std::string>& node) { +void RespondElement::exitElement(const Arabica::DOM::Node<std::string>& node) { } diff --git a/src/uscxml/plugins/element/response/ResponseElement.h b/src/uscxml/plugins/element/respond/RespondElement.h index 333dd98..c53d60a 100644 --- a/src/uscxml/plugins/element/response/ResponseElement.h +++ b/src/uscxml/plugins/element/respond/RespondElement.h @@ -1,5 +1,5 @@ -#ifndef RESPONSEELEMENT_H_I11KQ39Q -#define RESPONSEELEMENT_H_I11KQ39Q +#ifndef RESPONDELEMENT_H_I11KQ39Q +#define RESPONDELEMENT_H_I11KQ39Q #include <uscxml/Interpreter.h> @@ -9,14 +9,14 @@ namespace uscxml { -class ResponseElement : public ExecutableContentImpl { +class RespondElement : public ExecutableContentImpl { public: - ResponseElement() {} - virtual ~ResponseElement() {} + RespondElement() {} + virtual ~RespondElement() {} boost::shared_ptr<ExecutableContentImpl> create(InterpreterImpl* interpreter); std::string getLocalName() { - return "response"; + return "respond"; } std::string getNamespace() { @@ -33,10 +33,10 @@ public: }; #ifdef BUILD_AS_PLUGINS -PLUMA_INHERIT_PROVIDER(ResponseElement, ExecutableContentImpl); +PLUMA_INHERIT_PROVIDER(RespondElement, ExecutableContentImpl); #endif } -#endif /* end of include guard: RESPONSEELEMENT_H_I11KQ39Q */ +#endif /* end of include guard: RESPONDELEMENT_H_I11KQ39Q */ |