diff options
Diffstat (limited to 'sca-cpp/trunk/components')
17 files changed, 299 insertions, 17 deletions
diff --git a/sca-cpp/trunk/components/Makefile.am b/sca-cpp/trunk/components/Makefile.am index 0f1cd48197..e4a0f051f0 100644 --- a/sca-cpp/trunk/components/Makefile.am +++ b/sca-cpp/trunk/components/Makefile.am @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -SUBDIRS = cache store webservice +SUBDIRS = cache chat log queue store webservice includedir = $(prefix)/include/components nobase_include_HEADERS = */*.hpp diff --git a/sca-cpp/trunk/components/chat/Makefile.am b/sca-cpp/trunk/components/chat/Makefile.am new file mode 100644 index 0000000000..09cb5fa26a --- /dev/null +++ b/sca-cpp/trunk/components/chat/Makefile.am @@ -0,0 +1,20 @@ +# 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. + +if WANT_STORE + +endif diff --git a/sca-cpp/trunk/components/chat/chat.composite b/sca-cpp/trunk/components/chat/chat.composite new file mode 100644 index 0000000000..8b797bf75b --- /dev/null +++ b/sca-cpp/trunk/components/chat/chat.composite @@ -0,0 +1,33 @@ +<?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/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://tuscany.apache.org/xmlns/sca/components" + name="chat"> + + <component name="chat"> + <implementation.cpp path=".libs" library="libchat"/> + <property name="jid">sample@apache.org</property> + <service name="chat"> + <t:binding.http uri="chat"/> + </service> + </component> + +</composite> diff --git a/sca-cpp/trunk/components/log/Makefile.am b/sca-cpp/trunk/components/log/Makefile.am new file mode 100644 index 0000000000..de5c2d1b1e --- /dev/null +++ b/sca-cpp/trunk/components/log/Makefile.am @@ -0,0 +1,17 @@ +# 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. + diff --git a/sca-cpp/trunk/components/log/log.composite b/sca-cpp/trunk/components/log/log.composite new file mode 100644 index 0000000000..2b0a557e4e --- /dev/null +++ b/sca-cpp/trunk/components/log/log.composite @@ -0,0 +1,33 @@ +<?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/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://tuscany.apache.org/xmlns/sca/components" + name="log"> + + <component name="log"> + <implementation.cpp path=".libs" library="liblog"/> + <property name="file">sample.log</property>property> + <service name="log"> + <t:binding.http uri="log"/> + </service> + </component> + +</composite> diff --git a/sca-cpp/trunk/components/queue/Makefile.am b/sca-cpp/trunk/components/queue/Makefile.am new file mode 100644 index 0000000000..b2a9b3819e --- /dev/null +++ b/sca-cpp/trunk/components/queue/Makefile.am @@ -0,0 +1,20 @@ +# 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. + +if WANT_QUEUE + +endif diff --git a/sca-cpp/trunk/components/queue/queue.composite b/sca-cpp/trunk/components/queue/queue.composite new file mode 100644 index 0000000000..c60427dcc5 --- /dev/null +++ b/sca-cpp/trunk/components/queue/queue.composite @@ -0,0 +1,46 @@ +<?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/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://tuscany.apache.org/xmlns/sca/components" + name="queue"> + + <component name="queue-sender"> + <implementation.cpp path=".libs" library="libqueue-sender"/> + <property name="uri">amqp://localhost:5672/print</property> + <service name="queue-sender"> + <t:binding.http uri="print-sender"/> + </service> + </component> + + <component name="queue-listener"> + <implementation.cpp path=".libs" library="libqueue-listener"/> + <property name="uri">amqp://localhost:5672/print</property> + <reference name="relay" target="print"/> + </component> + + <component name="print"> + <t:implementation.scheme script="print.scm"/> + <service name="print"> + <t:binding.http uri="print"/> + </service> + </component> + +</composite> diff --git a/sca-cpp/trunk/components/store/Makefile.am b/sca-cpp/trunk/components/store/Makefile.am index 9270d00bc7..09cb5fa26a 100644 --- a/sca-cpp/trunk/components/store/Makefile.am +++ b/sca-cpp/trunk/components/store/Makefile.am @@ -15,5 +15,6 @@ # specific language governing permissions and limitations # under the License. -INCLUDES = -I. -I$(top_builddir)/kernel -I${LIBXML2_INCLUDE} -I${APR_INCLUDE} +if WANT_STORE +endif diff --git a/sca-cpp/trunk/components/store/store.composite b/sca-cpp/trunk/components/store/store.composite new file mode 100644 index 0000000000..ccfd61fc4d --- /dev/null +++ b/sca-cpp/trunk/components/store/store.composite @@ -0,0 +1,32 @@ +<?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/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://tuscany.apache.org/xmlns/sca/components" + name="store"> + + <component name="store"> + <implementation.cpp path=".libs" library="libstore"/> + <service name="store"> + <t:binding.http uri="store"/> + </service> + </component> + +</composite> diff --git a/sca-cpp/trunk/components/webservice/Makefile.am b/sca-cpp/trunk/components/webservice/Makefile.am index fd85cf4cb0..8d6a9a7879 100644 --- a/sca-cpp/trunk/components/webservice/Makefile.am +++ b/sca-cpp/trunk/components/webservice/Makefile.am @@ -22,10 +22,13 @@ noinst_PROGRAMS = axiom-test axis2-test client-test INCLUDES = -I${AXIS2C_INCLUDE} compdir=$(prefix)/components/webservice -comp_LTLIBRARIES = libwebservice.la +comp_LTLIBRARIES = libwebservice-client.la libwebservice-listener.la -libwebservice_la_SOURCES = webservice.cpp -libwebservice_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine +libwebservice_client_la_SOURCES = webservice-client.cpp +libwebservice_client_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine + +libwebservice_listener_la_SOURCES = webservice-listener.cpp +libwebservice_listener_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine axiom_test_SOURCES = axiom-test.cpp axiom_test_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine diff --git a/sca-cpp/trunk/components/webservice/axiom-test.cpp b/sca-cpp/trunk/components/webservice/axiom-test.cpp index c52183ea9b..a3ab8e7e8f 100644 --- a/sca-cpp/trunk/components/webservice/axiom-test.cpp +++ b/sca-cpp/trunk/components/webservice/axiom-test.cpp @@ -31,7 +31,7 @@ #include "monad.hpp" #include "value.hpp" #include "perf.hpp" -#include "webservice.hpp" +#include "axis2.hpp" namespace tuscany { namespace webservice { diff --git a/sca-cpp/trunk/components/webservice/axis2-test.cpp b/sca-cpp/trunk/components/webservice/axis2-test.cpp index 8ab21bee29..d7c2f3b671 100644 --- a/sca-cpp/trunk/components/webservice/axis2-test.cpp +++ b/sca-cpp/trunk/components/webservice/axis2-test.cpp @@ -31,7 +31,7 @@ #include "monad.hpp" #include "value.hpp" #include "perf.hpp" -#include "webservice.hpp" +#include "axis2.hpp" namespace tuscany { namespace webservice { diff --git a/sca-cpp/trunk/components/webservice/webservice.hpp b/sca-cpp/trunk/components/webservice/axis2.hpp index ba13b9ad7f..ba13b9ad7f 100644 --- a/sca-cpp/trunk/components/webservice/webservice.hpp +++ b/sca-cpp/trunk/components/webservice/axis2.hpp diff --git a/sca-cpp/trunk/components/webservice/client-test.cpp b/sca-cpp/trunk/components/webservice/client-test.cpp index 6e63c83ecb..7c1cd601e0 100644 --- a/sca-cpp/trunk/components/webservice/client-test.cpp +++ b/sca-cpp/trunk/components/webservice/client-test.cpp @@ -36,7 +36,6 @@ namespace tuscany { namespace webservice { -const string url("http://localhost:8090/webservice"); bool testEval() { http::CURLSession cs; @@ -47,7 +46,7 @@ bool testEval() { + (list<value>() + "@xmlns:ns1" + string("http://ws.apache.org/axis2/services/echo")) + (list<value>() + "text" + string("Hello World!"))); - const failable<value> rval = http::evalExpr(mklist<value>(func, arg), url, cs); + const failable<value> rval = http::evalExpr(mklist<value>(func, arg), "http://localhost:8090/echo-client", cs); assert(hasContent(rval)); const list<value> r = mklist<value>( diff --git a/sca-cpp/trunk/components/webservice/webservice.cpp b/sca-cpp/trunk/components/webservice/webservice-client.cpp index 6427756b40..cc3a15c734 100644 --- a/sca-cpp/trunk/components/webservice/webservice.cpp +++ b/sca-cpp/trunk/components/webservice/webservice-client.cpp @@ -20,7 +20,7 @@ /* $Rev$ $Date$ */ /** - * Web service component implementation. + * Web service client component implementation. */ #include "string.hpp" @@ -28,13 +28,13 @@ #include "list.hpp" #include "value.hpp" #include "monad.hpp" -#include "webservice.hpp" +#include "axis2.hpp" namespace tuscany { namespace webservice { /** - * Apply a Web service function / operation using Axis2. + * Apply a function provided by a remote Web service using Axis2. */ const failable<value> apply(const value& func, const list<value>& params) { const Axis2Context ax; diff --git a/sca-cpp/trunk/components/webservice/webservice-listener.cpp b/sca-cpp/trunk/components/webservice/webservice-listener.cpp new file mode 100644 index 0000000000..495eb3478c --- /dev/null +++ b/sca-cpp/trunk/components/webservice/webservice-listener.cpp @@ -0,0 +1,63 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +/** + * Web service listener component implementation. + */ + +#include "string.hpp" +#include "function.hpp" +#include "list.hpp" +#include "value.hpp" +#include "monad.hpp" +#include "../../modules/http/httpd.hpp" +#include "axis2.hpp" + +namespace tuscany { +namespace webservice { + +/** + * Handle an HTTP request. + */ +const failable<value> handle(const list<value>& params) { + + // Extract HTTPD request and relay reference + unused request_rec* r = httpd::request(car(params)); + const lambda<value(const list<value>&)> relay = cadr(params); + + //TODO Hook Axis2/C server module here + + return value(true); +} + +} +} + +extern "C" { + +const tuscany::value apply(const tuscany::list<tuscany::value>& params) { + const tuscany::value func(car(params)); + if (func == "handle") + return tuscany::webservice::handle(cdr(params)); + return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func); +} + +} diff --git a/sca-cpp/trunk/components/webservice/webservice.composite b/sca-cpp/trunk/components/webservice/webservice.composite index ebb007b37e..bbfc926e2e 100644 --- a/sca-cpp/trunk/components/webservice/webservice.composite +++ b/sca-cpp/trunk/components/webservice/webservice.composite @@ -20,13 +20,28 @@ <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://tuscany.apache.org/xmlns/sca/components" - name="webservice"> + name="webservice-client"> - <component name="webservice"> - <implementation.cpp path=".libs" library="libwebservice"/> + <component name="webservice-client"> + <implementation.cpp path=".libs" library="libwebservice-client"/> <property name="uri">http://localhost:9090/axis2/services/echo</property> - <service name="webservice"> - <t:binding.http uri="webservice"/> + <service name="webservice-client"> + <t:binding.jsonrpc uri="echo-client"/> + </service> + </component> + + <component name="webservice-listener"> + <implementation.cpp path=".libs" library="libwebservice-listener"/> + <service name="webservice-listener"> + <t:binding.http uri="echo-listener"/> + </service> + <reference name="relay" target="echo"/> + </component> + + <component name="echo"> + <t:implementation.scheme script="echo.scm"/> + <service name="echo"> + <t:binding.jsonrpc uri="echo"/> </service> </component> |