From 86b1de85536e93c59a25702a5a2d3e384202ffd2 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Tue, 11 Dec 2012 04:03:29 +0000 Subject: More changes to port to C++11, adjust to use the new JSON support, and cleanup rest of the modules. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1419987 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/modules/java/mod-java.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'sca-cpp/trunk/modules/java/mod-java.cpp') diff --git a/sca-cpp/trunk/modules/java/mod-java.cpp b/sca-cpp/trunk/modules/java/mod-java.cpp index d96861cc6d..61711db9f4 100644 --- a/sca-cpp/trunk/modules/java/mod-java.cpp +++ b/sca-cpp/trunk/modules/java/mod-java.cpp @@ -40,32 +40,25 @@ namespace modeval { /** * Apply a lifecycle start or restart event. */ -struct javaLifecycle { - javaLifecycle(java::JavaRuntime& jr) : jr(jr) { - } - const value operator()(const list& params) const { - const value func = car(params); - if (func == "javaRuntime") - return (gc_ptr)(value*)(void*)&jr; - return lambda&)>(); - } - java::JavaRuntime& jr; -}; - const value applyLifecycle(unused const list& params) { // Create a Java runtime - java::JavaRuntime& jr = *(new (gc_new()) java::JavaRuntime()); + const java::JavaRuntime& jr = *(new (gc_new()) java::JavaRuntime()); // Return the function to invoke on subsequent events - return failable(lambda&)>(javaLifecycle(jr))); + return failable(lvvlambda([&jr](const list& params) -> const value { + const value func = car(params); + if (func == "javaRuntime") + return (gc_ptr)(value*)(void*)&jr; + return lvvlambda(); + })); } /** * Evaluate a Java component implementation and convert it to an applicable * lambda function. */ -const failable&)> > evalImplementation(const string& path, const value& impl, const list& px, const lambda&)>& lifecycle) { +const failable evalImplementation(const string& path, const value& impl, const list& px, const lvvlambda& lifecycle) { const string itype(elementName(impl)); if (contains(itype, ".java")) { const void* p = (gc_ptr)lifecycle(mklist("javaRuntime")); @@ -74,8 +67,8 @@ const failable&)> > evalImplementation(const stri if (contains(itype, ".cpp")) return modcpp::evalImplementation(path, impl, px); if (contains(itype, ".widget")) - return mkfailure&)> >(string("Unsupported implementation type: ") + itype, -1, false); - return mkfailure&)> >(string("Unsupported implementation type: ") + itype); + return mkfailure(string("Unsupported implementation type: ") + itype, -1, false); + return mkfailure(string("Unsupported implementation type: ") + itype); } } -- cgit v1.2.3