summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-01-17 09:02:29 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-01-17 09:02:29 +0000
commitb00fe2747627bc95ac8d1d548e0621930a1775a2 (patch)
tree64561e332127d72763850196be5f0538cac9b8bb
parent9cb610814d58da1ba2617f78e36e9635f2e7d508 (diff)
Cleaned up test composite files. Adjusted C++ implementation elements to match the spec. Minor refactoring/terminology cleanup in HTTPD modules, renamed readImplementation to evalImplementation and evalImplementation to applyImplementation.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@900071 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-cpp/trunk/components/cache/mcache.composite2
-rw-r--r--sca-cpp/trunk/components/cache/mcache.cpp2
-rw-r--r--sca-cpp/trunk/components/webservice/webservice.composite2
-rw-r--r--sca-cpp/trunk/components/webservice/webservice.cpp8
-rw-r--r--sca-cpp/trunk/modules/python/domain-test.composite4
-rw-r--r--sca-cpp/trunk/modules/python/mod-python.cpp11
-rw-r--r--sca-cpp/trunk/modules/python/mod-python.hpp30
-rw-r--r--sca-cpp/trunk/modules/python/tuscany-sca-1.1-implementation-python.xsd2
-rw-r--r--sca-cpp/trunk/modules/scdl/scdl-test.cpp2
-rw-r--r--sca-cpp/trunk/modules/scdl/test.composite11
-rw-r--r--sca-cpp/trunk/modules/scheme/tuscany-sca-1.1-implementation-scheme.xsd (renamed from sca-cpp/trunk/modules/scheme/tuscany-sca-1.1-implementation-eval.xsd)6
-rw-r--r--sca-cpp/trunk/modules/server/domain-test.composite6
-rw-r--r--sca-cpp/trunk/modules/server/impl-test.cpp2
-rw-r--r--sca-cpp/trunk/modules/server/mod-cpp.hpp31
-rw-r--r--sca-cpp/trunk/modules/server/mod-eval.cpp11
-rw-r--r--sca-cpp/trunk/modules/server/mod-eval.hpp8
-rw-r--r--sca-cpp/trunk/modules/server/mod-scheme.hpp30
-rw-r--r--sca-cpp/trunk/test/store-python/currency.composite32
-rw-r--r--sca-cpp/trunk/test/store-python/store.composite11
-rw-r--r--sca-cpp/trunk/test/store-scheme/currency.composite32
-rw-r--r--sca-cpp/trunk/test/store-scheme/store.composite11
21 files changed, 98 insertions, 156 deletions
diff --git a/sca-cpp/trunk/components/cache/mcache.composite b/sca-cpp/trunk/components/cache/mcache.composite
index 99364104fb..3a838abc79 100644
--- a/sca-cpp/trunk/components/cache/mcache.composite
+++ b/sca-cpp/trunk/components/cache/mcache.composite
@@ -23,7 +23,7 @@
name="mcache">
<component name="mcache">
- <t:implementation.cpp uri=".libs/libmcache"/>
+ <implementation.cpp path=".libs" library="libmcache"/>
<service name="mcache">
<t:binding.http uri="mcache"/>
</service>
diff --git a/sca-cpp/trunk/components/cache/mcache.cpp b/sca-cpp/trunk/components/cache/mcache.cpp
index 3e8fdeb294..46f707ee19 100644
--- a/sca-cpp/trunk/components/cache/mcache.cpp
+++ b/sca-cpp/trunk/components/cache/mcache.cpp
@@ -89,7 +89,7 @@ const failable<value> del(const list<value>& params) {
extern "C" {
-const tuscany::value eval(const tuscany::list<tuscany::value>& params) {
+const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
if (func == "get")
return tuscany::cache::get(cdr(params));
diff --git a/sca-cpp/trunk/components/webservice/webservice.composite b/sca-cpp/trunk/components/webservice/webservice.composite
index 3e6be1fae6..9498a26b53 100644
--- a/sca-cpp/trunk/components/webservice/webservice.composite
+++ b/sca-cpp/trunk/components/webservice/webservice.composite
@@ -23,7 +23,7 @@
name="webservice">
<component name="webservice">
- <t:implementation.cpp uri=".libs/libwebservice"/>
+ <implementation.cpp path=".libs" library="libwebservice"/>
<service name="webservice">
<t:binding.http uri="webservice"/>
</service>
diff --git a/sca-cpp/trunk/components/webservice/webservice.cpp b/sca-cpp/trunk/components/webservice/webservice.cpp
index 769df9e258..f4606afdd8 100644
--- a/sca-cpp/trunk/components/webservice/webservice.cpp
+++ b/sca-cpp/trunk/components/webservice/webservice.cpp
@@ -34,9 +34,9 @@ namespace tuscany {
namespace webservice {
/**
- * Evaluate a Web service function / operation.
+ * Apply a Web service function / operation.
*/
-const failable<value> eval(const value& func, unused const list<value>& params) {
+const failable<value> apply(const value& func, unused const list<value>& params) {
return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
}
@@ -45,8 +45,8 @@ const failable<value> eval(const value& func, unused const list<value>& params)
extern "C" {
-const tuscany::value eval(const tuscany::list<tuscany::value>& params) {
- return tuscany::webservice::eval(car(params), cdr(params));
+const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
+ return tuscany::webservice::apply(car(params), cdr(params));
}
}
diff --git a/sca-cpp/trunk/modules/python/domain-test.composite b/sca-cpp/trunk/modules/python/domain-test.composite
index 7318f96520..a0e92dfb0c 100644
--- a/sca-cpp/trunk/modules/python/domain-test.composite
+++ b/sca-cpp/trunk/modules/python/domain-test.composite
@@ -23,14 +23,14 @@
name="domain-test">
<component name="python-test">
- <t:implementation.python uri="server-test.py"/>
+ <t:implementation.python script="server-test.py"/>
<service name="test">
<t:binding.http uri="python"/>
</service>
</component>
<component name="client-test">
- <t:implementation.python uri="client-test.py"/>
+ <t:implementation.python script="client-test.py"/>
<service name="client">
<t:binding.http uri="client"/>
</service>
diff --git a/sca-cpp/trunk/modules/python/mod-python.cpp b/sca-cpp/trunk/modules/python/mod-python.cpp
index 1352c50c11..1c35467b4b 100644
--- a/sca-cpp/trunk/modules/python/mod-python.cpp
+++ b/sca-cpp/trunk/modules/python/mod-python.cpp
@@ -37,14 +37,15 @@ namespace server {
namespace modeval {
/**
- * Return a configured component implementation.
- * For now only Scheme and C++ implementations are supported.
+ * Evaluate a Python component implementation and convert it to an applicable
+ * lambda function.
*/
-const failable<lambda<value(const list<value>&)> > readImplementation(const string& itype, const string& path, const list<value>& px) {
+const failable<lambda<value(const list<value>&)> > evalImplementation(const string& path, const value& impl, const list<value>& px) {
+ const string itype(elementName(impl));
if (contains(itype, ".python"))
- return modpython::readImplementation(path, px);
+ return modpython::evalImplementation(path, impl, px);
if (contains(itype, ".cpp"))
- return modcpp::readImplementation(path, px);
+ return modcpp::evalImplementation(path, impl, px);
return mkfailure<lambda<value(const list<value>&)> >(string("Unsupported implementation type: ") + itype);
}
diff --git a/sca-cpp/trunk/modules/python/mod-python.hpp b/sca-cpp/trunk/modules/python/mod-python.hpp
index a56232d641..e67b9a4a93 100644
--- a/sca-cpp/trunk/modules/python/mod-python.hpp
+++ b/sca-cpp/trunk/modules/python/mod-python.hpp
@@ -23,7 +23,7 @@
#define tuscany_modpython_hpp
/**
- * Evaluation functions used by mod-eval to evaluate implementation.python
+ * Evaluation functions used by mod-eval to evaluate Python
* component implementations.
*/
@@ -41,18 +41,18 @@ namespace server {
namespace modpython {
/**
- * Evaluate a script component implementation function.
+ * Apply a Python component implementation function.
*/
-struct evalImplementation {
+struct applyImplementation {
PyObject* impl;
const list<value> px;
- evalImplementation(PyObject* impl, const list<value>& px) : impl(impl), px(px) {
+ applyImplementation(PyObject* impl, const list<value>& px) : impl(impl), px(px) {
}
const value operator()(const list<value>& params) const {
const value expr = append<value>(params, px);
- debug(expr, "modeval::python::evalImplementation::input");
+ debug(expr, "modeval::python::applyImplementation::input");
const failable<value> val = python::evalScript(expr, impl);
- debug(val, "modeval::python::evalImplementation::result");
+ debug(val, "modeval::python::applyImplementation::result");
if (!hasContent(val))
return mklist<value>(value(), reason(val));
return mklist<value>(content(val));
@@ -60,16 +60,18 @@ struct evalImplementation {
};
/**
- * Read a script component implementation.
+ * Evaluate a Python component implementation and convert it to an applicable
+ * lambda function.
*/
-const failable<lambda<value(const list<value>&)> > readImplementation(const string& path, const list<value>& px) {
- ifstream is(path);
+const failable<lambda<value(const list<value>&)> > evalImplementation(const string& path, const value& impl, const list<value>& px) {
+ const string fpath(path + attributeValue("script", impl));
+ ifstream is(fpath);
if (fail(is))
- return mkfailure<lambda<value(const list<value>&)> >(string("Could not read implementation: ") + path);
- const failable<PyObject*> impl = python::readScript(path, is);
- if (!hasContent(impl))
- return mkfailure<lambda<value(const list<value>&)> >(reason(impl));
- return lambda<value(const list<value>&)>(evalImplementation(content(impl), px));
+ return mkfailure<lambda<value(const list<value>&)> >(string("Could not read implementation: ") + fpath);
+ const failable<PyObject*> script = python::readScript(fpath, is);
+ if (!hasContent(script))
+ return mkfailure<lambda<value(const list<value>&)> >(reason(script));
+ return lambda<value(const list<value>&)>(applyImplementation(content(script), px));
}
}
diff --git a/sca-cpp/trunk/modules/python/tuscany-sca-1.1-implementation-python.xsd b/sca-cpp/trunk/modules/python/tuscany-sca-1.1-implementation-python.xsd
index 95ffc4f743..24d5e224bc 100644
--- a/sca-cpp/trunk/modules/python/tuscany-sca-1.1-implementation-python.xsd
+++ b/sca-cpp/trunk/modules/python/tuscany-sca-1.1-implementation-python.xsd
@@ -34,7 +34,7 @@
<any namespace="##targetNamespace" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
- <attribute name="location" type="anyURI" use="required"/>
+ <attribute name="script" type="anyURI" use="required"/>
<anyAttribute namespace="##any" processContents="lax"/>
</extension>
</complexContent>
diff --git a/sca-cpp/trunk/modules/scdl/scdl-test.cpp b/sca-cpp/trunk/modules/scdl/scdl-test.cpp
index d6034d1e2f..e8ee77eb4e 100644
--- a/sca-cpp/trunk/modules/scdl/scdl-test.cpp
+++ b/sca-cpp/trunk/modules/scdl/scdl-test.cpp
@@ -48,7 +48,7 @@ bool testComponents() {
assert(name(store) == string("Store"));
const value impl = implementation(store);
assert(uri(impl) == string("store.html"));
- assert(implementationType(impl) == "t:implementation.widget");
+ assert(implementationType(impl) == "t:implementation.scheme");
const value catalog = named(string("Catalog"), c);
assert(name(catalog) == string("Catalog"));
diff --git a/sca-cpp/trunk/modules/scdl/test.composite b/sca-cpp/trunk/modules/scdl/test.composite
index b315f23f9a..92e8f64ca5 100644
--- a/sca-cpp/trunk/modules/scdl/test.composite
+++ b/sca-cpp/trunk/modules/scdl/test.composite
@@ -23,7 +23,7 @@
name="store">
<component name="Store">
- <t:implementation.widget uri="store.html"/>
+ <t:implementation.scheme script="store.scm"/>
<service name="Widget">
<t:binding.http uri="/store"/>
</service>
@@ -39,7 +39,7 @@
</component>
<component name="Catalog">
- <t:implementation.scheme uri="fruits-catalog.scm"/>
+ <t:implementation.scheme script="fruits-catalog.scm"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<t:binding.jsonrpc/>
@@ -48,20 +48,17 @@
</component>
<component name="ShoppingCart">
- <t:implementation.scheme uri="shopping-cart.scm"/>
+ <t:implementation.scheme script="shopping-cart.scm"/>
<service name="Cart">
<t:binding.atom uri="/ShoppingCart"/>
</service>
<service name="Total">
<t:binding.jsonrpc/>
</service>
- <reference name="cache">
- <binding.memcached uri="localhost:11311"/>
- </reference>
</component>
<component name="CurrencyConverter">
- <t:implementation.scheme uri="currency-converter.scm"/>
+ <t:implementation.scheme script="currency-converter.scm"/>
</component>
</composite>
diff --git a/sca-cpp/trunk/modules/scheme/tuscany-sca-1.1-implementation-eval.xsd b/sca-cpp/trunk/modules/scheme/tuscany-sca-1.1-implementation-scheme.xsd
index bbf4935346..4c2a30a55a 100644
--- a/sca-cpp/trunk/modules/scheme/tuscany-sca-1.1-implementation-eval.xsd
+++ b/sca-cpp/trunk/modules/scheme/tuscany-sca-1.1-implementation-scheme.xsd
@@ -25,16 +25,16 @@
<import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200903" schemaLocation="sca-1.1-cd04.xsd"/>
- <element name="implementation.eval" type="t:EvalImplementation" substitutionGroup="sca:implementation"/>
+ <element name="implementation.scheme" type="t:SchemeImplementation" substitutionGroup="sca:implementation"/>
- <complexType name="EvalImplementation">
+ <complexType name="SchemeImplementation">
<complexContent>
<extension base="sca:Implementation">
<sequence>
<any namespace="##targetNamespace" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
- <attribute name="location" type="anyURI" use="required"/>
+ <attribute name="script" type="anyURI" use="required"/>
<anyAttribute namespace="##any" processContents="lax"/>
</extension>
</complexContent>
diff --git a/sca-cpp/trunk/modules/server/domain-test.composite b/sca-cpp/trunk/modules/server/domain-test.composite
index d5b0dae511..1635f1f6cf 100644
--- a/sca-cpp/trunk/modules/server/domain-test.composite
+++ b/sca-cpp/trunk/modules/server/domain-test.composite
@@ -23,21 +23,21 @@
name="domain-test">
<component name="scheme-test">
- <t:implementation.scheme uri="server-test.scm"/>
+ <t:implementation.scheme script="server-test.scm"/>
<service name="test">
<t:binding.http uri="test"/>
</service>
</component>
<component name="cpp-test">
- <t:implementation.cpp uri=".libs/libimpl-test"/>
+ <implementation.cpp path=".libs" library="libimpl-test"/>
<service name="cpp">
<t:binding.http uri="cpp"/>
</service>
</component>
<component name="client-test">
- <t:implementation.scheme uri="client-test.scm"/>
+ <t:implementation.scheme script="client-test.scm"/>
<service name="client">
<t:binding.http uri="client"/>
</service>
diff --git a/sca-cpp/trunk/modules/server/impl-test.cpp b/sca-cpp/trunk/modules/server/impl-test.cpp
index ad8953bf12..748e5f3837 100644
--- a/sca-cpp/trunk/modules/server/impl-test.cpp
+++ b/sca-cpp/trunk/modules/server/impl-test.cpp
@@ -58,7 +58,7 @@ const failable<value> echo(const list<value>& params) {
extern "C" {
-const tuscany::value eval(const tuscany::list<tuscany::value>& params) {
+const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
if (func == "get")
return tuscany::server::get(cdr(params));
diff --git a/sca-cpp/trunk/modules/server/mod-cpp.hpp b/sca-cpp/trunk/modules/server/mod-cpp.hpp
index 416ccabf39..f10b91dc28 100644
--- a/sca-cpp/trunk/modules/server/mod-cpp.hpp
+++ b/sca-cpp/trunk/modules/server/mod-cpp.hpp
@@ -23,7 +23,7 @@
#define tuscany_modcpp_hpp
/**
- * Evaluation functions used by mod-eval to evaluate implementation.cpp
+ * Evaluation functions used by mod-eval to evaluate C++
* component implementations.
*/
@@ -32,6 +32,7 @@
#include "function.hpp"
#include "list.hpp"
+#include "element.hpp"
#include "value.hpp"
#include "monad.hpp"
#include "dynlib.hpp"
@@ -43,31 +44,35 @@ namespace server {
namespace modcpp {
/**
- * Evaluate a C++ component implementation function.
+ * Apply a C++ component implementation function.
*/
-struct evalImplementation {
+struct applyImplementation {
const lib ilib;
const lambda<value(const list<value>&)> impl;
const list<value> px;
- evalImplementation(const lib& ilib, const lambda<value(const list<value>&)>& impl, const list<value>& px) : ilib(ilib), impl(impl), px(px) {
+ applyImplementation(const lib& ilib, const lambda<value(const list<value>&)>& impl, const list<value>& px) : ilib(ilib), impl(impl), px(px) {
}
const value operator()(const list<value>& params) const {
- debug(params, "modeval::cpp::evalImplementation::input");
+ debug(params, "modeval::cpp::applyImplementation::input");
const value val = impl(append(params, px));
- debug(val, "modeval::cpp::evalImplementation::result");
+ debug(val, "modeval::cpp::applyImplementation::result");
return val;
}
};
/**
- * Read a C++ component implementation.
+ * Evaluate a C++ component implementation and convert it to
+ * an applicable lambda function.
*/
-const failable<lambda<value(const list<value>&)> > readImplementation(const string& path, const list<value>& px) {
- const lib ilib(*(new (gc_new<lib>()) lib(path + dynlibExt)));
- const failable<lambda<value(const list<value>&)> > impl(dynlambda<value(const list<value>&)>("eval", ilib));
- if (!hasContent(impl))
- return impl;
- return lambda<value(const list<value>&)>(evalImplementation(ilib, content(impl), px));
+const failable<lambda<value(const list<value>&)> > evalImplementation(const string& path, const value& impl, const list<value>& px) {
+ const value ipath(attributeValue("path", impl));
+ const value iname(attributeValue("library", impl));
+ const string fpath(isNil(ipath)? path + iname : path + ipath + "/" + iname);
+ const lib ilib(*(new (gc_new<lib>()) lib(fpath + dynlibExt)));
+ const failable<lambda<value(const list<value>&)> > evalf(dynlambda<value(const list<value>&)>("apply", ilib));
+ if (!hasContent(evalf))
+ return evalf;
+ return lambda<value(const list<value>&)>(applyImplementation(ilib, content(evalf), px));
}
}
diff --git a/sca-cpp/trunk/modules/server/mod-eval.cpp b/sca-cpp/trunk/modules/server/mod-eval.cpp
index 936c68d70f..54ca171ec4 100644
--- a/sca-cpp/trunk/modules/server/mod-eval.cpp
+++ b/sca-cpp/trunk/modules/server/mod-eval.cpp
@@ -37,14 +37,15 @@ namespace server {
namespace modeval {
/**
- * Return a configured component implementation.
- * For now only Scheme and C++ implementations are supported.
+ * Evaluate a Scheme or C++ component implementation and convert it to an
+ * applicable lambda function.
*/
-const failable<lambda<value(const list<value>&)> > readImplementation(const string& itype, const string& path, const list<value>& px) {
+const failable<lambda<value(const list<value>&)> > evalImplementation(const string& path, const value& impl, const list<value>& px) {
+ const string itype(elementName(impl));
if (contains(itype, ".scheme"))
- return modscheme::readImplementation(path, px);
+ return modscheme::evalImplementation(path, impl, px);
if (contains(itype, ".cpp"))
- return modcpp::readImplementation(path, px);
+ return modcpp::evalImplementation(path, impl, px);
return mkfailure<lambda<value(const list<value>&)> >(string("Unsupported implementation type: ") + itype);
}
diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp
index 4f95977fea..f5c4266cc1 100644
--- a/sca-cpp/trunk/modules/server/mod-eval.hpp
+++ b/sca-cpp/trunk/modules/server/mod-eval.hpp
@@ -279,11 +279,10 @@ const list<value> proxies(const list<value>& refs, const string& base) {
return cons(mkproxy(car(refs), base), proxies(cdr(refs), base));
}
-extern const failable<lambda<value(const list<value>&)> > readImplementation(const string& itype, const string& path, const list<value>& px);
+extern const failable<lambda<value(const list<value>&)> > evalImplementation(const string& cpath, const value& impl, const list<value>& px);
const value confImplementation(DirConf& dc, ServerConf& sc, server_rec& server, const value& comp) {
const value impl = scdl::implementation(comp);
- const string path = dc.contributionPath + string(scdl::uri(impl));
// Convert component references to configured proxy lambdas
ostringstream base;
@@ -296,8 +295,9 @@ const value confImplementation(DirConf& dc, ServerConf& sc, server_rec& server,
base << sc.wiringServerName << "/references/" << string(scdl::name(comp)) << "/";
const list<value> px(proxies(scdl::references(comp), str(base)));
- // Read and configure the implementation
- const failable<lambda<value(const list<value>&)> > cimpl(readImplementation(elementName(impl), path, px));
+ // Evaluate the component implementation and convert it to an
+ // applicable lambda function
+ const failable<lambda<value(const list<value>&)> > cimpl(evalImplementation(dc.contributionPath, impl, px));
if (!hasContent(cimpl))
return reason(cimpl);
return content(cimpl);
diff --git a/sca-cpp/trunk/modules/server/mod-scheme.hpp b/sca-cpp/trunk/modules/server/mod-scheme.hpp
index 5c6ea9ef7d..fd03ebb43e 100644
--- a/sca-cpp/trunk/modules/server/mod-scheme.hpp
+++ b/sca-cpp/trunk/modules/server/mod-scheme.hpp
@@ -23,7 +23,7 @@
#define tuscany_modscheme_hpp
/**
- * Evaluation functions used by mod-eval to evaluate implementation.scheme
+ * Evaluation functions used by mod-eval to evaluate Scheme
* component implementations.
*/
@@ -50,19 +50,19 @@ const list<value> primitiveProcedures(const list<value>& l) {
}
/**
- * Evaluate a scheme component implementation function.
+ * Apply a Scheme component implementation function.
*/
-struct evalImplementation {
+struct applyImplementation {
const value impl;
const list<value> px;
- evalImplementation(const value& impl, const list<value>& px) : impl(impl), px(scheme::quotedParameters(primitiveProcedures(px))) {
+ applyImplementation(const value& impl, const list<value>& px) : impl(impl), px(scheme::quotedParameters(primitiveProcedures(px))) {
}
const value operator()(const list<value>& params) const {
const value expr = cons<value>(car(params), append(scheme::quotedParameters(cdr(params)), px));
- debug(expr, "modeval::scheme::evalImplementation::input");
+ debug(expr, "modeval::scheme::applyImplementation::input");
scheme::Env env = scheme::setupEnvironment();
const value val = scheme::evalScript(expr, impl, env);
- debug(val, "modeval::scheme::evalImplementation::result");
+ debug(val, "modeval::scheme::applyImplementation::result");
if (isNil(val))
return mklist<value>(value(), string("Could not evaluate expression"));
return mklist<value>(val);
@@ -70,16 +70,18 @@ struct evalImplementation {
};
/**
- * Read a scheme component implementation.
+ * Evaluate a Scheme component implementation and convert it to an
+ * applicable lambda function.
*/
-const failable<lambda<value(const list<value>&)> > readImplementation(const string& path, const list<value>& px) {
- ifstream is(path);
+const failable<lambda<value(const list<value>&)> > evalImplementation(const string& path, const value& impl, const list<value>& px) {
+ const string fpath(path + attributeValue("script", impl));
+ ifstream is(fpath);
if (fail(is))
- return mkfailure<lambda<value(const list<value>&)> >(string("Could not read implementation: ") + path);
- const value impl = scheme::readScript(is);
- if (isNil(impl))
- return mkfailure<lambda<value(const list<value>&)> >(string("Could not read implementation: ") + path);
- return lambda<value(const list<value>&)>(evalImplementation(impl, px));
+ return mkfailure<lambda<value(const list<value>&)> >(string("Could not read implementation: ") + fpath);
+ const value script = scheme::readScript(is);
+ if (isNil(script))
+ return mkfailure<lambda<value(const list<value>&)> >(string("Could not read implementation: ") + fpath);
+ return lambda<value(const list<value>&)>(applyImplementation(script, px));
}
}
diff --git a/sca-cpp/trunk/test/store-python/currency.composite b/sca-cpp/trunk/test/store-python/currency.composite
deleted file mode 100644
index 17066e9626..0000000000
--- a/sca-cpp/trunk/test/store-python/currency.composite
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
- targetNamespace="http://services"
- name="currency">
-
- <component name="CurrencyConverterWebService">
- <t:implementation.python script="currency-converter.py"/>
- <service name="CurrencyConverter">
- <binding.http uri="currency-converter"/>
- </service>
- </component>
-
-</composite>
diff --git a/sca-cpp/trunk/test/store-python/store.composite b/sca-cpp/trunk/test/store-python/store.composite
index 8ea2dec373..abf43433d5 100644
--- a/sca-cpp/trunk/test/store-python/store.composite
+++ b/sca-cpp/trunk/test/store-python/store.composite
@@ -23,8 +23,7 @@
name="store">
<component name="Store">
- <!-- <t:implementation.widget location="store.html"/> -->
- <t:implementation.python uri="store.py"/>
+ <t:implementation.python script="store.py"/>
<service name="Widget">
<t:binding.http uri="store"/>
</service>
@@ -34,7 +33,7 @@
</component>
<component name="Catalog">
- <t:implementation.python uri="fruits-catalog.py"/>
+ <t:implementation.python script="fruits-catalog.py"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<t:binding.jsonrpc uri="catalog"/>
@@ -43,7 +42,7 @@
</component>
<component name="ShoppingCart">
- <t:implementation.python uri="shopping-cart.py"/>
+ <t:implementation.python script="shopping-cart.py"/>
<service name="ShoppingCart">
<t:binding.atom uri="shoppingCart"/>
</service>
@@ -54,14 +53,14 @@
</component>
<component name="CurrencyConverter">
- <t:implementation.python uri="currency-converter.py"/>
+ <t:implementation.python script="currency-converter.py"/>
<service name="CurrencyConverter">
<t:binding.jsonrpc uri="currencyConverter"/>
</service>
</component>
<component name="Cache">
- <t:implementation.cpp uri="../../components/cache/.libs/libmcache"/>
+ <implementation.cpp path="../../components/cache/.libs" library="libmcache"/>
<service name="Cache">
<t:binding.atom uri="cache"/>
</service>
diff --git a/sca-cpp/trunk/test/store-scheme/currency.composite b/sca-cpp/trunk/test/store-scheme/currency.composite
deleted file mode 100644
index eaea331dbe..0000000000
--- a/sca-cpp/trunk/test/store-scheme/currency.composite
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
- targetNamespace="http://services"
- name="currency">
-
- <component name="CurrencyConverterWebService">
- <t:implementation.scheme script="currency-converter.scm"/>
- <service name="CurrencyConverter">
- <binding.http uri="currency-converter"/>
- </service>
- </component>
-
-</composite>
diff --git a/sca-cpp/trunk/test/store-scheme/store.composite b/sca-cpp/trunk/test/store-scheme/store.composite
index cc00ae2d65..64ceaa2a24 100644
--- a/sca-cpp/trunk/test/store-scheme/store.composite
+++ b/sca-cpp/trunk/test/store-scheme/store.composite
@@ -23,8 +23,7 @@
name="store">
<component name="Store">
- <!-- <t:implementation.widget location="store.html"/> -->
- <t:implementation.scheme uri="store.scm"/>
+ <t:implementation.scheme script="store.scm"/>
<service name="Widget">
<t:binding.http uri="store"/>
</service>
@@ -34,7 +33,7 @@
</component>
<component name="Catalog">
- <t:implementation.scheme uri="fruits-catalog.scm"/>
+ <t:implementation.scheme script="fruits-catalog.scm"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<t:binding.jsonrpc uri="catalog"/>
@@ -43,7 +42,7 @@
</component>
<component name="ShoppingCart">
- <t:implementation.scheme uri="shopping-cart.scm"/>
+ <t:implementation.scheme script="shopping-cart.scm"/>
<service name="ShoppingCart">
<t:binding.atom uri="shoppingCart"/>
</service>
@@ -54,14 +53,14 @@
</component>
<component name="CurrencyConverter">
- <t:implementation.scheme uri="currency-converter.scm"/>
+ <t:implementation.scheme script="currency-converter.scm"/>
<service name="CurrencyConverter">
<t:binding.jsonrpc uri="currencyConverter"/>
</service>
</component>
<component name="Cache">
- <t:implementation.cpp uri="../../components/cache/.libs/libmcache"/>
+ <implementation.cpp path="../../components/cache/.libs" library="libmcache"/>
<service name="Cache">
<t:binding.atom uri="cache"/>
</service>