summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/server/mod-eval.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-01 06:04:35 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-01 06:04:35 +0000
commitac8bb2ddecac09d60760ef83319b627548d0fd77 (patch)
treeb15d73262f02989d8dfe554e127e82e70b5aebe4 /sca-cpp/trunk/modules/server/mod-eval.hpp
parent54561e00c9714c9230dc1ed39f3bb548a59adeed (diff)
Minimal support for implementation.widget, using simplified (and generic) JSONRPC and ATOMPub Javascript proxies. Minor changes to the server runtime to serve reference requests from widgets. Adjust and simplified samples using the widget support.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@959521 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/server/mod-eval.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp
index e46d8ba78a..14e5f40e9b 100644
--- a/sca-cpp/trunk/modules/server/mod-eval.hpp
+++ b/sca-cpp/trunk/modules/server/mod-eval.hpp
@@ -358,6 +358,22 @@ const list<value> propProxies(const list<value>& props) {
/**
* Evaluate a component and convert it to an applicable lambda function.
*/
+struct implementationFailure {
+ const value reason;
+ implementationFailure(const value& r) : reason(r) {
+ }
+
+ // Default implementation representing an implementation that
+ // couldn't be evaluated. Report the evaluation error on all
+ // subsequent calls expect start/stop.
+ const value operator()(unused const list<value>& params) const {
+ const value func = car(params);
+ if (func == "start" || func == "stop")
+ return mklist<value>(lambda<value(const list<value>&)>());
+ return mklist<value>(value(), reason);
+ }
+};
+
const value evalComponent(ServerConf& sc, server_rec& server, const value& comp) {
extern const failable<lambda<value(const list<value>&)> > evalImplementation(const string& cpath, const value& impl, const list<value>& px, const lambda<value(const list<value>&)>& lifecycle);
@@ -380,7 +396,7 @@ const value evalComponent(ServerConf& sc, server_rec& server, const value& comp)
// Evaluate the component implementation and convert it to an applicable lambda function
const failable<lambda<value(const list<value>&)> > cimpl(evalImplementation(sc.contributionPath, impl, append(rpx, ppx), sc.lifecycle));
if (!hasContent(cimpl))
- return reason(cimpl);
+ return lambda<value(const list<value>&)>(implementationFailure(reason(cimpl)));
return content(cimpl);
}