From 373b126bd091424d3871cd78787977997865d760 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Tue, 30 Nov 2010 16:01:03 +0000 Subject: [PATCH 001/174] Open up this utility so it can be used from the async implementation provider git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1040594 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/sample/Xutil.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java b/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java index ce89f9dd8c..264ce7fc85 100644 --- a/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java +++ b/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java @@ -44,22 +44,22 @@ /** * Just for fun, a little bit of magic code and utility functions to help work with XML DOM. */ -class Xutil { - interface NodeBuilder { +public class Xutil { + public interface NodeBuilder { Node build(Document doc); } /** * Convert a name and a list of children to a document element. */ - static Element xdom(String ns, String name, final NodeBuilder... nodes) { + public static Element xdom(String ns, String name, final NodeBuilder... nodes) { return (Element)elem(ns, name, nodes).build(db.newDocument()); } /** * Convert a name and children to an element. */ - static NodeBuilder elem(final String uri, final String n, final NodeBuilder... nodes) { + public static NodeBuilder elem(final String uri, final String n, final NodeBuilder... nodes) { return new NodeBuilder() { public Node build(Document doc) { final Element e = doc.createElementNS(uri, n); @@ -70,14 +70,14 @@ public Node build(Document doc) { }; } - static NodeBuilder elem(final String n, final NodeBuilder... nodes) { + public static NodeBuilder elem(final String n, final NodeBuilder... nodes) { return elem(null, n, nodes); } /** * Convert a string to a text element. */ - static NodeBuilder text(final String t) { + public static NodeBuilder text(final String t) { return new NodeBuilder() { public Node build(final Document doc) { return doc.createTextNode(t); @@ -100,7 +100,7 @@ private static DocumentBuilder db() { */ static TransformerFactory trf = TransformerFactory.newInstance(); - static String xml(final Node node) { + public static String xml(final Node node) { try { final StreamResult r = new StreamResult(new StringWriter()); trf.newTransformer().transform(new DOMSource(node), r); @@ -115,7 +115,7 @@ static String xml(final Node node) { */ private static XPathFactory xpf = XPathFactory.newInstance(); - static String xpath(final String expr, final Node node) { + public static String xpath(final String expr, final Node node) { final XPath xp = xpf.newXPath(); try { return (String)xp.evaluate(expr, node, XPathConstants.STRING); @@ -141,7 +141,7 @@ interface Reducer { T reduce(final T accum, final Element e); } - static Reducer print = new Reducer() { + public static Reducer print = new Reducer() { public String reduce(String accum, Element e) { return accum + e.getTextContent(); } @@ -150,7 +150,7 @@ public String reduce(String accum, Element e) { /** * Apply a mapper to a list of elements. */ - static List xmap(final Mapper f, final Iterable l) { + public static List xmap(final Mapper f, final Iterable l) { final List v = new ArrayList(); for(Element e: l) v.add(f.map(e)); @@ -160,7 +160,7 @@ static List xmap(final Mapper f, final Iterable l) { /** * Apply a filter to a list of elements. */ - static List xfilter(final Mapper f, final Iterable l) { + public static List xfilter(final Mapper f, final Iterable l) { final List v = new ArrayList(); for(Element e: l) if(f.map(e)) @@ -171,7 +171,7 @@ static List xfilter(final Mapper f, final Iterable l) /** * Perform a reduction over a list of elements. */ - static T xreduce(final Reducer f, final T initial, final Iterable l) { + public static T xreduce(final Reducer f, final T initial, final Iterable l) { T accum = initial; for(Element e: l) accum = f.reduce(accum, e); @@ -181,7 +181,7 @@ static T xreduce(final Reducer f, final T initial, final Iterable select(final String name) { + public static Mapper select(final String name) { return new Mapper() { public Boolean map(Element e) { return name.equals(e.getLocalName()); @@ -192,7 +192,7 @@ public Boolean map(Element e) { /** * Return the child elements of a node. */ - static Iterable elems(final Node parent) { + public static Iterable elems(final Node parent) { final List l = new ArrayList(); for (Node n: children(parent)) if (n instanceof Element) From d389dff972295d34bc6bfccc020565806291aa7a Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Tue, 30 Nov 2010 16:02:31 +0000 Subject: [PATCH 002/174] Add code to process the async response git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1040598 13f79535-47bb-0310-9956-ffa450edef68 --- .../sampleasync/impl/SampleAsyncInvoker.java | 68 +++++++++++++++++++ .../sampleasync/impl/SampleAsyncProvider.java | 13 +++- .../sampleasync/impl/SampleWSDLProxy.java | 17 +++-- .../impl/UpperSampleAsyncReferenceImpl.java | 32 +++++++-- 4 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java new file mode 100644 index 0000000000..74ac0467cf --- /dev/null +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java @@ -0,0 +1,68 @@ +/* + * 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. + */ + +package sampleasync.impl; + +import java.lang.reflect.Method; +import java.util.Map; + +import org.apache.tuscany.sca.core.invocation.Constants; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.w3c.dom.Element; + +/** + * Invoker for Sample components that implement a WSDL interface using a generic + * call method. + * + * @version $Rev$ $Date$ + */ +class SampleAsyncInvoker implements Invoker { + final String name; + final Object instance; + final Operation op; + Map asyncMessageMap; + + SampleAsyncInvoker(Map asyncMessageMap, final Operation op, final Class clazz, final Object instance) { + this.asyncMessageMap = asyncMessageMap; + this.name = op.getName(); + this.instance = instance; + this.op = op; + } + + public Message invoke(final Message msg) { + try { + String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); + String forwardOpName = (String)asyncMessageMap.get(messageID); + + // process the async response + Object reponse = ((Object[])msg.getBody())[0]; + + //Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); + Method method = instance.getClass().getMethod(forwardOpName + "Callback", String.class); + method.invoke(instance, reponse); + } catch(Exception e) { + e.printStackTrace(); + msg.setFaultBody(e.getCause()); + } + return msg; + } +} diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java index 9538a88a67..bc56877469 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java @@ -20,6 +20,8 @@ package sampleasync.impl; import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.core.ExtensionPointRegistry; @@ -30,7 +32,7 @@ import org.apache.tuscany.sca.interfacedef.java.JavaOperation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -39,12 +41,13 @@ * * @version $Rev$ $Date$ */ -class SampleAsyncProvider implements ImplementationProvider { +class SampleAsyncProvider implements ImplementationAsyncProvider { final RuntimeComponent comp; final SampleAsyncImplementation impl; final ProxyFactory pxf; final ExtensionPointRegistry ep; Object instance; + Map asyncMessageMap = new HashMap(); SampleAsyncProvider(final RuntimeComponent comp, final SampleAsyncImplementation impl, ProxyFactory pf, ExtensionPointRegistry ep) { this.comp = comp; @@ -66,7 +69,7 @@ public void start() { if(i instanceof JavaInterface) f.set(instance, pxf.createProxy(comp.getComponentContext().getServiceReference(f.getType(), r.getName()))); else - f.set(instance, new SampleWSDLProxy(r.getEndpointReferences().get(0), i, ep)); + f.set(instance, new SampleWSDLProxy(asyncMessageMap, r.getEndpointReferences().get(0), i, ep)); } } catch(Exception e) { throw new RuntimeException(e); @@ -91,4 +94,8 @@ public Invoker createInvoker(final RuntimeComponentService s, final Operation op throw new RuntimeException(e); } } + + public Invoker createAsyncInvoker(RuntimeComponentService service, Operation operation) { + return new SampleAsyncInvoker(asyncMessageMap, operation, impl.clazz, instance); + } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java index 19d518e44c..55a4d6b488 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java @@ -43,8 +43,10 @@ class SampleWSDLProxy implements WSDLReference { final Map ops; final ExtensionPointRegistry ep; final MessageFactory mf; + Map asyncMessageMap; - SampleWSDLProxy(EndpointReference epr, Interface wi, ExtensionPointRegistry ep) { + SampleWSDLProxy(Map asyncMessageMap, EndpointReference epr, Interface wi, ExtensionPointRegistry ep) { + this.asyncMessageMap = asyncMessageMap; this.ep = ep; mf = ep.getExtensionPoint(MessageFactory.class); @@ -68,15 +70,18 @@ public Element call(String op, Element e) { public void callAsync(String op, Element e) { // Asynchronously invoke the named operation on the endpoint reference Message message = mf.createMessage(); - message.setBody(message); + message.setBody(new Object[]{e}); // We could add implementation specific headers here if required - - repr.invokeAsync(ops.get(op), message); - - String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); + try { + repr.invokeAsync(ops.get(op), message); + } catch (Throwable ex) { + ex.printStackTrace(); + } // save the message id ready for when we process the response + String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); + asyncMessageMap.put(messageID, op); } } diff --git a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java index 286e619326..d3e91c7f18 100644 --- a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java +++ b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java @@ -20,6 +20,12 @@ package sampleasync.impl; import static java.lang.System.out; +import static sample.Xutil.elem; +import static sample.Xutil.text; +import static sample.Xutil.xdom; + +import org.w3c.dom.Element; + import sample.api.Java; import sample.api.WSDL; import sample.api.WSDLReference; @@ -35,11 +41,25 @@ public class UpperSampleAsyncReferenceImpl { @WSDL("http://sample/upper#Upper") WSDLReference upper; + String response; public String upper(String s) { out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); - upper.callAsync("upper", null); - return null; + + // TODO - I'm passing in the non-wrapped version of the parameter + // here which doesn't seem right. If I pass in the wrapped + // version then the databinding won't unwrap on the reference + // side as it thinks the target Java interface is bare? + final Element ureq = xdom("http://sample/upper", "s", text(s)); + upper.callAsync("upper", ureq); + + try { + Thread.sleep(500); + } catch (Exception ex) { + // do nothing + } + + return response; } /** @@ -47,7 +67,11 @@ public String upper(String s) { * async callback arrives at an operation named * operationName + Callback */ - public void upperCallback(String s) { - out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + s + ")"); + // TODO - I think this should take and Element parameter but the response + // handler interface is a Java interface at the moment and so no + // transformation takes place automatically. + public void upperCallback(String response) { + out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response + ")"); + this.response = response; } } From 34df57fe31727372b5a22c530bd6a0bb929e91a5 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Tue, 30 Nov 2010 16:10:22 +0000 Subject: [PATCH 003/174] Fix typo in comment git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1040607 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java index 9daaad8737..c60a497bad 100644 --- a/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java +++ b/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java @@ -768,7 +768,7 @@ private void setSingleAutoWireTarget(ComponentReference reference) { * to present the callback services and references. These are identifiable as their names * will match the name of the forward reference or service to which they relate. In the general * endpoint reference and endpoint processing we will have created endpoints and endpoint references - * for these callback services and references. We now need to related forward enspoint references with + * for these callback services and references. We now need to related forward endpoint references with * callback endpoints and forward endpoints with callback endpoint references. Here's the model... * * Client Component Target Component From 3ad91d96cca5a24de1c7a1c63d3f787d6b1ae06a Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 1 Dec 2010 11:14:32 +0000 Subject: [PATCH 004/174] Add tests dependency to see if that fixes the build problem on hudson solaris2 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1040950 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/java-caa/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/compliance-tests/java-caa/pom.xml b/testing/compliance-tests/java-caa/pom.xml index 14b3050ca8..bd84498a0c 100644 --- a/testing/compliance-tests/java-caa/pom.xml +++ b/testing/compliance-tests/java-caa/pom.xml @@ -32,11 +32,11 @@ - + org.apache.tuscany.sca From 80c0be17bc432201f41038242d0d3f7008d89fc1 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Wed, 1 Dec 2010 17:08:08 +0000 Subject: [PATCH 005/174] Make it clear the this invoker is for handling async responses. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041080 13f79535-47bb-0310-9956-ffa450edef68 --- .../sampleasync/impl/SampleAsyncProvider.java | 4 +- .../impl/SampleAsyncResponseInvoker.java | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java index bc56877469..80193277da 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java @@ -95,7 +95,7 @@ public Invoker createInvoker(final RuntimeComponentService s, final Operation op } } - public Invoker createAsyncInvoker(RuntimeComponentService service, Operation operation) { - return new SampleAsyncInvoker(asyncMessageMap, operation, impl.clazz, instance); + public Invoker createAsyncResponseInvoker(RuntimeComponentService service, Operation operation) { + return new SampleAsyncResponseInvoker(asyncMessageMap, operation, impl.clazz, instance); } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java new file mode 100644 index 0000000000..3e7e0f6a51 --- /dev/null +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java @@ -0,0 +1,68 @@ +/* + * 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. + */ + +package sampleasync.impl; + +import java.lang.reflect.Method; +import java.util.Map; + +import org.apache.tuscany.sca.core.invocation.Constants; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.w3c.dom.Element; + +/** + * Invoker for Sample components that implement a WSDL interface using a generic + * call method. + * + * @version $Rev$ $Date$ + */ +class SampleAsyncResponseInvoker implements Invoker { + final String name; + final Object instance; + final Operation op; + Map asyncMessageMap; + + SampleAsyncResponseInvoker(Map asyncMessageMap, final Operation op, final Class clazz, final Object instance) { + this.asyncMessageMap = asyncMessageMap; + this.name = op.getName(); + this.instance = instance; + this.op = op; + } + + public Message invoke(final Message msg) { + try { + String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); + String forwardOpName = (String)asyncMessageMap.get(messageID); + + // process the async response + Object reponse = ((Object[])msg.getBody())[0]; + + //Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); + Method method = instance.getClass().getMethod(forwardOpName + "Callback", String.class); + method.invoke(instance, reponse); + } catch(Exception e) { + e.printStackTrace(); + msg.setFaultBody(e.getCause()); + } + return msg; + } +} From d248e975ac53c6fa817afc4d64b797ed62d557b2 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Wed, 1 Dec 2010 17:15:58 +0000 Subject: [PATCH 006/174] Correct the implementation of the service to expect/produce elements git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041088 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/UpperSampleAsyncServiceImpl.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java index 271517c115..41a85e44a0 100644 --- a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java +++ b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java @@ -20,6 +20,11 @@ package sampleasync.impl; import static java.lang.System.out; +import static sample.Xutil.elem; +import static sample.Xutil.text; +import static sample.Xutil.xdom; + +import org.w3c.dom.Element; import sample.api.WSDL; @@ -31,8 +36,10 @@ @WSDL("http://sample/upper#Upper") public class UpperSampleAsyncServiceImpl { - public String upper(String s) { - out.println("UpperSampleAsyncServiceImpl.upper(" + s + ")"); - return s.toUpperCase(); + public Element call(String op, Element e) { + String input = e.getTextContent(); + out.println("UpperSampleAsyncServiceImpl.upper(" + input + ")"); + String output = input.toUpperCase(); + return xdom("http://sample/upper", "upperResponse", elem("result", text(output))); } } From b3cf82eca233145b4fac35c9bd2b75637edb90aa Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Wed, 1 Dec 2010 17:17:56 +0000 Subject: [PATCH 007/174] Make space for testing native as well as generic async support in bindings git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041090 13f79535-47bb-0310-9956-ffa450edef68 --- .../sampleasync/impl/SampleAsyncInvoker.java | 68 ------------------- ...e.java => SampleGenericAsyncTestCase.java} | 4 +- .../impl/SampleNativeAsyncTestCase.java | 63 +++++++++++++++++ ...c.composite => testgenericasync.composite} | 0 .../test/resources/testnativeasync.composite | 35 ++++++++++ 5 files changed, 100 insertions(+), 70 deletions(-) delete mode 100644 unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java rename unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/{SampleAsyncReferenceTestCase.java => SampleGenericAsyncTestCase.java} (92%) create mode 100644 unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java rename unreleased/samples/implementation-sample-async/src/test/resources/{testasync.composite => testgenericasync.composite} (100%) create mode 100644 unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java deleted file mode 100644 index 74ac0467cf..0000000000 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncInvoker.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -package sampleasync.impl; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.apache.tuscany.sca.core.invocation.Constants; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.w3c.dom.Element; - -/** - * Invoker for Sample components that implement a WSDL interface using a generic - * call method. - * - * @version $Rev$ $Date$ - */ -class SampleAsyncInvoker implements Invoker { - final String name; - final Object instance; - final Operation op; - Map asyncMessageMap; - - SampleAsyncInvoker(Map asyncMessageMap, final Operation op, final Class clazz, final Object instance) { - this.asyncMessageMap = asyncMessageMap; - this.name = op.getName(); - this.instance = instance; - this.op = op; - } - - public Message invoke(final Message msg) { - try { - String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); - String forwardOpName = (String)asyncMessageMap.get(messageID); - - // process the async response - Object reponse = ((Object[])msg.getBody())[0]; - - //Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); - Method method = instance.getClass().getMethod(forwardOpName + "Callback", String.class); - method.invoke(instance, reponse); - } catch(Exception e) { - e.printStackTrace(); - msg.setFaultBody(e.getCause()); - } - return msg; - } -} diff --git a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleAsyncReferenceTestCase.java b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java similarity index 92% rename from unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleAsyncReferenceTestCase.java rename to unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java index 6511f3ddf3..36fdb76424 100644 --- a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleAsyncReferenceTestCase.java +++ b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java @@ -36,13 +36,13 @@ * * @version $Rev$ $Date$ */ -public class SampleAsyncReferenceTestCase { +public class SampleGenericAsyncTestCase { static Node node; @BeforeClass public static void setUp() throws Exception { final NodeFactory nf = NodeFactory.newInstance(); - String here = SampleAsyncReferenceTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); + String here = SampleGenericAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); node = nf.createNode(new Contribution("test", here)); node.start(); } diff --git a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java new file mode 100644 index 0000000000..bc35a637d1 --- /dev/null +++ b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java @@ -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. + */ + +package sampleasync.impl; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import sampleasync.Upper; + +/** + * Test how to run an SCA contribution containing a test composite on a + * Tuscany runtime node. + * + * @version $Rev$ $Date$ + */ +public class SampleNativeAsyncTestCase { + static Node node; + + @BeforeClass + public static void setUp() throws Exception { + final NodeFactory nf = NodeFactory.newInstance(); + String here = SampleNativeAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); + node = nf.createNode(new Contribution("test", here)); + node.start(); + } + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testReference() { + System.out.println("SampleNaiveAsyncTestCase.testReference"); + Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference"); + final String r = upper.upper("async"); + System.out.println(r); + assertEquals("ASYNC", r); + } +} diff --git a/unreleased/samples/implementation-sample-async/src/test/resources/testasync.composite b/unreleased/samples/implementation-sample-async/src/test/resources/testgenericasync.composite similarity index 100% rename from unreleased/samples/implementation-sample-async/src/test/resources/testasync.composite rename to unreleased/samples/implementation-sample-async/src/test/resources/testgenericasync.composite diff --git a/unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite b/unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite new file mode 100644 index 0000000000..f9c077e272 --- /dev/null +++ b/unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + From 4187e047e21f1f75bd290cbda579ad8df1b2d1d0 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Thu, 2 Dec 2010 07:37:39 +0000 Subject: [PATCH 008/174] Start bringing up eightball app in trunk git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041296 13f79535-47bb-0310-9956-ffa450edef68 --- .../applications/eightball-demo/README.txt | 55 +++++++ .../eightball-demo/eightball-process/pom.xml | 109 ++++++++++++++ .../src/main/java/demo/EightBall.java | 28 ++++ .../src/main/java/demo/EightBallProcess.java | 42 ++++++ .../src/main/java/demo/Translator.java | 29 ++++ .../resources/META-INF/sca-contribution.xml | 23 +++ .../resources/eightball-process.composite | 31 ++++ .../eightball-demo/eightball-webapp/pom.xml | 135 ++++++++++++++++++ .../src/main/java/demo/EightBall.java | 28 ++++ .../src/main/java/demo/EightBallServlet.java | 52 +++++++ .../src/main/webapp/WEB-INF/web.composite | 30 ++++ .../src/main/webapp/WEB-INF/web.xml | 41 ++++++ .../src/main/webapp/eightball.html | 48 +++++++ .../eightball-demo/eightball/pom.xml | 109 ++++++++++++++ .../src/main/java/demo/EightBall.java | 28 ++++ .../src/main/java/demo/EightBallImpl.java | 62 ++++++++ .../resources/META-INF/sca-contribution.xml | 23 +++ .../src/main/resources/eightball.composite | 29 ++++ .../eightball-demo/translator/pom.xml | 109 ++++++++++++++ .../src/main/java/demo/Translator.java | 29 ++++ .../src/main/java/demo/TranslatorImpl.java | 95 ++++++++++++ .../resources/META-INF/sca-contribution.xml | 23 +++ .../src/main/resources/translator.composite | 29 ++++ 23 files changed, 1187 insertions(+) create mode 100644 samples/applications/eightball-demo/README.txt create mode 100644 samples/applications/eightball-demo/eightball-process/pom.xml create mode 100644 samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBall.java create mode 100644 samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBallProcess.java create mode 100644 samples/applications/eightball-demo/eightball-process/src/main/java/demo/Translator.java create mode 100644 samples/applications/eightball-demo/eightball-process/src/main/resources/META-INF/sca-contribution.xml create mode 100644 samples/applications/eightball-demo/eightball-process/src/main/resources/eightball-process.composite create mode 100644 samples/applications/eightball-demo/eightball-webapp/pom.xml create mode 100644 samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java create mode 100644 samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java create mode 100644 samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite create mode 100644 samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html create mode 100644 samples/applications/eightball-demo/eightball/pom.xml create mode 100644 samples/applications/eightball-demo/eightball/src/main/java/demo/EightBall.java create mode 100644 samples/applications/eightball-demo/eightball/src/main/java/demo/EightBallImpl.java create mode 100644 samples/applications/eightball-demo/eightball/src/main/resources/META-INF/sca-contribution.xml create mode 100644 samples/applications/eightball-demo/eightball/src/main/resources/eightball.composite create mode 100644 samples/applications/eightball-demo/translator/pom.xml create mode 100644 samples/applications/eightball-demo/translator/src/main/java/demo/Translator.java create mode 100644 samples/applications/eightball-demo/translator/src/main/java/demo/TranslatorImpl.java create mode 100644 samples/applications/eightball-demo/translator/src/main/resources/META-INF/sca-contribution.xml create mode 100644 samples/applications/eightball-demo/translator/src/main/resources/translator.composite diff --git a/samples/applications/eightball-demo/README.txt b/samples/applications/eightball-demo/README.txt new file mode 100644 index 0000000000..5ab7f1ff37 --- /dev/null +++ b/samples/applications/eightball-demo/README.txt @@ -0,0 +1,55 @@ +Eight Ball Demo +--------------- + +The Eight Ball Demo is a lighthearted application based on the Doug Tidwell's Magic 8-Ball demo (http://www.ibm.com/developerworks/webservices/library/ws-eight/) to demonstrate the Tuscany distributed domain support. + +There is a eightball.jar SCA contribution which has a Java component that answers yes-no questions, and an eightball-test.jar which is a simple test harness to invoke the EightBall service from the command line. To make the demo more interesting the eightball gives the answers in German. + +There is a translator.jar and contribution which has a component that can translate phrases between German and English, and a translator-test.jar for testing that at the command line. Presently the translator is just hardcoded with the phrases the EIghtball uses, later it would be good to enhance the translator to use one of Tuscanys bindings to call one of the remote translaotr services available on the internet. + +There is a eightball-process.jar contribution which has a Java component which uses the translator and eightball services to translate phrases from English to German, ask the eightball the question, and then translate the answer from German to English. Ideally this would be rewritten using BPEL. And an associated eightball-process-test.jar to test it at the command line. + +And finally there's an eightball-webapp which has a simple webapp to invoke all that from a web gui. Presently this doesn't embed the Tuscany runtime so needs to run on a Tomact with the tuscany.war distribution installed. + + + +When the SCAClient API is updated to work with the distributed domain it would be good to simplify all the *-test.jar contributions to show using the SCAClient APIs. + +If you've a recent 2.x full build you can run the contributions using the tuscany.bat script in the 2.x distribution (which you can find in distribution\all\target\apache-tuscany-sca-all-2.0-SNAPSHOT-dir\tuscany-sca-2.0-SNAPSHOT). Its easiest if you add that to your environment path, eg: + + set PATH=\Tuscany\SVN\2.x-trunk\distribution\all\target\apache-tuscany-sca-all-2.0-SNAPSHOT-dir\tuscany-sca-2.0-SNAPSHOT\bin;%PATH% + +then at a command prompt: + + tuscany tribes:eightballDomain eightball.jar + +and at another command prompt: + + tuscany tribes:eightballDomain eightball-test.jar + +That uses multicast, running on separate machines you need point one node at another, so + + tuscany tribes:eightballDomain eightball.jar + +then in the console log look for the IP in the line: + + INFO: Receiver Server Socket bound to:/9.164.186.49:4000 + +and start the test node using that ip:port, eg: + + tuscany "tribes:eightballDomain?routes=9.164.186.49:4000" eightball-test.jar + +(Note that you must have quotes around the config uri) + + + + + + + + + + + + + diff --git a/samples/applications/eightball-demo/eightball-process/pom.xml b/samples/applications/eightball-demo/eightball-process/pom.xml new file mode 100644 index 0000000000..38b52e183d --- /dev/null +++ b/samples/applications/eightball-demo/eightball-process/pom.xml @@ -0,0 +1,109 @@ + + + + + 4.0.0 + demo + eightball-process + jar + 1.0-SNAPSHOT + + quickstart + + + + + + org.apache.tuscany.sca + tuscany-sca-api + ${tuscany.version} + provided + + + + + junit + junit + 4.5 + test + + + + + install + ${artifactId} + + + false + src/main/resources + + + false + src/main/java + + ** + + + **/*.java + + + + + + false + src/test/java + + ** + + + **/*.java + + + + + + true + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + true + true + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + + + org.apache.tuscany.maven.plugins + maven-tuscany-plugin + + + + + 2.0-SNAPSHOT + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBall.java b/samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBall.java new file mode 100644 index 0000000000..88f8b67abb --- /dev/null +++ b/samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBall.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +package demo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface EightBall { + + String askQuestion(String question); + +} diff --git a/samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBallProcess.java b/samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBallProcess.java new file mode 100644 index 0000000000..7c12c1c3ea --- /dev/null +++ b/samples/applications/eightball-demo/eightball-process/src/main/java/demo/EightBallProcess.java @@ -0,0 +1,42 @@ +/* + * 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. + */ +package demo; + +import org.oasisopen.sca.annotation.Reference; + +public class EightBallProcess implements EightBall { + + @Reference + public EightBall eightball; + + @Reference + public Translator translator; + + public String askQuestion(String question) { + System.out.println("Processing " + question); + String germanQuestion = translator.toGerman(question); + System.out.println("Processing " + germanQuestion); + String germanAnswer = eightball.askQuestion(germanQuestion); + System.out.println("Processing " + germanAnswer); + String englishAnswer = translator.toEnglish(germanAnswer); + System.out.println("Processing " + englishAnswer); + return englishAnswer; + } + +} diff --git a/samples/applications/eightball-demo/eightball-process/src/main/java/demo/Translator.java b/samples/applications/eightball-demo/eightball-process/src/main/java/demo/Translator.java new file mode 100644 index 0000000000..11070032d1 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-process/src/main/java/demo/Translator.java @@ -0,0 +1,29 @@ +/* + * 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. + */ +package demo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Translator { + + String toEnglish(String phrase); + String toGerman(String phrase); + +} diff --git a/samples/applications/eightball-demo/eightball-process/src/main/resources/META-INF/sca-contribution.xml b/samples/applications/eightball-demo/eightball-process/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e36a08dfe5 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-process/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/eightball-process/src/main/resources/eightball-process.composite b/samples/applications/eightball-demo/eightball-process/src/main/resources/eightball-process.composite new file mode 100644 index 0000000000..1e3c19f9f4 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-process/src/main/resources/eightball-process.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/samples/applications/eightball-demo/eightball-webapp/pom.xml b/samples/applications/eightball-demo/eightball-webapp/pom.xml new file mode 100644 index 0000000000..6287de1a7e --- /dev/null +++ b/samples/applications/eightball-demo/eightball-webapp/pom.xml @@ -0,0 +1,135 @@ + + + + + 4.0.0 + demo + eightball-webapp + war + 1.0-SNAPSHOT + quickstart + + + + + org.apache.tuscany.sca + tuscany-sca-api + ${tuscany.version} + provided + + + + + + + junit + junit + 4.5 + test + + + + + org.mortbay.jetty + jetty + ${jetty.version} + provided + + + org.mortbay.jetty + jetty-util + ${jetty.version} + provided + + + org.mortbay.jetty + jetty-management + ${jetty.version} + provided + + + + install + eightball-webapp + + + false + src/main/resources + + + false + src/main/java + + ** + + + **/*.java + + + + + + false + src/test/java + + ** + + + **/*.java + + + + + + true + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + true + true + + + + org.mortbay.jetty + maven-jetty-plugin + ${jetty.version} + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + + + + + 2.0-SNAPSHOT + 6.1.18 + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java b/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java new file mode 100644 index 0000000000..88f8b67abb --- /dev/null +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBall.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +package demo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface EightBall { + + String askQuestion(String question); + +} diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java b/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java new file mode 100644 index 0000000000..d6c3103281 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java @@ -0,0 +1,52 @@ +/* + * 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. + */ +package demo; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.oasisopen.sca.annotation.Reference; + +/** + */ +public class EightBallServlet extends HttpServlet { + + @Reference + protected EightBall eightball; + + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { + String question = request.getParameter("question"); + String answer = eightball.askQuestion(question); + Writer out = response.getWriter(); + out.write("The Magic Eight Ball"); + out.write("

The Magic Eight Ball

"); + out.write("

You ask:"); + out.write("
" + question + ""); + out.write("

Eight Ball says:"); + out.write("
" + answer + ""); + out.write(""); + out.flush(); + out.close(); + } +} diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..88bd46e866 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..f828db7a81 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + eightball-webapp + + + EightBallServlet + demo.EightBallServlet + + + + EightBallServlet + /EightBallServlet + + + + eightball.html + + + diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html new file mode 100644 index 0000000000..e22cc81c83 --- /dev/null +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/eightball.html @@ -0,0 +1,48 @@ + + + + +The Magic Eight Ball + + + + +

The Magic Eight Ball

+ +The Tuscany Magic Eight Ball reaches into the future to find the answers to your questions. It knows what will be, and is willing to share this with you.

+Just type in your question that can be answered "Yes" or "No", concentrate very, very hard, and click on the "Ask" button.

+ +

+ + + + + + + +
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/eightball/pom.xml b/samples/applications/eightball-demo/eightball/pom.xml new file mode 100644 index 0000000000..5bd58d3dae --- /dev/null +++ b/samples/applications/eightball-demo/eightball/pom.xml @@ -0,0 +1,109 @@ + + + + + 4.0.0 + demo + eightball + jar + 1.0-SNAPSHOT + + quickstart + + + + + + org.apache.tuscany.sca + tuscany-sca-api + ${tuscany.version} + provided + + + + + junit + junit + 4.5 + test + + + + + install + ${artifactId} + + + false + src/main/resources + + + false + src/main/java + + ** + + + **/*.java + + + + + + false + src/test/java + + ** + + + **/*.java + + + + + + true + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + true + true + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + + + org.apache.tuscany.maven.plugins + maven-tuscany-plugin + + + + + 2.0-SNAPSHOT + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/eightball/src/main/java/demo/EightBall.java b/samples/applications/eightball-demo/eightball/src/main/java/demo/EightBall.java new file mode 100644 index 0000000000..88f8b67abb --- /dev/null +++ b/samples/applications/eightball-demo/eightball/src/main/java/demo/EightBall.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +package demo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface EightBall { + + String askQuestion(String question); + +} diff --git a/samples/applications/eightball-demo/eightball/src/main/java/demo/EightBallImpl.java b/samples/applications/eightball-demo/eightball/src/main/java/demo/EightBallImpl.java new file mode 100644 index 0000000000..10a09aee9c --- /dev/null +++ b/samples/applications/eightball-demo/eightball/src/main/java/demo/EightBallImpl.java @@ -0,0 +1,62 @@ +/* + * 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. + */ +package demo; + +import java.util.Random; +import java.lang.Double; +import java.util.Date; + +public class EightBallImpl implements EightBall { + + static String answers[] = { + "Zeichen zeigen auf \"Ja\".", + "Ja.", + "Antwort unklar, versuchen Sie es erneut.", + "Ohne Zweifel.", + "Meine Quellen sagen nein.", + "Wie ich es sehe, ja.", + "Sie koennen sich darauf verlassen.", + "Konzentrieren Sie sich und fragen Sie erneut.", + "Aussichten unguenstig.", + "Auf alle Faelle, ja.", + "Es ist besser, es Ihnen jetzt nicht zu sagen.", + "Sehr zweifelhaft.", + "Ja - auf jeden Fall.", + "Es ist sicher.", + "Kann jetzt nicht vorhergesagt werden.", + "Höchstwahrscheinlich.", + "Fragen Sie später noch einmal.", + "Meine Antwort ist nein.", + "Aussichten gut.", + "Verlassen Sie sich nicht darauf."}; + + public String askQuestion(String question) { + String answer; + if ("1+2".equals(question)) { + answer = "3"; + } else { + Random r = new Random(new Date().getTime()); + Double d = new Double((r.nextDouble() * 20) - 1); + answer = new String(answers[d.intValue()]); + } + System.out.println("EightBall answer: " + answer); + return answer; + } + +} diff --git a/samples/applications/eightball-demo/eightball/src/main/resources/META-INF/sca-contribution.xml b/samples/applications/eightball-demo/eightball/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..cf91d3a97b --- /dev/null +++ b/samples/applications/eightball-demo/eightball/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/eightball/src/main/resources/eightball.composite b/samples/applications/eightball-demo/eightball/src/main/resources/eightball.composite new file mode 100644 index 0000000000..35c29a72e6 --- /dev/null +++ b/samples/applications/eightball-demo/eightball/src/main/resources/eightball.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/samples/applications/eightball-demo/translator/pom.xml b/samples/applications/eightball-demo/translator/pom.xml new file mode 100644 index 0000000000..858fa1b4eb --- /dev/null +++ b/samples/applications/eightball-demo/translator/pom.xml @@ -0,0 +1,109 @@ + + + + + 4.0.0 + demo + translator + jar + 1.0-SNAPSHOT + + quickstart + + + + + + org.apache.tuscany.sca + tuscany-sca-api + ${tuscany.version} + provided + + + + + junit + junit + 4.5 + test + + + + + install + ${artifactId} + + + false + src/main/resources + + + false + src/main/java + + ** + + + **/*.java + + + + + + false + src/test/java + + ** + + + **/*.java + + + + + + true + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + true + true + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + + + org.apache.tuscany.maven.plugins + maven-tuscany-plugin + + + + + 2.0-SNAPSHOT + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/translator/src/main/java/demo/Translator.java b/samples/applications/eightball-demo/translator/src/main/java/demo/Translator.java new file mode 100644 index 0000000000..11070032d1 --- /dev/null +++ b/samples/applications/eightball-demo/translator/src/main/java/demo/Translator.java @@ -0,0 +1,29 @@ +/* + * 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. + */ +package demo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Translator { + + String toEnglish(String phrase); + String toGerman(String phrase); + +} diff --git a/samples/applications/eightball-demo/translator/src/main/java/demo/TranslatorImpl.java b/samples/applications/eightball-demo/translator/src/main/java/demo/TranslatorImpl.java new file mode 100644 index 0000000000..19116bc047 --- /dev/null +++ b/samples/applications/eightball-demo/translator/src/main/java/demo/TranslatorImpl.java @@ -0,0 +1,95 @@ +/* + * 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. + */ +package demo; + +import java.util.Arrays; +import java.util.List; + +public class TranslatorImpl implements Translator { + + static List english = Arrays.asList(new String[]{ + "Signs point to yes.", + "Yes.", + "Reply hazy, try again.", + "Without a doubt.", + "My sources say no.", + "As I see it, yes.", + "You may rely on it.", + "Concentrate and ask again.", + "Outlook not so good.", + "It is decidedly so.", + "Better not tell you now.", + "Very doubtful.", + "Yes - definitely.", + "It is certain.", + "Cannot predict now.", + "Most likely.", + "Ask again later.", + "My reply is no.", + "Outlook good.", + "Don't count on it.", + "You are a donkey"}); + + static List german = Arrays.asList(new String[]{ + "Zeichen zeigen auf \"Ja\".", + "Ja.", + "Antwort unklar, versuchen Sie es erneut.", + "Ohne Zweifel.", + "Meine Quellen sagen nein.", + "Wie ich es sehe, ja.", + "Sie koennen sich darauf verlassen.", + "Konzentrieren Sie sich und fragen Sie erneut.", + "Aussichten unguenstig.", + "Auf alle Faelle, ja.", + "Es ist besser, es Ihnen jetzt nicht zu sagen.", + "Sehr zweifelhaft.", + "Ja - auf jeden Fall.", + "Es ist sicher.", + "Kann jetzt nicht vorhergesagt werden.", + "Höchstwahrscheinlich.", + "Fragen Sie später noch einmal.", + "Meine Antwort ist nein.", + "Aussichten gut.", + "Verlassen Sie sich nicht darauf.", + "Du bist ein Esel"}); + + public String toEnglish(String phrase) { + int x = german.indexOf(phrase); + String translatedPhrase; + if (x == -1) { + translatedPhrase = phrase; + } else { + translatedPhrase = english.get(x); + } + System.out.println("Translated " + phrase + " : " + translatedPhrase); + return translatedPhrase; + } + + public String toGerman(String phrase) { + int x = english.indexOf(phrase); + String translatedPhrase; + if (x == -1) { + translatedPhrase = phrase; + } else { + translatedPhrase = german.get(x); + } + System.out.println("Translated " + phrase + " : " + translatedPhrase); + return translatedPhrase; + } +} diff --git a/samples/applications/eightball-demo/translator/src/main/resources/META-INF/sca-contribution.xml b/samples/applications/eightball-demo/translator/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f06b6eb3c8 --- /dev/null +++ b/samples/applications/eightball-demo/translator/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/samples/applications/eightball-demo/translator/src/main/resources/translator.composite b/samples/applications/eightball-demo/translator/src/main/resources/translator.composite new file mode 100644 index 0000000000..00ff94f2ed --- /dev/null +++ b/samples/applications/eightball-demo/translator/src/main/resources/translator.composite @@ -0,0 +1,29 @@ + + + + + + + + + From 1baf57de9cdc45fcb3868b449544ef1dd647bfa6 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 2 Dec 2010 08:32:13 +0000 Subject: [PATCH 009/174] Added manifest entries for missing package dependencies, for TUSCANY-3803 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041306 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-jms-runtime/META-INF/MANIFEST.MF | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/binding-jms-runtime/META-INF/MANIFEST.MF b/modules/binding-jms-runtime/META-INF/MANIFEST.MF index a16f0c48ca..4d7f88a476 100644 --- a/modules/binding-jms-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-jms-runtime/META-INF/MANIFEST.MF @@ -22,7 +22,9 @@ Import-Package: javax.jms, org.apache.tuscany.sca.binding.jms.wireformat;version="2.0.0", org.apache.tuscany.sca.binding.ws;version="2.0.0", org.apache.tuscany.sca.binding.ws.wsdlgen;version="2.0.0", + org.apache.tuscany.sca.common.xml.dom;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", + org.apache.tuscany.sca.databinding.xml;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", org.apache.tuscany.sca.interfacedef.impl;version="2.0.0", org.apache.tuscany.sca.interfacedef.util;version="2.0.0", From 4aba37c4a70bb3b03bf9613e96e94da4594efb05 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 2 Dec 2010 08:33:00 +0000 Subject: [PATCH 010/174] Added manifest entries for missing package dependencies, for TUSCANY-3803 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041307 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-jms/META-INF/MANIFEST.MF | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/binding-jms/META-INF/MANIFEST.MF b/modules/binding-jms/META-INF/MANIFEST.MF index 9b6da67343..dd879e6b5e 100644 --- a/modules/binding-jms/META-INF/MANIFEST.MF +++ b/modules/binding-jms/META-INF/MANIFEST.MF @@ -52,6 +52,8 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.assembly.xml;version="2.0.0";resolution:=optional, org.apache.tuscany.sca.binding.jms;version="2.0.0", + org.apache.tuscany.sca.common.xml.dom;version="2.0.0", + org.apache.tuscany.sca.common.xml.stax;version="2.0.0", org.apache.tuscany.sca.contribution.processor;version="2.0.0", org.apache.tuscany.sca.contribution.resolver;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", From 198b87d0ac7c8abc199193a6ddb8180e91df0985 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Thu, 2 Dec 2010 18:59:29 +0000 Subject: [PATCH 011/174] If WEB-INF/sca-contributions contains contributions then use it automatically without requireing users define it in the web.xml git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041529 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/host/webapp/WebAppHelper.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java b/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java index 47fd852f57..0d905eb6eb 100644 --- a/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java +++ b/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppHelper.java @@ -42,6 +42,7 @@ public class WebAppHelper { private static final String ROOT = "/"; // The prefix for the parameters in web.xml which configure the folders that contain SCA contributions private static final String CONTRIBUTIONS = "contributions"; + private static final String DEFAULT_CONTRIBUTIONS = "/WEB-INF/sca-contributions"; // The prefix for the parameters in web.xml which configure the individual SCA contributions private static final String CONTRIBUTION = "contribution"; private static final String NODE_CONFIGURATION = "node.configuration"; @@ -91,10 +92,14 @@ private static NodeConfiguration getNodeConfiguration(ServletContext servletCont configuration = factory.loadConfiguration(url.openStream(), url); } else { configuration = factory.createNodeConfiguration(); + + + boolean explicitContributions = false; Enumeration names = servletContext.getAttributeNames(); while (names.hasMoreElements()) { String name = names.nextElement(); if (name.equals(CONTRIBUTION) || name.startsWith(CONTRIBUTION + ".")) { + explicitContributions = true; // We need to have a way to select one or more folders within the webapp as the contributions String listOfValues = (String)servletContext.getAttribute(name); if (listOfValues != null) { @@ -107,6 +112,7 @@ private static NodeConfiguration getNodeConfiguration(ServletContext servletCont } } } else if (name.equals(CONTRIBUTIONS) || name.startsWith(CONTRIBUTIONS + ".")) { + explicitContributions = true; String listOfValues = (String)servletContext.getAttribute(name); if (listOfValues != null) { for (String path : parse(listOfValues)) { @@ -126,14 +132,25 @@ private static NodeConfiguration getNodeConfiguration(ServletContext servletCont } } - if (configuration.getContributions().isEmpty()) { + URL composite = getResource(servletContext, WEB_COMPOSITE); + if (configuration.getContributions().isEmpty() || (!explicitContributions && composite != null)) { // TODO: Which path should be the default root configuration.addContribution(getResource(servletContext, ROOT)); } - URL composite = getResource(servletContext, WEB_COMPOSITE); if (composite != null) { configuration.getContributions().get(0).addDeploymentComposite(composite); } + if (!explicitContributions) { + URL url = getResource(servletContext, DEFAULT_CONTRIBUTIONS); + if (url != null) { + File f = new File(url.toURI()); + if (f.isDirectory()) { + for (File n : f.listFiles()) { + configuration.addContribution(n.toURI().toURL()); + } + } + } + } String nodeURI = (String)servletContext.getAttribute(NODE_URI); if (nodeURI == null) { nodeURI = new File(servletContext.getRealPath(ROOT)).getName(); From f7696401bfb300f28c9721c794647eb673290dfc Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Thu, 2 Dec 2010 19:11:25 +0000 Subject: [PATCH 012/174] Get the eightball webapp running git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041540 13f79535-47bb-0310-9956-ffa450edef68 --- .../eightball-demo/eightball-webapp/pom.xml | 47 +++++++++++++++---- .../src/main/java/demo/EightBallServlet.java | 11 +++++ .../src/main/webapp/WEB-INF/web.xml | 3 ++ 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/samples/applications/eightball-demo/eightball-webapp/pom.xml b/samples/applications/eightball-demo/eightball-webapp/pom.xml index 6287de1a7e..eeabfc5fa4 100644 --- a/samples/applications/eightball-demo/eightball-webapp/pom.xml +++ b/samples/applications/eightball-demo/eightball-webapp/pom.xml @@ -28,21 +28,12 @@ quickstart - org.apache.tuscany.sca - tuscany-sca-api + tuscany-base-runtime ${tuscany.version} - provided - - junit @@ -126,6 +117,42 @@ true + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + compile + + copy + + + + + + demo + eightball + ${pom.version} + src/main/webapp/WEB-INF/sca-contributions + + + demo + eightball-process + ${pom.version} + src/main/webapp/WEB-INF/sca-contributions + + + demo + translator + ${pom.version} + src/main/webapp/WEB-INF/sca-contributions + + + + + + diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java b/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java index d6c3103281..6728d44e61 100644 --- a/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/java/demo/EightBallServlet.java @@ -21,10 +21,13 @@ import java.io.IOException; import java.io.Writer; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.oasisopen.sca.ComponentContext; import org.oasisopen.sca.annotation.Reference; /** @@ -34,6 +37,14 @@ public class EightBallServlet extends HttpServlet { @Reference protected EightBall eightball; + @Override + public void init(ServletConfig servletConfig) throws ServletException { + if (eightball == null) { + ComponentContext cc = (ComponentContext)servletConfig.getServletContext().getAttribute("org.oasisopen.sca.ComponentContext"); + eightball = cc.getService(EightBall .class, "eightball"); + } + } + @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { String question = request.getParameter("question"); diff --git a/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml index f828db7a81..ddfcc666ad 100644 --- a/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml +++ b/samples/applications/eightball-demo/eightball-webapp/src/main/webapp/WEB-INF/web.xml @@ -24,6 +24,8 @@ eightball-webapp + org.apache.tuscany.sca.host.webapp.TuscanyContextListener + EightBallServlet demo.EightBallServlet @@ -39,3 +41,4 @@ + From 801bec80ea0ddada92d852cd66f3e1073f8b47db Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Thu, 2 Dec 2010 20:33:30 +0000 Subject: [PATCH 013/174] Update to support entering quoted strings conatining spaces git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041571 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/shell/Shell.java | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java index 1174506613..0c06af891d 100644 --- a/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java +++ b/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java @@ -319,12 +319,7 @@ boolean run(final String commandsFileURL) throws IOException { while ((l = r.readLine()) != null) { out.println(l); String[] toks = l != null ? l.trim().split(" ") : "".split(" "); - List toksList = new ArrayList(); - for (String s : toks) { - if (s != null && s.trim().length() > 0) { - toksList.add(s); - } - } + List toksList = getTokens(toks); apply(eval(toksList)); } } finally { @@ -488,15 +483,47 @@ List read(Object r) throws IOException { l = ((BufferedReader)r).readLine(); history.add(l); } + String[] toks = l != null ? l.trim().split(" ") : "bye".split(" "); + return getTokens(toks); + } + + /** + * Parse the string into tokens, which may include quoted strings + */ + List getTokens(String[] toks) { List toksList = new ArrayList(); - for (String s : toks) { - if (s != null && s.trim().length() > 0) { - toksList.add(s); + for (int i=0; i 0) { + int j = quotedString(toks, i); + if (j > -1) { + StringBuilder sb = new StringBuilder(); + sb.append(toks[i]); + for (int k=i+1; k<=j; k++) { + sb.append(" "); + sb.append(toks[k]); + } + i = j; + String s = sb.toString(); + toksList.add(s.substring(1, s.length()-1)); + } else { + toksList.add(toks[i]); + } } } return toksList; } + + int quotedString(String[] toks, int i) { + if (toks[i].startsWith("\"") || toks[i].startsWith("'")) { + for (int j=i+1; j eval(final List toks) { final String op = toks.size() > 0 ? toks.get(0) : ""; From 2e1bc5d8e635104f8602bf026700bc5be0e8daf8 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Fri, 3 Dec 2010 07:43:30 +0000 Subject: [PATCH 014/174] Add a top level pom to build it all git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041715 13f79535-47bb-0310-9956-ffa450edef68 --- samples/applications/eightball-demo/pom.xml | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 samples/applications/eightball-demo/pom.xml diff --git a/samples/applications/eightball-demo/pom.xml b/samples/applications/eightball-demo/pom.xml new file mode 100644 index 0000000000..2499576fec --- /dev/null +++ b/samples/applications/eightball-demo/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-samples + 2.0-SNAPSHOT + ../../pom.xml + + tuscany-eightball-demo + pom + Apache Tuscany Eightball Demo + + + eightball + eightball-process + eightball-webapp + translator + + + From f820bf4a9874fe27f5c537738b0065360f306669 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Fri, 3 Dec 2010 07:45:37 +0000 Subject: [PATCH 015/174] Set svn ignores git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041716 13f79535-47bb-0310-9956-ffa450edef68 From 95cc02d3033ec454a94c8317da77ee084df89762 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Fri, 3 Dec 2010 08:01:37 +0000 Subject: [PATCH 016/174] Clean up the getting started helloworld webapp. Update it to use a jsp to invoke the component git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041721 13f79535-47bb-0310-9956-ffa450edef68 --- .../sample/Helloworld.java} | 26 ++++++------- .../src/main/webapp/WEB-INF/web.composite | 30 +++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 16 ++------ .../src/main/webapp/hello.jsp | 37 +++++++++++++++++++ 4 files changed, 82 insertions(+), 27 deletions(-) rename samples/getting-started/helloworld-webapp/src/main/{webapp/hello.html => java/sample/Helloworld.java} (69%) create mode 100644 samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.composite create mode 100644 samples/getting-started/helloworld-webapp/src/main/webapp/hello.jsp diff --git a/samples/getting-started/helloworld-webapp/src/main/webapp/hello.html b/samples/getting-started/helloworld-webapp/src/main/java/sample/Helloworld.java similarity index 69% rename from samples/getting-started/helloworld-webapp/src/main/webapp/hello.html rename to samples/getting-started/helloworld-webapp/src/main/java/sample/Helloworld.java index 05038391a0..1eeb8be9fd 100644 --- a/samples/getting-started/helloworld-webapp/src/main/webapp/hello.html +++ b/samples/getting-started/helloworld-webapp/src/main/java/sample/Helloworld.java @@ -1,4 +1,4 @@ - - + * under the License. + */ +package sample; - -Apache Tuscany Helloworld Servlet Sample - +import org.oasisopen.sca.annotation.Remotable; - +@Remotable +public interface Helloworld { -

Apache Tuscany Helloworld Servlet Sample

+ String sayHello(String name); -WSDL for binding.ws of the Helloworld service of the HelloWorldWS component - - - \ No newline at end of file +} diff --git a/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.composite b/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..0c03826f99 --- /dev/null +++ b/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.xml b/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.xml index 755162e305..b83a9c3417 100644 --- a/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.xml +++ b/samples/getting-started/helloworld-webapp/src/main/webapp/WEB-INF/web.xml @@ -24,18 +24,6 @@ Apache Tuscany Helloworld Sample - - contributions - /WEB-INF/sca-contributions - - - - tuscany org.apache.tuscany.sca.host.webapp.TuscanyServletFilter @@ -46,4 +34,8 @@ /* + + hello.jsp + + diff --git a/samples/getting-started/helloworld-webapp/src/main/webapp/hello.jsp b/samples/getting-started/helloworld-webapp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..57abb08ca2 --- /dev/null +++ b/samples/getting-started/helloworld-webapp/src/main/webapp/hello.jsp @@ -0,0 +1,37 @@ + + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> + + + + + + +

Apache Tuscany Helloworld JSP Sample

+ + Calling HelloworldService sayHello("world") returns: + +

+ + <%= service.sayHello("world") %> + + + From f05be47633b54b3a57000aa3ffc6ac889dda66cd Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Fri, 3 Dec 2010 08:10:50 +0000 Subject: [PATCH 017/174] Disable web unit tests for now git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041722 13f79535-47bb-0310-9956-ffa450edef68 --- samples/getting-started/helloworld-webapp/pom.xml | 2 ++ .../src/test/java/itest/HelloworldTestCaseFIXME.java | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/samples/getting-started/helloworld-webapp/pom.xml b/samples/getting-started/helloworld-webapp/pom.xml index 291273b2eb..d1876b94d8 100644 --- a/samples/getting-started/helloworld-webapp/pom.xml +++ b/samples/getting-started/helloworld-webapp/pom.xml @@ -85,6 +85,7 @@ foo 9999 + diff --git a/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCaseFIXME.java b/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCaseFIXME.java index c1c2c6aae0..76d6661576 100644 --- a/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCaseFIXME.java +++ b/samples/getting-started/helloworld-webapp/src/test/java/itest/HelloworldTestCaseFIXME.java @@ -36,9 +36,9 @@ public class HelloworldTestCaseFIXME { public void testHelloworld() throws NoSuchDomainException, NoSuchServiceException { // TODO: need to fix the config URI so it works properly // SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("uri:default?remote=127.0.0.1:54321")); - SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscany:default?remotes=192.168.1.64")); - Helloworld helloworld = factory.getService(Helloworld.class, "HelloworldComponent"); - assertEquals("Hello World", helloworld.sayHello("World")); +// SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscany:default?remotes=192.168.1.64")); +// Helloworld helloworld = factory.getService(Helloworld.class, "HelloworldComponent"); +// assertEquals("Hello World", helloworld.sayHello("World")); } } From e5e3a6664590e336785aa339a93d3863d2d28da6 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 12:23:19 +0000 Subject: [PATCH 018/174] TUSCANY-3801 - update to match infrastructure changes to support native async bindings (not committed yet) git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041784 13f79535-47bb-0310-9956-ffa450edef68 --- .../sampleasync/impl/SampleAsyncProvider.java | 11 +++++- .../impl/SampleAsyncResponseInvoker.java | 6 +-- .../sampleasync/impl/SampleWSDLInvoker.java | 38 +++++++++++++++++-- .../sampleasync/impl/SampleWSDLProxy.java | 19 ++++++++-- .../impl/UpperSampleAsyncReferenceImpl.java | 11 ++---- 5 files changed, 66 insertions(+), 19 deletions(-) diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java index 80193277da..146d027df8 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.interfacedef.Interface; @@ -85,17 +86,23 @@ public boolean supportsOneWayInvocation() { } public Invoker createInvoker(final RuntimeComponentService s, final Operation op) { + // TODO - we're passing EP into the WSDL invoker so this isn't going to work + // properly for sync calls + return createAsyncInvoker(null, s, op); + } + + public Invoker createAsyncInvoker(Endpoint endpoint, final RuntimeComponentService s, final Operation op) { try { // Creating an invoker for a Java or WSDL-typed implementation if(op instanceof JavaOperation) return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance); - return new SampleWSDLInvoker((WSDLOperation)op, impl.clazz, instance); + return new SampleWSDLInvoker(endpoint, (WSDLOperation)op, impl.clazz, instance); } catch(Exception e) { throw new RuntimeException(e); } } - public Invoker createAsyncResponseInvoker(RuntimeComponentService service, Operation operation) { + public Invoker createAsyncResponseInvoker(Operation operation) { return new SampleAsyncResponseInvoker(asyncMessageMap, operation, impl.clazz, instance); } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java index 3e7e0f6a51..c73fdbc7e3 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java @@ -54,10 +54,10 @@ public Message invoke(final Message msg) { String forwardOpName = (String)asyncMessageMap.get(messageID); // process the async response - Object reponse = ((Object[])msg.getBody())[0]; + //Object reponse = ((Object[])msg.getBody())[0]; + Object reponse = msg.getBody(); - //Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); - Method method = instance.getClass().getMethod(forwardOpName + "Callback", String.class); + Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); method.invoke(instance, reponse); } catch(Exception e) { e.printStackTrace(); diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java index 0c1051b58c..3140da16da 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java @@ -21,9 +21,14 @@ import java.lang.reflect.Method; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.core.invocation.impl.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; +import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.w3c.dom.Element; /** @@ -32,26 +37,53 @@ * * @version $Rev$ $Date$ */ -class SampleWSDLInvoker implements Invoker { +class SampleWSDLInvoker extends InterceptorAsyncImpl { + final Endpoint endpoint; final String name; final Object instance; final Method method; - SampleWSDLInvoker(final WSDLOperation op, final Class clazz, final Object instance) throws SecurityException, NoSuchMethodException { + SampleWSDLInvoker(Endpoint endpoint, final WSDLOperation op, final Class clazz, final Object instance) throws SecurityException, NoSuchMethodException { + this.endpoint = endpoint; this.name = op.getName(); this.instance = instance; this.method = clazz.getMethod("call", String.class, Element.class); } + + public Invoker getNext() { + // Can't get next for an implementation invoker + return null; + } public Message invoke(final Message msg) { + return processRequest(msg); + } + + public void invokeAsyncRequest(Message msg) { + Message responseMsg = processRequest(msg); + + // in this sample programming model we make the async + // response from the implementation provider. The + // component implementation itself doesn't get a chance to + // do async responses. + + ((RuntimeEndpoint)endpoint).invokeAsyncResponse(this, responseMsg); + } + + public Message processRequest(Message msg) { try { //AsyncHeader asyncHeader = (String) message.getHeaders().get("ASYNC-HEADER"); // Invoke the generic call method - msg.setBody(method.invoke(instance, name, ((Object[])msg.getBody())[0])); + Object response = method.invoke(instance, name, ((Object[])msg.getBody())[0]); + msg.setBody(response); } catch(Exception e) { e.printStackTrace(); msg.setFaultBody(e.getCause()); } return msg; } + + public Message processResponse(Message msg) { + return msg; + } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java index 55a4d6b488..a02132ac9e 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java @@ -72,16 +72,27 @@ public void callAsync(String op, Element e) { Message message = mf.createMessage(); message.setBody(new Object[]{e}); + // We could MESSAGE_ID here if required. If not the infrastructure + // will generate a UUID + String messageID = "myuniqueid"; + message.getHeaders().put(Constants.MESSAGE_ID, messageID); + + // save the message id ready for when we process the response + asyncMessageMap.put(messageID, op); + // We could add implementation specific headers here if required + //message.getHeaders().put(Constants.???, ???); + try { repr.invokeAsync(ops.get(op), message); } catch (Throwable ex) { ex.printStackTrace(); } - // save the message id ready for when we process the response - String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); - - asyncMessageMap.put(messageID, op); + // if we don't provide a message id we can get the one the + // infrastructure generates + //String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); + //asyncMessageMap.put(messageID, op); + } } diff --git a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java index d3e91c7f18..101c6a4399 100644 --- a/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java +++ b/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java @@ -41,7 +41,7 @@ public class UpperSampleAsyncReferenceImpl { @WSDL("http://sample/upper#Upper") WSDLReference upper; - String response; + Element response; public String upper(String s) { out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); @@ -59,7 +59,7 @@ public String upper(String s) { // do nothing } - return response; + return response.getTextContent(); } /** @@ -67,11 +67,8 @@ public String upper(String s) { * async callback arrives at an operation named * operationName + Callback */ - // TODO - I think this should take and Element parameter but the response - // handler interface is a Java interface at the moment and so no - // transformation takes place automatically. - public void upperCallback(String response) { - out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response + ")"); + public void upperCallback(Element response) { + out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response.getTextContent() + ")"); this.response = response; } } From 0cff102ab33f9f2f4e9798c7c61ecd145505ca94 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 14:59:54 +0000 Subject: [PATCH 019/174] TUSCANY-3801 - allow endpoints to report when they are configured for async invocation. Correct comment on endpoint reference version of the operation. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041845 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/assembly/Endpoint.java | 9 +++++++++ .../tuscany/sca/assembly/EndpointReference.java | 4 ++-- .../tuscany/sca/assembly/impl/EndpointImpl.java | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java b/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java index 43bf17d66a..ec16b20b6e 100644 --- a/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java +++ b/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java @@ -136,4 +136,13 @@ public interface Endpoint extends Base, PolicySubject, Cloneable, Serializable { */ boolean matches(String serviceURI); + /** + * When true this endpoint is able to process the invocation + * asynchronously. The forward call is effectively one-way + * and the response will arrive asynchronously + * + * @return true if the service is asynchronous + */ + boolean isAsyncInvocation(); + } diff --git a/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java b/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java index 2fc8eebe4d..c70d4521ba 100644 --- a/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java +++ b/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java @@ -165,8 +165,8 @@ enum Status { /** * When true this endpoint reference is able to process the invocation - * as being asynchronous. The forward call is effectively one-way - * and the response will arrive asynchronously via the CallbackEndpoint + * asynchronously. The forward call is effectively one-way + * and the response will arrive asynchronously * * @return true if the reference is asynchronous */ diff --git a/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java index e25bd4206b..f4a8429f13 100644 --- a/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java +++ b/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java @@ -279,5 +279,20 @@ private static String[] parseStructuralURI(String structuralURI) { } return names; } + + public boolean isAsyncInvocation() { + if (service.getName().endsWith("_asyncCallback")){ + // this is a response service at the reference component so don't create a + // response reference. + return false; + } + + for(Intent intent : getRequiredIntents()){ + if (intent.getName().getLocalPart().equals("asyncInvocation")){ + return true; + } + } + return false; + } } From ac1be0d14cc0b1de7c3cf66ba43e3c79e5162b56 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:05:15 +0000 Subject: [PATCH 020/174] just remove some blank lines git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041847 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/provider/RuntimeSCABindingProviderFactory.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java index 393b8f400c..75d8de64ca 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCABindingProviderFactory.java @@ -1,5 +1,5 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one +ah * 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 @@ -37,12 +37,10 @@ public class RuntimeSCABindingProviderFactory implements BindingProviderFactory< private ExtensionPointRegistry extensionPoints; public RuntimeSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) { - this.extensionPoints = extensionPoints; - + this.extensionPoints = extensionPoints; } public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) { - return new RuntimeSCAReferenceBindingProvider(extensionPoints, endpointReference); } From 18ebddab491f2a92a3ecfeb61523f41bd27a9438 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:10:23 +0000 Subject: [PATCH 021/174] TUSCANY-3801 - Add new provider interfaces that allow providers to indicate whether they support async or not. May be merged into existing interfaces but kept separate for the time being so as not to upset existing providers. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041855 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/provider/EndpointAsyncProvider.java | 55 +++++++++++++++++++ .../EndpointReferenceAsyncProvider.java | 41 ++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java new file mode 100644 index 0000000000..dbf0c0fd8d --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java @@ -0,0 +1,55 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.provider; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; + + +/** + * TUSCANY-3783 + * + * Async related operations that are here rather than higher up + * while we develop them. + * + */ +public interface EndpointAsyncProvider extends EndpointProvider { + + /** + * TUSCANY-3801 + * Returns true if the service binding provider is natively able + * to dispatch async responses. + * + * @return true if the service provide support async operation natively + */ + boolean supportsNativeAsync(); + + /** + * TUSCANY-3801 + * Create an async response invoker. This is used when + * supportsNativeAsync = true so that the endpoint + * has somewhere to send the async response when it + * eventually returns from the implementation. + * + * @para operation + * @return the invoker that will dispatch the async response + */ + Invoker createAsyncResponseInvoker(Operation operation); +} diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java new file mode 100644 index 0000000000..536b6f2ea5 --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java @@ -0,0 +1,41 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.provider; + + +/** + * TUSCANY-3783 + * + * Async related operations that are here rather than higher up + * while we develop them. + * + */ +public interface EndpointReferenceAsyncProvider extends EndpointReferenceProvider { + + /** + * TUSCANY-3801 + * Returns true if the service binding provider is natively able + * to dispatch async responses. + * + * @return true if the service provide support async operation natively + */ + boolean supportsNativeAsync(); + +} From f076b45c94e5d477d711f01fcf5a6e45129f9c2a Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:12:43 +0000 Subject: [PATCH 022/174] TUSCANY-3801 - add an async interceptor interface to chain can be navigated backwards. Also add an implementation that can hold generic interceptor implementation that to date, for the forward chain, has been repeated in each interceptor. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041858 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/invocation/InterceptorAsync.java | 40 ++++++++++ .../core/invocation/InterceptorAsyncImpl.java | 74 +++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java create mode 100644 modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java new file mode 100644 index 0000000000..3819147526 --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java @@ -0,0 +1,40 @@ +/* + * 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. + */ +package org.apache.tuscany.sca.invocation; + +/** + * Allows asynchronous wires to be navigated in reverse in order for the + * reponse to be processed. + * + */ +public interface InterceptorAsync extends Interceptor, InvokerAsync { + + /** + * Sets the previous invoker + * @param next The previous invoker + */ + void setPrevious(InvokerAsync previous); + + /** + * Returns the previous invoker or null + * @return The previous Invoker + */ + InvokerAsync getPrevious(); + +} diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java new file mode 100644 index 0000000000..0c42a523a6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java @@ -0,0 +1,74 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.core.invocation; + + +import org.apache.tuscany.sca.invocation.InterceptorAsync; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsync; +import org.apache.tuscany.sca.invocation.Message; + +/** + * A base class that holds the mechanics for representing + * chained interceptors and for driving processing up and + * down the chain. + * + */ +public abstract class InterceptorAsyncImpl implements InterceptorAsync { + + protected InvokerAsync next; + protected InvokerAsync previous; + + public Invoker getNext() { + return (Invoker)next; + } + + public void setNext(Invoker next) { + this.next = (InvokerAsync)next; + } + + public InvokerAsync getPrevious() { + return previous; + } + + public void setPrevious(InvokerAsync previous) { + this.previous = previous; + } + + public Message invoke(Message msg) { + msg = processRequest(msg); + Message resultMsg = getNext().invoke(msg); + resultMsg = processResponse(resultMsg); + return resultMsg; + } + + public void invokeAsyncRequest(Message msg) { + msg = processRequest(msg); + ((InvokerAsync)getNext()).invokeAsyncRequest(msg); + } + + public Message invokeAsyncResponse(Message msg) { + msg = processResponse(msg); + if (getPrevious() != null){ + return ((InvokerAsync)getPrevious()).invokeAsyncResponse(msg); + } + return msg; + } +} From 1df5ad415fcfd8af0ebec95ec972b2226b0d644e Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:14:31 +0000 Subject: [PATCH 023/174] TUSCANY-3801 - add an async implementation provider interface to allow provider to create async invokers for the forward and response call. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041861 13f79535-47bb-0310-9956-ffa450edef68 --- .../provider/ImplementationAsyncProvider.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java new file mode 100644 index 0000000000..b555087d82 --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java @@ -0,0 +1,65 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.provider; + +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * TUSCANY-3786 - Possibly temporary interface to describe an + * async invocation. Need to make it work end to + * end before committing to this. + * + * A component implementation can implement this interface in order to tie + * into the Tuscany runtime to process asynchronous responses. + * + */ +public interface ImplementationAsyncProvider extends ImplementationProvider { + + /** + * Create an async invoker for the component implementation in the invocation + * chain. The invoker will be responsible for calling the implementation + * logic for the given component. The only realy difference between this and + * createInvoker is that the Endpoint is passed in so that the invoker can + * engineer the async response + * + * @param endpoint the endoint at the head of this invocation chain + * @param service The component service + * @param operation The operation that the interceptor will handle + * @return An invoker that handles the invocation logic, null should be + * returned if no invoker is required + */ + Invoker createAsyncInvoker(Endpoint endpoint, RuntimeComponentService service, Operation operation); + + /** + * Create an invoker for the asynchronous responses in the invocation + * chain. The invoker will be responsible for processing the async + * response including correlating it with the forward call using + * the MESAGE_ID that appears in the message header. + * + * @param service The component service + * @param operation The operation that the interceptor will handle + * @return An AsyncResponseHandler instance + */ + Invoker createAsyncResponseInvoker(Operation operation); + +} From 33152fde94b38aa5a3fd90386d9759fe736fd48c Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:17:41 +0000 Subject: [PATCH 024/174] TUSCANY-3801 - Move the SCA binding up to the new async provider interfaces. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041863 13f79535-47bb-0310-9956-ffa450edef68 --- .../RuntimeSCAReferenceBindingProvider.java | 8 ++++++-- .../RuntimeSCAServiceBindingProvider.java | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java index 08f2bee3b3..c36506a6c7 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java @@ -30,6 +30,7 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.EndpointReferenceAsyncProvider; import org.apache.tuscany.sca.provider.EndpointReferenceProvider; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -49,7 +50,7 @@ * * @version $Rev$ $Date$ */ -public class RuntimeSCAReferenceBindingProvider implements EndpointReferenceProvider { +public class RuntimeSCAReferenceBindingProvider implements EndpointReferenceAsyncProvider { private RuntimeEndpointReference endpointReference; private RuntimeComponent component; @@ -209,7 +210,10 @@ public void configure() { if (distributedProvider instanceof EndpointReferenceProvider) { ((EndpointReferenceProvider)distributedProvider).configure(); } - + } + + public boolean supportsNativeAsync() { + return true; } } diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java index 14d7284846..7c6ba9cd69 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java @@ -22,6 +22,10 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.EndpointAsyncProvider; +import org.apache.tuscany.sca.provider.EndpointProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; @@ -34,7 +38,7 @@ * * @version $Rev$ $Date$ */ -public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider { +public class RuntimeSCAServiceBindingProvider implements EndpointAsyncProvider { private RuntimeEndpoint endpoint; private RuntimeComponentService service; @@ -98,4 +102,16 @@ public void stop() { } } + public void configure() { + // TODO Auto-generated method stub + } + + public boolean supportsNativeAsync() { + return true; + } + + public Invoker createAsyncResponseInvoker(Operation operation) { + return new SCABindingAsyncResponseInvoker(null, null); + } + } From 1991747696d231d1c6f4272fa0e59e357e4cb4d4 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:22:31 +0000 Subject: [PATCH 025/174] TUSCANY-3801 - Update the invocation chain infrastructure, and the enpoints/endpointreferences that call it, to allow async response messages to be processed backwards along the response part of the chain independently of the forward message processing. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041866 13f79535-47bb-0310-9956-ffa450edef68 --- .../service/mocks/TestRuntimeWire.java | 9 +- .../sca/invocation/InvocationChain.java | 12 +++ .../tuscany/sca/invocation/InvokerAsync.java | 51 ++++++++-- .../apache/tuscany/sca/runtime/Invocable.java | 11 ++- .../assembly/impl/RuntimeEndpointImpl.java | 41 ++++++-- .../impl/RuntimeEndpointReferenceImpl.java | 20 +++- .../sca/core/invocation/RuntimeInvoker.java | 99 ++++++++++++++++++- .../invocation/impl/InvocationChainImpl.java | 29 +++++- .../impl/InvocationChainImplTestCase.java | 4 +- 9 files changed, 251 insertions(+), 25 deletions(-) diff --git a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java index d109b74e34..756299696a 100644 --- a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java +++ b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java @@ -33,6 +33,7 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; @@ -206,7 +207,9 @@ public Message invoke(Operation operation, Message msg) { } public void invokeAsync(Operation operation, Message msg) { - return; + } + + public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) { } public void unbind() { @@ -311,4 +314,8 @@ public InterfaceContract getGeneratedWSDLContract( return null; } + public boolean isAsyncInvocation() { + // TODO Auto-generated method stub + return false; + } } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java index 579e0c3da9..d10a5689d4 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java @@ -105,4 +105,16 @@ public interface InvocationChain { * @param allowsPBR */ void setAllowsPassByReference(boolean allowsPBR); + + /** + * Returns true if this chain must be able to support async + * invocation. This will be as a consequence of the EPR/EP + * detecting the asyncInvocation intent. The flag is set on + * construction and used as an internal guard against non + * async interceptors being added to a chain that expect to + * be able to handle async calls + * + * @return true is the chain supports async invocation. + */ + boolean isAsyncInvocation(); } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java index 624e8fdab4..a67a28a931 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java @@ -19,21 +19,56 @@ package org.apache.tuscany.sca.invocation; /** - * TUSCANY-3786 - Possibly temporary interface to describe an - * async invocation. Need to make it work end to - * end before committing to this. - * - * Asynchronous mediation associated with a client- or target- side wire. + * TUSCANY-3786 + * + * Interface to describe an invoation where the request processing + * can be performed independently of the response processing. This + * has been instigated to allow async responses to be processed + * independently of the requests that instigated them. Due to the need + * to run the reponse processing interceptors effectively backwards the + * methods defined here are not responsible for finding the next invoker + * in the chain. * */ public interface InvokerAsync { + + /** + * Process the forward message and pass it down the chain + * + * @param msg The request Message + * @return the processed message + * + */ + void invokeAsyncRequest(Message msg); + + /** + * Process response message and pass it back up the chain. + * This returns the message that is processed by the chain + * so that it can be passes onto the appropriate invoker by the caller + * the response path doesn't have an invoker. + * + * @param msg The request Message + * @return the processed message + * + */ + Message invokeAsyncResponse(Message msg); /** - * Process an asynchronous wire + * Process a request message + * + * @param msg The request Message + * @return the processed message + * + */ + Message processRequest(Message msg); + + /** + * Process a response message * - * @param msg The request Message for the wire + * @param msg The request Message + * @return the processed message * */ - void invokeAsync(Message msg); + Message processResponse(Message msg); } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index 31260f1afa..cf9b8ac49e 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -29,6 +29,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.provider.PolicyProvider; @@ -136,7 +137,15 @@ public interface Invocable { * @return The ticket that can be used to identify this invocation * @throws InvocationTargetException */ - void invokeAsync(Operation operation, Message msg); + void invokeAsync(Operation operation, Message msg) throws Throwable; + // TODO - this shouldn't throw an exception + + /** + * Asynchronously invoke an operation with a context message + * @param tailInvoker the invoker at the end of the chain + * @param msg The request message + */ + void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg); /** * Get a list of policy providers diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 31738c3a5d..32aa0c0646 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -75,11 +75,13 @@ import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.EndpointProvider; +import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.PolicyProviderFactory; @@ -209,7 +211,7 @@ public synchronized List getInvocationChains() { public synchronized InvocationChain getBindingInvocationChain() { if (bindingInvocationChain == null) { - bindingInvocationChain = new InvocationChainImpl(null, null, false, phaseManager); + bindingInvocationChain = new InvocationChainImpl(null, null, false, phaseManager, isAsyncInvocation()); initServiceBindingInvocationChains(); } @@ -224,7 +226,7 @@ public synchronized InvocationChain getBindingInvocationChain() { /** * A dummy invocation chain representing null as ConcurrentHashMap doesn't allow null values */ - private static final InvocationChain NULL_CHAIN = new InvocationChainImpl(null, null, false, null); + private static final InvocationChain NULL_CHAIN = new InvocationChainImpl(null, null, false, null, false); public InvocationChain getInvocationChain(Operation operation) { InvocationChain cached = invocationChainMap.get(operation); @@ -286,13 +288,17 @@ public Message invoke(Operation operation, Message msg) { return invoker.invoke(operation, msg); } - public void invokeAsync(Operation operation, Message msg) { + public void invokeAsync(Operation operation, Message msg) throws Throwable { msg.setOperation(operation); invoker.invokeAsync(msg); } + + public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){ + invoker.invokeAsyncResponse(tailInvoker, msg); + } /** - * Navigate the component/componentType inheritence chain to find the leaf contract + * Navigate the component/componentType inheritance chain to find the leaf contract * @param contract * @return */ @@ -344,7 +350,7 @@ private void initInvocationChains() { + "#" + service.getName()); } - InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false, phaseManager); + InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false, phaseManager, isAsyncInvocation()); if (operation.isNonBlocking()) { addNonBlockingInterceptor(chain); } @@ -630,7 +636,30 @@ private void addImplementationInterceptor(Component component, if (provider != null) { Invoker invoker = null; - invoker = provider.createInvoker((RuntimeComponentService)service, operation); + RuntimeComponentService runtimeService = (RuntimeComponentService)service; + if (runtimeService.getName().endsWith("_asyncCallback")){ + if (provider instanceof ImplementationAsyncProvider){ + invoker = ((ImplementationAsyncProvider)provider).createAsyncResponseInvoker(operation); + } else { + // TODO - This should be an error but taking account of the + // existing non-native async support + invoker = provider.createInvoker((RuntimeComponentService)service, operation); +/* + throw new ServiceRuntimeException("Component " + + this.getComponent().getName() + + " Service " + + getService().getName() + + " implementation provider doesn't implement ImplementationAsyncProvider but the implementation uses a " + + "refrence interface with the asyncInvocation intent set" + + " - [" + this.toString() + "]"); +*/ + } + } else if (isAsyncInvocation() && + provider instanceof ImplementationAsyncProvider){ + invoker = ((ImplementationAsyncProvider)provider).createAsyncInvoker(this, (RuntimeComponentService)service, operation); + } else { + invoker = provider.createInvoker((RuntimeComponentService)service, operation); + } chain.addInvoker(invoker); } // TODO - EPR - don't we need to get the policy from the right level in the diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index b18af33a39..2aadf34295 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -61,9 +61,11 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; @@ -198,7 +200,7 @@ public synchronized List getInvocationChains() { public synchronized InvocationChain getBindingInvocationChain() { if (bindingInvocationChain == null) { - bindingInvocationChain = new InvocationChainImpl(null, null, true, phaseManager); + bindingInvocationChain = new InvocationChainImpl(null, null, true, phaseManager, isAsyncInvocation()); initReferenceBindingInvocationChains(); } return bindingInvocationChain; @@ -238,10 +240,14 @@ public Message invoke(Operation operation, Message msg) { return invoker.invoke(operation, msg); } - public void invokeAsync(Operation operation, Message msg) { + public void invokeAsync(Operation operation, Message msg) throws Throwable { msg.setOperation(operation); invoker.invokeAsync(msg); } + + public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){ + invoker.invokeAsyncResponse(tailInvoker, msg); + } /** * Navigate the component/componentType inheritence chain to find the leaf contract @@ -309,7 +315,7 @@ private void initInvocationChains() { + "#" + reference.getName()); } - InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true, phaseManager); + InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true, phaseManager, isAsyncInvocation()); if (operation.isNonBlocking()) { addNonBlockingInterceptor(chain); } @@ -653,6 +659,7 @@ public void createAsyncCallbackEndpoint(){ } // end try service.setInterfaceContract(interfaceContract); + String serviceName = getReference().getName() + "_asyncCallback"; service.setName(serviceName); service.getEndpoints().add(endpoint); @@ -661,6 +668,13 @@ public void createAsyncCallbackEndpoint(){ // Set pseudo-service onto the component getComponent().getServices().add(service); + + // if the reference has a WSDL contract reset the response endpoint to be WSDL also + InterfaceContract referenceInterfaceContract = getComponentTypeReferenceInterfaceContract(); + if (referenceInterfaceContract instanceof WSDLInterfaceContract){ + WSDLInterfaceContract wsdlInterfaceContract = (WSDLInterfaceContract)endpoint.getGeneratedWSDLContract(interfaceContract); + service.setInterfaceContract(wsdlInterfaceContract); + } // Create a binding // Mike had to go via the XML but I don't remember why diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index b5e3eec282..7700eeb79c 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -30,12 +30,20 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.provider.EndpointAsyncProvider; +import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.Invocable; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.work.WorkScheduler; @@ -43,7 +51,7 @@ * Invoker for a endpoint or endpoint reference * @version $Rev$ $Date$ */ -public class RuntimeInvoker implements Invoker, InvokerAsync { +public class RuntimeInvoker implements Invoker{ protected ExtensionPointRegistry registry; protected MessageFactory messageFactory; protected Invocable invocable; @@ -120,6 +128,7 @@ public void invokeAsync(Message msg) { epr.rebuild(); } msg.setFrom((EndpointReference)invocable); + msg.setTo(((EndpointReference)invocable).getTargetEndpoint()); } Operation operation = msg.getOperation(); @@ -140,12 +149,96 @@ public void invokeAsync(Message msg) { Message msgContext = ThreadMessageContext.setMessageContext(msg); try { // TODO - is this the way we'll pass async messages down the chain? - headInvoker.invokeAsync(msg); + Message resp = null; + try { + headInvoker.invokeAsyncRequest(msg); + } catch (Throwable ex) { + // temporary fix to swallow the dummy exception that's + // thrown back to get past the response chain processing. + if (!(ex instanceof AsyncResponseException)){ + // throw ex; + } + } + + // This is async but we check the response in case there is a + // fault reported on the forward request, i.e. before the + // request reaches the binding + if (resp != null){ + Object body = resp.getBody(); + if (resp.isFault()) { + //throw (Throwable)body; + } + } } finally { ThreadMessageContext.setMessageContext(msgContext); } return; } - + + public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) { + + // TODO - I pass a tail invoker in as on the service side I have one handy + // but calculate it here if it's not passed in + if (tailInvoker == null){ + Operation operation = msg.getOperation(); + InvocationChain chain = invocable.getInvocationChain(operation); + + // find the tail invoker + Invoker next = chain.getHeadInvoker(); + Invoker tail = null; + while (next != null){ + tail = next; + if (next instanceof Interceptor){ + next = ((Interceptor)next).getNext(); + + // TODO - hack to get round SCA binding optimization + // On the refrence side this loop will go all the way + // across to the service invoker so stop the look if we find + // an invoker with no previous pointer. This will be the point + // where the SCA binding invoker points to the head of the + // service chain + + if (!(next instanceof InterceptorAsync) || + ((InterceptorAsync)next).getPrevious() == null){ + break; + } + } else { + next = null; + } + } + tailInvoker = (InvokerAsync)tail; + } + + Message asyncResponseMsg = tailInvoker.invokeAsyncResponse(msg); + + // now get the asyncResponseInvoker + Invoker asyncResponseInvoker = null; + + // We'd want to cache this based on the reference EPR + if (invocable instanceof Endpoint) { + // get it from the binding + RuntimeEndpoint ep = (RuntimeEndpoint)invocable; + ServiceBindingProvider serviceBindingProvider = ep.getBindingProvider(); + if (serviceBindingProvider instanceof EndpointAsyncProvider){ + EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; + asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(asyncResponseMsg.getOperation()); + + } else { + // TODO - throw error + } + } else if (invocable instanceof EndpointReference) { + // get it from the implementation + RuntimeEndpointReference epr = (RuntimeEndpointReference)invocable; + ImplementationProvider implementationProvider = ((RuntimeComponent)epr.getComponent()).getImplementationProvider(); + + if (implementationProvider instanceof ImplementationAsyncProvider){ + asyncResponseInvoker = ((ImplementationAsyncProvider)implementationProvider).createAsyncResponseInvoker(asyncResponseMsg.getOperation()); + } else { + // TODO - throw an error + } + } + + asyncResponseInvoker.invoke(asyncResponseMsg); + } } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java index 8569af0de8..477f84e690 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java @@ -25,8 +25,10 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.DataExchangeSemantics; import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Phase; import org.apache.tuscany.sca.invocation.PhasedInterceptor; @@ -43,12 +45,14 @@ public class InvocationChainImpl implements InvocationChain { private final PhaseManager phaseManager; private boolean forReference; private boolean allowsPassByReference; + private boolean isAsyncInvocation; - public InvocationChainImpl(Operation sourceOperation, Operation targetOperation, boolean forReference, PhaseManager phaseManager) { + public InvocationChainImpl(Operation sourceOperation, Operation targetOperation, boolean forReference, PhaseManager phaseManager, boolean isAsyncInvocation) { this.targetOperation = targetOperation; this.sourceOperation = sourceOperation; this.forReference = forReference; this.phaseManager = phaseManager; + this.isAsyncInvocation = isAsyncInvocation; } public Operation getTargetOperation() { @@ -119,6 +123,17 @@ public void addInterceptor(String phase, Interceptor interceptor) { } private void addInvoker(String phase, Invoker invoker) { + if (isAsyncInvocation && + !(invoker instanceof InvokerAsync)){ + // TODO - should raise an error but don't want to break + // the existing non-native async support +/* + throw new IllegalArgumentException("Trying to add synchronous invoker " + + invoker.getClass().getName() + + " to asynchronous chain"); +*/ + } + int index = phaseManager.getAllPhases().indexOf(phase); if (index == -1) { throw new IllegalArgumentException("Invalid phase name: " + phase); @@ -149,11 +164,19 @@ private void addInvoker(String phase, Invoker invoker) { if (before != null) { if (before.getInvoker() instanceof Interceptor) { ((Interceptor)before.getInvoker()).setNext(invoker); + if (invoker instanceof InterceptorAsync && + before.getInvoker() instanceof InvokerAsync){ + ((InterceptorAsync) invoker).setPrevious((InvokerAsync)before.getInvoker()); + } } } if (after != null) { if (invoker instanceof Interceptor) { ((Interceptor)invoker).setNext(after.getInvoker()); + if (after.getInvoker() instanceof InterceptorAsync && + invoker instanceof InvokerAsync){ + ((InterceptorAsync) after.getInvoker()).setPrevious((InvokerAsync)invoker); + } } } @@ -204,5 +227,9 @@ public String toString() { return "(" + phaseIndex + ")" + invoker; } } + + public boolean isAsyncInvocation() { + return isAsyncInvocation; + } } diff --git a/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java b/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java index 1302bed681..38306317b4 100644 --- a/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java +++ b/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImplTestCase.java @@ -38,7 +38,7 @@ public class InvocationChainImplTestCase { @Test public void testInsertAtEnd() throws Exception { Operation op = newOperation("foo"); - InvocationChain chain = new InvocationChainImpl(op, op, true, new PhaseManager(new DefaultExtensionPointRegistry())); + InvocationChain chain = new InvocationChainImpl(op, op, true, new PhaseManager(new DefaultExtensionPointRegistry()), false); Interceptor inter2 = new MockInterceptor(); Interceptor inter1 = new MockInterceptor(); chain.addInterceptor(inter1); @@ -51,7 +51,7 @@ public void testInsertAtEnd() throws Exception { @Test public void testAddByPhase() throws Exception { Operation op = newOperation("foo"); - InvocationChain chain = new InvocationChainImpl(op, op, false, new PhaseManager(new DefaultExtensionPointRegistry())); + InvocationChain chain = new InvocationChainImpl(op, op, false, new PhaseManager(new DefaultExtensionPointRegistry()), false); Interceptor inter1 = new MockInterceptor(); Interceptor inter2 = new MockInterceptor(); Interceptor inter3 = new MockInterceptor(); From d8b2b0f7165df7187af4a3fe02085fd3702c70ff Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:25:42 +0000 Subject: [PATCH 026/174] TUSCANY-3801 - Update SCA binding to allow the invoker to exploit the new async interceptor impl and add and async response invoker to push async response back from service to reference (this only works in the local case though). git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041870 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding-sca-runtime/META-INF/MANIFEST.MF | 1 + .../SCABindingAsyncResponseInvoker.java | 45 +++++++++++++++++++ .../sca/provider/SCABindingInvoker.java | 33 +++++++------- 3 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java diff --git a/modules/binding-sca-runtime/META-INF/MANIFEST.MF b/modules/binding-sca-runtime/META-INF/MANIFEST.MF index 0732ffc0d7..a992e8286f 100644 --- a/modules/binding-sca-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-sca-runtime/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.contribution.processor;version="2.0.0", org.apache.tuscany.sca.contribution.resolver;version="2.0.0";resolution:=optional, org.apache.tuscany.sca.core;version="2.0.0", + org.apache.tuscany.sca.core.invocation;version="2.0.0", org.apache.tuscany.sca.databinding;version="2.0.0", org.apache.tuscany.sca.definitions;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java new file mode 100644 index 0000000000..8072b70795 --- /dev/null +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.binding.sca.provider; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + +/** + * @version $Rev: 989157 $ $Date: 2010-08-25 16:02:01 +0100 (Wed, 25 Aug 2010) $ + */ +public class SCABindingAsyncResponseInvoker implements Invoker { + + public SCABindingAsyncResponseInvoker(ExtensionPointRegistry extensionPoints, + RuntimeEndpointReference endpointReference) { + } + + // TODO - this only works for the local case! + public Message invoke(Message msg) { + RuntimeEndpointReference epr = (RuntimeEndpointReference)msg.getFrom(); + epr.invokeAsyncResponse(null, msg); + return null; + } +} diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java index c2a9038367..95fd4cd934 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java @@ -19,9 +19,9 @@ package org.apache.tuscany.sca.binding.sca.provider; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -29,10 +29,11 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + /** * @version $Rev$ $Date$ */ -public class SCABindingInvoker implements Interceptor { +public class SCABindingInvoker extends InterceptorAsyncImpl { private InvocationChain chain; private Mediator mediator; private Operation sourceOperation; @@ -68,12 +69,8 @@ public Invoker getNext() { public void setNext(Invoker next) { // NOOP } - - /** - * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message) - */ - public Message invoke(Message msg) { - + + public Message processRequest(Message msg){ if (passByValue) { msg.setBody(mediator.copyInput(msg.getBody(), sourceOperation, targetOperation)); } @@ -83,22 +80,24 @@ public Message invoke(Message msg) { RuntimeEndpointReference asyncEPR = (RuntimeEndpointReference) ep.getCallbackEndpointReferences().get(0); // Place a link to the callback EPR into the message headers... msg.getHeaders().put("ASYNC_CALLBACK", asyncEPR ); - } - - Message resultMsg = getNext().invoke(msg); - + } + + return msg; + } + + public Message processResponse(Message msg){ if (passByValue) { // Note source and target operation swapped so result is in source class loader - if (resultMsg.isFault()) { - resultMsg.setFaultBody(mediator.copyFault(resultMsg.getBody(), sourceOperation, targetOperation)); + if (msg.isFault()) { + msg.setFaultBody(mediator.copyFault(msg.getBody(), sourceOperation, targetOperation)); } else { if (sourceOperation.getOutputType() != null) { - resultMsg.setBody(mediator.copyOutput(resultMsg.getBody(), sourceOperation, targetOperation)); + msg.setBody(mediator.copyOutput(msg.getBody(), sourceOperation, targetOperation)); } } } - - return resultMsg; + + return msg; } } From e711d10222277d76d17aeee790508bf7a90414b2 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:26:59 +0000 Subject: [PATCH 027/174] TUSCANY-3801 - only create a service to accept async responses if the binding doesn't support asycn interactions natively git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041872 13f79535-47bb-0310-9956-ffa450edef68 --- .../runtime/impl/EndpointReferenceBinderImpl.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index ffe48005ea..67455bad09 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -55,6 +55,8 @@ import org.apache.tuscany.sca.policy.IntentMap; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.Qualifier; +import org.apache.tuscany.sca.provider.EndpointReferenceAsyncProvider; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; import org.apache.tuscany.sca.runtime.EndpointRegistry; @@ -330,9 +332,14 @@ public void bind(EndpointRegistry endpointRegistry, } } - // if the reference is an async reference fluff up the - // response service/endpoint - if (endpointReference.isAsyncInvocation()){ + // TUSCANY-3783 + // if the reference is an async reference and the binding doesn't support + // async natively fluff up the response service/endpoint + ReferenceBindingProvider referenceBindingProvider = ((RuntimeEndpointReference)endpointReference).getBindingProvider(); + if ( referenceBindingProvider instanceof EndpointReferenceAsyncProvider && + !((EndpointReferenceAsyncProvider)referenceBindingProvider).supportsNativeAsync() && + endpointReference.isAsyncInvocation() && + endpointReference.getCallbackEndpoint() == null) { ((RuntimeEndpointReference)endpointReference).createAsyncCallbackEndpoint(); } From a02ac36471e2c198be57f5f5808ac969eaaeb6cd Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 3 Dec 2010 15:28:08 +0000 Subject: [PATCH 028/174] correct import git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041875 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/sampleasync/impl/SampleWSDLInvoker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java index 3140da16da..1e682a9fe0 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java @@ -22,7 +22,7 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.core.invocation.impl.InterceptorAsyncImpl; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.Invoker; From 7b41fd6b15b68982a1cfb99745e23fd93b4e16e6 Mon Sep 17 00:00:00 2001 From: Brent Daniel Date: Fri, 3 Dec 2010 17:10:49 +0000 Subject: [PATCH 029/174] Modify test cases so that they aren't checking for an exact string. Different parser implementations can return strings that are equivalent but different in some trivial way git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1041915 13f79535-47bb-0310-9956-ffa450edef68 --- .../xml/ReadWriteAnyAttributeTestCase.java | 33 +++++++++- .../xml/ReadWriteAnyElementTestCase.java | 66 +++++++++++++++++-- .../xml/ReadWriteLocalCompositeTestCase.java | 8 ++- 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java index 28a2bb6851..cbe3cfa09c 100644 --- a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java +++ b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.StringReader; @@ -29,7 +30,9 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamReader; +import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Extension; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -47,7 +50,7 @@ public class ReadWriteAnyAttributeTestCase { private static final String XML = ""+ - ""+ ""+ @@ -94,6 +97,8 @@ public void testReadWriteCompositeWithAttributeProcessor() throws Exception { assertNotNull(composite); reader.close(); + verifyComposite(composite); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); staxProcessor.write(composite, bos, context); @@ -101,7 +106,11 @@ public void testReadWriteCompositeWithAttributeProcessor() throws Exception { // System.out.println(XML); // System.out.println(bos.toString()); - assertEquals(XML, bos.toString()); + //assertEquals(XML, bos.toString()); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + composite = staxProcessor.read(bis, Composite.class, context); + verifyComposite(composite); } /** @@ -118,6 +127,8 @@ public void testDefaultReadWriteComposite() throws Exception { assertNotNull(composite); reader.close(); + verifyComposite(composite); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); staxProcessor.write(composite, bos, context); @@ -125,6 +136,22 @@ public void testDefaultReadWriteComposite() throws Exception { // System.out.println(XML); // System.out.println(bos.toString()); - assertEquals(XML, bos.toString()); + // assertEquals(XML, bos.toString()); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + composite = staxProcessor.read(bis, Composite.class, context); + verifyComposite(composite); + } + + private void verifyComposite(Composite c) { + assertEquals("Calculator", c.getName().getLocalPart()); + assertEquals(1, c.getComponents().size()); + Component component = c.getComponents().get(0); + assertEquals("AddServiceComponent", component.getName()); + assertEquals(1, component.getAttributeExtensions().size()); + Extension extension = component.getAttributeExtensions().get(0); + assertEquals("customAttribute", extension.getQName().getLocalPart()); + assertEquals("http://test", extension.getQName().getNamespaceURI()); + assertEquals("customValue", extension.getValue()); } } \ No newline at end of file diff --git a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java index 7a36c1d97d..ddbd70e567 100644 --- a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java +++ b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java @@ -21,13 +21,17 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.StringReader; import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Extension; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -101,24 +105,54 @@ public void testReadWriteExtendedRecursiveElement() throws Exception { assertNotNull(composite); reader.close(); + verifyExtendedElementComposite(composite); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); staxProcessor.write(composite, bos, context); // used for debug comparison - // System.out.println(XML_RECURSIVE_EXTENDED_ELEMENT); - // System.out.println(bos.toString()); +// System.out.println(XML_RECURSIVE_EXTENDED_ELEMENT); +// System.out.println(bos.toString()); - assertEquals(XML_RECURSIVE_EXTENDED_ELEMENT, bos.toString()); + // assertEquals(XML_RECURSIVE_EXTENDED_ELEMENT, bos.toString()); bos.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + composite = staxProcessor.read(bis, Composite.class, context); + verifyExtendedElementComposite(composite); } - @Test + private void verifyExtendedElementComposite(Composite composite) throws XMLStreamException { + + assertEquals("RecursiveExtendedElement", composite.getName().getLocalPart()); + assertEquals(1, composite.getExtensions().size()); + Extension ext1 = (Extension) composite.getExtensions().get(0); + assertEquals("unknownElement", ext1.getQName().getLocalPart()); + assertEquals("http://docs.oasis-open.org/ns/opencsa/sca/200912", ext1.getQName().getNamespaceURI()); + + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader((String)ext1.getValue())); + reader.next(); + assertEquals("unknownElement", reader.getLocalName()); + reader.next(); + assertEquals("subUnknownElement1", reader.getLocalName()); + assertEquals(1, reader.getAttributeCount()); + assertEquals("attribute", reader.getAttributeLocalName(0)); + assertEquals("anyAttribute", reader.getAttributeValue(0)); + + reader.close(); + + } + + @Test public void testReadWriteUnknwonImpl() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_UNKNOWN_IMPL)); Composite composite = (Composite)staxProcessor.read(reader, context); assertNotNull(composite); reader.close(); + verifyUnknownImplComposite(composite); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); staxProcessor.write(composite, bos, context); @@ -126,13 +160,33 @@ public void testReadWriteUnknwonImpl() throws Exception { // System.out.println(XML_UNKNOWN_IMPL); // System.out.println(bos.toString()); - assertEquals(XML_UNKNOWN_IMPL, bos.toString()); + // assertEquals(XML_UNKNOWN_IMPL, bos.toString()); bos.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + composite = staxProcessor.read(bis, Composite.class, context); + verifyUnknownImplComposite(composite); } - // @Test + private void verifyUnknownImplComposite(Composite composite) { + + assertEquals("aaaa", composite.getName().getLocalPart()); + assertEquals(1, composite.getComponents().size()); + Component component = composite.getComponents().get(0); + assertEquals("unknownImpl", component.getName()); + assertEquals(1, component.getServices().size()); + assertEquals("service", component.getServices().get(0).getName()); + assertEquals(1, component.getExtensions().size()); + Extension ext = (Extension) component.getExtensions().get(0); + assertEquals("http://docs.oasis-open.org/ns/opencsa/sca/200912", ext.getQName().getNamespaceURI()); + assertEquals("implementation.unknown", ext.getQName().getLocalPart()); + + } + + // @Test @Ignore() public void testReadWriteInvalidAttribute() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_UNKNOWN_IMPL_WITH_INVALID_ATTRIBUTE)); Composite composite = (Composite)staxProcessor.read(reader, context); assertNotNull(composite); diff --git a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java index fc675dcdce..b3ccdd8201 100644 --- a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java +++ b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -98,6 +99,11 @@ public void testWriteComposite() throws Exception { staxProcessor.write(composite, bos, context); System.out.println(bos.toString()); - assertEquals(LOCAL_COMPOSITE_XML, bos.toString()); + // assertEquals(LOCAL_COMPOSITE_XML, bos.toString()); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + composite = staxProcessor.read(bis, Composite.class, context); + assertNotNull(composite); + assertTrue(composite.isLocal()); } } From 36260ffcc2ddb3f3b1c708d0bc27f6686b37c70a Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Mon, 6 Dec 2010 01:37:36 +0000 Subject: [PATCH 030/174] Minor cleanup git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042506 13f79535-47bb-0310-9956-ffa450edef68 --- .../provider/RESTServiceBindingProvider.java | 101 +++++++++--------- 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java b/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java index ec607e9e13..fab971de53 100644 --- a/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java +++ b/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTServiceBindingProvider.java @@ -157,6 +157,42 @@ public RESTServiceBindingProvider(RuntimeEndpoint endpoint, } + public InterfaceContract getBindingInterfaceContract() { + return serviceContract; + } + + + /** + * Add specific rest interceptor to invocation chain + */ + public void configure() { + + InvocationChain bindingChain = endpoint.getBindingInvocationChain(); + + if (wfProvider != null) { + Interceptor interceptor = wfProvider.createInterceptor(); + if (interceptor != null) { + bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor); + } + } + + if (wfResponseProvider != null) { + Interceptor interceptor = wfResponseProvider.createInterceptor(); + if (interceptor != null) { + bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor); + } + + } + + if (osProvider != null) { + Interceptor interceptor = osProvider.createInterceptor(); + if (interceptor != null) { + bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, interceptor); + } + } + + } + public void start() { InvocationChain bindingChain = endpoint.getBindingInvocationChain(); @@ -214,7 +250,21 @@ public void start() { servletMapping = registerServlet(servlet); } - public String registerServlet(Servlet servlet) { + public void stop() { + if (application != null) { + application.destroy(); + } + // Unregister the Servlet from the Servlet host + servletHost.removeServletMapping(servletMapping); + } + + + public boolean supportsOneWayInvocation() { + return false; + } + + + private String registerServlet(Servlet servlet) { // Create our HTTP service listener Servlet and register it with the // Servlet host String servletMapping = binding.getURI(); @@ -234,22 +284,6 @@ public String registerServlet(Servlet servlet) { return mappedURI; } - public void stop() { - if (application != null) { - application.destroy(); - } - // Unregister the Servlet from the Servlet host - servletHost.removeServletMapping(servletMapping); - } - - public InterfaceContract getBindingInterfaceContract() { - return serviceContract; - } - - public boolean supportsOneWayInvocation() { - return false; - } - /** * Register a Tuscany REST Servlet to handle JAX-RS Resources on a binding endpoint * @return @@ -269,7 +303,7 @@ private SimpleApplication registerWithJAXRS() { TuscanyRESTServlet restServlet = new TuscanyRESTServlet(extensionPoints, binding, application.resourceClass); servletMapping = registerServlet(restServlet); - + RegistrationUtils.registerApplication(application, restServlet.getServletContext()); return application; } else { @@ -338,35 +372,4 @@ public void destroy() { } } - /** - * Add specific rest interceptor to invocation chain - */ - public void configure() { - - InvocationChain bindingChain = endpoint.getBindingInvocationChain(); - - if (wfProvider != null) { - Interceptor interceptor = wfProvider.createInterceptor(); - if (interceptor != null) { - bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor); - } - } - - if (wfResponseProvider != null) { - Interceptor interceptor = wfResponseProvider.createInterceptor(); - if (interceptor != null) { - bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor); - } - - } - - if (osProvider != null) { - Interceptor interceptor = osProvider.createInterceptor(); - if (interceptor != null) { - bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, interceptor); - } - } - - } - } From 2251ab14202586ac6c01cd173b50ddc22b141665 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 6 Dec 2010 08:17:01 +0000 Subject: [PATCH 031/174] Add RAT exclude for OO diagrams git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042543 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/distribution/legal-checks/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/itest/distribution/legal-checks/pom.xml b/testing/itest/distribution/legal-checks/pom.xml index 7e246308a4..47ff46da35 100644 --- a/testing/itest/distribution/legal-checks/pom.xml +++ b/testing/itest/distribution/legal-checks/pom.xml @@ -64,6 +64,7 @@ **/DEPENDENCIES **/target/**/*.log **/config.ini + **/*.odg tuscany-sca-2.0-SNAPSHOT/features/configuration/config.ini From 7a6dae0f5591beaf44c0787a8326e5ba8b01d744 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Mon, 6 Dec 2010 10:39:12 +0000 Subject: [PATCH 032/174] Fix error message. The details stay the same but the prefix "Test service got an exception during execution" is removed git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042563 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/resources/tuscany-oasis-sca-tests-errors.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/testing/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties index 3a6e06654c..9410c01ff8 100644 --- a/testing/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ b/testing/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -POL_3001=Test service got an exception during execution: org.oasisopen.sca.ServiceRuntimeException WSDL document is using SOAP v1.2 but SOAP v1.1 is required by the specified policy intents +POL_3001=org.oasisopen.sca.ServiceRuntimeException: WSDL document is using SOAP v1.2 but SOAP v1.1 is required by the specified policy intents POL_3002=TUSCANY-3370 POL_3003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3003, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3003.zip!/META-INF/definitions.xml] - [ASM10001,POL30002] Duplicate intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}dupIntent found in domain POL_3004=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3004, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3004.zip!/META-INF/definitions.xml] - [POL30004] Intent twoDefaults has more than one qualifier marked as the default qualifier From 7af60d7cba882e744b105264cf9100a20954ea16 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Mon, 6 Dec 2010 12:47:39 +0000 Subject: [PATCH 033/174] TUSCANY-3801 - move chain tail location code into the chain implementation git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042609 13f79535-47bb-0310-9956-ffa450edef68 --- .../service/mocks/TestRuntimeWire.java | 2 +- .../SCABindingAsyncResponseInvoker.java | 2 +- .../sca/invocation/InvocationChain.java | 7 ++++ .../apache/tuscany/sca/runtime/Invocable.java | 2 +- .../assembly/impl/RuntimeEndpointImpl.java | 4 +-- .../impl/RuntimeEndpointReferenceImpl.java | 4 +-- .../sca/core/invocation/RuntimeInvoker.java | 35 ++----------------- .../invocation/impl/InvocationChainImpl.java | 28 +++++++++++++++ .../sampleasync/impl/SampleWSDLInvoker.java | 2 +- 9 files changed, 46 insertions(+), 40 deletions(-) diff --git a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java index 756299696a..db0e571ef6 100644 --- a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java +++ b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java @@ -209,7 +209,7 @@ public Message invoke(Operation operation, Message msg) { public void invokeAsync(Operation operation, Message msg) { } - public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) { + public void invokeAsyncResponse(Message msg) { } public void unbind() { diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java index 8072b70795..26707e8ebd 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java @@ -39,7 +39,7 @@ public SCABindingAsyncResponseInvoker(ExtensionPointRegistry extensionPoints, // TODO - this only works for the local case! public Message invoke(Message msg) { RuntimeEndpointReference epr = (RuntimeEndpointReference)msg.getFrom(); - epr.invokeAsyncResponse(null, msg); + epr.invokeAsyncResponse(msg); return null; } } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java index d10a5689d4..1d38ec7101 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java @@ -81,6 +81,13 @@ public interface InvocationChain { */ Invoker getHeadInvoker(); + /** + * Returns the last invoker in the chain. + * + * @return The last invoker in the chain + */ + Invoker getTailInvoker(); + /** * Get the first invoker that is on the same or later phase * @param phase diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index cf9b8ac49e..7c7c104947 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -145,7 +145,7 @@ public interface Invocable { * @param tailInvoker the invoker at the end of the chain * @param msg The request message */ - void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg); + void invokeAsyncResponse(Message msg); /** * Get a list of policy providers diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 32aa0c0646..d74ee4a8f9 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -293,8 +293,8 @@ public void invokeAsync(Operation operation, Message msg) throws Throwable { invoker.invokeAsync(msg); } - public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){ - invoker.invokeAsyncResponse(tailInvoker, msg); + public void invokeAsyncResponse(Message msg){ + invoker.invokeAsyncResponse(msg); } /** diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index 2aadf34295..b8ca59b214 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -245,8 +245,8 @@ public void invokeAsync(Operation operation, Message msg) throws Throwable { invoker.invokeAsync(msg); } - public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg){ - invoker.invokeAsyncResponse(tailInvoker, msg); + public void invokeAsyncResponse(Message msg){ + invoker.invokeAsyncResponse(msg); } /** diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index 7700eeb79c..e1ec899fa5 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -176,39 +176,10 @@ public void invokeAsync(Message msg) { return; } - public void invokeAsyncResponse(InvokerAsync tailInvoker, Message msg) { + public void invokeAsyncResponse(Message msg) { - // TODO - I pass a tail invoker in as on the service side I have one handy - // but calculate it here if it's not passed in - if (tailInvoker == null){ - Operation operation = msg.getOperation(); - InvocationChain chain = invocable.getInvocationChain(operation); - - // find the tail invoker - Invoker next = chain.getHeadInvoker(); - Invoker tail = null; - while (next != null){ - tail = next; - if (next instanceof Interceptor){ - next = ((Interceptor)next).getNext(); - - // TODO - hack to get round SCA binding optimization - // On the refrence side this loop will go all the way - // across to the service invoker so stop the look if we find - // an invoker with no previous pointer. This will be the point - // where the SCA binding invoker points to the head of the - // service chain - - if (!(next instanceof InterceptorAsync) || - ((InterceptorAsync)next).getPrevious() == null){ - break; - } - } else { - next = null; - } - } - tailInvoker = (InvokerAsync)tail; - } + InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); + InvokerAsync tailInvoker = (InvokerAsync)chain.getTailInvoker(); Message asyncResponseMsg = tailInvoker.invokeAsyncResponse(msg); diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java index 477f84e690..716379d141 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java @@ -91,6 +91,34 @@ public Invoker getHeadInvoker() { return nodes.isEmpty() ? null : nodes.get(0).getInvoker(); } + public Invoker getTailInvoker() { + // find the tail invoker + Invoker next = getHeadInvoker(); + Invoker tail = null; + while (next != null){ + tail = next; + if (next instanceof Interceptor){ + next = ((Interceptor)next).getNext(); + + // TODO - hack to get round SCA binding optimization + // On the reference side this loop will go all the way + // across to the service invoker so stop looking if we find + // an invoker with no "previous" pointer. This will be the point + // where the SCA binding invoker points to the head of the + // service chain + + if (!(next instanceof InterceptorAsync) || + ((InterceptorAsync)next).getPrevious() == null){ + break; + } + } else { + next = null; + } + } + + return tail; + } + public Invoker getHeadInvoker(String phase) { int index = phaseManager.getAllPhases().indexOf(phase); if (index == -1) { diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java index 1e682a9fe0..4341c053fd 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java @@ -67,7 +67,7 @@ public void invokeAsyncRequest(Message msg) { // component implementation itself doesn't get a chance to // do async responses. - ((RuntimeEndpoint)endpoint).invokeAsyncResponse(this, responseMsg); + ((RuntimeEndpoint)endpoint).invokeAsyncResponse(responseMsg); } public Message processRequest(Message msg) { From 5075d7cdf0d5cd4d9966290fe62f1287689ab69d Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 6 Dec 2010 14:53:37 +0000 Subject: [PATCH 034/174] Start updating the sca binding to be able to choose the binding type impl on a per service basis instead of a single global choice git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042665 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/provider/DefaultSCABindingMapper.java | 106 +++++++++++------- .../RuntimeSCAReferenceBindingProvider.java | 2 +- .../RuntimeSCAServiceBindingProvider.java | 2 +- .../sca/provider/SCABindingMapper.java | 3 +- 4 files changed, 68 insertions(+), 45 deletions(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java index 4105c74efc..9a1c4777a8 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java @@ -57,51 +57,55 @@ public class DefaultSCABindingMapper implements SCABindingMapper { private final static Logger logger = Logger.getLogger(DefaultSCABindingMapper.class.getName()); protected ExtensionPointRegistry registry; protected ProviderFactoryExtensionPoint providerFactories; - protected StAXArtifactProcessor processor; - protected BindingBuilder builder; - protected QName mappedBinding; - private Binding bindingTemplate; - private boolean remotable; + protected StAXArtifactProcessorExtensionPoint processors; + protected QName defaultMappedBinding; public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map attributes) { this.registry = registry; + providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class); + processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + defaultMappedBinding = getDefaultMappedBinding(attributes); + } + + protected QName getDefaultMappedBinding(Map attributes) { + QName defaultMappedBinding = null; if (attributes != null) { String qname = attributes.get("mappedBinding"); if (qname != null) { - mappedBinding = ServiceDeclarationParser.getQName(qname); + defaultMappedBinding = ServiceDeclarationParser.getQName(qname); } } - if (mappedBinding == null) { + if (defaultMappedBinding == null) { String qname = System.getProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); if (qname != null) { - mappedBinding = ServiceDeclarationParser.getQName(qname); + defaultMappedBinding = ServiceDeclarationParser.getQName(qname); } else { // By default, mapping to binding.ws or if thats not available then binding.rmi - mappedBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.hazelcast"); - if (registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class).getProcessor(mappedBinding) == null) { - mappedBinding = new QName(Base.SCA11_NS, "binding.ws"); - if (registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class).getProcessor(mappedBinding) == null) { - mappedBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.rmi"); + defaultMappedBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.hazelcast"); + if (registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class).getProcessor(defaultMappedBinding) == null) { + defaultMappedBinding = new QName(Base.SCA11_NS, "binding.ws"); + if (registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class).getProcessor(defaultMappedBinding) == null) { + defaultMappedBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.rmi"); } } } } + return defaultMappedBinding; + } - providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class); - StAXArtifactProcessorExtensionPoint processors = - registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - processor = processors.getProcessor(mappedBinding); + private BindingBuilder getBindingBuilder(QName binding) { + StAXArtifactProcessor processor = processors.getProcessor(binding); if (processor == null) { - logger.warning("Mapped binding for binding.sca is not supported: " + mappedBinding); + logger.warning("Mapped binding for binding.sca is not supported: " + binding); } try { if (processor != null) { - bindingTemplate = createDelegatingBinding(); + Binding bindingTemplate = createDelegatingBinding(defaultMappedBinding); ProviderFactory providerFactory = providerFactories.getProviderFactory(bindingTemplate.getClass()); if (providerFactory == null) { - logger.warning("Mapped binding for binding.sca is not supported: " + mappedBinding); + logger.warning("Mapped binding for binding.sca is not supported: " + binding); processor = null; } } @@ -109,13 +113,13 @@ public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map list = factories.getDomainRegistryFactories(); @@ -129,9 +133,13 @@ private boolean isDistributed() { } public RuntimeEndpoint map(RuntimeEndpoint endpoint) { - if (processor == null) { + + QName bindingType = chooseBinding(endpoint); + if (processors.getProcessor(bindingType) == null) { + logger.warning("Mapped binding for binding.sca is not supported: " + bindingType); return null; } + // create a copy of the endpoint but with the web service binding in RuntimeEndpoint ep = null; try { @@ -140,8 +148,9 @@ public RuntimeEndpoint map(RuntimeEndpoint endpoint) { // we know we can clone endpoint references } - Binding binding = map(endpoint.getBinding()); + Binding binding = map(endpoint.getBinding(), bindingType); ep.setBinding(binding); + BindingBuilder builder = getBindingBuilder(bindingType); if (builder != null) { builder.build(ep.getComponent(), ep.getService(), binding, new BuilderContext(registry), false); } @@ -149,9 +158,12 @@ public RuntimeEndpoint map(RuntimeEndpoint endpoint) { } public RuntimeEndpointReference map(RuntimeEndpointReference endpointReference) { - if (processor == null) { + QName bindingType = chooseBinding(endpointReference); + if (processors.getProcessor(bindingType) == null) { + logger.warning("Mapped binding for binding.sca is not supported: " + bindingType); return null; } + // create a copy of the endpoint but with the web service binding in RuntimeEndpointReference epr = null; try { @@ -160,11 +172,12 @@ public RuntimeEndpointReference map(RuntimeEndpointReference endpointReference) // we know we can clone endpoint references } - Binding binding = map(endpointReference.getBinding()); + Binding binding = map(endpointReference.getBinding(), bindingType); epr.setBinding(binding); // epr.setTargetEndpoint(map((RuntimeEndpoint)epr.getTargetEndpoint())); + BindingBuilder builder = getBindingBuilder(bindingType); if (builder != null) { builder.build(epr.getComponent(), epr.getReference(), binding, new BuilderContext(registry), false); } @@ -172,9 +185,9 @@ public RuntimeEndpointReference map(RuntimeEndpointReference endpointReference) return epr; } - protected Binding map(Binding scaBinding) { + protected Binding map(Binding scaBinding, QName newBindingType) { try { - Binding binding = createDelegatingBinding(); + Binding binding = createDelegatingBinding(newBindingType); binding.setName(scaBinding.getName()); binding.setURI(scaBinding.getURI()); binding.setOperationSelector(scaBinding.getOperationSelector()); @@ -192,29 +205,38 @@ protected Binding map(Binding scaBinding) { } } - - private Binding createDelegatingBinding() throws XMLStreamException, ContributionReadException { - if (bindingTemplate != null) { - try { - return (Binding)bindingTemplate.clone(); - } catch (CloneNotSupportedException e) { - // Ignore - } + + protected Binding createDelegatingBinding(QName bindingType) throws XMLStreamException, ContributionReadException { + StAXArtifactProcessor processor = processors.getProcessor(bindingType); + if (processor == null) { + logger.warning("Mapped binding for binding.sca is not supported: " + bindingType); } - // This is a hack to create an instance of the binding using the XML QName + StringBuffer xml = new StringBuffer(); - xml.append("<").append(mappedBinding.getLocalPart()).append(" xmlns:b=\"").append(mappedBinding - .getNamespaceURI()).append("\"/>"); + xml.append("<").append(bindingType.getLocalPart()).append(" xmlns:b=\"").append(bindingType.getNamespaceURI()).append("\"/>"); StAXHelper staxHelper = StAXHelper.getInstance(registry); XMLStreamReader reader = staxHelper.createXMLStreamReader(new StringReader(xml.toString())); reader.nextTag(); Binding binding = (Binding)processor.read(reader, new ProcessorContext(registry)); + return binding; } - public boolean isRemotable() { - return remotable; + public boolean isRemotable(RuntimeEndpoint endpoint) { + return isDistributed() && processors.getProcessor(chooseBinding(endpoint)) != null; + } + + public boolean isRemotable(RuntimeEndpointReference endpointReference) { + return isDistributed() && processors.getProcessor(chooseBinding(endpointReference)) != null; + } + + protected QName chooseBinding(RuntimeEndpoint endpoint) { + return defaultMappedBinding; + } + + protected QName chooseBinding(RuntimeEndpointReference endpointReference) { + return defaultMappedBinding; } } diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java index c36506a6c7..dff89b8d79 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java @@ -96,7 +96,7 @@ private ReferenceBindingProvider getDistributedProvider() { + reference.getName()); } - if (scaBindingMapper.isRemotable()) { + if (scaBindingMapper.isRemotable(endpointReference)) { distributedProvider = new DelegatingSCAReferenceBindingProvider(endpointReference, scaBindingMapper); } diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java index 7c6ba9cd69..87d3013a98 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java @@ -55,7 +55,7 @@ public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints, // then we need to create a remote endpoint if (service.getInterfaceContract().getInterface().isRemotable()) { - if (scaBindingMapper.isRemotable()) { + if (scaBindingMapper.isRemotable(endpoint)) { distributedProvider = new DelegatingSCAServiceBindingProvider(endpoint, scaBindingMapper); } } diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingMapper.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingMapper.java index 03aa44a04e..f0e6a77b16 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingMapper.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingMapper.java @@ -45,6 +45,7 @@ public interface SCABindingMapper { * Check if the remote SCA binding is supported * @return */ - boolean isRemotable(); + boolean isRemotable(RuntimeEndpoint endpoint); + boolean isRemotable(RuntimeEndpointReference endpointReference); } From 6d3a45186d1666da25a16a6a7a4765b7535c4faf Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Mon, 6 Dec 2010 17:34:20 +0000 Subject: [PATCH 035/174] Removing duplicated HTTPContext class from binding-http and using the one from common-http git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042738 13f79535-47bb-0310-9956-ffa450edef68 --- ...ltServiceOperationSelectorInterceptor.java | 4 +- ...TPDefaultWireFormatServiceInterceptor.java | 8 ++-- .../HTTPXMLWireFormatServiceInterceptor.java | 6 +-- .../provider/HTTPBindingServiceServlet.java | 5 +- .../binding/http/provider/HTTPContext.java | 46 ------------------- 5 files changed, 12 insertions(+), 57 deletions(-) delete mode 100644 modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPContext.java diff --git a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultServiceOperationSelectorInterceptor.java b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultServiceOperationSelectorInterceptor.java index dc4f37dbad..d45401bd7f 100644 --- a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultServiceOperationSelectorInterceptor.java +++ b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultServiceOperationSelectorInterceptor.java @@ -23,7 +23,7 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.tuscany.sca.binding.http.provider.HTTPContext; +import org.apache.tuscany.sca.common.http.HTTPContext; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; @@ -56,7 +56,7 @@ public HTTPDefaultServiceOperationSelectorInterceptor(RuntimeEndpoint endpoint) @Override public Message invoke(Message msg) { HTTPContext context = msg.getBindingContext(); - HttpServletRequest request = context.getRequest(); + HttpServletRequest request = context.getHttpRequest(); String path = request.getPathInfo(); if (path.startsWith("/")) { path = path.substring(1); diff --git a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java index fcbf8015f8..e2ac99bfb8 100644 --- a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java +++ b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPDefaultWireFormatServiceInterceptor.java @@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.tuscany.sca.binding.http.provider.HTTPContext; +import org.apache.tuscany.sca.common.http.HTTPContext; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; @@ -87,7 +87,7 @@ public Message invoke(Message msg) { private Message invokeRequest(Message msg) throws IOException { HTTPContext context = msg.getBindingContext(); - HttpServletRequest servletRequest = context.getRequest(); + HttpServletRequest servletRequest = context.getHttpRequest(); if ("GET".equals(servletRequest.getMethod())) { msg.setBody(getRequestFromQueryString(msg.getOperation(), servletRequest)); } else { @@ -120,8 +120,8 @@ private Object[] getRequestFromPost(Operation operation, HttpServletRequest serv private Message invokeResponse(Message msg) throws IOException { HTTPContext context = msg.getBindingContext(); - HttpServletRequest servletRequest = context.getRequest(); - HttpServletResponse servletResponse = context.getResponse(); + HttpServletRequest servletRequest = context.getHttpRequest(); + HttpServletResponse servletResponse = context.getHttpResponse(); if (msg.isFault()) { servletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, String.valueOf(msg.getBody())); diff --git a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java index 8bd8b8b9f0..bfc22ec78f 100644 --- a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java +++ b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/format/HTTPXMLWireFormatServiceInterceptor.java @@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.tuscany.sca.binding.http.provider.HTTPContext; +import org.apache.tuscany.sca.common.http.HTTPContext; import org.apache.tuscany.sca.common.xml.dom.DOMHelper; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.util.FaultException; @@ -80,7 +80,7 @@ public Message invoke(Message msg) { private Message invokeRequest(Message msg) throws IOException, SAXException { HTTPContext context = msg.getBindingContext(); - HttpServletRequest servletRequest = context.getRequest(); + HttpServletRequest servletRequest = context.getHttpRequest(); if ("GET".equals(servletRequest.getMethod())) { msg.setBody(getRequestFromQueryString(msg.getOperation(), servletRequest)); } else { @@ -91,7 +91,7 @@ private Message invokeRequest(Message msg) throws IOException, SAXException { private Message invokeResponse(Message msg) throws IOException { HTTPContext context = msg.getBindingContext(); - HttpServletResponse servletResponse = context.getResponse(); + HttpServletResponse servletResponse = context.getHttpResponse(); servletResponse.setContentType("text/xml"); diff --git a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingServiceServlet.java b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingServiceServlet.java index 686032571e..4d1f655577 100644 --- a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingServiceServlet.java +++ b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingServiceServlet.java @@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.tuscany.sca.common.http.HTTPContext; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; @@ -44,8 +45,8 @@ public HTTPBindingServiceServlet(RuntimeEndpoint wire, MessageFactory messageFac @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HTTPContext bindingContext = new HTTPContext(); - bindingContext.setRequest(request); - bindingContext.setResponse(response); + bindingContext.setHttpRequest(request); + bindingContext.setHttpResponse(response); Message msg = messageFactory.createMessage(); msg.setBindingContext(bindingContext); wire.invoke(msg); diff --git a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPContext.java b/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPContext.java deleted file mode 100644 index 0a49823f06..0000000000 --- a/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPContext.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ - -package org.apache.tuscany.sca.binding.http.provider; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Holder to pass servlet request and response between the Inteceptors - */ -public class HTTPContext { - - private HttpServletRequest request; - private HttpServletResponse response; - - public HttpServletRequest getRequest() { - return request; - } - public void setRequest(HttpServletRequest request) { - this.request = request; - } - public HttpServletResponse getResponse() { - return response; - } - public void setResponse(HttpServletResponse response) { - this.response = response; - } - -} From 91206efa08c02e3d494308d6c8c6fc69a5fdf256 Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Mon, 6 Dec 2010 17:34:25 +0000 Subject: [PATCH 036/174] Adding client javascript proxy support for rest binding integrated with implementation widget git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042739 13f79535-47bb-0310-9956-ffa450edef68 --- ....sca.web.javascript.JavascriptProxyFactory | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 modules/binding-rest-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory diff --git a/modules/binding-rest-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory b/modules/binding-rest-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory new file mode 100644 index 0000000000..36093d7bfa --- /dev/null +++ b/modules/binding-rest-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory @@ -0,0 +1,19 @@ +# 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. + +# Implementation class for the Javascript Proxy Factory +org.apache.tuscany.sca.binding.rest.js.dojo.RESTBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.rest,model=org.apache.tuscany.sca.binding.rest.RESTBinding \ No newline at end of file From cd93ed2a7f4c5fc46f9588b8db213960b4996528 Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Mon, 6 Dec 2010 17:34:27 +0000 Subject: [PATCH 037/174] Adding new modules to web20 feature git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042740 13f79535-47bb-0310-9956-ffa450edef68 --- features/web20/pom.xml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/features/web20/pom.xml b/features/web20/pom.xml index 73c8d43b57..84fc50352a 100644 --- a/features/web20/pom.xml +++ b/features/web20/pom.xml @@ -85,11 +85,6 @@ 2.0-SNAPSHOT - - org.apache.tuscany.sca - tuscany-binding-http - 2.0-SNAPSHOT - org.apache.tuscany.sca tuscany-binding-http-runtime @@ -104,10 +99,10 @@ org.apache.tuscany.sca - tuscany-binding-jsonp + tuscany-binding-rest-js-dojo 2.0-SNAPSHOT - + org.apache.tuscany.sca tuscany-binding-jsonrpc-runtime From 90e3bd64d4b39cd72daaaec0a7d7ed6a5efb732f Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Mon, 6 Dec 2010 17:34:31 +0000 Subject: [PATCH 038/174] Modifying typo in the package name for the jsonrpc js proxy factory service registration git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042741 13f79535-47bb-0310-9956-ffa450edef68 --- ...org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory b/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory index 88f2fa0dbe..39af70d08f 100644 --- a/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory +++ b/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory @@ -16,4 +16,4 @@ # under the License. # Implementation class for the Javascript Proxy Factory -org.apache.tuscany.sca.binding.jsonrpc.js.dojo.JSONRPCBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.jsonrpc,model=org.apache.tuscany.sca.binding.atom.JSONRPCBinding \ No newline at end of file +org.apache.tuscany.sca.binding.jsonrpc.js.dojo.JSONRPCBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.jsonrpc,model=org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding \ No newline at end of file From 542e49ce8d98fb7d8b3347a39c1b91c1814d1694 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Tue, 7 Dec 2010 11:23:53 +0000 Subject: [PATCH 039/174] TUSCANY-3801 - Allow the response chain "previous" link to be attached to an async response handler so that the invokerAsyncResponse can have a void return type. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1042976 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/invocation/InvokerAsync.java | 74 ------------------- .../sca/invocation/InvokerAsyncRequest.java | 51 +++++++++++++ .../sca/provider/EndpointAsyncProvider.java | 3 +- .../EndpointReferenceAsyncProvider.java | 5 +- .../provider/ImplementationAsyncProvider.java | 10 ++- .../apache/tuscany/sca/runtime/Invocable.java | 1 - .../assembly/impl/RuntimeEndpointImpl.java | 71 ++++++++++++++++-- .../impl/RuntimeEndpointReferenceImpl.java | 24 +++++- .../core/invocation/InterceptorAsyncImpl.java | 34 ++++++--- .../sca/core/invocation/RuntimeInvoker.java | 23 +++--- .../invocation/impl/InvocationChainImpl.java | 26 ++++--- .../sampleasync/impl/SampleAsyncProvider.java | 8 +- .../impl/SampleAsyncResponseInvoker.java | 21 +++--- .../sampleasync/impl/SampleJavaInvoker.java | 13 +++- .../sampleasync/impl/SampleWSDLInvoker.java | 2 - 15 files changed, 222 insertions(+), 144 deletions(-) delete mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java deleted file mode 100644 index a67a28a931..0000000000 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsync.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -package org.apache.tuscany.sca.invocation; - -/** - * TUSCANY-3786 - * - * Interface to describe an invoation where the request processing - * can be performed independently of the response processing. This - * has been instigated to allow async responses to be processed - * independently of the requests that instigated them. Due to the need - * to run the reponse processing interceptors effectively backwards the - * methods defined here are not responsible for finding the next invoker - * in the chain. - * - */ -public interface InvokerAsync { - - /** - * Process the forward message and pass it down the chain - * - * @param msg The request Message - * @return the processed message - * - */ - void invokeAsyncRequest(Message msg); - - /** - * Process response message and pass it back up the chain. - * This returns the message that is processed by the chain - * so that it can be passes onto the appropriate invoker by the caller - * the response path doesn't have an invoker. - * - * @param msg The request Message - * @return the processed message - * - */ - Message invokeAsyncResponse(Message msg); - - /** - * Process a request message - * - * @param msg The request Message - * @return the processed message - * - */ - Message processRequest(Message msg); - - /** - * Process a response message - * - * @param msg The request Message - * @return the processed message - * - */ - Message processResponse(Message msg); - -} diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java new file mode 100644 index 0000000000..5a53504ffb --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java @@ -0,0 +1,51 @@ +/* + * 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. + */ +package org.apache.tuscany.sca.invocation; + +/** + * TUSCANY-3786 + * + * The request side of an Interface to describe an invocation where + * the request processing can be performed independently of the + * response processing. + */ +public interface InvokerAsyncRequest { + + /** + * Process the request message and pass it down the chain + * + * @param msg The request Message + * @return the processed message + * + */ + void invokeAsyncRequest(Message msg); + + /** + * Process a request message. Provided so that the synchronous + * and asynchronous patterns can re-use the request message + * processing + * + * @param msg The request Message + * @return the processed message + * + */ + Message processRequest(Message msg); + + +} diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java index dbf0c0fd8d..b74b1dd9a7 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointAsyncProvider.java @@ -21,6 +21,7 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; /** @@ -51,5 +52,5 @@ public interface EndpointAsyncProvider extends EndpointProvider { * @para operation * @return the invoker that will dispatch the async response */ - Invoker createAsyncResponseInvoker(Operation operation); + InvokerAsyncResponse createAsyncResponseInvoker(); } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java index 536b6f2ea5..044ba523b9 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/EndpointReferenceAsyncProvider.java @@ -31,11 +31,10 @@ public interface EndpointReferenceAsyncProvider extends EndpointReferenceProvide /** * TUSCANY-3801 - * Returns true if the service binding provider is natively able - * to dispatch async responses. + * Returns true if the reference binding provider is natively able + * to receive async responses. * * @return true if the service provide support async operation natively */ boolean supportsNativeAsync(); - } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java index b555087d82..1ddf015568 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java @@ -22,6 +22,8 @@ import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.runtime.RuntimeComponentService; /** @@ -36,9 +38,10 @@ public interface ImplementationAsyncProvider extends ImplementationProvider { /** + * TUSCANY-3801 * Create an async invoker for the component implementation in the invocation * chain. The invoker will be responsible for calling the implementation - * logic for the given component. The only realy difference between this and + * logic for the given component. The only real difference between this and * createInvoker is that the Endpoint is passed in so that the invoker can * engineer the async response * @@ -48,9 +51,10 @@ public interface ImplementationAsyncProvider extends ImplementationProvider { * @return An invoker that handles the invocation logic, null should be * returned if no invoker is required */ - Invoker createAsyncInvoker(Endpoint endpoint, RuntimeComponentService service, Operation operation); + InvokerAsyncRequest createAsyncInvoker(Endpoint endpoint, RuntimeComponentService service, Operation operation); /** + * TUSCANY-3801 * Create an invoker for the asynchronous responses in the invocation * chain. The invoker will be responsible for processing the async * response including correlating it with the forward call using @@ -60,6 +64,6 @@ public interface ImplementationAsyncProvider extends ImplementationProvider { * @param operation The operation that the interceptor will handle * @return An AsyncResponseHandler instance */ - Invoker createAsyncResponseInvoker(Operation operation); + InvokerAsyncResponse createAsyncResponseInvoker(Operation operation); } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index 7c7c104947..9a936bf141 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -29,7 +29,6 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.provider.PolicyProvider; diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index d74ee4a8f9..26fc6722aa 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -73,13 +73,15 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsync; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.EndpointAsyncProvider; import org.apache.tuscany.sca.provider.EndpointProvider; import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; import org.apache.tuscany.sca.provider.ImplementationProvider; @@ -365,6 +367,31 @@ private void initInvocationChains() { } wireProcessor.process(this); + + // If we have to support async and there is no binding chain + // then set the response path to point directly to the + // binding provided async response handler + if (isAsyncInvocation() && + bindingInvocationChain == null){ + // fix up the operation chain response path to point back to the + // binding provided async response handler + ServiceBindingProvider serviceBindingProvider = getBindingProvider(); + if (serviceBindingProvider instanceof EndpointAsyncProvider){ + EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; + InvokerAsyncResponse asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); + + for (InvocationChain chain : getInvocationChains()){ + Invoker invoker = chain.getHeadInvoker(); + if (invoker instanceof InterceptorAsync){ + ((InterceptorAsync)invoker).setPrevious(asyncResponseInvoker); + } else { + //TODO - throw error once the old async code is removed + } + } + } else { + // TODO - throw error once the old async code is removed + } + } } /** @@ -570,11 +597,41 @@ private void initServiceBindingInvocationChains() { } - // TODO - add something on the end of the wire to invoke the - // invocation chain. Need to split out the runtime - // wire invoker into conversation, callback interceptors etc + // Add the runtime invoker to the end of the binding chain. + // It mediates between the binding chain and selects the + // correct invocation chain based on the operation that's + // been selected bindingInvocationChain.addInvoker(invoker); - + + if (isAsyncInvocation()){ + // fix up the invocation chains to point back to the + // binding chain so that async response messages + // are processed correctly + for (InvocationChain chain : getInvocationChains()){ + Invoker invoker = chain.getHeadInvoker(); + if (invoker instanceof InterceptorAsync){ + ((InterceptorAsync)invoker).setPrevious((InvokerAsyncResponse)bindingInvocationChain.getTailInvoker()); + } else { + // TODO - raise an error. Not doing that while + // we have the old async mechanism in play + } + } + + // fix up the binding chain response path to point back to the + // binding provided async response handler + ServiceBindingProvider serviceBindingProvider = getBindingProvider(); + if (serviceBindingProvider instanceof EndpointAsyncProvider){ + EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; + InvokerAsyncResponse asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); + if (bindingInvocationChain.getHeadInvoker() instanceof InterceptorAsync){ + ((InterceptorAsync)bindingInvocationChain.getHeadInvoker()).setPrevious(asyncResponseInvoker); + } else { + //TODO - throw error once the old async code is removed + } + } else { + //TODO - throw error once the old async code is removed + } + } } /** @@ -639,7 +696,7 @@ private void addImplementationInterceptor(Component component, RuntimeComponentService runtimeService = (RuntimeComponentService)service; if (runtimeService.getName().endsWith("_asyncCallback")){ if (provider instanceof ImplementationAsyncProvider){ - invoker = ((ImplementationAsyncProvider)provider).createAsyncResponseInvoker(operation); + invoker = (Invoker)((ImplementationAsyncProvider)provider).createAsyncResponseInvoker(operation); } else { // TODO - This should be an error but taking account of the // existing non-native async support @@ -656,7 +713,7 @@ private void addImplementationInterceptor(Component component, } } else if (isAsyncInvocation() && provider instanceof ImplementationAsyncProvider){ - invoker = ((ImplementationAsyncProvider)provider).createAsyncInvoker(this, (RuntimeComponentService)service, operation); + invoker = (Invoker)((ImplementationAsyncProvider)provider).createAsyncInvoker(this, (RuntimeComponentService)service, operation); } else { invoker = provider.createInvoker((RuntimeComponentService)service, operation); } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index b8ca59b214..a854e833ac 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -63,14 +63,17 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsync; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.EndpointReferenceProvider; +import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; +import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.PolicyProviderFactory; import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; @@ -324,10 +327,27 @@ private void initInvocationChains() { } } - // Set the chains until it's fully populated. If we initialize too early, any exeception could + // Set the chains until it's fully populated. If we initialize too early, any exception could // leave this endpoint reference in a wrong state with an empty chain. chains = chainList; wireProcessor.process(this); + + if (isAsyncInvocation()){ + // fix up all of the operation chain response paths + // to point back to the implementation provided + // async response handler + ImplementationProvider implementationProvider = ((RuntimeComponent)getComponent()).getImplementationProvider(); + if (implementationProvider instanceof ImplementationAsyncProvider){ + for (InvocationChain chain : getInvocationChains()){ + InvokerAsyncResponse asyncResponseInvoker = ((ImplementationAsyncProvider)implementationProvider).createAsyncResponseInvoker(chain.getSourceOperation()); + if (chain.getHeadInvoker() instanceof InterceptorAsync){ + ((InterceptorAsync)chain.getHeadInvoker()).setPrevious(asyncResponseInvoker); + } else { + //TODO - throw error once the old async code is removed + } + } + } + } } /** diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java index 0c42a523a6..8495445951 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java @@ -22,7 +22,8 @@ import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsync; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; /** @@ -33,22 +34,22 @@ */ public abstract class InterceptorAsyncImpl implements InterceptorAsync { - protected InvokerAsync next; - protected InvokerAsync previous; + protected Invoker next; + protected InvokerAsyncResponse previous; public Invoker getNext() { return (Invoker)next; } public void setNext(Invoker next) { - this.next = (InvokerAsync)next; + this.next = next; } - public InvokerAsync getPrevious() { + public InvokerAsyncResponse getPrevious() { return previous; } - public void setPrevious(InvokerAsync previous) { + public void setPrevious(InvokerAsyncResponse previous) { this.previous = previous; } @@ -61,14 +62,23 @@ public Message invoke(Message msg) { public void invokeAsyncRequest(Message msg) { msg = processRequest(msg); - ((InvokerAsync)getNext()).invokeAsyncRequest(msg); + ((InvokerAsyncRequest)getNext()).invokeAsyncRequest(msg); } - public Message invokeAsyncResponse(Message msg) { + public void invokeAsyncResponse(Message msg) { msg = processResponse(msg); - if (getPrevious() != null){ - return ((InvokerAsync)getPrevious()).invokeAsyncResponse(msg); - } - return msg; + ((InvokerAsyncResponse)getPrevious()).invokeAsyncResponse(msg); + } + + /** + * A testing method while I use the local SCA binding wire to look + * at how the async response path works. This allows me to detect the + * point where the reference wire turns into the service with in the + * optimized case + * + * @return + */ + public boolean isLocalSCABIndingInvoker() { + return false; } } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index e1ec899fa5..6c9f13ff17 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -30,20 +30,13 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsync; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.EndpointAsyncProvider; -import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.Invocable; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.work.WorkScheduler; @@ -144,14 +137,14 @@ public void invokeAsync(Message msg) { } // Perform the async invocation - InvokerAsync headInvoker = (InvokerAsync)chain.getHeadInvoker(); + Invoker headInvoker = chain.getHeadInvoker(); Message msgContext = ThreadMessageContext.setMessageContext(msg); try { // TODO - is this the way we'll pass async messages down the chain? Message resp = null; try { - headInvoker.invokeAsyncRequest(msg); + ((InvokerAsyncRequest)headInvoker).invokeAsyncRequest(msg); } catch (Throwable ex) { // temporary fix to swallow the dummy exception that's // thrown back to get past the response chain processing. @@ -179,10 +172,11 @@ public void invokeAsync(Message msg) { public void invokeAsyncResponse(Message msg) { InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); - InvokerAsync tailInvoker = (InvokerAsync)chain.getTailInvoker(); + Invoker tailInvoker = chain.getTailInvoker(); - Message asyncResponseMsg = tailInvoker.invokeAsyncResponse(msg); + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); +/* now statically configured // now get the asyncResponseInvoker Invoker asyncResponseInvoker = null; @@ -193,7 +187,7 @@ public void invokeAsyncResponse(Message msg) { ServiceBindingProvider serviceBindingProvider = ep.getBindingProvider(); if (serviceBindingProvider instanceof EndpointAsyncProvider){ EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; - asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(asyncResponseMsg.getOperation()); + asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); } else { // TODO - throw error @@ -211,5 +205,6 @@ public void invokeAsyncResponse(Message msg) { } asyncResponseInvoker.invoke(asyncResponseMsg); +*/ } } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java index 716379d141..69158683ef 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java @@ -22,13 +22,15 @@ import java.util.List; import java.util.ListIterator; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.DataExchangeSemantics; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsync; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Phase; import org.apache.tuscany.sca.invocation.PhasedInterceptor; @@ -98,19 +100,18 @@ public Invoker getTailInvoker() { while (next != null){ tail = next; if (next instanceof Interceptor){ - next = ((Interceptor)next).getNext(); - // TODO - hack to get round SCA binding optimization // On the reference side this loop will go all the way // across to the service invoker so stop looking if we find // an invoker with no "previous" pointer. This will be the point // where the SCA binding invoker points to the head of the // service chain - if (!(next instanceof InterceptorAsync) || - ((InterceptorAsync)next).getPrevious() == null){ + ((InterceptorAsyncImpl)next).isLocalSCABIndingInvoker()){ break; } + + next = ((Interceptor)next).getNext(); } else { next = null; } @@ -152,7 +153,8 @@ public void addInterceptor(String phase, Interceptor interceptor) { private void addInvoker(String phase, Invoker invoker) { if (isAsyncInvocation && - !(invoker instanceof InvokerAsync)){ + !(invoker instanceof InvokerAsyncRequest) && + !(invoker instanceof InvokerAsyncResponse) ){ // TODO - should raise an error but don't want to break // the existing non-native async support /* @@ -192,18 +194,18 @@ private void addInvoker(String phase, Invoker invoker) { if (before != null) { if (before.getInvoker() instanceof Interceptor) { ((Interceptor)before.getInvoker()).setNext(invoker); - if (invoker instanceof InterceptorAsync && - before.getInvoker() instanceof InvokerAsync){ - ((InterceptorAsync) invoker).setPrevious((InvokerAsync)before.getInvoker()); + if ((invoker instanceof InterceptorAsync) && + (before.getInvoker() instanceof InvokerAsyncResponse)) { + ((InterceptorAsync) invoker).setPrevious((InvokerAsyncResponse)before.getInvoker()); } } } if (after != null) { if (invoker instanceof Interceptor) { ((Interceptor)invoker).setNext(after.getInvoker()); - if (after.getInvoker() instanceof InterceptorAsync && - invoker instanceof InvokerAsync){ - ((InterceptorAsync) after.getInvoker()).setPrevious((InvokerAsync)invoker); + if ((after.getInvoker() instanceof InterceptorAsync) && + (invoker instanceof InvokerAsyncResponse)){ + ((InterceptorAsync) after.getInvoker()).setPrevious((InvokerAsyncResponse)invoker); } } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java index 146d027df8..8387285e3d 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java @@ -33,6 +33,8 @@ import org.apache.tuscany.sca.interfacedef.java.JavaOperation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -88,10 +90,10 @@ public boolean supportsOneWayInvocation() { public Invoker createInvoker(final RuntimeComponentService s, final Operation op) { // TODO - we're passing EP into the WSDL invoker so this isn't going to work // properly for sync calls - return createAsyncInvoker(null, s, op); + return (Invoker)createAsyncInvoker(null, s, op); } - public Invoker createAsyncInvoker(Endpoint endpoint, final RuntimeComponentService s, final Operation op) { + public InvokerAsyncRequest createAsyncInvoker(Endpoint endpoint, final RuntimeComponentService s, final Operation op) { try { // Creating an invoker for a Java or WSDL-typed implementation if(op instanceof JavaOperation) @@ -102,7 +104,7 @@ public Invoker createAsyncInvoker(Endpoint endpoint, final RuntimeComponentServi } } - public Invoker createAsyncResponseInvoker(Operation operation) { + public InvokerAsyncResponse createAsyncResponseInvoker(Operation operation) { return new SampleAsyncResponseInvoker(asyncMessageMap, operation, impl.clazz, instance); } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java index c73fdbc7e3..4a5d30d2f4 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java @@ -24,8 +24,7 @@ import org.apache.tuscany.sca.core.invocation.Constants; import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; import org.w3c.dom.Element; @@ -35,7 +34,7 @@ * * @version $Rev$ $Date$ */ -class SampleAsyncResponseInvoker implements Invoker { +class SampleAsyncResponseInvoker implements InvokerAsyncResponse { final String name; final Object instance; final Operation op; @@ -48,21 +47,25 @@ class SampleAsyncResponseInvoker implements Invoker { this.op = op; } - public Message invoke(final Message msg) { + public void invokeAsyncResponse(final Message msg) { try { String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); String forwardOpName = (String)asyncMessageMap.get(messageID); // process the async response - //Object reponse = ((Object[])msg.getBody())[0]; - Object reponse = msg.getBody(); + //Object response = ((Object[])msg.getBody())[0]; + Object response = msg.getBody(); Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); - method.invoke(instance, reponse); + method.invoke(instance, response); } catch(Exception e) { e.printStackTrace(); - msg.setFaultBody(e.getCause()); + // TODO - need to throw this to somewhere? } - return msg; + } + + public Message processResponse(Message msg) { + // Do nothing as no need to share the processing with synch here. + return null; } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.java index 437d141be0..063fe166eb 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.java @@ -23,6 +23,8 @@ import org.apache.tuscany.sca.interfacedef.java.JavaOperation; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; /** @@ -30,7 +32,7 @@ * * @version $Rev$ $Date$ */ -class SampleJavaInvoker implements Invoker { +class SampleJavaInvoker implements Invoker, InvokerAsyncRequest { final Object instance; final Method method; @@ -40,6 +42,15 @@ class SampleJavaInvoker implements Invoker { } public Message invoke(final Message msg) { + return processRequest(msg); + } + + public void invokeAsyncRequest(Message msg) { + processRequest(msg); + // TODO - need to do something about exceptions + } + + public Message processRequest(Message msg) { try { // Call the method that implements the operation msg.setBody(method.invoke(instance, (Object[])msg.getBody())); diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java index 4341c053fd..b87e6f7d5a 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java @@ -24,9 +24,7 @@ import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.InterceptorAsync; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.w3c.dom.Element; From 8ae57b9ee21395d8eb10daf4d87b10f00db15b41 Mon Sep 17 00:00:00 2001 From: Brent Daniel Date: Tue, 7 Dec 2010 21:19:48 +0000 Subject: [PATCH 040/174] Change method call to support older versions of XmlSchema git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043206 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index c98001dc1d..1a5051dd95 100644 --- a/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -731,7 +731,8 @@ private void checkComponentPropertyType(Component component, ComponentProperty c // create schema factory for XML schema SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - Document schemaDom = xsdDefinition.getSchema().getSchemaDocument(); + // Equivalent to getSchema().getSchemaDocument(), but allows us to support older versions of XmlSchema + Document schemaDom = xsdDefinition.getSchema().getAllSchemas()[0]; String valueSchema = null; Schema schema = null; From 32abbfd0bbb89b3385a4009c15224ee0c3745ca2 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Tue, 7 Dec 2010 22:05:44 +0000 Subject: [PATCH 041/174] TUSCANY-3801 - missed files from previous check in. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043211 13f79535-47bb-0310-9956-ffa450edef68 --- .../service/mocks/TestRuntimeWire.java | 1 - .../RuntimeSCAServiceBindingProvider.java | 6 ++---- .../SCABindingAsyncResponseInvoker.java | 19 ++++++++++--------- .../sca/provider/SCABindingInvoker.java | 4 ++++ .../sca/invocation/InterceptorAsync.java | 10 +++++----- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java index db0e571ef6..04e4fa3b3b 100644 --- a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java +++ b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java @@ -33,7 +33,6 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.InvokerAsync; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java index 87d3013a98..fd04cf02e3 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java @@ -22,10 +22,8 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.provider.EndpointAsyncProvider; -import org.apache.tuscany.sca.provider.EndpointProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; @@ -110,7 +108,7 @@ public boolean supportsNativeAsync() { return true; } - public Invoker createAsyncResponseInvoker(Operation operation) { + public InvokerAsyncResponse createAsyncResponseInvoker() { return new SCABindingAsyncResponseInvoker(null, null); } diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java index 26707e8ebd..d502cdd22c 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java @@ -20,26 +20,27 @@ package org.apache.tuscany.sca.binding.sca.provider; import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; /** * @version $Rev: 989157 $ $Date: 2010-08-25 16:02:01 +0100 (Wed, 25 Aug 2010) $ */ -public class SCABindingAsyncResponseInvoker implements Invoker { +public class SCABindingAsyncResponseInvoker implements InvokerAsyncResponse { public SCABindingAsyncResponseInvoker(ExtensionPointRegistry extensionPoints, RuntimeEndpointReference endpointReference) { } - + // TODO - this only works for the local case! - public Message invoke(Message msg) { + public void invokeAsyncResponse(Message msg) { RuntimeEndpointReference epr = (RuntimeEndpointReference)msg.getFrom(); - epr.invokeAsyncResponse(msg); + epr.invokeAsyncResponse(msg); + } + + public Message processResponse(Message msg) { + // TODO Auto-generated method stub return null; } -} +} \ No newline at end of file diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java index 95fd4cd934..a131c88a0c 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java @@ -99,5 +99,9 @@ public Message processResponse(Message msg){ return msg; } + + public boolean isLocalSCABIndingInvoker() { + return true; + } } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java index 3819147526..50bcf13b04 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java @@ -20,21 +20,21 @@ /** * Allows asynchronous wires to be navigated in reverse in order for the - * reponse to be processed. + * response to be processed. * */ -public interface InterceptorAsync extends Interceptor, InvokerAsync { +public interface InterceptorAsync extends Interceptor, InvokerAsyncRequest, InvokerAsyncResponse { /** * Sets the previous invoker * @param next The previous invoker */ - void setPrevious(InvokerAsync previous); + void setPrevious(InvokerAsyncResponse previous); /** * Returns the previous invoker or null * @return The previous Invoker */ - InvokerAsync getPrevious(); - + InvokerAsyncResponse getPrevious(); + } From 7d8ab1c0470326cb39398cfbdaa2ce1380145220 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Tue, 7 Dec 2010 22:09:21 +0000 Subject: [PATCH 042/174] TUSCANY-3801 - add missing response interface git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043212 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/invocation/InvokerAsyncResponse.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java new file mode 100644 index 0000000000..1de12638b6 --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java @@ -0,0 +1,50 @@ +/* + * 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. + */ +package org.apache.tuscany.sca.invocation; + +/** + * TUSCANY-3786 + * + * The response side of an Interface to describe an invocation where + * the request processing can be performed independently of the + * response processing. + */ +public interface InvokerAsyncResponse { + + /** + * Process the response message and pass it down the chain + * + * @param msg The request Message + * @return the processed message + * + */ + void invokeAsyncResponse(Message msg); + + /** + * Process a response message. Provided so that the synchronous + * and asynchronous patterns can re-use the response message + * processing + * + * @param msg The request Message + * @return the processed message + * + */ + Message processResponse(Message msg); + +} From 5a8ab8120d8b7283555438ab8c0bbed2cfb1aaf8 Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Wed, 8 Dec 2010 05:47:21 +0000 Subject: [PATCH 043/174] Allowing more flexible resolution for the widget artifact git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043310 13f79535-47bb-0310-9956-ffa450edef68 --- .../widget/WidgetImplementationProcessor.java | 59 +++++++++++++------ 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java index bf84a15aa6..39e6ae0606 100644 --- a/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java +++ b/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java @@ -20,7 +20,11 @@ import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.xml.namespace.QName; @@ -61,7 +65,6 @@ public WidgetImplementationProcessor(ExtensionPointRegistry registry) { implementationFactory = modelFactories.getFactory(WidgetImplementationFactory.class); } - public QName getArtifactType() { // Returns the QName of the XML element processed by this processor return WidgetImplementation.TYPE; @@ -103,26 +106,48 @@ public WidgetImplementation read(XMLStreamReader reader, ProcessorContext contex public void resolve(WidgetImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { if (implementation != null) { - // Resolve the resource directory location + // Resolve the resource directory location Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(implementation.getLocation()); Artifact resolved = resolver.resolveModel(Artifact.class, artifact, context); - if (resolved.getLocation() != null) { - try { - implementation.setLocationURL(new URL(resolved.getLocation())); - - //introspect implementation - WidgetImplementationIntrospector widgetIntrospector = - new WidgetImplementationIntrospector(registry, implementation); - widgetIntrospector.introspectImplementation(); - - implementation.setUnresolved(false); - } catch (IOException e) { - ContributionResolveException ce = new ContributionResolveException(e); - error(context.getMonitor(), "ContributionResolveException", resolver, ce); - //throw ce; + + if(resolved.getLocation() == null) { + URL resource = null; + URI uri = URI.create(implementation.getLocation()); + Artifact parent = context.getArtifact(); + if (!uri.isAbsolute()) { + if (parent != null && parent.getURI() != null) { + URI base = URI.create("/" + parent.getURI()); + uri = base.resolve(uri); + // Remove the leading / to make artifact resolver happy + if (uri.toString().startsWith("/")) { + uri = URI.create(uri.toString().substring(1)); + } + } + } + + + // The resource can be out of scope of the contribution root + if (parent != null && parent.getLocation() != null) { + try { + resource = new URL(new URL(parent.getLocation()), implementation.getLocation()); + + implementation.setLocationURL(resource); + + //introspect implementation + WidgetImplementationIntrospector widgetIntrospector = + new WidgetImplementationIntrospector(registry, implementation); + widgetIntrospector.introspectImplementation(); + + implementation.setUnresolved(false); + } catch (MalformedURLException e) { + ContributionResolveException ce = new ContributionResolveException(e); + error(context.getMonitor(), "ContributionResolveException", resolver, ce); + } } - } else { + } + + if (implementation.isUnresolved()) { error(context.getMonitor(), "CouldNotResolveLocation", resolver, implementation.getLocation()); //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation()); } From 3c1a606ae69f597084466a9dee58a4b2d3a70f86 Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Wed, 8 Dec 2010 05:47:27 +0000 Subject: [PATCH 044/174] Fixing minor issue when running regular resolution path (side effect of previous change) git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043311 13f79535-47bb-0310-9956-ffa450edef68 --- .../widget/WidgetImplementationProcessor.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java index 39e6ae0606..b5b374baad 100644 --- a/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java +++ b/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java @@ -105,12 +105,12 @@ public WidgetImplementation read(XMLStreamReader reader, ProcessorContext contex public void resolve(WidgetImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { - if (implementation != null) { - // Resolve the resource directory location + if (implementation != null) { + // Resolve the resource directory location Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(implementation.getLocation()); Artifact resolved = resolver.resolveModel(Artifact.class, artifact, context); - + if(resolved.getLocation() == null) { URL resource = null; URI uri = URI.create(implementation.getLocation()); @@ -134,24 +134,34 @@ public void resolve(WidgetImplementation implementation, ModelResolver resolver, implementation.setLocationURL(resource); - //introspect implementation - WidgetImplementationIntrospector widgetIntrospector = - new WidgetImplementationIntrospector(registry, implementation); - widgetIntrospector.introspectImplementation(); - - implementation.setUnresolved(false); } catch (MalformedURLException e) { ContributionResolveException ce = new ContributionResolveException(e); error(context.getMonitor(), "ContributionResolveException", resolver, ce); } } + } else { + try { + implementation.setLocationURL(new URL(resolved.getLocation())); + } catch (MalformedURLException e) { + ContributionResolveException ce = new ContributionResolveException(e); + error(context.getMonitor(), "ContributionResolveException", resolver, ce); + } } - + + //introspect implementation + WidgetImplementationIntrospector widgetIntrospector = + new WidgetImplementationIntrospector(registry, implementation); + widgetIntrospector.introspectImplementation(); + + implementation.setUnresolved(false); + + + if (implementation.isUnresolved()) { error(context.getMonitor(), "CouldNotResolveLocation", resolver, implementation.getLocation()); //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation()); } - } + } } public void write(WidgetImplementation implementation, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { From 997800b9b985f14899dc6db522067aa33d9a2df7 Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Wed, 8 Dec 2010 05:47:33 +0000 Subject: [PATCH 045/174] Enabling transformer to avoid issues with rest binding and json wireFormat git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043312 13f79535-47bb-0310-9956-ffa450edef68 --- .../services/org.apache.tuscany.sca.databinding.PullTransformer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer index 3590a46c47..39426ce844 100644 --- a/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer +++ b/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer @@ -23,7 +23,7 @@ org.apache.tuscany.sca.databinding.json.jackson.Object2JSON;source=java:simpleTy org.apache.tuscany.sca.databinding.json.axiom.JSON2OMElement;source=JSON,target=org.apache.axiom.om.OMElement,weight=500 org.apache.tuscany.sca.databinding.json.jackson.Object2JSON;source=java:array,target=JSON,weight=90000,public=false org.apache.tuscany.sca.databinding.json.jackson.Object2JSON;source=commonj.sdo.DataObject,target=JSON,weight=90000,public=false -org.apache.tuscany.sca.databinding.json.jackson.Object2JSON;source=javax.xml.bind.JAXBElement,target=JSON,weight=90000,public=false +org.apache.tuscany.sca.databinding.json.jackson.Object2JSON;source=javax.xml.bind.JAXBElement,target=JSON,weight=90000,public=true org.apache.tuscany.sca.databinding.json.jackson.JSON2Object;source=JSON,target=java:complexType,weight=90000,public=false org.apache.tuscany.sca.databinding.json.jackson.JSON2Object;source=JSON,target=java:simpleType,weight=90000,public=false org.apache.tuscany.sca.databinding.json.jackson.JSON2Object;source=JSON,target=commonj.sdo.DataObject,weight=90000,public=false From e288a751b55b896d18b134f85c02e9c0e7e949b7 Mon Sep 17 00:00:00 2001 From: Luciano Resende Date: Wed, 8 Dec 2010 05:47:37 +0000 Subject: [PATCH 046/174] Having sample actually pointing to base-runtime pom git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043313 13f79535-47bb-0310-9956-ffa450edef68 --- samples/applications/store/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/applications/store/pom.xml b/samples/applications/store/pom.xml index f9f65b9d3d..965f8583a3 100644 --- a/samples/applications/store/pom.xml +++ b/samples/applications/store/pom.xml @@ -31,8 +31,9 @@ org.apache.tuscany.sca - tuscany-base-runtime + tuscany-base-runtime-pom 2.0-SNAPSHOT + pom From 751c8420efa5e99e6752d3dff47e055f963b3bd2 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 8 Dec 2010 12:06:06 +0000 Subject: [PATCH 047/174] Add an itest for changing the sca binding protocol on a per service basis git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043371 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/scabindingmapper/pom.xml | 61 ++++++++++++++++ .../java/itest/scabindingmapper/MyMapper.java | 70 +++++++++++++++++++ ....sca.binding.sca.provider.SCABindingMapper | 18 +++++ .../java/itest/helloworld/Helloworld.java | 28 ++++++++ .../helloworld/HelloworldClientImpl.java | 34 +++++++++ .../helloworld/HelloworldServiceImpl.java | 29 ++++++++ .../itest/helloworld/Mapper1TestCase.java | 70 +++++++++++++++++++ .../src/test/resources/test.composite | 41 +++++++++++ 8 files changed, 351 insertions(+) create mode 100644 testing/itest/scabindingmapper/pom.xml create mode 100644 testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java create mode 100644 testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper create mode 100644 testing/itest/scabindingmapper/src/test/java/itest/helloworld/Helloworld.java create mode 100644 testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldClientImpl.java create mode 100644 testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldServiceImpl.java create mode 100644 testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java create mode 100644 testing/itest/scabindingmapper/src/test/resources/test.composite diff --git a/testing/itest/scabindingmapper/pom.xml b/testing/itest/scabindingmapper/pom.xml new file mode 100644 index 0000000000..59eb0b75a5 --- /dev/null +++ b/testing/itest/scabindingmapper/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-SNAPSHOT + ../pom.xml + + + itest-scabindingmapper + Apache Tuscany Async Integration Tests SCA Binding Mapper + + + + org.apache.tuscany.sca + tuscany-base-runtime + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-binding-jsonp-runtime + 2.0-SNAPSHOT + + + + org.mortbay.jetty + jetty + 6.1.19 + + + + + + + + diff --git a/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java b/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java new file mode 100644 index 0000000000..b3f4b7eae8 --- /dev/null +++ b/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java @@ -0,0 +1,70 @@ +/* + * 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. + */ + +package itest.scabindingmapper; + +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.binding.jsonp.JSONPBinding; +import org.apache.tuscany.sca.binding.sca.provider.DefaultSCABindingMapper; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + +/** + * A test SCABindingMapper to demonstrate changing the protocol on a per service basis. + * This uses JSONP if the service name ends with a "2" character. + * Uses a high ranking in the The meta-inf/services file to override the default mapper. + */ +public class MyMapper extends DefaultSCABindingMapper { + + public MyMapper(ExtensionPointRegistry registry, Map attributes) { + super(registry, attributes); + } + + @Override + protected QName chooseBinding(RuntimeEndpoint endpoint) { + if (endpoint.getComponent().getName().endsWith("2")) { + return JSONPBinding.TYPE; + } else { + return super.defaultMappedBinding; + } + } + + @Override + protected QName chooseBinding(RuntimeEndpointReference endpointReference) { + if (endpointReference.getURI().endsWith("2")) { + return JSONPBinding.TYPE; + } else { + return super.defaultMappedBinding; + } + } + + /* + * Probably others don't need to override this is they have a remotable endpoint registry, this itest + * doesn't so just fiddle the test + */ + @Override + protected boolean isDistributed() { + return true; + } + +} diff --git a/testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper b/testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper new file mode 100644 index 0000000000..ef32d42058 --- /dev/null +++ b/testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper @@ -0,0 +1,18 @@ +# 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. +itest.scabindingmapper.MyMapper,ranking=4321 + diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Helloworld.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Helloworld.java new file mode 100644 index 0000000000..244d077f0b --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Helloworld.java @@ -0,0 +1,28 @@ +/* + * 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. + */ + +package itest.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); +} diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldClientImpl.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldClientImpl.java new file mode 100644 index 0000000000..8d69e1d31b --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldClientImpl.java @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package itest.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloworldClientImpl implements Helloworld{ + + @Reference + public Helloworld ref; + + @Override + public String sayHello(String name) { + return ref.sayHello(name); + } + +} diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldServiceImpl.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldServiceImpl.java new file mode 100644 index 0000000000..12e194f6dc --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/HelloworldServiceImpl.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package itest.helloworld; + +public class HelloworldServiceImpl implements Helloworld { + + @Override + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java new file mode 100644 index 0000000000..382cffa892 --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java @@ -0,0 +1,70 @@ +/* + * 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. + */ +package itest.helloworld; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.Assert; +import org.junit.Test; + +public class Mapper1TestCase { + + @Test + public void testSCABindingFactory() throws IOException { + Node node = NodeFactory.newInstance().createNode("test.composite", new String[]{"target/test-classes"}) ; + node.start(); + + // test the service invocations work + Helloworld helloworld = node.getService(Helloworld.class, "Client1"); + Assert.assertEquals("Hello Petra", helloworld.sayHello("Petra")); + + helloworld = node.getService(Helloworld.class, "Client2"); + Assert.assertEquals("Hello Petra", helloworld.sayHello("Petra")); + + // verify service1 is exposed as a WS endpoint and service2 is a jsonp endpoint + URL wsService = new URL("http://localhost:8080/Service1/Helloworld?wsdl"); + Assert.assertTrue(getContent(wsService).contains("definitions name=\"HelloworldService\"")); + + URL jsonpService = new URL("http://localhost:8080/Client2/Helloworld/sayHello?name=Petra"); + Assert.assertEquals("\"Hello Petra\"", getContent(jsonpService)); + } + + private String getContent(URL url) throws IOException { + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(url.openStream())); + StringBuffer sb = new StringBuffer(); + String str; + while ((str = reader.readLine()) != null) { + sb.append(str); + } + return sb.toString(); + } finally { + if (reader != null) { + reader.close(); + } + } + } + +} diff --git a/testing/itest/scabindingmapper/src/test/resources/test.composite b/testing/itest/scabindingmapper/src/test/resources/test.composite new file mode 100644 index 0000000000..d29c636f77 --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/resources/test.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + From d65f9bb56d38708cd5b89ef2c66b5a3ecb026acb Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 8 Dec 2010 12:06:50 +0000 Subject: [PATCH 048/174] Update so the binding type is public git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043372 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/binding/jsonp/JSONPBinding.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/binding-jsonp/src/main/java/org/apache/tuscany/sca/binding/jsonp/JSONPBinding.java b/modules/binding-jsonp/src/main/java/org/apache/tuscany/sca/binding/jsonp/JSONPBinding.java index 3b57ca199e..7ef6fcf91d 100644 --- a/modules/binding-jsonp/src/main/java/org/apache/tuscany/sca/binding/jsonp/JSONPBinding.java +++ b/modules/binding-jsonp/src/main/java/org/apache/tuscany/sca/binding/jsonp/JSONPBinding.java @@ -30,7 +30,7 @@ */ public class JSONPBinding extends HTTPBindingImpl { - QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.jsonp"); + public static final QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.jsonp"); public JSONPBinding() { super(); From 02ba1007763c2fc118ca27cb1e8c8c45df7de1b3 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 8 Dec 2010 12:09:14 +0000 Subject: [PATCH 049/174] Add the sca binding mapper itest to build git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043374 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/itest/pom.xml b/testing/itest/pom.xml index fa900c48a4..c7ca8a848a 100644 --- a/testing/itest/pom.xml +++ b/testing/itest/pom.xml @@ -89,6 +89,7 @@ ws ws-jaxws async-interactions + scabindingmapper From d3f2d44ec635001d10c4b5c45edc636c389b211e Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Wed, 8 Dec 2010 14:35:39 +0000 Subject: [PATCH 050/174] TUSCANY-3801 - Thinking about how to wrap the difference between native and non-native async at the service end. Not actually used yet. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043436 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/invocation/AsyncResponseInvoker.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java new file mode 100644 index 0000000000..9c327defbd --- /dev/null +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java @@ -0,0 +1,70 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.core.invocation; + +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.provider.EndpointAsyncProvider; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + +/** + * A class that wraps the mechanics for sending async responses + * and hides the decision about whether the response will be processed + * natively or non-natively + */ +public class AsyncResponseInvoker implements InvokerAsyncResponse { + + RuntimeEndpoint requestEndpoint; + RuntimeEndpointReference responseEndpointReference; + + public AsyncResponseInvoker(Message requestMessage){ + requestEndpoint = (RuntimeEndpoint)requestMessage.getTo(); + responseEndpointReference = (RuntimeEndpointReference)requestMessage.getFrom(); + } + + /** + * If you have a Tuscany message you can call this + */ + public void invokeAsyncResponse(Message responseMessage) { + if ((requestEndpoint.getBindingProvider() instanceof EndpointAsyncProvider) && + (((EndpointAsyncProvider)requestEndpoint.getBindingProvider()).supportsNativeAsync())){ + // process the response as a native async response + requestEndpoint.invokeAsyncResponse(responseMessage); + } else { + // process the response as a non-native async response + responseEndpointReference.invoke(responseMessage); + } + } + + /** + * If you have Java beans you can call this and we'll create + * a Tuscany message + * + * @param args the response data + */ + public void invokeAsyncResponse(Object args) { + // TODO - how to get at the code that translates from args to msg? + + // turn args into a message + Message responseMessage = null; + invokeAsyncResponse(responseMessage); + } +} From 38e2ad8ca0f07a374e0c423da29fba4eeba00f63 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 8 Dec 2010 14:44:41 +0000 Subject: [PATCH 051/174] Start exploring way sof handling a pluggable approach of what to do when the endpoint for a reference is not found in the endpoint registry git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043439 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/runtime/UnknownEndpointHandler.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/UnknownEndpointHandler.java diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/UnknownEndpointHandler.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/UnknownEndpointHandler.java new file mode 100644 index 0000000000..cfb205f489 --- /dev/null +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/UnknownEndpointHandler.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.runtime; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.EndpointReference; + +public interface UnknownEndpointHandler { + + Binding handleUnknownEndpoint(EndpointReference endpointReference); + +} From 851cca1a5a9e3e01095af187c4e24fe227025d08 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Wed, 8 Dec 2010 15:18:12 +0000 Subject: [PATCH 052/174] TUSCANY-3801 - Separate off the asyncy response invocation interfaces from the "process" methods I added as a convenience for sharing invoker implementation. Asl get rid of "throws" from Invocable git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043447 13f79535-47bb-0310-9956-ffa450edef68 --- .../SCABindingAsyncResponseInvoker.java | 5 -- .../sca/invocation/InterceptorAsync.java | 22 +++++++ .../sca/invocation/InvokerAsyncRequest.java | 12 ---- .../sca/invocation/InvokerAsyncResponse.java | 11 ---- .../apache/tuscany/sca/runtime/Invocable.java | 3 +- .../assembly/impl/RuntimeEndpointImpl.java | 2 +- .../impl/RuntimeEndpointReferenceImpl.java | 2 +- .../sca/core/invocation/RuntimeInvoker.java | 60 +++++-------------- .../impl/SampleAsyncResponseInvoker.java | 5 -- .../sampleasync/impl/SampleWSDLInvoker.java | 5 +- 10 files changed, 44 insertions(+), 83 deletions(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java index d502cdd22c..240ba69d62 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java @@ -38,9 +38,4 @@ public void invokeAsyncResponse(Message msg) { RuntimeEndpointReference epr = (RuntimeEndpointReference)msg.getFrom(); epr.invokeAsyncResponse(msg); } - - public Message processResponse(Message msg) { - // TODO Auto-generated method stub - return null; - } } \ No newline at end of file diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java index 50bcf13b04..806feccca2 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java @@ -37,4 +37,26 @@ public interface InterceptorAsync extends Interceptor, InvokerAsyncRequest, Invo */ InvokerAsyncResponse getPrevious(); + /** + * Process a request message. Provided so that the synchronous + * and asynchronous patterns can re-use the request message + * processing + * + * @param msg The request Message + * @return the processed message + * + */ + Message processRequest(Message msg); + + /** + * Process a response message. Provided so that the synchronous + * and asynchronous patterns can re-use the response message + * processing + * + * @param msg The request Message + * @return the processed message + * + */ + Message processResponse(Message msg); + } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java index 5a53504ffb..48fad02b53 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java @@ -36,16 +36,4 @@ public interface InvokerAsyncRequest { */ void invokeAsyncRequest(Message msg); - /** - * Process a request message. Provided so that the synchronous - * and asynchronous patterns can re-use the request message - * processing - * - * @param msg The request Message - * @return the processed message - * - */ - Message processRequest(Message msg); - - } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java index 1de12638b6..7eeabb760e 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java @@ -36,15 +36,4 @@ public interface InvokerAsyncResponse { */ void invokeAsyncResponse(Message msg); - /** - * Process a response message. Provided so that the synchronous - * and asynchronous patterns can re-use the response message - * processing - * - * @param msg The request Message - * @return the processed message - * - */ - Message processResponse(Message msg); - } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index 9a936bf141..948063f480 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -136,8 +136,7 @@ public interface Invocable { * @return The ticket that can be used to identify this invocation * @throws InvocationTargetException */ - void invokeAsync(Operation operation, Message msg) throws Throwable; - // TODO - this shouldn't throw an exception + void invokeAsync(Operation operation, Message msg); /** * Asynchronously invoke an operation with a context message diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 26fc6722aa..e353af92e2 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -290,7 +290,7 @@ public Message invoke(Operation operation, Message msg) { return invoker.invoke(operation, msg); } - public void invokeAsync(Operation operation, Message msg) throws Throwable { + public void invokeAsync(Operation operation, Message msg){ msg.setOperation(operation); invoker.invokeAsync(msg); } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index a854e833ac..ad5c9124fa 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -243,7 +243,7 @@ public Message invoke(Operation operation, Message msg) { return invoker.invoke(operation, msg); } - public void invokeAsync(Operation operation, Message msg) throws Throwable { + public void invokeAsync(Operation operation, Message msg){ msg.setOperation(operation); invoker.invokeAsync(msg); } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index 6c9f13ff17..4b2e72ac6b 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -112,6 +112,12 @@ public Message invoke(InvocationChain chain, Message msg) { } } + /** + * Initiate the sending of the forward part of an asynchronous + * exchange along the request part of the wire. + * + * @param msg the request message + */ public void invokeAsync(Message msg) { if (invocable instanceof Endpoint) { msg.setTo((Endpoint)invocable); @@ -141,25 +147,14 @@ public void invokeAsync(Message msg) { Message msgContext = ThreadMessageContext.setMessageContext(msg); try { - // TODO - is this the way we'll pass async messages down the chain? - Message resp = null; try { ((InvokerAsyncRequest)headInvoker).invokeAsyncRequest(msg); } catch (Throwable ex) { // temporary fix to swallow the dummy exception that's // thrown back to get past the response chain processing. if (!(ex instanceof AsyncResponseException)){ - // throw ex; - } - } - - // This is async but we check the response in case there is a - // fault reported on the forward request, i.e. before the - // request reaches the binding - if (resp != null){ - Object body = resp.getBody(); - if (resp.isFault()) { - //throw (Throwable)body; + // TODO send the exception in through the + // async response processing path } } } finally { @@ -169,42 +164,17 @@ public void invokeAsync(Message msg) { return; } + /** + * Initiate the sending of the response part of an asynchronous + * exchange along the response part of the wire. + * + * @param msg the response message + */ public void invokeAsyncResponse(Message msg) { InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); Invoker tailInvoker = chain.getTailInvoker(); - ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); - -/* now statically configured - // now get the asyncResponseInvoker - Invoker asyncResponseInvoker = null; - - // We'd want to cache this based on the reference EPR - if (invocable instanceof Endpoint) { - // get it from the binding - RuntimeEndpoint ep = (RuntimeEndpoint)invocable; - ServiceBindingProvider serviceBindingProvider = ep.getBindingProvider(); - if (serviceBindingProvider instanceof EndpointAsyncProvider){ - EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider; - asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker(); - - } else { - // TODO - throw error - } - } else if (invocable instanceof EndpointReference) { - // get it from the implementation - RuntimeEndpointReference epr = (RuntimeEndpointReference)invocable; - ImplementationProvider implementationProvider = ((RuntimeComponent)epr.getComponent()).getImplementationProvider(); - - if (implementationProvider instanceof ImplementationAsyncProvider){ - asyncResponseInvoker = ((ImplementationAsyncProvider)implementationProvider).createAsyncResponseInvoker(asyncResponseMsg.getOperation()); - } else { - // TODO - throw an error - } - } - - asyncResponseInvoker.invoke(asyncResponseMsg); -*/ + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java index 4a5d30d2f4..2a7ad3f5bc 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java @@ -63,9 +63,4 @@ public void invokeAsyncResponse(final Message msg) { // TODO - need to throw this to somewhere? } } - - public Message processResponse(Message msg) { - // Do nothing as no need to share the processing with synch here. - return null; - } } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java index b87e6f7d5a..b0d9c07d86 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java @@ -65,7 +65,10 @@ public void invokeAsyncRequest(Message msg) { // component implementation itself doesn't get a chance to // do async responses. - ((RuntimeEndpoint)endpoint).invokeAsyncResponse(responseMsg); + // At this point we could serialize the ??? and pick it up again + // later to send the async response + + ((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg); } public Message processRequest(Message msg) { From 48a1772cb9dffce8551c584e43d852a9e145ecee Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 8 Dec 2010 15:52:30 +0000 Subject: [PATCH 053/174] Update EndpointReferenceBinder with a plug point for an UnknownEndpointHandler thats called when an endpoint isn't found in the registry. Don't know if this is the best approach yet but it gives something to try with itests too see how it works git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043464 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/EndpointReferenceBinderImpl.java | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 67455bad09..47c0ca4fc5 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -42,6 +42,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl; import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl; import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.interfacedef.InterfaceContract; @@ -62,6 +63,7 @@ import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; +import org.apache.tuscany.sca.runtime.UnknownEndpointHandler; import org.oasisopen.sca.ServiceRuntimeException; /** @@ -83,6 +85,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { protected BuilderExtensionPoint builders; protected CompositeActivator compositeActivator; protected Monitor monitor; + protected UnknownEndpointHandler unknownEndpointHandler; public EndpointReferenceBinderImpl(ExtensionPointRegistry extensionPoints) { @@ -96,6 +99,8 @@ public EndpointReferenceBinderImpl(ExtensionPointRegistry extensionPoints) { MonitorFactory monitorFactory = utils.getUtility(MonitorFactory.class); monitor = monitorFactory.createMonitor(); + + this.unknownEndpointHandler = utils.getUtility(UnknownEndpointHandler.class); this.builders = extensionPoints.getExtensionPoint(BuilderExtensionPoint.class); this.compositeActivator = extensionPoints.getExtensionPoint(CompositeActivator.class); @@ -274,13 +279,29 @@ public void bind(EndpointRegistry endpointRegistry, endpointReference.getTargetEndpoint().setBinding(endpointReference.getBinding()); endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING); } else { - Monitor.error(monitor, - this, - "endpoint-validation-messages", - "NoEndpointsFound", - endpointReference.toString()); - throw new ServiceRuntimeException("Unable to bind " + - monitor.getLastProblem().toString()); + Binding b = null; + if (unknownEndpointHandler != null) { + b = unknownEndpointHandler.handleUnknownEndpoint(endpointReference); + } + if (b != null) { + Endpoint matchedEndpoint = new RuntimeEndpointImpl(extensionPoints); + matchedEndpoint.setBinding(b); + matchedEndpoint.setRemote(true); + endpointReference.setTargetEndpoint(matchedEndpoint); + endpointReference.setBinding(b); + endpointReference.setUnresolved(false); + endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); + matchAudit.append("Match because the UnknownEndpointHandler provided a binding: " + b.getType() + " uri: " + b.getURI()); + matchAudit.appendSeperator(); + } else { + Monitor.error(monitor, + this, + "endpoint-validation-messages", + "NoEndpointsFound", + endpointReference.toString()); + throw new ServiceRuntimeException("Unable to bind " + + monitor.getLastProblem().toString()); + } } } } From 712faff030c3c78c21d5b3e74a9a100b0cc6743c Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 8 Dec 2010 15:55:42 +0000 Subject: [PATCH 054/174] Add itest using an UnknownEndpointHandler. Also update tests to use port 8085 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043467 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/itest/scabindingmapper/MyMapper.java | 2 +- .../MyUnknownEndpointHandler.java | 47 +++++++++++++++ ...tuscany.sca.runtime.UnknownEndpointHandler | 19 ++++++ .../itest/helloworld/Mapper1TestCase.java | 18 +++++- .../helloworld/UnknownEndpointTestCase.java | 58 +++++++++++++++++++ .../src/test/resources/clients.composite | 34 +++++++++++ .../src/test/resources/services.composite | 31 ++++++++++ 7 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyUnknownEndpointHandler.java create mode 100644 testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.UnknownEndpointHandler create mode 100644 testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java create mode 100644 testing/itest/scabindingmapper/src/test/resources/clients.composite create mode 100644 testing/itest/scabindingmapper/src/test/resources/services.composite diff --git a/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java b/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java index b3f4b7eae8..016f744598 100644 --- a/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java +++ b/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyMapper.java @@ -51,7 +51,7 @@ protected QName chooseBinding(RuntimeEndpoint endpoint) { @Override protected QName chooseBinding(RuntimeEndpointReference endpointReference) { - if (endpointReference.getURI().endsWith("2")) { + if (endpointReference.getBinding().getURI().contains("Service2")) { return JSONPBinding.TYPE; } else { return super.defaultMappedBinding; diff --git a/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyUnknownEndpointHandler.java b/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyUnknownEndpointHandler.java new file mode 100644 index 0000000000..1b75cf5bf5 --- /dev/null +++ b/testing/itest/scabindingmapper/src/main/java/itest/scabindingmapper/MyUnknownEndpointHandler.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +package itest.scabindingmapper; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.assembly.impl.SCABindingFactoryImpl; +import org.apache.tuscany.sca.runtime.UnknownEndpointHandler; + +public class MyUnknownEndpointHandler implements UnknownEndpointHandler { + + @Override + public Binding handleUnknownEndpoint(EndpointReference endpointReference) { + + if (endpointReference.getTargetEndpoint().getURI().endsWith("Service1")) { + SCABinding b = new SCABindingFactoryImpl().createSCABinding(); + b.setURI("http://localhost:8085/Service1/Helloworld"); + return b; + + } else if (endpointReference.getTargetEndpoint().getURI().endsWith("Service2")) { + SCABinding b = new SCABindingFactoryImpl().createSCABinding(); + b.setURI("http://localhost:8085/Service2/Helloworld"); + return b; + } + + return null; + } + +} diff --git a/testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.UnknownEndpointHandler b/testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.UnknownEndpointHandler new file mode 100644 index 0000000000..11828b7b2b --- /dev/null +++ b/testing/itest/scabindingmapper/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.UnknownEndpointHandler @@ -0,0 +1,19 @@ +# 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. +itest.scabindingmapper.MyUnknownEndpointHandler + + diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java index 382cffa892..b6b6d406f8 100644 --- a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/Mapper1TestCase.java @@ -25,14 +25,21 @@ import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; import org.junit.Assert; import org.junit.Test; public class Mapper1TestCase { + static { + org.apache.tuscany.sca.http.jetty.JettyServer.portDefault = 8085; + } + + Node node; + @Test public void testSCABindingFactory() throws IOException { - Node node = NodeFactory.newInstance().createNode("test.composite", new String[]{"target/test-classes"}) ; + node = NodeFactory.newInstance().createNode("test.composite", new String[]{"target/test-classes"}) ; node.start(); // test the service invocations work @@ -43,10 +50,10 @@ public void testSCABindingFactory() throws IOException { Assert.assertEquals("Hello Petra", helloworld.sayHello("Petra")); // verify service1 is exposed as a WS endpoint and service2 is a jsonp endpoint - URL wsService = new URL("http://localhost:8080/Service1/Helloworld?wsdl"); + URL wsService = new URL("http://localhost:8085/Service1/Helloworld?wsdl"); Assert.assertTrue(getContent(wsService).contains("definitions name=\"HelloworldService\"")); - URL jsonpService = new URL("http://localhost:8080/Client2/Helloworld/sayHello?name=Petra"); + URL jsonpService = new URL("http://localhost:8085/Client2/Helloworld/sayHello?name=Petra"); Assert.assertEquals("\"Hello Petra\"", getContent(jsonpService)); } @@ -66,5 +73,10 @@ private String getContent(URL url) throws IOException { } } } + + @After + public void shutdown() { + node.stop(); + } } diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java new file mode 100644 index 0000000000..d6c56d6dc3 --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java @@ -0,0 +1,58 @@ +/* + * 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. + */ +package itest.helloworld; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; + +public class UnknownEndpointTestCase { + + static { + org.apache.tuscany.sca.http.jetty.JettyServer.portDefault = 8085; + } + + Node servicesnode; + Node node; + + @Test + public void testUnknownEndpoints() throws IOException, InterruptedException { + servicesnode = NodeFactory.newInstance().createNode("services.composite", new String[]{"target/test-classes"}) ; + servicesnode.start(); + node = NodeFactory.newInstance().createNode("clients.composite", new String[]{"target/test-classes"}) ; + node.start(); + + // test the service invocations work + Helloworld helloworld = node.getService(Helloworld.class, "Client1"); + Assert.assertEquals("Hello Petra", helloworld.sayHello("Petra")); + + helloworld = node.getService(Helloworld.class, "Client2"); + Assert.assertEquals("Hello Petra", helloworld.sayHello("Petra")); + } + + @After + public void shutdown() throws InterruptedException { + node.stop(); + servicesnode.stop(); + } +} diff --git a/testing/itest/scabindingmapper/src/test/resources/clients.composite b/testing/itest/scabindingmapper/src/test/resources/clients.composite new file mode 100644 index 0000000000..5597ec112c --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/resources/clients.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/testing/itest/scabindingmapper/src/test/resources/services.composite b/testing/itest/scabindingmapper/src/test/resources/services.composite new file mode 100644 index 0000000000..bb1161c1ac --- /dev/null +++ b/testing/itest/scabindingmapper/src/test/resources/services.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + From 7153c3d0d7c34f0c8f313c8ac69d1eb1292c289b Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:07 +0000 Subject: [PATCH 055/174] Upgrade to Axis2 1.5.3, Axiom 1.2.10 and Abdera 1.1.1 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043771 13f79535-47bb-0310-9956-ffa450edef68 --- distribution/all/manifests/axiom-api-1.2.7.MF | 47 --- distribution/all/manifests/axiom-api-1.2.8.MF | 49 --- .../all/manifests/axis2-kernel-1.5.1.MF | 39 --- .../all/manifests/axis2-kernel-1.5.3.MF | 36 ++ .../manifests/axis2-transport-http-1.5.1.MF | 12 - .../manifests/axis2-transport-http-1.5.3.MF | 11 + distribution/all/pom.xml | 34 +- distribution/all/src/main/release/bin/LICENSE | 40 +-- features/eclipse-pde/pom.xml | 14 +- .../binding-atom-runtime/META-INF/MANIFEST.MF | 15 +- ...uscany.sca.provider.BindingProviderFactory | 19 -- modules/binding-atom-runtime/pom.xml | 20 +- .../atom/provider/AtomBindingInvoker.java | 319 +++++++++++------- .../provider/AtomBindingListenerServlet.java | 4 +- .../atom/provider/AtomBindingUtil.java | 4 +- .../AtomReferenceBindingProvider.java | 18 +- .../binding/atom/MediaCollectionTestCase.java | 156 +++++---- .../META-INF/MANIFEST.MF | 12 +- modules/binding-jsonrpc-runtime/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 1 + modules/binding-ws-runtime-axis2/pom.xml | 24 +- ...uthenticationServicePolicyInterceptor.java | 4 +- modules/common-http/META-INF/MANIFEST.MF | 15 +- modules/common-http/pom.xml | 6 + .../common/http/client/HttpClientFactory.java | 58 ++++ modules/databinding-axiom/pom.xml | 4 +- modules/databinding-jaxb-axiom/pom.xml | 4 +- modules/databinding-sdo-axiom/pom.xml | 4 +- modules/implementation-python-runtime/pom.xml | 2 +- modules/implementation-script-runtime/pom.xml | 6 +- modules/implementation-script/pom.xml | 2 +- modules/policy-wspolicy/pom.xml | 4 +- 32 files changed, 510 insertions(+), 475 deletions(-) delete mode 100644 distribution/all/manifests/axiom-api-1.2.7.MF delete mode 100644 distribution/all/manifests/axiom-api-1.2.8.MF delete mode 100644 distribution/all/manifests/axis2-kernel-1.5.1.MF create mode 100644 distribution/all/manifests/axis2-kernel-1.5.3.MF delete mode 100644 distribution/all/manifests/axis2-transport-http-1.5.1.MF create mode 100644 distribution/all/manifests/axis2-transport-http-1.5.3.MF delete mode 100644 modules/binding-atom-runtime/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory create mode 100644 modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java diff --git a/distribution/all/manifests/axiom-api-1.2.7.MF b/distribution/all/manifests/axiom-api-1.2.7.MF deleted file mode 100644 index 3a692b6c06..0000000000 --- a/distribution/all/manifests/axiom-api-1.2.7.MF +++ /dev/null @@ -1,47 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Axiom API -Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api -Bundle-Version: 1.2.7 -Bundle-Vendor: Apache Software Foundation -Export-Package: org.apache.axiom.attachments, - org.apache.axiom.attachments.impl, - org.apache.axiom.attachments.lifecycle, - org.apache.axiom.attachments.lifecycle.impl, - org.apache.axiom.attachments.utils, - org.apache.axiom.om, - org.apache.axiom.om.ds, - org.apache.axiom.om.ds.custombuilder, - org.apache.axiom.om.impl, - org.apache.axiom.om.impl.builder, - org.apache.axiom.om.impl.exception, - org.apache.axiom.om.impl.serialize, - org.apache.axiom.om.impl.traverse, - org.apache.axiom.om.impl.util, - org.apache.axiom.om.util, - org.apache.axiom.om.xpath, - org.apache.axiom.soap, - org.apache.axiom.soap.impl.builder -Archiver-Version: Plexus Archiver -Build-Jdk: 1.5.0_15 -Created-By: Apache Maven -Bundle-DocURL: http://www.apache.org/ -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Built-By: dims -Import-Package: javax.activation, - javax.mail, - javax.mail.internet, - javax.xml.namespace, - javax.xml.stream, - org.apache.axiom.om.impl.dom.factory;resolution:=optional, - org.apache.axiom.om.impl.llom.factory;resolution:=optional, - org.apache.axiom.soap.impl.dom.factory;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap11;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap12;resolution:=optional, - org.apache.commons.logging, - org.jaxen;resolution:=optional, - org.jaxen.saxpath;resolution:=optional, - org.jaxen.util;resolution:=optional, - org.w3c.dom, - org.xml.sax, - org.xml.sax.helpers diff --git a/distribution/all/manifests/axiom-api-1.2.8.MF b/distribution/all/manifests/axiom-api-1.2.8.MF deleted file mode 100644 index 671a7bff34..0000000000 --- a/distribution/all/manifests/axiom-api-1.2.8.MF +++ /dev/null @@ -1,49 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Axiom API -Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api -Bundle-Version: 1.2.8 -Bundle-Vendor: Apache Software Foundation -Bundle-DocURL: http://www.apache.org/ -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Bundle-ClassPath: axiom-api-1.2.8.jar -Export-Package: org.apache.axiom.attachments, - org.apache.axiom.attachments.impl, - org.apache.axiom.attachments.lifecycle, - org.apache.axiom.attachments.lifecycle.impl, - org.apache.axiom.attachments.utils, - org.apache.axiom.om, - org.apache.axiom.om.ds, - org.apache.axiom.om.ds.custombuilder, - org.apache.axiom.om.impl, - org.apache.axiom.om.impl.builder, - org.apache.axiom.om.impl.exception, - org.apache.axiom.om.impl.serialize, - org.apache.axiom.om.impl.traverse, - org.apache.axiom.om.impl.util, - org.apache.axiom.om.util, - org.apache.axiom.om.xpath, - org.apache.axiom.soap, - org.apache.axiom.soap.impl.builder -Archiver-Version: Plexus Archiver -Build-Jdk: 1.5.0_15 -Created-By: Apache Maven -Built-By: dims -Import-Package: javax.activation, - javax.mail, - javax.mail.internet, - javax.xml.namespace, - javax.xml.stream, - javax.xml.stream.util, - org.apache.axiom.om.impl.dom.factory;resolution:=optional, - org.apache.axiom.om.impl.llom.factory;resolution:=optional, - org.apache.axiom.soap.impl.dom.factory;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap11;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap12;resolution:=optional, - org.apache.commons.logging, - org.jaxen;resolution:=optional, - org.jaxen.saxpath;resolution:=optional, - org.jaxen.util;resolution:=optional, - org.w3c.dom, - org.xml.sax, - org.xml.sax.helpers diff --git a/distribution/all/manifests/axis2-kernel-1.5.1.MF b/distribution/all/manifests/axis2-kernel-1.5.1.MF deleted file mode 100644 index 686e53ae0b..0000000000 --- a/distribution/all/manifests/axis2-kernel-1.5.1.MF +++ /dev/null @@ -1,39 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.axis2.kernel -Bundle-Name: org.apache.axis2.kernel -Bundle-Version: 1.5.1 -DynamicImport-Package: javax.transaction;version="1.1",javax.transacti - on.xa;version="1.1",javax.xml.ws,* -Bundle-ClassPath: axis2-kernel-1.5.1.jar -Export-Package: org.apache.axis2.dataretrieval;version=1.5.1,org.apach - e.axis2;version=1.5.1,org.apache.axis2.builder;version=1.5.1,org.apac - he.axis2.phaseresolver;version=1.5.1,org.apache.axis2.deployment.repo - sitory.util;version=1.5.1,org.apache.axis2.deployment;version=1.5.1,o - rg.apache.axis2.java.security;version=1.5.1,org.apache.axis2.engine;v - ersion=1.5.1,org.apache.axis2.context;version=1.5.1,org.apache.axis2. - addressing.i18n;version=1.5.1,org.apache.axis2.modules;version=1.5.1, - org.apache.axis2.addressing.metadata;version=1.5.1,org.apache.axis2.d - ataretrieval.client;version=1.5.1,org.apache.axis2.service;version=1. - 5.1,org.apache.axis2.description.java2wsdl.bytecode;version=1.5.1,org - .apache.axis2.i18n;version=1.5.1,org.apache.axis2.deployment.schedule - r;version=1.5.1,org.apache.axis2.description.java2wsdl;version=1.5.1, - org.apache.axis2.transport;version=1.5.1,org.apache.axis2.transport.h - ttp;version=1.5.1,org.apache.axis2.client;version=1.5.1,org.apache.ax - is2.wsdl;version=1.5.1,org.apache.axis2.util.threadpool;version=1.5.1 - ,org.apache.axis2.client.async;version=1.5.1,org.apache.axis2.receive - rs;version=1.5.1,org.apache.axis2.util;version=1.5.1,org.apache.axis2 - .namespace;version=1.5.1,org.apache.axis2.transport.http.util;version - =1.5.1,org.apache.axis2.context.externalize;version=1.5.1,org.apache. - axis2.addressing;version=1.5.1,org.apache.axis2.deployment.util;versi - on=1.5.1,org.apache.axis2.dispatchers;version=1.5.1,org.apache.axis2. - deployment.resolver;version=1.5.1,org.apache.axis2.clustering.configu - ration;version=1.5.1,org.apache.axis2.transaction;version=1.5.1,org.a - pache.axis2.clustering;version=1.5.1,org.apache.axis2.wsdl.util;versi - on=1.5.1,org.apache.axis2.clustering.context;version=1.5.1,org.apache - .axis2.builder.unknowncontent;version=1.5.1,org.apache.axis2.handlers - ;version=1.5.1,org.apache.axis2.addressing.wsdl;version=1.5.1,org.apa - che.axis2.classloader;version=1.5.1,org.apache.axis2.description;vers - ion=1.5.1 -Import-Package: javax.xml.ws -Eclipse-ExtensibleAPI: true diff --git a/distribution/all/manifests/axis2-kernel-1.5.3.MF b/distribution/all/manifests/axis2-kernel-1.5.3.MF new file mode 100644 index 0000000000..88a7f690a8 --- /dev/null +++ b/distribution/all/manifests/axis2-kernel-1.5.3.MF @@ -0,0 +1,36 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.apache.axis2.axis2-kernel +Bundle-Name: org.apache.axis2.axis2-kernel +Bundle-Version: 1.5.3 +DynamicImport-Package: javax.transaction;version="1.1",javax.transacti + on.xa;version="1.1",* +Bundle-ClassPath: axis2-kernel-1.5.3.jar +Export-Package: org.apache.axis2.client;version=1.5.3,org.apache.axis2 + .transaction;version=1.5.3,org.apache.axis2.classloader;version=1.5.3 + ,org.apache.axis2.wsdl.util;version=1.5.3,org.apache.axis2.descriptio + n.java2wsdl.bytecode;version=1.5.3,org.apache.axis2.handlers;version= + 1.5.3,org.apache.axis2.dispatchers;version=1.5.3,org.apache.axis2.clu + stering.configuration;version=1.5.3,org.apache.axis2.java.security;ve + rsion=1.5.3,org.apache.axis2.phaseresolver;version=1.5.3,org.apache.a + xis2.transport.http.util;version=1.5.3,org.apache.axis2.addressing.ws + dl;version=1.5.3,org.apache.axis2.description;version=1.5.3,org.apach + e.axis2.description.java2wsdl;version=1.5.3,org.apache.axis2.addressi + ng.i18n;version=1.5.3,org.apache.axis2.deployment.repository.util;ver + sion=1.5.3,org.apache.axis2.modules;version=1.5.3,org.apache.axis2.de + ployment.resolver;version=1.5.3,org.apache.axis2.client.async;version + =1.5.3,org.apache.axis2.builder;version=1.5.3,org.apache.axis2.util;v + ersion=1.5.3,org.apache.axis2.clustering;version=1.5.3,org.apache.axi + s2.clustering.context;version=1.5.3,org.apache.axis2.builder.unknownc + ontent;version=1.5.3,org.apache.axis2.dataretrieval.client;version=1. + 5.3,org.apache.axis2.context.externalize;version=1.5.3,org.apache.axi + s2.dataretrieval;version=1.5.3,org.apache.axis2.addressing.metadata;v + ersion=1.5.3,org.apache.axis2.receivers;version=1.5.3,org.apache.axis + 2.deployment.scheduler;version=1.5.3,org.apache.axis2;version=1.5.3,o + rg.apache.axis2.deployment;version=1.5.3,org.apache.axis2.deployment. + util;version=1.5.3,org.apache.axis2.util.threadpool;version=1.5.3,org + .apache.axis2.i18n;version=1.5.3,org.apache.axis2.engine;version=1.5. + 3,org.apache.axis2.wsdl;version=1.5.3,org.apache.axis2.transport;vers + ion=1.5.3,org.apache.axis2.addressing;version=1.5.3,org.apache.axis2. + namespace;version=1.5.3,org.apache.axis2.context;version=1.5.3,org.ap + ache.axis2.service;version=1.5.3 diff --git a/distribution/all/manifests/axis2-transport-http-1.5.1.MF b/distribution/all/manifests/axis2-transport-http-1.5.1.MF deleted file mode 100644 index ae6448acf5..0000000000 --- a/distribution/all/manifests/axis2-transport-http-1.5.1.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.axis2.transport.http -Bundle-Name: org.apache.axis2.transport.http -Bundle-Version: 1.5.1 -DynamicImport-Package: javax.transaction;version="1.1",javax.transacti - on.xa;version="1.1",* -Bundle-ClassPath: axis2-transport-http-1.5.1.jar -Export-Package: org.apache.axis2.transport.http.server;version=1.5.1,o - rg.apache.axis2.transport.http;version=1.5.1,org.apache.axis2.transpo - rt.http.util;version=1.5.1 -Fragment-Host: org.apache.axis2.kernel;bundle-version=1.5.1 diff --git a/distribution/all/manifests/axis2-transport-http-1.5.3.MF b/distribution/all/manifests/axis2-transport-http-1.5.3.MF new file mode 100644 index 0000000000..cffa6fc6e1 --- /dev/null +++ b/distribution/all/manifests/axis2-transport-http-1.5.3.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: axis2-transport-http +Bundle-Name: axis2-transport-http +Bundle-Version: 1.5.3 +DynamicImport-Package: javax.transaction;version="1.1",javax.transacti + on.xa;version="1.1",* +Bundle-ClassPath: axis2-transport-http-1.5.3.jar +Export-Package: org.apache.axis2.transport.http.server;version=1.5.3,o + rg.apache.axis2.transport.http;version=1.5.3,org.apache.axis2.transpo + rt.http.util;version=1.5.3 diff --git a/distribution/all/pom.xml b/distribution/all/pom.xml index e621bc5bdb..97a0e8fed9 100644 --- a/distribution/all/pom.xml +++ b/distribution/all/pom.xml @@ -179,11 +179,12 @@ org.apache.tuscany.sca.aggregation + org.apache.axis2 axis2-kernel - 1.5.1 - ${basedir}/manifests/axis2-kernel-1.5.1.MF + 1.5.3 + ${basedir}/manifests/axis2-kernel-1.5.3.MF org.apache.axis2 axis2-transport-http - 1.5.1 - ${basedir}/manifests/axis2-transport-http-1.5.1.MF + 1.5.3 + ${basedir}/manifests/axis2-transport-http-1.5.3.MF org.apache.axis2 @@ -215,17 +217,17 @@ org.apache.woden woden-impl-dom @@ -384,14 +388,14 @@ org.apache.axis2 axis2-kernel - 1.5.1 - ${basedir}/manifests/axis2-kernel-1.5.1.MF + 1.5.3 + ${basedir}/manifests/axis2-kernel-1.5.3.MF org.apache.axis2 axis2-transport-http - 1.5.1 - ${basedir}/manifests/axis2-transport-http-1.5.1.MF + 1.5.3 + ${basedir}/manifests/axis2-transport-http-1.5.3.MF org.apache.axis2 diff --git a/distribution/all/src/main/release/bin/LICENSE b/distribution/all/src/main/release/bin/LICENSE index bbab062516..6e814119f0 100644 --- a/distribution/all/src/main/release/bin/LICENSE +++ b/distribution/all/src/main/release/bin/LICENSE @@ -215,30 +215,30 @@ conditions of the following licenses. The following components come under Apache Software License 2.0 - abdera-client-1.0.jar - abdera-core-1.0.jar - abdera-extensions-html-1.0.jar - abdera-extensions-json-1.0.jar - abdera-extensions-main-1.0.jar - abdera-i18n-1.0.jar - abdera-parser-1.0.jar - abdera-server-1.0.jar + abdera-client-1.1.jar + abdera-core-1.1.jar + abdera-extensions-html-1.1.jar + abdera-extensions-json-1.1.jar + abdera-extensions-main-1.1.jar + abdera-i18n-1.1.jar + abdera-parser-1.1.jar + abdera-server-1.1.jar addressing-1.3.mar aopalliance-1.0.jar annogen-0.1.0.jar aspectjrt-1.6.8.jar aspectjweaver-1.6.8.jar - axiom-api-1.2.8.jar - axiom-dom-1.2.8.jar - axiom-impl-1.2.8.jar - axis2-codegen-1.5.1.jar - axis2-kernel-1.5.1.jar - axis2-java2wsdl-1.5.1.jar - axis2-mtompolicy-1.5.1.jar + axiom-api-1.2.10.jar + axiom-dom-1.2.10.jar + axiom-impl-1.2.10.jar + axis2-codegen-1.5.3.jar + axis2-kernel-1.5.3.jar + axis2-java2wsdl-1.5.3.jar + axis2-mtompolicy-1.5.3.jar axis2-transport-base-1.0.0.jar axis2-transport-jms-1.0.0.jar - axis2-transport-local-1.5.1.jar - axis2-transport-http-1.5.1.jar + axis2-transport-local-1.5.3.jar + axis2-transport-http-1.5.3.jar axis-ant-1.4.jar bsf-utils-3.1.jar cglib-2.2.jar @@ -274,9 +274,9 @@ The following components come under Apache Software License 2.0 gson-1.4.jar hazelcast-1.8.3.jar hazelcast-client-1.8.3.jar - httpclient-4.0.jar - httpcore-4.0.1.jar - httpcore-nio-4.0.1.jar + httpclient-4.0.3.jar + httpcore-4.1.jar + httpcore-nio-4.1.jar jabsorb-1.3.1.jar jackson-core-asl-1.6.2.jar jackson-mapper-asl-1.6.2.jar diff --git a/features/eclipse-pde/pom.xml b/features/eclipse-pde/pom.xml index 9b0eca71ed..36c778d044 100644 --- a/features/eclipse-pde/pom.xml +++ b/features/eclipse-pde/pom.xml @@ -82,12 +82,14 @@ org.apache.tuscany.sca.aggregation + org.apache.woden woden-impl-dom @@ -100,14 +102,14 @@ org.apache.axis2 axis2-kernel - 1.5.1 - ${basedir}/../../distribution/all/manifests/axis2-kernel-1.5.1.MF + 1.5.3 + ${basedir}/../../distribution/all/manifests/axis2-kernel-1.5.3.MF org.apache.axis2 axis2-transport-http - 1.5.1 - ${basedir}/../../distribution/all/manifests/axis2-transport-http-1.5.1.MF + 1.5.3 + ${basedir}/../../distribution/all/manifests/axis2-transport-http-1.5.3.MF org.apache.axis2 diff --git a/modules/binding-atom-runtime/META-INF/MANIFEST.MF b/modules/binding-atom-runtime/META-INF/MANIFEST.MF index 4ae5784c2a..62bc96dd98 100644 --- a/modules/binding-atom-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-atom-runtime/META-INF/MANIFEST.MF @@ -21,22 +21,23 @@ Import-Package: javax.servlet, org.apache.abdera.protocol.client.util, org.apache.abdera.writer, org.apache.commons.codec.binary, - org.apache.commons.httpclient, - org.apache.commons.httpclient.auth, - org.apache.commons.httpclient.methods, - org.apache.commons.httpclient.params, + org.apache.http, + org.apache.http.client, + org.apache.http.client.entity, + org.apache.http.client.methods, + org.apache.http.entity, + org.apache.http.message, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.atom;version="2.0.0", - org.apache.tuscany.sca.binding.http;version="2.0.0", org.apache.tuscany.sca.common.http;version="2.0.0", + org.apache.tuscany.sca.common.http.client;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.data.collection;version="2.0.0", org.apache.tuscany.sca.databinding;version="2.0.0", org.apache.tuscany.sca.host.http;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", org.apache.tuscany.sca.interfacedef.impl;version="2.0.0";resolution:=optional, - org.apache.tuscany.sca.interfacedef.util, - org.apache.tuscany.sca.interfacedef.wsdl;version="2.0.0", + org.apache.tuscany.sca.interfacedef.util;version="2.0.0", org.apache.tuscany.sca.invocation;version="2.0.0", org.apache.tuscany.sca.provider;version="2.0.0", org.apache.tuscany.sca.runtime;version="2.0.0", diff --git a/modules/binding-atom-runtime/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/modules/binding-atom-runtime/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index 1b9052299c..0000000000 --- a/modules/binding-atom-runtime/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -# Implementation class for the binding extension -org.apache.tuscany.sca.binding.atom.provider.AtomBindingProviderFactory;model=org.apache.tuscany.sca.binding.atom.AtomBinding diff --git a/modules/binding-atom-runtime/pom.xml b/modules/binding-atom-runtime/pom.xml index ce7fb47ccc..d353f1074b 100644 --- a/modules/binding-atom-runtime/pom.xml +++ b/modules/binding-atom-runtime/pom.xml @@ -91,23 +91,17 @@ provided - - commons-httpclient - commons-httpclient - 3.1 - - org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime org.apache.abdera abdera-core - 1.0 + 1.1.1 org.apache.geronimo.specs @@ -119,7 +113,7 @@ org.apache.abdera abdera-parser - 1.0 + 1.1.1 stax @@ -139,19 +133,19 @@ org.apache.abdera abdera-client - 1.0 + 1.1.1 org.apache.abdera abdera-extensions-main - 1.0 + 1.1.1 org.apache.abdera abdera-extensions-json - 1.0 + 1.1.1 @@ -218,7 +212,7 @@ org.apache.maven.plugins maven-surefire-plugin - true + false diff --git a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java index e92bfa07e4..9ad69d58a3 100644 --- a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java +++ b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java @@ -21,6 +21,7 @@ import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.entry; import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry; +import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; @@ -30,12 +31,15 @@ import org.apache.abdera.model.Document; import org.apache.abdera.model.Feed; import org.apache.abdera.parser.Parser; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.methods.DeleteMethod; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.PutMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.entity.StringEntity; import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; import org.apache.tuscany.sca.data.collection.Entry; import org.apache.tuscany.sca.interfacedef.Operation; @@ -49,7 +53,7 @@ * @version $Rev$ $Date$ */ class AtomBindingInvoker implements Invoker { - + private static final Factory abderaFactory = Abdera.getNewFactory(); private static final Parser abderaParser = Abdera.getNewParser(); @@ -58,15 +62,19 @@ class AtomBindingInvoker implements Invoker { HttpClient httpClient; String authorizationHeader; AtomReferenceBindingProvider provider; - - AtomBindingInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + + AtomBindingInvoker(Operation operation, + String uri, + org.apache.http.client.HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { this.operation = operation; this.uri = uri; this.httpClient = httpClient; this.authorizationHeader = authorizationHeader; this.provider = bindingProvider; } - + public Message invoke(Message msg) { // Shouldn't get here, as the only supported methods are // defined in the ResourceCollection interface, and implemented @@ -79,7 +87,11 @@ public Message invoke(Message msg) { */ public static class GetInvoker extends AtomBindingInvoker { - public GetInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public GetInvoker(Operation operation, + String uri, + org.apache.http.client.HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @@ -89,40 +101,43 @@ public Message invoke(Message msg) { String id = (String)((Object[])msg.getBody())[0]; // Send an HTTP GET - GetMethod getMethod = new GetMethod(uri + "/" + id); + HttpGet getMethod = new HttpGet(uri + "/" + id); if (authorizationHeader != null) { - getMethod.setRequestHeader("Authorization", authorizationHeader); + getMethod.setHeader("Authorization", authorizationHeader); } boolean parsing = false; + HttpResponse response = null; try { - httpClient.executeMethod(getMethod); - int status = getMethod.getStatusCode(); + response = httpClient.execute(getMethod); + int status = response.getStatusLine().getStatusCode(); // Read the Atom entry if (status == 200) { - Document doc = - abderaParser.parse(getMethod.getResponseBodyAsStream()); + Document doc = abderaParser.parse(response.getEntity().getContent()); parsing = true; org.apache.abdera.model.Entry feedEntry = doc.getRoot(); - + if (provider.supportsFeedEntries()) { - + // Return the Atom entry msg.setBody(feedEntry); - + } else { - + // Convert the feed entry to a data entry and return the data item - Entry entry = entry(feedEntry, provider.getItemClassType(), - provider.getItemXMLType(), provider.getMediator()); + Entry entry = + entry(feedEntry, + provider.getItemClassType(), + provider.getItemXMLType(), + provider.getMediator()); msg.setBody(entry.getData()); } } else if (status == 404) { - if ( provider.supportsFeedEntries()) - msg.setFaultBody(new NotFoundException()); - else - msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); + if (provider.supportsFeedEntries()) + msg.setFaultBody(new NotFoundException()); + else + msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); } else { msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status)); } @@ -133,7 +148,7 @@ public Message invoke(Message msg) { if (!parsing) { // Release the connection unless the Abdera parser is // parsing the response, in this case it will release it - getMethod.releaseConnection(); + release(getMethod, response); } } @@ -146,7 +161,11 @@ public Message invoke(Message msg) { */ public static class PostInvoker extends AtomBindingInvoker { - public PostInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public PostInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @@ -156,58 +175,64 @@ public Message invoke(Message msg) { Object[] args = (Object[])msg.getBody(); org.apache.abdera.model.Entry feedEntry; if (provider.supportsFeedEntries()) { - + // Expect an Atom entry feedEntry = (org.apache.abdera.model.Entry)args[0]; } else { - + // Expect a key and data item Entry entry = new Entry(args[0], args[1]); - feedEntry = feedEntry(entry, provider.getItemClassType(), - provider.getItemXMLType(), provider.getMediator(), abderaFactory); + feedEntry = + feedEntry(entry, + provider.getItemClassType(), + provider.getItemXMLType(), + provider.getMediator(), + abderaFactory); } // Send an HTTP POST - PostMethod postMethod = new PostMethod(uri); + HttpPost postMethod = new HttpPost(uri); if (authorizationHeader != null) { - postMethod.setRequestHeader("Authorization", authorizationHeader); + postMethod.setHeader("Authorization", authorizationHeader); } boolean parsing = false; + HttpResponse response = null; try { // Write the Atom entry StringWriter writer = new StringWriter(); feedEntry.writeTo(writer); - // postMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8"); - postMethod.setRequestHeader("Content-type", "application/atom+xml;type=entry"); - postMethod.setRequestEntity(new StringRequestEntity(writer.toString())); + // postMethod.setHeader("Content-type", "application/atom+xml; charset=utf-8"); + postMethod.setHeader("Content-type", "application/atom+xml;type=entry"); + postMethod.setEntity(new StringEntity(writer.toString())); - httpClient.executeMethod(postMethod); - int status = postMethod.getStatusCode(); + response = httpClient.execute(postMethod); + int status = response.getStatusLine().getStatusCode(); // Read the Atom entry if (status == 200 || status == 201) { - Document doc = abderaParser.parse(postMethod.getResponseBodyAsStream()); + Document doc = + abderaParser.parse(postMethod.getEntity().getContent()); parsing = true; org.apache.abdera.model.Entry createdEntry = doc.getRoot(); // Returns the created Atom entry ID if (provider.supportsFeedEntries()) { - + // Returns the created entry msg.setBody(createdEntry); - + } else { - + // Returns the id of the created entry msg.setBody(createdEntry.getId().toString()); } } else if (status == 404) { - if ( provider.supportsFeedEntries()) - msg.setFaultBody(new NotFoundException()); - else - msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); + if (provider.supportsFeedEntries()) + msg.setFaultBody(new NotFoundException()); + else + msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); } else { msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status)); } @@ -218,7 +243,7 @@ public Message invoke(Message msg) { if (!parsing) { // Release the connection unless the Abdera parser is // parsing the response, in this case it will release it - postMethod.releaseConnection(); + release(postMethod, response); } } @@ -231,7 +256,11 @@ public Message invoke(Message msg) { */ public static class PutInvoker extends AtomBindingInvoker { - public PutInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public PutInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @@ -242,44 +271,49 @@ public Message invoke(Message msg) { String id; org.apache.abdera.model.Entry feedEntry; if (provider.supportsFeedEntries()) { - + // Expect a key and Atom entry id = (String)args[0]; feedEntry = (org.apache.abdera.model.Entry)args[1]; } else { - + // Expect a key and data item id = (String)args[0]; Entry entry = new Entry(id, args[1]); - feedEntry = feedEntry(entry, provider.getItemClassType(), - provider.getItemXMLType(), provider.getMediator(), abderaFactory); + feedEntry = + feedEntry(entry, + provider.getItemClassType(), + provider.getItemXMLType(), + provider.getMediator(), + abderaFactory); } // Send an HTTP PUT - PutMethod putMethod = new PutMethod(uri + "/" + id); + HttpPut putMethod = new HttpPut(uri + "/" + id); if (authorizationHeader != null) { - putMethod.setRequestHeader("Authorization", authorizationHeader); + putMethod.setHeader("Authorization", authorizationHeader); } + HttpResponse response = null; try { // Write the Atom entry StringWriter writer = new StringWriter(); feedEntry.writeTo(writer); - putMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8"); - putMethod.setRequestEntity(new StringRequestEntity(writer.toString())); + putMethod.setHeader("Content-type", "application/atom+xml; charset=utf-8"); + putMethod.setEntity(new StringEntity(writer.toString())); - httpClient.executeMethod(putMethod); - int status = putMethod.getStatusCode(); + response = httpClient.execute(putMethod); + int status = response.getStatusLine().getStatusCode(); if (status == 200 || status == 201 || status == 412) { msg.setBody(null); } else if (status == 404) { - if ( provider.supportsFeedEntries()) - msg.setFaultBody(new NotFoundException()); - else - msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); + if (provider.supportsFeedEntries()) + msg.setFaultBody(new NotFoundException()); + else + msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); } else { msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status)); } @@ -287,7 +321,7 @@ public Message invoke(Message msg) { } catch (Exception e) { msg.setFaultBody(new ServiceRuntimeException(e)); } finally { - putMethod.releaseConnection(); + release(putMethod, response); } return msg; @@ -299,7 +333,11 @@ public Message invoke(Message msg) { */ public static class DeleteInvoker extends AtomBindingInvoker { - public DeleteInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public DeleteInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @@ -309,21 +347,22 @@ public Message invoke(Message msg) { String id = (String)((Object[])msg.getBody())[0]; // Send an HTTP DELETE - DeleteMethod deleteMethod = new DeleteMethod(uri + "/" + id); + HttpDelete deleteMethod = new HttpDelete(uri + "/" + id); if (authorizationHeader != null) { - deleteMethod.setRequestHeader("Authorization", authorizationHeader); + deleteMethod.setHeader("Authorization", authorizationHeader); } + HttpResponse response = null; try { - httpClient.executeMethod(deleteMethod); - int status = deleteMethod.getStatusCode(); + response = httpClient.execute(deleteMethod); + int status = response.getStatusLine().getStatusCode(); if (status == 200) { msg.setBody(null); } else if (status == 404) { - if ( provider.supportsFeedEntries()) - msg.setFaultBody(new NotFoundException()); - else - msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); + if (provider.supportsFeedEntries()) + msg.setFaultBody(new NotFoundException()); + else + msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); } else { msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status)); } @@ -331,7 +370,7 @@ public Message invoke(Message msg) { } catch (Exception e) { msg.setFaultBody(new ServiceRuntimeException(e)); } finally { - deleteMethod.releaseConnection(); + release(deleteMethod, response); } return msg; @@ -343,7 +382,11 @@ public Message invoke(Message msg) { */ public static class GetAllInvoker extends AtomBindingInvoker { - public GetAllInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public GetAllInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @@ -352,51 +395,55 @@ public Message invoke(Message msg) { // Get a feed // Send an HTTP GET - GetMethod getMethod = new GetMethod(uri); + HttpGet getMethod = new HttpGet(uri); if (authorizationHeader != null) { - getMethod.setRequestHeader("Authorization", authorizationHeader); + getMethod.setHeader("Authorization", authorizationHeader); } boolean parsing = false; + HttpResponse response = null; try { - httpClient.executeMethod(getMethod); - int status = getMethod.getStatusCode(); + response = httpClient.execute(getMethod); + int status = response.getStatusLine().getStatusCode(); // AtomBindingInvoker.printResponseHeader( getMethod ); // Read the Atom feed if (status == 200) { - Document doc = abderaParser.parse(getMethod.getResponseBodyAsStream()); + Document doc = abderaParser.parse(response.getEntity().getContent()); parsing = true; - + Feed feed = null; try { - feed = doc.getRoot(); - } catch(Exception e) { + feed = doc.getRoot(); + } catch (Exception e) { throw new IllegalArgumentException("Invalid feed format :" + uri); } if (provider.supportsFeedEntries()) { - + // Returns the Atom feed msg.setBody(feed); - + } else { - + // Returns an array of data entries - List> entries = new ArrayList>(); - for (org.apache.abdera.model.Entry feedEntry: feed.getEntries()) { - Entry entry = entry(feedEntry, provider.getItemClassType(), - provider.getItemXMLType(), provider.getMediator()); + List> entries = new ArrayList>(); + for (org.apache.abdera.model.Entry feedEntry : feed.getEntries()) { + Entry entry = + entry(feedEntry, + provider.getItemClassType(), + provider.getItemXMLType(), + provider.getMediator()); entries.add(entry); } msg.setBody(entries.toArray(new Entry[entries.size()])); } } else if (status == 404) { - if ( provider.supportsFeedEntries()) { - msg.setFaultBody(new NotFoundException()); - } else { - msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); - } + if (provider.supportsFeedEntries()) { + msg.setFaultBody(new NotFoundException()); + } else { + msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); + } } else { msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status)); } @@ -407,7 +454,7 @@ public Message invoke(Message msg) { if (!parsing) { // Release the connection unless the Abdera parser is // parsing the response, in this case it will release it - getMethod.releaseConnection(); + release(getMethod, response); } } @@ -420,7 +467,11 @@ public Message invoke(Message msg) { */ public static class QueryInvoker extends AtomBindingInvoker { - public QueryInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public QueryInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @@ -430,44 +481,48 @@ public Message invoke(Message msg) { String queryString = (String)((Object[])msg.getBody())[0]; // Send an HTTP GET - GetMethod getMethod = new GetMethod(uri); + HttpGet getMethod = new HttpGet(uri + "?" + queryString); if (authorizationHeader != null) { - getMethod.setRequestHeader("Authorization", authorizationHeader); + getMethod.setHeader("Authorization", authorizationHeader); } - getMethod.setQueryString(queryString); + // getMethod.setQueryString(queryString); boolean parsing = false; + HttpResponse response = null; try { - httpClient.executeMethod(getMethod); - int status = getMethod.getStatusCode(); + response = httpClient.execute(getMethod); + int status = response.getStatusLine().getStatusCode(); // Read the Atom feed if (status == 200) { - Document doc = abderaParser.parse(getMethod.getResponseBodyAsStream()); + Document doc = abderaParser.parse(response.getEntity().getContent()); parsing = true; Feed feed = doc.getRoot(); if (provider.supportsFeedEntries()) { - + // Returns the Atom feed msg.setBody(feed); - + } else { - + // Returns an array of data entries - List> entries = new ArrayList>(); - for (org.apache.abdera.model.Entry feedEntry: feed.getEntries()) { - Entry entry = entry(feedEntry, provider.getItemClassType(), - provider.getItemXMLType(), provider.getMediator()); + List> entries = new ArrayList>(); + for (org.apache.abdera.model.Entry feedEntry : feed.getEntries()) { + Entry entry = + entry(feedEntry, + provider.getItemClassType(), + provider.getItemXMLType(), + provider.getMediator()); entries.add(entry); } msg.setBody(entries.toArray(new Entry[entries.size()])); } } else if (status == 404) { - if ( provider.supportsFeedEntries()) - msg.setFaultBody(new NotFoundException()); - else - msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); + if (provider.supportsFeedEntries()) + msg.setFaultBody(new NotFoundException()); + else + msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException()); } else { msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status)); } @@ -478,7 +533,7 @@ public Message invoke(Message msg) { if (!parsing) { // Release the connection unless the Abdera parser is // parsing the response, in this case it will release it - getMethod.releaseConnection(); + release(getMethod, response); } } @@ -486,18 +541,38 @@ public Message invoke(Message msg) { } } + private static void release(HttpRequestBase request, HttpResponse response) { + + if (response != null) { + HttpEntity entity = response.getEntity(); + if (entity != null) { + try { + entity.consumeContent(); + } catch (IOException e) { + if (request != null) { + request.abort(); + } + } + } + } + } + /** * PostMedia operation invoker */ public static class PostMediaInvoker extends AtomBindingInvoker { - public PostMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public PostMediaInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @Override public Message invoke(Message msg) { - // PostInvoker can detect media by content type (non-Feed, non-Entry) + // PostInvoker can detect media by content type (non-Feed, non-Entry) return super.invoke(msg); } } @@ -507,13 +582,17 @@ public Message invoke(Message msg) { */ public static class PutMediaInvoker extends AtomBindingInvoker { - public PutMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) { + public PutMediaInvoker(Operation operation, + String uri, + HttpClient httpClient, + String authorizationHeader, + AtomReferenceBindingProvider bindingProvider) { super(operation, uri, httpClient, authorizationHeader, bindingProvider); } @Override public Message invoke(Message msg) { - // PutInvoker can detect media by content type (non-Feed, non-Entry) + // PutInvoker can detect media by content type (non-Feed, non-Entry) return super.invoke(msg); } } diff --git a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java index 6dc9524f92..d5ae26e01b 100644 --- a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java +++ b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java @@ -145,13 +145,13 @@ class AtomBindingListenerServlet extends HttpServlet { // Determine the collection item type if (getOperation != null) { itemXMLType = new DataTypeImpl>(String.class.getName(), String.class, String.class); - Class itemClass = getOperation.getOutputType().getPhysical(); + Class itemClass = getOperation.getOutputType().getLogical().get(0).getPhysical(); if (itemClass == org.apache.abdera.model.Entry.class) { supportsFeedEntries = true; } //We assume that the item type is the same for both input and //ouput for all operations on the interface - itemClassType = ((List)getOperation.getOutputType().getLogical()).get(0); + itemClassType = getOperation.getOutputType().getLogical().get(0); } } diff --git a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java index fad06a0c99..ad1c8d2fd0 100644 --- a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java +++ b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java @@ -23,8 +23,8 @@ import org.apache.abdera.factory.Factory; import org.apache.abdera.model.Content; -import org.apache.abdera.model.Link; import org.apache.abdera.model.Content.Type; +import org.apache.abdera.model.Link; import org.apache.tuscany.sca.data.collection.Entry; import org.apache.tuscany.sca.data.collection.Item; import org.apache.tuscany.sca.databinding.Mediator; @@ -78,9 +78,11 @@ static Entry entry(org.apache.abdera.model.Entry feedEntry, } // Create the item from XML + /* if (feedEntry.getContentElement().getElements().size() == 0) { return null; } + */ String value = feedEntry.getContent(); Object data = mediator.mediate(value, itemXMLType, itemClassType, null); diff --git a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java index 2801690f41..3612442e90 100644 --- a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java +++ b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java @@ -19,17 +19,10 @@ package org.apache.tuscany.sca.binding.atom.provider; -import java.net.URI; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.httpclient.Credentials; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpConnectionManager; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.UsernamePasswordCredentials; -import org.apache.commons.httpclient.auth.AuthScope; +import org.apache.http.client.HttpClient; import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.binding.atom.AtomBinding; +import org.apache.tuscany.sca.common.http.client.HttpClientFactory; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.InterfaceContract; @@ -77,10 +70,8 @@ class AtomReferenceBindingProvider implements ReferenceBindingProvider { //authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes())); // Create an HTTP client - HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); - connectionManager.getParams().setDefaultMaxConnectionsPerHost(10); - connectionManager.getParams().setConnectionTimeout(60000); - httpClient = new HttpClient(connectionManager); + HttpClientFactory clientFactory = new HttpClientFactory(); + httpClient = clientFactory.createHttpClient(); } public Invoker createInvoker(Operation operation) { @@ -90,7 +81,6 @@ public Invoker createInvoker(Operation operation) { // Determine the collection item type itemXMLType = new DataTypeImpl>(String.class.getName(), String.class, String.class); - Class itemClass = operation.getOutputType().getPhysical(); DataType outputType = operation.getOutputType().getLogical().get(0); itemClassType = outputType; if (itemClassType.getPhysical() == org.apache.abdera.model.Entry.class) { diff --git a/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java b/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java index 6d4a173d30..57eacab0e2 100644 --- a/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java +++ b/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.binding.atom; import java.io.File; -import java.io.FileInputStream; import java.text.SimpleDateFormat; import java.util.Date; @@ -32,11 +31,13 @@ import org.apache.abdera.model.Link; import org.apache.abdera.parser.Parser; import org.apache.abdera.protocol.client.AbderaClient; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.methods.InputStreamRequestEntity; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.entity.FileEntity; +import org.apache.tuscany.sca.common.http.client.HttpClientFactory; import org.apache.tuscany.sca.node.Contribution; import org.apache.tuscany.sca.node.ContributionLocationHelper; import org.apache.tuscany.sca.node.Node; @@ -62,11 +63,11 @@ public class MediaCollectionTestCase { protected static CustomerClient testService; protected static Abdera abdera; protected static AbderaClient client; - protected static Parser abderaParser; + protected static Parser abderaParser; protected static String eTag; protected static Date lastModified; protected static String mediaId; - protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time + protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z"); // RFC 822 date time @BeforeClass public static void init() throws Exception { @@ -74,13 +75,15 @@ public static void init() throws Exception { //System.out.println(">>>MediaCollectionTestCase.init"); String contribution = ContributionLocationHelper.getContributionLocation(MediaCollectionTestCase.class); - scaProviderNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite", new Contribution("provider", contribution)); + scaProviderNode = + NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite", + new Contribution("provider", contribution)); scaProviderNode.start(); abdera = new Abdera(); client = new AbderaClient(abdera); abderaParser = Abdera.getNewParser(); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -96,7 +99,7 @@ public static void destroy() throws Exception { @Test public void testPrelim() throws Exception { Assert.assertNotNull(scaProviderNode); - Assert.assertNotNull( client ); + Assert.assertNotNull(client); } @Test @@ -113,23 +116,25 @@ public void testMediaEntryPost() throws Exception { // Testing of entry creation String receiptName = "Auto Repair Bill"; String fileName = "target/test-classes/ReceiptToms.gif"; - File input = new File( fileName ); + File input = new File(fileName); boolean exists = input.exists(); - Assert.assertTrue( exists ); + Assert.assertTrue(exists); // Prepare HTTP post // PostMethod post = new PostMethod( colUri.toString() ); - PostMethod post = new PostMethod( providerURI ); - post.addRequestHeader( "Content-Type", "image/gif" ); - post.addRequestHeader( "Title", "Title " + receiptName + "" ); - post.addRequestHeader( "Slug", "Slug " + receiptName + "" ); - post.setRequestEntity( new InputStreamRequestEntity( new FileInputStream( input ), "image/gif" ) ); + HttpPost post = new HttpPost(providerURI); + post.addHeader("Content-Type", "image/gif"); + post.addHeader("Title", "Title " + receiptName + ""); + post.addHeader("Slug", "Slug " + receiptName + ""); + + post.setEntity(new FileEntity(input, "image/gif")); // Get HTTP client - HttpClient httpclient = new HttpClient(); + org.apache.http.client.HttpClient httpclient = new HttpClientFactory().createHttpClient(); try { // Execute request - int result = httpclient.executeMethod(post); + HttpResponse response = httpclient.execute(post); + int result = response.getStatusLine().getStatusCode(); // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6) // Post response // Tuscany responds with proper media links. Note that the media is @@ -138,31 +143,31 @@ public void testMediaEntryPost() throws Exception { // HTTP/1.1 201 Created // Display status code // System.out.println("Response status code: " + result + ", status text=" + post.getStatusText() ); - Assert.assertEquals(201, result ); + Assert.assertEquals(201, result); // Display response // System.out.println("Response body: "); // System.out.println(post.getResponseBodyAsString()); // Warning: BodyAsString recommends BodyAsStream // Location: http://example.org/media/edit/the_beach.atom (REQUIRED) - // System.out.println( "Response Location=" + post.getResponseHeader( "Location" ).getValue() + "." ); - Header header = post.getResponseHeader( "Location" ); - Assert.assertNotNull( header ); - Assert.assertNotNull( header.getValue() ); + // System.out.println( "Response Location=" + response.getFirstHeader( "Location" ).getValue() + "." ); + Header header = response.getFirstHeader("Location"); + Assert.assertNotNull(header); + Assert.assertNotNull(header.getValue()); // ContentLocation: http://example.org/media/edit/the_beach.jpg (REQUIRED) - // System.out.println( "Response Content-Location=" + post.getResponseHeader( "Content-Location" ).getValue() ); - header = post.getResponseHeader( "Content-Location" ); - Assert.assertNotNull( header ); - Assert.assertNotNull( header.getValue() ); + // System.out.println( "Response Content-Location=" + response.getFirstHeader( "Content-Location" ).getValue() ); + header = response.getFirstHeader("Content-Location"); + Assert.assertNotNull(header); + Assert.assertNotNull(header.getValue()); // Content-Type: application/atom+xml;type=entry;charset="utf-8" - // System.out.println( "Response Content-Type=" + post.getResponseHeader( "Content-Type" ).getValue()); - header = post.getResponseHeader( "Content-Type" ); - Assert.assertNotNull( header ); - Assert.assertNotNull( header.getValue() ); + // System.out.println( "Response Content-Type=" + response.getFirstHeader( "Content-Type" ).getValue()); + header = response.getFirstHeader("Content-Type"); + Assert.assertNotNull(header); + Assert.assertNotNull(header.getValue()); // Content-Length: nnn (OPTIONAL) - // System.out.println( "Response Content-Length=" + post.getResponseHeader( "Content-Length" ).getValue() ); - header = post.getResponseHeader( "Content-Length" ); - Assert.assertNotNull( header ); - Assert.assertNotNull( header.getValue() ); + // System.out.println( "Response Content-Length=" + response.getFirstHeader( "Content-Length" ).getValue() ); + header = response.getFirstHeader("Content-Length"); + Assert.assertNotNull(header); + Assert.assertNotNull(header.getValue()); // // // The Beach (REQUIRED) @@ -174,39 +179,39 @@ public void testMediaEntryPost() throws Exception { // // // - Document document = abderaParser.parse( post.getResponseBodyAsStream() ); + Document document = abderaParser.parse(response.getEntity().getContent()); Entry entry = document.getRoot(); String title = entry.getTitle(); // System.out.println( "mediaPost entry.title=" + title ); - Assert.assertNotNull( title ); + Assert.assertNotNull(title); IRI id = entry.getId(); // System.out.println( "mediaPost entry.id=" + id ); - Assert.assertNotNull( id ); + Assert.assertNotNull(id); mediaId = id.toString(); - Assert.assertNotNull( mediaId ); // Save for put/update request + Assert.assertNotNull(mediaId); // Save for put/update request Date updated = entry.getUpdated(); // System.out.println( "mediaPost entry.updated=" + updated); - Assert.assertNotNull( updated ); + Assert.assertNotNull(updated); String summary = entry.getSummary(); // System.out.println( "mediaPost entry.summary=" + summary); - Assert.assertNotNull( summary ); + Assert.assertNotNull(summary); IRI contentSrc = entry.getContentSrc(); // System.out.println( "mediaPost entry.content.src=" + contentSrc + ", type=" + entry.getContentType()); - Assert.assertNotNull( contentSrc ); + Assert.assertNotNull(contentSrc); Link editLink = entry.getEditLink(); // System.out.println( "mediaPost entry.editLink" + " rel=" + editLink.getRel() + ", href=" + editLink.getHref() ); - Assert.assertNotNull( editLink ); - Assert.assertNotNull( editLink.getRel() ); - Assert.assertNotNull( editLink.getHref() ); + Assert.assertNotNull(editLink); + Assert.assertNotNull(editLink.getRel()); + Assert.assertNotNull(editLink.getHref()); Link editMediaLink = entry.getEditMediaLink(); // System.out.println( "mediaPost entry.editMediaLink" + " rel=" + editMediaLink.getRel() + ", href=" + editMediaLink.getHref() ); - Assert.assertNotNull( editMediaLink ); - Assert.assertNotNull( editMediaLink.getRel() ); - Assert.assertNotNull( editMediaLink.getHref() ); + Assert.assertNotNull(editMediaLink); + Assert.assertNotNull(editMediaLink.getRel()); + Assert.assertNotNull(editMediaLink.getHref()); } finally { // Release current connection to the connection pool once you are done - post.releaseConnection(); + // post.releaseConnection(); } } @@ -216,9 +221,9 @@ public void testMediaEntryPutFound() throws Exception { // Testing of entry update String receiptName = "Value Autoglass Bill"; String fileName = "target/test-classes/ReceiptValue.jpg"; - File input = new File( fileName ); + File input = new File(fileName); boolean exists = input.exists(); - Assert.assertTrue( exists ); + Assert.assertTrue(exists); // Prepare HTTP put request // PUT /edit/the_beach.png HTTP/1.1 @@ -226,28 +231,29 @@ public void testMediaEntryPutFound() throws Exception { // Content-Type: image/png // Content-Length: nnn // ...binary data... - PutMethod put = new PutMethod( providerURI + "/" + mediaId ); - put.addRequestHeader( "Content-Type", "image/jpg" ); - put.addRequestHeader( "Title", "Title " + receiptName + "" ); - put.addRequestHeader( "Slug", "Slug " + receiptName + "" ); - put.setRequestEntity( - new InputStreamRequestEntity( new FileInputStream( input ), "image/jpg" ) ); + HttpPut put = new HttpPut(providerURI + "/" + mediaId); + put.addHeader("Content-Type", "image/jpg"); + put.addHeader("Title", "Title " + receiptName + ""); + put.addHeader("Slug", "Slug " + receiptName + ""); + put.setEntity(new FileEntity(input, "image/jpg")); // Get HTTP client - HttpClient httpclient = new HttpClient(); + HttpClient httpclient = new HttpClientFactory().createHttpClient(); try { // Execute request - int result = httpclient.executeMethod(put); + HttpResponse response = httpclient.execute(put); + response.getEntity().consumeContent(); + int result = response.getStatusLine().getStatusCode(); // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6) // Display status code // System.out.println("Response status code: " + result + ", status text=" + put.getStatusText() ); - Assert.assertEquals(200, result ); + Assert.assertEquals(200, result); // Display response. Should be empty for put. // System.out.println("Response body: "); // System.out.println(put.getResponseBodyAsString()); // Warning: BodyAsString recommends BodyAsStream } finally { // Release current connection to the connection pool once you are done - put.releaseConnection(); + // put.releaseConnection(); } } @@ -257,9 +263,9 @@ public void testMediaEntryPutNotFound() throws Exception { // Testing of entry update String receiptName = "Value Autoglass Bill"; String fileName = "target/test-classes/ReceiptValue.jpg"; - File input = new File( fileName ); + File input = new File(fileName); boolean exists = input.exists(); - Assert.assertTrue( exists ); + Assert.assertTrue(exists); // Prepare HTTP put request // PUT /edit/the_beach.png HTTP/1.1 @@ -267,28 +273,28 @@ public void testMediaEntryPutNotFound() throws Exception { // Content-Type: image/png // Content-Length: nnn // ...binary data... - PutMethod put = new PutMethod( providerURI + "/" + mediaId + "-bogus" ); // Does not exist. - put.addRequestHeader( "Content-Type", "image/jpg" ); - put.addRequestHeader( "Title", "Title " + receiptName + "" ); - put.addRequestHeader( "Slug", "Slug " + receiptName + "" ); - put.setRequestEntity( - new InputStreamRequestEntity( new FileInputStream( input ), "image/jpg" ) ); + HttpPut put = new HttpPut(providerURI + "/" + mediaId + "-bogus"); // Does not exist. + put.addHeader("Content-Type", "image/jpg"); + put.addHeader("Title", "Title " + receiptName + ""); + put.addHeader("Slug", "Slug " + receiptName + ""); + put.setEntity(new FileEntity(input, "image/jpg")); // Get HTTP client - HttpClient httpclient = new HttpClient(); + HttpClient httpclient = new HttpClientFactory().createHttpClient(); try { // Execute request - int result = httpclient.executeMethod(put); + HttpResponse response = httpclient.execute(put); + int result = response.getStatusLine().getStatusCode(); // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6) // Display status code // System.out.println("Response status code: " + result + ", status text=" + put.getStatusText() ); - Assert.assertEquals(404, result ); + Assert.assertEquals(404, result); // Display response. Should be empty for put. // System.out.println("Response body: "); // System.out.println(put.getResponseBodyAsString()); // Warning: BodyAsString recommends BodyAsStream } finally { // Release current connection to the connection pool once you are done - put.releaseConnection(); + // put.releaseConnection(); } } } diff --git a/modules/binding-jsonp-runtime/META-INF/MANIFEST.MF b/modules/binding-jsonp-runtime/META-INF/MANIFEST.MF index 9c5633ae1b..f5ab3c2d9d 100644 --- a/modules/binding-jsonp-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-jsonp-runtime/META-INF/MANIFEST.MF @@ -10,12 +10,12 @@ Import-Package: javax.servlet;version="2.5.0", javax.servlet.http;version="2.5.0", org.apache.commons.codec, org.apache.commons.codec.net, - org.apache.http;version="4.0.1", - org.apache.http.client;version="4.0.0", - org.apache.http.client.methods;version="4.0.0", - org.apache.http.client.utils;version="4.0.0", - org.apache.http.conn;version="4.0.0", - org.apache.http.impl.client;version="4.0.0", + org.apache.http, + org.apache.http.client, + org.apache.http.client.methods, + org.apache.http.client.utils, + org.apache.http.conn, + org.apache.http.impl.client, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.jsonp;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", diff --git a/modules/binding-jsonrpc-runtime/pom.xml b/modules/binding-jsonrpc-runtime/pom.xml index ecb0db3320..00c0e0d37b 100644 --- a/modules/binding-jsonrpc-runtime/pom.xml +++ b/modules/binding-jsonrpc-runtime/pom.xml @@ -69,7 +69,7 @@ org.apache.httpcomponents httpclient - 4.0 + 4.0.3 diff --git a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF index 2ad383d9f7..a2c1fe03ea 100644 --- a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF +++ b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF @@ -87,6 +87,7 @@ Import-Package: javax.activation;resolution:=optional, org.apache.axiom.om, org.apache.axiom.om.impl.builder, org.apache.axiom.om.util, + org.apache.axiom.util.base64, org.apache.axiom.soap, org.apache.axis2, org.apache.axis2.addressing, diff --git a/modules/binding-ws-runtime-axis2/pom.xml b/modules/binding-ws-runtime-axis2/pom.xml index d09fa8a124..25bbea3a77 100644 --- a/modules/binding-ws-runtime-axis2/pom.xml +++ b/modules/binding-ws-runtime-axis2/pom.xml @@ -51,7 +51,7 @@ org.apache.axis2 axis2-kernel - 1.5.1 + 1.5.3 xerces @@ -75,7 +75,7 @@ org.apache.axis2 axis2-java2wsdl - 1.5.1 + 1.5.3 org.apache.ant @@ -95,7 +95,7 @@ org.apache.axis2 axis2-codegen - 1.5.1 + 1.5.3 runtime @@ -112,26 +112,26 @@ org.apache.axis2 axis2-mtompolicy - 1.5.1 + 1.5.3 org.apache.axis2 mex - 1.5.1 + 1.5.3 impl org.apache.axis2 axis2-transport-http - 1.5.1 + 1.5.3 org.apache.axis2 axis2-transport-local - 1.5.1 + 1.5.3 @@ -143,19 +143,19 @@ org.apache.ws.commons.axiom axiom-api - 1.2.8 + 1.2.10 org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 org.apache.ws.commons.axiom axiom-dom - 1.2.8 + 1.2.10 @@ -179,13 +179,13 @@ org.apache.httpcomponents httpcore - 4.0.1 + 4.1 org.apache.httpcomponents httpcore-nio - 4.0.1 + 4.1 diff --git a/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java b/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java index 3d73410ae9..5365754fb3 100644 --- a/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java +++ b/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java @@ -24,8 +24,8 @@ import javax.security.auth.Subject; import javax.xml.namespace.QName; +import org.apache.axiom.util.base64.Base64Utils; import org.apache.axis2.context.MessageContext; -import org.apache.axis2.util.Base64; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.Phase; @@ -86,7 +86,7 @@ public Message invoke(Message msg) { basicAuthString = basicAuthString.trim(); if (basicAuthString.startsWith("Basic ")) { - decodedBasicAuthString = new String(Base64.decode(basicAuthString.substring(6))); + decodedBasicAuthString = new String(Base64Utils.decode(basicAuthString.substring(6))); } int collonIndex = decodedBasicAuthString.indexOf(':'); diff --git a/modules/common-http/META-INF/MANIFEST.MF b/modules/common-http/META-INF/MANIFEST.MF index 942e695a71..ccb1db35c5 100644 --- a/modules/common-http/META-INF/MANIFEST.MF +++ b/modules/common-http/META-INF/MANIFEST.MF @@ -8,7 +8,18 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Common HTTP Bundle-SymbolicName: org.apache.tuscany.sca.common.http Bundle-DocURL: http://www.apache.org/ -Export-Package: org.apache.tuscany.sca.common.http;version="2.0.0" -Import-Package: javax.servlet.http +Export-Package: org.apache.tuscany.sca.common.http;version="2.0.0";uses:="javax.servlet.http", + org.apache.tuscany.sca.common.http.client;version="2.0.0";uses:="org.apache.http.client" +Import-Package: javax.servlet.http, + org.apache.http, + org.apache.http.client, + org.apache.http.conn, + org.apache.http.conn.scheme, + org.apache.http.conn.ssl, + org.apache.http.impl.client, + org.apache.http.impl.conn.tsccm, + org.apache.http.params, + org.apache.http.protocol +Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/modules/common-http/pom.xml b/modules/common-http/pom.xml index 2fa94a708c..4cdd7fc98d 100644 --- a/modules/common-http/pom.xml +++ b/modules/common-http/pom.xml @@ -35,6 +35,12 @@ 2.5 provided + + + org.apache.httpcomponents + httpclient + 4.0.3 + junit diff --git a/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java b/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java new file mode 100644 index 0000000000..225bc952fb --- /dev/null +++ b/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.common.http.client; + +import org.apache.http.HttpHost; +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.PlainSocketFactory; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.params.HttpParams; +import org.apache.http.params.HttpProtocolParams; +import org.apache.http.protocol.HTTP; + +/** + * + */ +public class HttpClientFactory { + + public HttpClient createHttpClient() { + HttpParams defaultParameters = new BasicHttpParams(); + //defaultParameters.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 10); + HttpProtocolParams.setContentCharset(defaultParameters, HTTP.UTF_8); + HttpConnectionParams.setConnectionTimeout(defaultParameters, 60000); + HttpConnectionParams.setSoTimeout(defaultParameters, 60000); + + SchemeRegistry supportedSchemes = new SchemeRegistry(); + supportedSchemes.register(new Scheme(HttpHost.DEFAULT_SCHEME_NAME, PlainSocketFactory.getSocketFactory(), 80)); + supportedSchemes.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); + + ClientConnectionManager connectionManager = + new ThreadSafeClientConnManager(defaultParameters, supportedSchemes); + + return new DefaultHttpClient(connectionManager, defaultParameters); + } +} diff --git a/modules/databinding-axiom/pom.xml b/modules/databinding-axiom/pom.xml index b2e08bb1b8..c783cdc7ab 100644 --- a/modules/databinding-axiom/pom.xml +++ b/modules/databinding-axiom/pom.xml @@ -40,7 +40,7 @@ org.apache.ws.commons.axiom axiom-api - 1.2.8 + 1.2.10 xerces @@ -60,7 +60,7 @@ org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime diff --git a/modules/databinding-jaxb-axiom/pom.xml b/modules/databinding-jaxb-axiom/pom.xml index 23a5ef1ee3..7f74a09a9c 100644 --- a/modules/databinding-jaxb-axiom/pom.xml +++ b/modules/databinding-jaxb-axiom/pom.xml @@ -40,7 +40,7 @@ org.apache.ws.commons.axiom axiom-api - 1.2.8 + 1.2.10 xerces @@ -64,7 +64,7 @@ org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime diff --git a/modules/databinding-sdo-axiom/pom.xml b/modules/databinding-sdo-axiom/pom.xml index b438818c9d..c142b24500 100644 --- a/modules/databinding-sdo-axiom/pom.xml +++ b/modules/databinding-sdo-axiom/pom.xml @@ -38,7 +38,7 @@ org.apache.ws.commons.axiom axiom-api - 1.2.8 + 1.2.10 xerces @@ -62,7 +62,7 @@ org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime diff --git a/modules/implementation-python-runtime/pom.xml b/modules/implementation-python-runtime/pom.xml index c8ca9106de..448166350c 100644 --- a/modules/implementation-python-runtime/pom.xml +++ b/modules/implementation-python-runtime/pom.xml @@ -53,7 +53,7 @@ junit junit - 4.5 + 4.8.1 test diff --git a/modules/implementation-script-runtime/pom.xml b/modules/implementation-script-runtime/pom.xml index 1fda2ec5c2..7e039ff372 100644 --- a/modules/implementation-script-runtime/pom.xml +++ b/modules/implementation-script-runtime/pom.xml @@ -122,20 +122,20 @@ xml-apis - 1.2.8 + 1.2.10 org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime junit junit - 4.5 + 4.8.1 test diff --git a/modules/implementation-script/pom.xml b/modules/implementation-script/pom.xml index 0aad4c121d..f6b295814e 100644 --- a/modules/implementation-script/pom.xml +++ b/modules/implementation-script/pom.xml @@ -40,7 +40,7 @@ junit junit - 4.5 + 4.8.1 test diff --git a/modules/policy-wspolicy/pom.xml b/modules/policy-wspolicy/pom.xml index 7729af9556..71cafc147c 100644 --- a/modules/policy-wspolicy/pom.xml +++ b/modules/policy-wspolicy/pom.xml @@ -58,7 +58,7 @@ org.apache.ws.commons.axiom axiom-api - 1.2.8 + 1.2.10 xerces @@ -98,7 +98,7 @@ org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime From e0a2ea1a80fd3d32cac35e102275f968bb247e88 Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:14 +0000 Subject: [PATCH 056/174] More version changes and make sure HttpClient connections are released git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043772 13f79535-47bb-0310-9956-ffa450edef68 --- distribution/all/src/main/release/bin/LICENSE | 6 +- modules/binding-atom-runtime/pom.xml | 2 +- .../atom/provider/AtomBindingInvoker.java | 58 +++++++++++-------- modules/binding-jsonp-runtime/pom.xml | 15 +---- modules/common-http/META-INF/MANIFEST.MF | 1 + .../common/http/client/HttpClientFactory.java | 7 +++ modules/databinding-json/pom.xml | 10 ++-- 7 files changed, 51 insertions(+), 48 deletions(-) diff --git a/distribution/all/src/main/release/bin/LICENSE b/distribution/all/src/main/release/bin/LICENSE index 6e814119f0..293ba71e6c 100644 --- a/distribution/all/src/main/release/bin/LICENSE +++ b/distribution/all/src/main/release/bin/LICENSE @@ -278,9 +278,9 @@ The following components come under Apache Software License 2.0 httpcore-4.1.jar httpcore-nio-4.1.jar jabsorb-1.3.1.jar - jackson-core-asl-1.6.2.jar - jackson-mapper-asl-1.6.2.jar - jackson-xc-1.6.2.jar + jackson-core-asl-1.6.3.jar + jackson-mapper-asl-1.6.3.jar + jackson-xc-1.6.3.jar jettison-1.2.jar jetty-6.1.19.jar jetty-util-6.1.19.jar diff --git a/modules/binding-atom-runtime/pom.xml b/modules/binding-atom-runtime/pom.xml index d353f1074b..373d55c3ce 100644 --- a/modules/binding-atom-runtime/pom.xml +++ b/modules/binding-atom-runtime/pom.xml @@ -212,7 +212,7 @@ org.apache.maven.plugins maven-surefire-plugin - false + true diff --git a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java index 9ad69d58a3..c1de646f54 100644 --- a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java +++ b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java @@ -22,6 +22,7 @@ import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry; import java.io.IOException; +import java.io.InputStream; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; @@ -113,7 +114,9 @@ public Message invoke(Message msg) { // Read the Atom entry if (status == 200) { - Document doc = abderaParser.parse(response.getEntity().getContent()); + InputStream content = response.getEntity().getContent(); + Document doc = abderaParser.parse(content); + content.close(); parsing = true; org.apache.abdera.model.Entry feedEntry = doc.getRoot(); @@ -145,11 +148,11 @@ public Message invoke(Message msg) { } catch (Exception e) { msg.setFaultBody(new ServiceRuntimeException(e)); } finally { - if (!parsing) { - // Release the connection unless the Abdera parser is - // parsing the response, in this case it will release it - release(getMethod, response); - } + + // Release the connection unless the Abdera parser is + // parsing the response, in this case it will release it + release(getMethod, response); + } return msg; @@ -211,8 +214,9 @@ public Message invoke(Message msg) { // Read the Atom entry if (status == 200 || status == 201) { - Document doc = - abderaParser.parse(postMethod.getEntity().getContent()); + InputStream content = postMethod.getEntity().getContent(); + Document doc = abderaParser.parse(content); + content.close(); parsing = true; org.apache.abdera.model.Entry createdEntry = doc.getRoot(); @@ -240,11 +244,11 @@ public Message invoke(Message msg) { } catch (Exception e) { msg.setFaultBody(new ServiceRuntimeException(e)); } finally { - if (!parsing) { - // Release the connection unless the Abdera parser is - // parsing the response, in this case it will release it - release(postMethod, response); - } + + // Release the connection unless the Abdera parser is + // parsing the response, in this case it will release it + release(postMethod, response); + } return msg; @@ -408,7 +412,9 @@ public Message invoke(Message msg) { // Read the Atom feed if (status == 200) { - Document doc = abderaParser.parse(response.getEntity().getContent()); + InputStream content = response.getEntity().getContent(); + Document doc = abderaParser.parse(content); + content.close(); parsing = true; Feed feed = null; @@ -451,11 +457,11 @@ public Message invoke(Message msg) { } catch (Exception e) { msg.setFaultBody(new ServiceRuntimeException(e)); } finally { - if (!parsing) { - // Release the connection unless the Abdera parser is - // parsing the response, in this case it will release it - release(getMethod, response); - } + + // Release the connection unless the Abdera parser is + // parsing the response, in this case it will release it + release(getMethod, response); + } return msg; @@ -494,7 +500,9 @@ public Message invoke(Message msg) { // Read the Atom feed if (status == 200) { - Document doc = abderaParser.parse(response.getEntity().getContent()); + InputStream content = response.getEntity().getContent(); + Document doc = abderaParser.parse(content); + content.close(); parsing = true; Feed feed = doc.getRoot(); @@ -530,11 +538,11 @@ public Message invoke(Message msg) { } catch (Exception e) { msg.setFaultBody(new ServiceRuntimeException(e)); } finally { - if (!parsing) { - // Release the connection unless the Abdera parser is - // parsing the response, in this case it will release it - release(getMethod, response); - } + + // Release the connection unless the Abdera parser is + // parsing the response, in this case it will release it + release(getMethod, response); + } return msg; diff --git a/modules/binding-jsonp-runtime/pom.xml b/modules/binding-jsonp-runtime/pom.xml index 58fd948d03..6eb93add56 100644 --- a/modules/binding-jsonp-runtime/pom.xml +++ b/modules/binding-jsonp-runtime/pom.xml @@ -47,30 +47,17 @@ tuscany-host-http 2.0-SNAPSHOT - - - org.codehaus.jackson - jackson-core-asl - 1.6.2 - - - - org.codehaus.jackson - jackson-mapper-asl - 1.6.2 - org.apache.httpcomponents httpclient - 4.0 + 4.0.3 org.apache.tuscany.sca tuscany-databinding-json 2.0-SNAPSHOT - runtime diff --git a/modules/common-http/META-INF/MANIFEST.MF b/modules/common-http/META-INF/MANIFEST.MF index ccb1db35c5..267a70a118 100644 --- a/modules/common-http/META-INF/MANIFEST.MF +++ b/modules/common-http/META-INF/MANIFEST.MF @@ -14,6 +14,7 @@ Import-Package: javax.servlet.http, org.apache.http, org.apache.http.client, org.apache.http.conn, + org.apache.http.conn.params, org.apache.http.conn.scheme, org.apache.http.conn.ssl, org.apache.http.impl.client, diff --git a/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java b/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java index 225bc952fb..73bb9ebb8f 100644 --- a/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java +++ b/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java @@ -22,6 +22,7 @@ import org.apache.http.HttpHost; import org.apache.http.client.HttpClient; import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.params.ConnManagerParams; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; @@ -42,6 +43,10 @@ public class HttpClientFactory { public HttpClient createHttpClient() { HttpParams defaultParameters = new BasicHttpParams(); //defaultParameters.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 10); + + ConnManagerParams.setMaxTotalConnections(defaultParameters, 160); + // ConnManagerParams.setMaxConnectionsPerRoute(defaultParameters, ConnPerRoute); + HttpProtocolParams.setContentCharset(defaultParameters, HTTP.UTF_8); HttpConnectionParams.setConnectionTimeout(defaultParameters, 60000); HttpConnectionParams.setSoTimeout(defaultParameters, 60000); @@ -52,6 +57,8 @@ public HttpClient createHttpClient() { ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(defaultParameters, supportedSchemes); + + return new DefaultHttpClient(connectionManager, defaultParameters); } diff --git a/modules/databinding-json/pom.xml b/modules/databinding-json/pom.xml index b329c214fe..71c52e9632 100644 --- a/modules/databinding-json/pom.xml +++ b/modules/databinding-json/pom.xml @@ -40,17 +40,17 @@ org.codehaus.jackson jackson-core-asl - 1.6.2 + 1.6.3 org.codehaus.jackson jackson-mapper-asl - 1.6.2 + 1.6.3 org.codehaus.jackson jackson-xc - 1.6.2 + 1.6.3 @@ -75,7 +75,7 @@ org.apache.ws.commons.axiom axiom-api - 1.2.8 + 1.2.10 xerces @@ -99,7 +99,7 @@ org.apache.ws.commons.axiom axiom-impl - 1.2.8 + 1.2.10 runtime From ed7c8066e4c1ae748f8d4efb422eb8906dd5b579 Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:18 +0000 Subject: [PATCH 057/174] Customize the surefire plugin trying to avoid out of heap space git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043773 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/assembly/pom.xml | 1 + testing/compliance-tests/binding-jms/pom.xml | 1 + testing/compliance-tests/binding-ws/pom.xml | 1 + testing/compliance-tests/java-caa/pom.xml | 1 + testing/compliance-tests/java-ci/pom.xml | 1 + testing/compliance-tests/policy/pom.xml | 1 + 6 files changed, 6 insertions(+) diff --git a/testing/compliance-tests/assembly/pom.xml b/testing/compliance-tests/assembly/pom.xml index adc7edcf11..973bec43be 100644 --- a/testing/compliance-tests/assembly/pom.xml +++ b/testing/compliance-tests/assembly/pom.xml @@ -74,6 +74,7 @@ org.apache.maven.plugins maven-surefire-plugin + -Xms256m -Xmx1024m diff --git a/testing/compliance-tests/binding-jms/pom.xml b/testing/compliance-tests/binding-jms/pom.xml index 2cc7f67495..6964ecf1f9 100644 --- a/testing/compliance-tests/binding-jms/pom.xml +++ b/testing/compliance-tests/binding-jms/pom.xml @@ -96,6 +96,7 @@ org.apache.maven.plugins maven-surefire-plugin + -Xms256m -Xmx1024m diff --git a/testing/compliance-tests/binding-ws/pom.xml b/testing/compliance-tests/binding-ws/pom.xml index cd2e72100b..e09c910a47 100644 --- a/testing/compliance-tests/binding-ws/pom.xml +++ b/testing/compliance-tests/binding-ws/pom.xml @@ -74,6 +74,7 @@ org.apache.maven.plugins maven-surefire-plugin + -Xms256m -Xmx1024m diff --git a/testing/compliance-tests/java-caa/pom.xml b/testing/compliance-tests/java-caa/pom.xml index bd84498a0c..6b6bb6fcb7 100644 --- a/testing/compliance-tests/java-caa/pom.xml +++ b/testing/compliance-tests/java-caa/pom.xml @@ -76,6 +76,7 @@ org.apache.maven.plugins maven-surefire-plugin + -Xms256m -Xmx1024m **/JCA_11021_TestCase.java diff --git a/testing/compliance-tests/java-ci/pom.xml b/testing/compliance-tests/java-ci/pom.xml index dfb33bc425..c9a5eb7bb1 100644 --- a/testing/compliance-tests/java-ci/pom.xml +++ b/testing/compliance-tests/java-ci/pom.xml @@ -65,6 +65,7 @@ org.apache.maven.plugins maven-surefire-plugin + -Xms256m -Xmx1024m diff --git a/testing/compliance-tests/policy/pom.xml b/testing/compliance-tests/policy/pom.xml index e034c5f8a4..dc8d4dd199 100644 --- a/testing/compliance-tests/policy/pom.xml +++ b/testing/compliance-tests/policy/pom.xml @@ -74,6 +74,7 @@ org.apache.maven.plugins maven-surefire-plugin + -Xms256m -Xmx1024m **/POL_3002_TestCase.java From 02c730eda1e47d9d0517f8b262d3719d2cab07f7 Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:29 +0000 Subject: [PATCH 058/174] Move HttpClientFactory from common-http to host-http git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043774 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding-atom-runtime/META-INF/MANIFEST.MF | 3 +- .../AtomReferenceBindingProvider.java | 15 ++++---- .../binding/atom/MediaCollectionTestCase.java | 2 +- .../META-INF/MANIFEST.MF | 7 +--- .../JSONRPCReferenceBindingProvider.java | 37 +++---------------- modules/common-http/META-INF/MANIFEST.MF | 15 +------- modules/common-http/pom.xml | 8 +--- modules/host-http/META-INF/MANIFEST.MF | 20 ++++++++-- modules/host-http/pom.xml | 7 ++++ .../host}/http/client/HttpClientFactory.java | 2 +- 10 files changed, 44 insertions(+), 72 deletions(-) rename modules/{common-http/src/main/java/org/apache/tuscany/sca/common => host-http/src/main/java/org/apache/tuscany/sca/host}/http/client/HttpClientFactory.java (98%) diff --git a/modules/binding-atom-runtime/META-INF/MANIFEST.MF b/modules/binding-atom-runtime/META-INF/MANIFEST.MF index 62bc96dd98..b077100048 100644 --- a/modules/binding-atom-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-atom-runtime/META-INF/MANIFEST.MF @@ -25,16 +25,17 @@ Import-Package: javax.servlet, org.apache.http.client, org.apache.http.client.entity, org.apache.http.client.methods, + org.apache.http.conn, org.apache.http.entity, org.apache.http.message, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.atom;version="2.0.0", org.apache.tuscany.sca.common.http;version="2.0.0", - org.apache.tuscany.sca.common.http.client;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.data.collection;version="2.0.0", org.apache.tuscany.sca.databinding;version="2.0.0", org.apache.tuscany.sca.host.http;version="2.0.0", + org.apache.tuscany.sca.host.http.client;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", org.apache.tuscany.sca.interfacedef.impl;version="2.0.0";resolution:=optional, org.apache.tuscany.sca.interfacedef.util;version="2.0.0", diff --git a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java index 3612442e90..9f4ea496c1 100644 --- a/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java +++ b/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java @@ -22,8 +22,8 @@ import org.apache.http.client.HttpClient; import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.binding.atom.AtomBinding; -import org.apache.tuscany.sca.common.http.client.HttpClientFactory; import org.apache.tuscany.sca.databinding.Mediator; +import org.apache.tuscany.sca.host.http.client.HttpClientFactory; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; @@ -69,9 +69,6 @@ class AtomReferenceBindingProvider implements ReferenceBindingProvider { //String authorization = "admin" + ":" + "admin"; //authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes())); - // Create an HTTP client - HttpClientFactory clientFactory = new HttpClientFactory(); - httpClient = clientFactory.createHttpClient(); } public Invoker createInvoker(Operation operation) { @@ -123,13 +120,15 @@ public void start() { //httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials); // Find the get operation on the reference interface - if (true) { - return; - } + // Create an HTTP client + HttpClientFactory clientFactory = new HttpClientFactory(); + httpClient = clientFactory.createHttpClient(); } public void stop() { - + if (httpClient != null) { + httpClient.getConnectionManager().shutdown(); + } } public boolean supportsOneWayInvocation() { diff --git a/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java b/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java index 57eacab0e2..f3cb052e39 100644 --- a/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java +++ b/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java @@ -37,7 +37,7 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.FileEntity; -import org.apache.tuscany.sca.common.http.client.HttpClientFactory; +import org.apache.tuscany.sca.host.http.client.HttpClientFactory; import org.apache.tuscany.sca.node.Contribution; import org.apache.tuscany.sca.node.ContributionLocationHelper; import org.apache.tuscany.sca.node.Node; diff --git a/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF b/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF index 0a40a2295a..cb951b84a2 100644 --- a/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF @@ -9,17 +9,11 @@ Bundle-Description: Apache Tuscany SCA JSON-RPC Binding Runtime Import-Package: javax.security.auth.login, javax.servlet, javax.servlet.http, - org.apache.http.conn.ssl, org.apache.http, org.apache.http.client, org.apache.http.client.methods, org.apache.http.conn, - org.apache.http.conn.scheme, org.apache.http.entity, - org.apache.http.impl.client, - org.apache.http.impl.conn.tsccm, - org.apache.http.params, - org.apache.http.protocol, org.apache.http.util, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.jsonrpc;version="2.0.0", @@ -27,6 +21,7 @@ Import-Package: javax.security.auth.login, org.apache.tuscany.sca.databinding.javabeans;version="2.0.0", org.apache.tuscany.sca.databinding.json;version="2.0.0", org.apache.tuscany.sca.host.http;version="2.0.0", + org.apache.tuscany.sca.host.http.client;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", org.apache.tuscany.sca.interfacedef.java;version="2.0.0", org.apache.tuscany.sca.interfacedef.util;version="2.0.0", diff --git a/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java index e04065eed2..d0b24a0253 100644 --- a/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java +++ b/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java @@ -19,21 +19,9 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider; -import org.apache.http.HttpHost; import org.apache.http.client.HttpClient; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.PlainSocketFactory; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.apache.http.params.HttpParams; -import org.apache.http.params.HttpProtocolParams; -import org.apache.http.protocol.HTTP; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.host.http.client.HttpClientFactory; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; @@ -58,6 +46,7 @@ public JSONRPCReferenceBindingProvider(EndpointReference endpointReference) { this.endpointReference = endpointReference; this.reference = (RuntimeComponentReference)endpointReference.getReference(); + //clone the service contract to avoid databinding issues /* try { @@ -73,24 +62,6 @@ public JSONRPCReferenceBindingProvider(EndpointReference endpointReference) { // httpClient = createHttpClient(); } - public HttpClient createHttpClient() { - HttpParams defaultParameters = new BasicHttpParams(); - //defaultParameters.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 10); - HttpProtocolParams.setContentCharset(defaultParameters, HTTP.UTF_8); - HttpConnectionParams.setConnectionTimeout(defaultParameters, 60000); - HttpConnectionParams.setSoTimeout(defaultParameters, 60000); - - SchemeRegistry supportedSchemes = new SchemeRegistry(); - supportedSchemes.register(new Scheme(HttpHost.DEFAULT_SCHEME_NAME, PlainSocketFactory.getSocketFactory(), 80)); - supportedSchemes - .register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); - - ClientConnectionManager connectionManager = - new ThreadSafeClientConnManager(defaultParameters, supportedSchemes); - - return new DefaultHttpClient(connectionManager, defaultParameters); - } - public InterfaceContract getBindingInterfaceContract() { //return referenceContract; return reference.getInterfaceContract(); @@ -102,7 +73,9 @@ public Invoker createInvoker(Operation operation) { } public void start() { - this.httpClient = createHttpClient(); + // Create an HTTP client + HttpClientFactory clientFactory = new HttpClientFactory(); + httpClient = clientFactory.createHttpClient(); } public void stop() { diff --git a/modules/common-http/META-INF/MANIFEST.MF b/modules/common-http/META-INF/MANIFEST.MF index 267a70a118..4afe089d61 100644 --- a/modules/common-http/META-INF/MANIFEST.MF +++ b/modules/common-http/META-INF/MANIFEST.MF @@ -8,19 +8,8 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Common HTTP Bundle-SymbolicName: org.apache.tuscany.sca.common.http Bundle-DocURL: http://www.apache.org/ -Export-Package: org.apache.tuscany.sca.common.http;version="2.0.0";uses:="javax.servlet.http", - org.apache.tuscany.sca.common.http.client;version="2.0.0";uses:="org.apache.http.client" -Import-Package: javax.servlet.http, - org.apache.http, - org.apache.http.client, - org.apache.http.conn, - org.apache.http.conn.params, - org.apache.http.conn.scheme, - org.apache.http.conn.ssl, - org.apache.http.impl.client, - org.apache.http.impl.conn.tsccm, - org.apache.http.params, - org.apache.http.protocol +Export-Package: org.apache.tuscany.sca.common.http;version="2.0.0";uses:="javax.servlet.http" +Import-Package: javax.servlet.http Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/modules/common-http/pom.xml b/modules/common-http/pom.xml index 4cdd7fc98d..72d5493280 100644 --- a/modules/common-http/pom.xml +++ b/modules/common-http/pom.xml @@ -32,16 +32,10 @@ javax.servlet servlet-api - 2.5 + 2.5 provided - - org.apache.httpcomponents - httpclient - 4.0.3 - - junit junit diff --git a/modules/host-http/META-INF/MANIFEST.MF b/modules/host-http/META-INF/MANIFEST.MF index 33d1e52caf..3ab8b6de73 100644 --- a/modules/host-http/META-INF/MANIFEST.MF +++ b/modules/host-http/META-INF/MANIFEST.MF @@ -1,6 +1,10 @@ Manifest-Version: 1.0 -Export-Package: org.apache.tuscany.sca.host.http;uses:="javax.servlet, - javax.servlet.http";version="2.0.0" +Export-Package: org.apache.tuscany.sca.host.http;version="2.0.0"; + uses:="javax.servlet, + org.apache.tuscany.sca.core, + org.apache.tuscany.sca.extensibility, + javax.servlet.http", + org.apache.tuscany.sca.host.http.client;version="2.0.0";uses:="org.apache.http.client" SCA-Version: 1.1 Bundle-Name: Apache Tuscany SCA HTTP Servlet Host Extension Point Bundle-Vendor: The Apache Software Foundation @@ -13,7 +17,17 @@ Import-Package: javax.servlet, javax.servlet.http, org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", - org.apache.tuscany.sca.host.http;version="2.0.0" + org.apache.tuscany.sca.host.http;version="2.0.0", + org.apache.http, + org.apache.http.client, + org.apache.http.conn, + org.apache.http.conn.params, + org.apache.http.conn.scheme, + org.apache.http.conn.ssl, + org.apache.http.impl.client, + org.apache.http.impl.conn.tsccm, + org.apache.http.params, + org.apache.http.protocol Bundle-SymbolicName: org.apache.tuscany.sca.host.http Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/modules/host-http/pom.xml b/modules/host-http/pom.xml index cc725d24d5..63ea0345f5 100644 --- a/modules/host-http/pom.xml +++ b/modules/host-http/pom.xml @@ -41,6 +41,13 @@ 2.5 provided + + + org.apache.httpcomponents + httpclient + 4.0.3 + + diff --git a/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java b/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java similarity index 98% rename from modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java rename to modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java index 73bb9ebb8f..b3f21728c8 100644 --- a/modules/common-http/src/main/java/org/apache/tuscany/sca/common/http/client/HttpClientFactory.java +++ b/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/client/HttpClientFactory.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.common.http.client; +package org.apache.tuscany.sca.host.http.client; import org.apache.http.HttpHost; import org.apache.http.client.HttpClient; From 4c2e97fe00ca21b2cdb34714a7e58350a4ac7c2a Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:37 +0000 Subject: [PATCH 059/174] Update MFs and jar versions git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043775 13f79535-47bb-0310-9956-ffa450edef68 --- distribution/all/src/main/release/bin/LICENSE | 29 ++++++----- .../META-INF/MANIFEST.MF | 20 +------- modules/binding-ws-runtime-axis2/pom.xml | 4 +- .../node/equinox/launcher/axiom-api-1.2.7.MF | 47 ------------------ .../node/equinox/launcher/axiom-api-1.2.8.MF | 49 ------------------- .../equinox/launcher/axis2-kernel-1.4.1.MF | 2 - .../equinox/launcher/axis2-kernel-1.5.1.MF | 39 --------------- .../equinox/launcher/axis2-kernel-1.5.3.MF | 36 ++++++++++++++ .../launcher/axis2-transport-http-1.5.1.MF | 12 ----- .../launcher/axis2-transport-http-1.5.3.MF | 11 +++++ modules/policy-wspolicy/META-INF/MANIFEST.MF | 10 +--- 11 files changed, 67 insertions(+), 192 deletions(-) delete mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.7.MF delete mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.8.MF delete mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.4.1.MF delete mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.1.MF create mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF delete mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.1.MF create mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.3.MF diff --git a/distribution/all/src/main/release/bin/LICENSE b/distribution/all/src/main/release/bin/LICENSE index 293ba71e6c..a9cd8cee9d 100644 --- a/distribution/all/src/main/release/bin/LICENSE +++ b/distribution/all/src/main/release/bin/LICENSE @@ -215,14 +215,14 @@ conditions of the following licenses. The following components come under Apache Software License 2.0 - abdera-client-1.1.jar - abdera-core-1.1.jar - abdera-extensions-html-1.1.jar - abdera-extensions-json-1.1.jar - abdera-extensions-main-1.1.jar - abdera-i18n-1.1.jar - abdera-parser-1.1.jar - abdera-server-1.1.jar + abdera-client-1.1.1jar + abdera-core-1.1.1.jar + abdera-extensions-html-1.1.1.jar + abdera-extensions-json-1.1.1.jar + abdera-extensions-main-1.1.1.jar + abdera-i18n-1.1.1.jar + abdera-parser-1.1.1.jar + abdera-server-1.1.1.jar addressing-1.3.mar aopalliance-1.0.jar annogen-0.1.0.jar @@ -245,7 +245,7 @@ The following components come under Apache Software License 2.0 commons-beanutils-1.7.0.jar commons-cli-1.2.jar commons-collections-3.2.jar - commons-codec-1.3.jar + commons-codec-1.4.jar commons-digester-1.8.jar commons-discovery-0.4.jar commons-fileupload-1.2.jar @@ -256,7 +256,7 @@ The following components come under Apache Software License 2.0 commons-pool-1.3.jar derby-10.4.1.3.jar dwr-2.0.3.jar - geronimo-activation_1.1_spec-1.0.1.jar + geronimo-activation_1.1_spec-1.0.2.jar geronimo-annotation_1.1_spec-1.0.jar geronimo-connector-2.1.4.jar geronimo-ejb_3.0_spec-1.0.1.jar @@ -275,8 +275,8 @@ The following components come under Apache Software License 2.0 hazelcast-1.8.3.jar hazelcast-client-1.8.3.jar httpclient-4.0.3.jar - httpcore-4.1.jar - httpcore-nio-4.1.jar + httpcore-4.0.1.jar + httpcore-nio-4.0.1.jar jabsorb-1.3.1.jar jackson-core-asl-1.6.3.jar jackson-mapper-asl-1.6.3.jar @@ -286,7 +286,7 @@ The following components come under Apache Software License 2.0 jetty-util-6.1.19.jar juli-6.0.26.jar log4j-1.2.15.jar - mex-1.5.1-impl.jar + mex-1.5.3-impl.jar myfaces-api-1.2.2.jar myfaces-impl-1.2.2.jar neethi-2.0.4.jar @@ -325,10 +325,9 @@ The following components come under Apache Software License 2.0 woden-api-1.0M8.jar woden-impl-dom-1.0M8.jar wss4j-1.5.4.jar - wstx-asl-3.2.4.jar + wstx-asl-3.2.9.jar xalan-2.7.0.jar xercesImpl-2.8.1.jar - xml-apis-1.3.04.jar xmlbeans-2.3.0.jar xmlsec-1.4.3.jar XmlSchema-1.4.3.jar diff --git a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF index a2c1fe03ea..98360d8566 100644 --- a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF +++ b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF @@ -68,27 +68,20 @@ Bundle-ManifestVersion: 2 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Axis2-based WS Binding Extension Eclipse-RegisterBuddy: org.apache.axis2.kernel -Import-Package: javax.activation;resolution:=optional, - javax.security.auth.callback;resolution:=optional, - javax.servlet, +Import-Package: javax.servlet, javax.servlet.http, javax.wsdl, javax.wsdl.extensions, javax.wsdl.extensions.soap, javax.wsdl.extensions.soap12, - javax.wsdl.factory;resolution:=optional, - javax.wsdl.xml;resolution:=optional, javax.xml.namespace, javax.xml.parsers, javax.xml.stream, - javax.xml.transform, javax.xml.transform.dom, - javax.xml.ws, org.apache.axiom.om, org.apache.axiom.om.impl.builder, - org.apache.axiom.om.util, - org.apache.axiom.util.base64, org.apache.axiom.soap, + org.apache.axiom.util.base64, org.apache.axis2, org.apache.axis2.addressing, org.apache.axis2.addressing.wsdl, @@ -99,19 +92,14 @@ Import-Package: javax.activation;resolution:=optional, org.apache.axis2.description, org.apache.axis2.engine, org.apache.axis2.handlers, - org.apache.axis2.i18n, org.apache.axis2.receivers, - org.apache.axis2.transport, org.apache.axis2.transport.http, - org.apache.axis2.transport.http.server, org.apache.axis2.transport.jms, org.apache.axis2.transport.local, - org.apache.axis2.util, org.apache.axis2.util.threadpool, org.apache.commons.httpclient, org.apache.commons.httpclient.params, org.apache.commons.logging;resolution:=optional, - org.apache.neethi, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.assembly.xml;version="2.0.0", org.apache.tuscany.sca.binding.ws;version="2.0.0", @@ -121,7 +109,6 @@ Import-Package: javax.activation;resolution:=optional, org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.core.assembly;version="2.0.0", org.apache.tuscany.sca.databinding;version="2.0.0", - org.apache.tuscany.sca.definitions;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", org.apache.tuscany.sca.host.http;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", @@ -137,11 +124,8 @@ Import-Package: javax.activation;resolution:=optional, org.apache.tuscany.sca.provider;version="2.0.0", org.apache.tuscany.sca.runtime;version="2.0.0", org.apache.tuscany.sca.xsd;version="2.0.0", - org.apache.tuscany.sca.xsd.xml;version="2.0.0", org.apache.ws.commons.schema, org.apache.ws.commons.schema.resolver, - org.apache.ws.security, - org.apache.ws.security.handler, org.oasisopen.sca;version="2.0.0", org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional, org.w3c.dom, diff --git a/modules/binding-ws-runtime-axis2/pom.xml b/modules/binding-ws-runtime-axis2/pom.xml index 25bbea3a77..09ce75a412 100644 --- a/modules/binding-ws-runtime-axis2/pom.xml +++ b/modules/binding-ws-runtime-axis2/pom.xml @@ -179,13 +179,13 @@ org.apache.httpcomponents httpcore - 4.1 + 4.0.1 org.apache.httpcomponents httpcore-nio - 4.1 + 4.0.1 diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.7.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.7.MF deleted file mode 100644 index 41dcb9390e..0000000000 --- a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.7.MF +++ /dev/null @@ -1,47 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Axiom API -Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api -Bundle-Version: 1.2.7 -Bundle-ClassPath: axiom-api-1.2.7.jar -Bundle-Vendor: Apache Software Foundation -Export-Package: org.apache.axiom.attachments, - org.apache.axiom.attachments.impl, - org.apache.axiom.attachments.lifecycle, - org.apache.axiom.attachments.lifecycle.impl, - org.apache.axiom.attachments.utils, - org.apache.axiom.om, - org.apache.axiom.om.ds, - org.apache.axiom.om.ds.custombuilder, - org.apache.axiom.om.impl, - org.apache.axiom.om.impl.builder, - org.apache.axiom.om.impl.exception, - org.apache.axiom.om.impl.serialize, - org.apache.axiom.om.impl.traverse, - org.apache.axiom.om.impl.util, - org.apache.axiom.om.util, - org.apache.axiom.om.xpath, - org.apache.axiom.soap, - org.apache.axiom.soap.impl.builder -Archiver-Version: Plexus Archiver -Build-Jdk: 1.5.0_15 -Bundle-DocURL: http://www.apache.org/ -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Built-By: dims -Import-Package: javax.activation, - javax.mail, - javax.mail.internet, - javax.xml.namespace, - javax.xml.stream, - org.apache.axiom.om.impl.dom.factory;resolution:=optional, - org.apache.axiom.om.impl.llom.factory;resolution:=optional, - org.apache.axiom.soap.impl.dom.factory;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap11;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap12;resolution:=optional, - org.apache.commons.logging, - org.jaxen;resolution:=optional, - org.jaxen.saxpath;resolution:=optional, - org.jaxen.util;resolution:=optional, - org.w3c.dom, - org.xml.sax, - org.xml.sax.helpers diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.8.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.8.MF deleted file mode 100644 index 671a7bff34..0000000000 --- a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.8.MF +++ /dev/null @@ -1,49 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Axiom API -Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api -Bundle-Version: 1.2.8 -Bundle-Vendor: Apache Software Foundation -Bundle-DocURL: http://www.apache.org/ -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Bundle-ClassPath: axiom-api-1.2.8.jar -Export-Package: org.apache.axiom.attachments, - org.apache.axiom.attachments.impl, - org.apache.axiom.attachments.lifecycle, - org.apache.axiom.attachments.lifecycle.impl, - org.apache.axiom.attachments.utils, - org.apache.axiom.om, - org.apache.axiom.om.ds, - org.apache.axiom.om.ds.custombuilder, - org.apache.axiom.om.impl, - org.apache.axiom.om.impl.builder, - org.apache.axiom.om.impl.exception, - org.apache.axiom.om.impl.serialize, - org.apache.axiom.om.impl.traverse, - org.apache.axiom.om.impl.util, - org.apache.axiom.om.util, - org.apache.axiom.om.xpath, - org.apache.axiom.soap, - org.apache.axiom.soap.impl.builder -Archiver-Version: Plexus Archiver -Build-Jdk: 1.5.0_15 -Created-By: Apache Maven -Built-By: dims -Import-Package: javax.activation, - javax.mail, - javax.mail.internet, - javax.xml.namespace, - javax.xml.stream, - javax.xml.stream.util, - org.apache.axiom.om.impl.dom.factory;resolution:=optional, - org.apache.axiom.om.impl.llom.factory;resolution:=optional, - org.apache.axiom.soap.impl.dom.factory;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap11;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap12;resolution:=optional, - org.apache.commons.logging, - org.jaxen;resolution:=optional, - org.jaxen.saxpath;resolution:=optional, - org.jaxen.util;resolution:=optional, - org.w3c.dom, - org.xml.sax, - org.xml.sax.helpers diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.4.1.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.4.1.MF deleted file mode 100644 index 58630c02ef..0000000000 --- a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.4.1.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.1.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.1.MF deleted file mode 100644 index 107916e4f7..0000000000 --- a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.1.MF +++ /dev/null @@ -1,39 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.axis2.kernel -Bundle-Name: org.apache.axis2.kernel -Bundle-Version: 1.5.1 -DynamicImport-Package: javax.transaction;version="1.1",javax.transacti - on.xa;version="1.1",* -Bundle-ClassPath: axis2-kernel-1.5.1.jar -Export-Package: org.apache.axis2.dataretrieval;version=1.5.1,org.apach - e.axis2;version=1.5.1,org.apache.axis2.builder;version=1.5.1,org.apac - he.axis2.phaseresolver;version=1.5.1,org.apache.axis2.deployment.repo - sitory.util;version=1.5.1,org.apache.axis2.deployment;version=1.5.1,o - rg.apache.axis2.java.security;version=1.5.1,org.apache.axis2.engine;v - ersion=1.5.1,org.apache.axis2.context;version=1.5.1,org.apache.axis2. - addressing.i18n;version=1.5.1,org.apache.axis2.modules;version=1.5.1, - org.apache.axis2.addressing.metadata;version=1.5.1,org.apache.axis2.d - ataretrieval.client;version=1.5.1,org.apache.axis2.service;version=1. - 5.1,org.apache.axis2.description.java2wsdl.bytecode;version=1.5.1,org - .apache.axis2.i18n;version=1.5.1,org.apache.axis2.deployment.schedule - r;version=1.5.1,org.apache.axis2.description.java2wsdl;version=1.5.1, - org.apache.axis2.transport;version=1.5.1,org.apache.axis2.transport.h - ttp;version=1.5.1,org.apache.axis2.client;version=1.5.1,org.apache.ax - is2.wsdl;version=1.5.1,org.apache.axis2.util.threadpool;version=1.5.1 - ,org.apache.axis2.client.async;version=1.5.1,org.apache.axis2.receive - rs;version=1.5.1,org.apache.axis2.util;version=1.5.1,org.apache.axis2 - .namespace;version=1.5.1,org.apache.axis2.transport.http.util;version - =1.5.1,org.apache.axis2.context.externalize;version=1.5.1,org.apache. - axis2.addressing;version=1.5.1,org.apache.axis2.deployment.util;versi - on=1.5.1,org.apache.axis2.dispatchers;version=1.5.1,org.apache.axis2. - deployment.resolver;version=1.5.1,org.apache.axis2.clustering.configu - ration;version=1.5.1,org.apache.axis2.transaction;version=1.5.1,org.a - pache.axis2.clustering;version=1.5.1,org.apache.axis2.wsdl.util;versi - on=1.5.1,org.apache.axis2.clustering.context;version=1.5.1,org.apache - .axis2.builder.unknowncontent;version=1.5.1,org.apache.axis2.handlers - ;version=1.5.1,org.apache.axis2.addressing.wsdl;version=1.5.1,org.apa - che.axis2.classloader;version=1.5.1,org.apache.axis2.description;vers - ion=1.5.1 -Import-Package: javax.xml.ws -Eclipse-ExtensibleAPI: true diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF new file mode 100644 index 0000000000..88a7f690a8 --- /dev/null +++ b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF @@ -0,0 +1,36 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.apache.axis2.axis2-kernel +Bundle-Name: org.apache.axis2.axis2-kernel +Bundle-Version: 1.5.3 +DynamicImport-Package: javax.transaction;version="1.1",javax.transacti + on.xa;version="1.1",* +Bundle-ClassPath: axis2-kernel-1.5.3.jar +Export-Package: org.apache.axis2.client;version=1.5.3,org.apache.axis2 + .transaction;version=1.5.3,org.apache.axis2.classloader;version=1.5.3 + ,org.apache.axis2.wsdl.util;version=1.5.3,org.apache.axis2.descriptio + n.java2wsdl.bytecode;version=1.5.3,org.apache.axis2.handlers;version= + 1.5.3,org.apache.axis2.dispatchers;version=1.5.3,org.apache.axis2.clu + stering.configuration;version=1.5.3,org.apache.axis2.java.security;ve + rsion=1.5.3,org.apache.axis2.phaseresolver;version=1.5.3,org.apache.a + xis2.transport.http.util;version=1.5.3,org.apache.axis2.addressing.ws + dl;version=1.5.3,org.apache.axis2.description;version=1.5.3,org.apach + e.axis2.description.java2wsdl;version=1.5.3,org.apache.axis2.addressi + ng.i18n;version=1.5.3,org.apache.axis2.deployment.repository.util;ver + sion=1.5.3,org.apache.axis2.modules;version=1.5.3,org.apache.axis2.de + ployment.resolver;version=1.5.3,org.apache.axis2.client.async;version + =1.5.3,org.apache.axis2.builder;version=1.5.3,org.apache.axis2.util;v + ersion=1.5.3,org.apache.axis2.clustering;version=1.5.3,org.apache.axi + s2.clustering.context;version=1.5.3,org.apache.axis2.builder.unknownc + ontent;version=1.5.3,org.apache.axis2.dataretrieval.client;version=1. + 5.3,org.apache.axis2.context.externalize;version=1.5.3,org.apache.axi + s2.dataretrieval;version=1.5.3,org.apache.axis2.addressing.metadata;v + ersion=1.5.3,org.apache.axis2.receivers;version=1.5.3,org.apache.axis + 2.deployment.scheduler;version=1.5.3,org.apache.axis2;version=1.5.3,o + rg.apache.axis2.deployment;version=1.5.3,org.apache.axis2.deployment. + util;version=1.5.3,org.apache.axis2.util.threadpool;version=1.5.3,org + .apache.axis2.i18n;version=1.5.3,org.apache.axis2.engine;version=1.5. + 3,org.apache.axis2.wsdl;version=1.5.3,org.apache.axis2.transport;vers + ion=1.5.3,org.apache.axis2.addressing;version=1.5.3,org.apache.axis2. + namespace;version=1.5.3,org.apache.axis2.context;version=1.5.3,org.ap + ache.axis2.service;version=1.5.3 diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.1.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.1.MF deleted file mode 100644 index efe4d924ce..0000000000 --- a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.1.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.axis2.transport.http -Bundle-Name: org.apache.axis2.transport.http -Bundle-Version: 1.5.1 -DynamicImport-Package: javax.transaction;version="1.1",javax.transacti - on.xa;version="1.1",* -Bundle-ClassPath: axis2-transport-http-1.5.1.jar -Export-Package: org.apache.axis2.transport.http.server;version=1.5.1,o - rg.apache.axis2.transport.http;version=1.5.1,org.apache.axis2.transpo - rt.http.util;version=1.5.1 -Fragment-Host: org.apache.axis2.kernel;bunlde-version=1.5.1 diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.3.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.3.MF new file mode 100644 index 0000000000..cffa6fc6e1 --- /dev/null +++ b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-transport-http-1.5.3.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: axis2-transport-http +Bundle-Name: axis2-transport-http +Bundle-Version: 1.5.3 +DynamicImport-Package: javax.transaction;version="1.1",javax.transacti + on.xa;version="1.1",* +Bundle-ClassPath: axis2-transport-http-1.5.3.jar +Export-Package: org.apache.axis2.transport.http.server;version=1.5.3,o + rg.apache.axis2.transport.http;version=1.5.3,org.apache.axis2.transpo + rt.http.util;version=1.5.3 diff --git a/modules/policy-wspolicy/META-INF/MANIFEST.MF b/modules/policy-wspolicy/META-INF/MANIFEST.MF index 5dcfbd5b14..7d0d0b62a1 100644 --- a/modules/policy-wspolicy/META-INF/MANIFEST.MF +++ b/modules/policy-wspolicy/META-INF/MANIFEST.MF @@ -12,21 +12,15 @@ Import-Package: javax.xml.namespace, org.apache.axiom.om.impl.builder, org.apache.neethi, org.apache.tuscany.sca.assembly;version="2.0.0", - org.apache.tuscany.sca.assembly.builder;version="2.0.0", - org.apache.tuscany.sca.common.xml.stax;version="2.0.0", + org.apache.tuscany.sca.assembly.builder;version="2.0.0", org.apache.tuscany.sca.common.xml.stax.reader;version="2.0.0", org.apache.tuscany.sca.contribution.processor;version="2.0.0", org.apache.tuscany.sca.contribution.resolver;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.definitions;version="2.0.0", - org.apache.tuscany.sca.interfacedef;version="2.0.0", - org.apache.tuscany.sca.invocation;version="2.0.0", org.apache.tuscany.sca.monitor;version="2.0.0", org.apache.tuscany.sca.policy;version="2.0.0";resolution:=optional, - org.apache.tuscany.sca.policy.xml;version="2.0.0";resolution:=optional, - org.apache.tuscany.sca.provider;version="2.0.0", - org.apache.tuscany.sca.runtime;version="2.0.0", - org.oasisopen.sca.annotation + org.apache.tuscany.sca.policy.xml;version="2.0.0";resolution:=optional Bundle-SymbolicName: org.apache.tuscany.sca.policy.wspolicy Bundle-DocURL: http://www.apache.org/ Export-Package: org.apache.tuscany.sca.policy.wspolicy.xml;version="2.0.0"; From cb170d6731c4e7e0a5e5596bf4e5dbccb52b04ba Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:43:11 +0000 Subject: [PATCH 060/174] Explicitly set the httpcore version git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043776 13f79535-47bb-0310-9956-ffa450edef68 --- modules/host-http/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/host-http/pom.xml b/modules/host-http/pom.xml index 63ea0345f5..0204cad136 100644 --- a/modules/host-http/pom.xml +++ b/modules/host-http/pom.xml @@ -48,6 +48,12 @@ 4.0.3 + + org.apache.httpcomponents + httpcore + 4.0.1 + + From af4ebd6287dacfbee60c7fcf0ec26042a4ca34f9 Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:44 +0000 Subject: [PATCH 061/174] Fix the OSGi deps git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043777 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-sdo-axiom/META-INF/MANIFEST.MF | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/databinding-sdo-axiom/META-INF/MANIFEST.MF b/modules/databinding-sdo-axiom/META-INF/MANIFEST.MF index a40e93b8b8..26558b129c 100644 --- a/modules/databinding-sdo-axiom/META-INF/MANIFEST.MF +++ b/modules/databinding-sdo-axiom/META-INF/MANIFEST.MF @@ -11,6 +11,9 @@ Import-Package: commonj.sdo;version="2.1", commonj.sdo.impl;version="2.1", javax.xml.namespace, javax.xml.stream, + org.apache.axiom.om, + org.apache.axiom.om.impl.builder, + org.apache.axiom.om.impl.serialize, org.apache.tuscany.sca.databinding;version="2.0.0", org.apache.tuscany.sca.databinding.impl;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", From 87231ed8106151115ecd066e966cc74284fcf570 Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:50 +0000 Subject: [PATCH 062/174] Add customized MF to work around neethi osgi issue git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043778 13f79535-47bb-0310-9956-ffa450edef68 --- .../all/manifests/axiom-impl-1.2.10.MF | 36 +++++++++++++++++++ .../equinox/launcher/axiom-impl-1.2.10.MF | 36 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 distribution/all/manifests/axiom-impl-1.2.10.MF create mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-impl-1.2.10.MF diff --git a/distribution/all/manifests/axiom-impl-1.2.10.MF b/distribution/all/manifests/axiom-impl-1.2.10.MF new file mode 100644 index 0000000000..7e2c6db434 --- /dev/null +++ b/distribution/all/manifests/axiom-impl-1.2.10.MF @@ -0,0 +1,36 @@ +Manifest-Version: 1.0 +Specification-Title: Axiom Impl +Service-Component: OSGI-INF/serviceComponents.xml +Built-By: veithen +Created-By: Apache Maven Bundle Plugin +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Import-Package: javax.activation,javax.xml.namespace,javax.xml.stream, + org.apache.axiom.attachments,org.apache.axiom.attachments.utils,org.a + pache.axiom.ext.stax.datahandler,org.apache.axiom.om,org.apache.axiom + .om.impl,org.apache.axiom.om.impl.builder,org.apache.axiom.om.impl.ex + ception,org.apache.axiom.om.impl.serialize,org.apache.axiom.om.impl.t + raverse,org.apache.axiom.om.impl.util,org.apache.axiom.om.util,org.ap + ache.axiom.soap,org.apache.axiom.soap.impl.builder,org.apache.axiom.u + til,org.apache.axiom.util.base64,org.apache.axiom.util.namespace,org. + apache.axiom.util.stax,org.apache.commons.logging +Specification-Version: 1.2.10 +Implementation-Vendor-Id: org.apache.ws.commons.axiom +Bnd-LastModified: 1288443136116 +Bundle-Version: 1.2.10 +Bundle-Name: Axiom Impl +Bundle-Description: The Axiom default implementation. +Build-Jdk: 1.5.0_24 +Bundle-DocURL: http://www.apache.org/ +Export-Package: org.apache.axiom.om.impl.llom;version=1.2.10,org.apach + e.axiom.om.impl.llom.factory;version=1.2.10,org.apache.axiom.om.impl. + llom.util;version=1.2.10,org.apache.axiom.soap.impl.llom;version=1.2. + 10,org.apache.axiom.soap.impl.llom.soap11;version=1.2.10,org.apache.a + xiom.soap.impl.llom.soap12;version=1.2.10 +Bundle-ManifestVersion: 2 +Bundle-Vendor: The Apache Software Foundation +Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-impl +Implementation-Title: Axiom Impl +Tool: Bnd-0.0.238 +Specification-Vendor: The Apache Software Foundation +Implementation-Version: 1.2.10 +Implementation-Vendor: The Apache Software Foundation diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-impl-1.2.10.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-impl-1.2.10.MF new file mode 100644 index 0000000000..7e2c6db434 --- /dev/null +++ b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-impl-1.2.10.MF @@ -0,0 +1,36 @@ +Manifest-Version: 1.0 +Specification-Title: Axiom Impl +Service-Component: OSGI-INF/serviceComponents.xml +Built-By: veithen +Created-By: Apache Maven Bundle Plugin +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Import-Package: javax.activation,javax.xml.namespace,javax.xml.stream, + org.apache.axiom.attachments,org.apache.axiom.attachments.utils,org.a + pache.axiom.ext.stax.datahandler,org.apache.axiom.om,org.apache.axiom + .om.impl,org.apache.axiom.om.impl.builder,org.apache.axiom.om.impl.ex + ception,org.apache.axiom.om.impl.serialize,org.apache.axiom.om.impl.t + raverse,org.apache.axiom.om.impl.util,org.apache.axiom.om.util,org.ap + ache.axiom.soap,org.apache.axiom.soap.impl.builder,org.apache.axiom.u + til,org.apache.axiom.util.base64,org.apache.axiom.util.namespace,org. + apache.axiom.util.stax,org.apache.commons.logging +Specification-Version: 1.2.10 +Implementation-Vendor-Id: org.apache.ws.commons.axiom +Bnd-LastModified: 1288443136116 +Bundle-Version: 1.2.10 +Bundle-Name: Axiom Impl +Bundle-Description: The Axiom default implementation. +Build-Jdk: 1.5.0_24 +Bundle-DocURL: http://www.apache.org/ +Export-Package: org.apache.axiom.om.impl.llom;version=1.2.10,org.apach + e.axiom.om.impl.llom.factory;version=1.2.10,org.apache.axiom.om.impl. + llom.util;version=1.2.10,org.apache.axiom.soap.impl.llom;version=1.2. + 10,org.apache.axiom.soap.impl.llom.soap11;version=1.2.10,org.apache.a + xiom.soap.impl.llom.soap12;version=1.2.10 +Bundle-ManifestVersion: 2 +Bundle-Vendor: The Apache Software Foundation +Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-impl +Implementation-Title: Axiom Impl +Tool: Bnd-0.0.238 +Specification-Vendor: The Apache Software Foundation +Implementation-Version: 1.2.10 +Implementation-Vendor: The Apache Software Foundation From eabf176d8fb9e59e224d75f8daa6d321078e54e3 Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:45:57 +0000 Subject: [PATCH 063/174] More tweaks for the OSGi MF git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043779 13f79535-47bb-0310-9956-ffa450edef68 --- .../all/manifests/axiom-api-1.2.10.MF | 58 +++++++++++++++++++ .../META-INF/MANIFEST.MF | 12 ++-- modules/binding-jsonrpc-runtime/pom.xml | 2 +- modules/binding-rest-runtime/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 1 + modules/databinding-json/pom.xml | 13 +++++ modules/implementation-bpel-runtime/pom.xml | 4 ++ .../node/equinox/launcher/axiom-api-1.2.10.MF | 58 +++++++++++++++++++ 8 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 distribution/all/manifests/axiom-api-1.2.10.MF create mode 100644 modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.10.MF diff --git a/distribution/all/manifests/axiom-api-1.2.10.MF b/distribution/all/manifests/axiom-api-1.2.10.MF new file mode 100644 index 0000000000..66eb85a28b --- /dev/null +++ b/distribution/all/manifests/axiom-api-1.2.10.MF @@ -0,0 +1,58 @@ +Manifest-Version: 1.0 +Service-Component: OSGI-INF/serviceComponents.xml +Built-By: veithen +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Import-Package: javax.activation,javax.mail,javax.mail.internet,javax. + mail.util,javax.xml.namespace,javax.xml.stream,javax.xml.stream.util, + javax.xml.transform,javax.xml.transform.sax,org.apache.commons.loggin + g,org.jaxen;resolution:=optional,org.jaxen.saxpath;resolution:=option + al,org.jaxen.util;resolution:=optional,org.w3c.dom,org.xml.sax,org.xm + l.sax.ext,org.xml.sax.helpers, org.apache.axiom.om.impl.dom.factory;r + esolution:=optional,org.apache.axiom.om.impl.llom.factory;resolution: + =optional,org.apache.axiom.soap.impl.dom.factory;resolution:=optional + ,org.apache.axiom.soap.impl.llom.soap11;resolution:=optional,org.apac + he.axiom.soap.impl.llom.soap12;resolution:=optional +Include-Resource: META-INF/DEPENDENCIES=target/maven-shared-archive-re + sources/META-INF/DEPENDENCIES,META-INF/LICENSE=target/maven-shared-ar + chive-resources/META-INF/LICENSE,META-INF/NOTICE=target/maven-shared- + archive-resources/META-INF/NOTICE,OSGI-INF/metatype/metatype.xml=targ + et/scr-plugin-generated/OSGI-INF/metatype/metatype.xml,OSGI-INF/scr-p + lugin/scrinfo.xml=target/scr-plugin-generated/OSGI-INF/scr-plugin/scr + info.xml,OSGI-INF/serviceComponents.xml=target/scr-plugin-generated/O + SGI-INF/serviceComponents.xml +Implementation-Vendor-Id: org.apache.ws.commons.axiom +Bnd-LastModified: 1288443040121 +Bundle-Version: 1.2.10 +Bundle-Name: Axiom API +Bundle-Description: The Axiom API +Build-Jdk: 1.5.0_24 +Bundle-ManifestVersion: 2 +Tool: Bnd-0.0.238 +Specification-Vendor: The Apache Software Foundation +Implementation-Version: 1.2.10 +Implementation-Vendor: The Apache Software Foundation +Specification-Title: Axiom API +Created-By: Apache Maven Bundle Plugin +Specification-Version: 1.2.10 +Export-Package: org.apache.axiom.util.stax,org.apache.axiom.om.impl,or + g.apache.axiom.om.impl.serialize,org.apache.axiom.util,org.apache.axi + om.soap.impl.builder,org.apache.axiom.util.base64,org.apache.axiom.ex + t.io,org.apache.axiom.ext.stax.datahandler,org.apache.axiom.om.impl.u + til,org.apache.axiom.om.impl.exception,org.apache.axiom.mime,org.apac + he.axiom.util.stax.xop,org.apache.axiom.util.blob,org.apache.axiom.os + gi,org.apache.axiom.util.stax.dialect,org.apache.axiom.om,org.apache. + axiom.util.stax.wrapper,org.apache.axiom.om.impl.jaxp,org.apache.axio + m.om.ds.custombuilder,org.apache.axiom.attachments.impl,org.apache.ax + iom.om.xpath,org.apache.axiom.util.activation,org.apache.axiom.om.uti + l,org.apache.axiom.attachments.lifecycle,org.apache.axiom.util.namesp + ace,org.apache.axiom.om.impl.traverse,org.apache.axiom.util.stax.debu + g,org.apache.axiom.attachments.utils,org.apache.axiom.soap,org.apache + .axiom.ext.activation,org.apache.axiom.attachments,org.apache.axiom.m + ime.impl.javamail,org.apache.axiom.ext.stax,org.apache.axiom.attachme + nts.lifecycle.impl,org.apache.axiom.om.ds,org.apache.axiom.om.impl.bu + ilder +Bundle-DocURL: http://www.apache.org/ +Bundle-Vendor: The Apache Software Foundation +Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api +Implementation-Title: Axiom API + diff --git a/modules/binding-comet-runtime/META-INF/MANIFEST.MF b/modules/binding-comet-runtime/META-INF/MANIFEST.MF index 61933424f3..5f20b13b5c 100644 --- a/modules/binding-comet-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-comet-runtime/META-INF/MANIFEST.MF @@ -10,12 +10,12 @@ Import-Package: javax.servlet;version="2.5.0", javax.servlet.http;version="2.5.0", org.apache.commons.codec, org.apache.commons.codec.net, - org.apache.http;version="4.0.1", - org.apache.http.client;version="4.0.0", - org.apache.http.client.methods;version="4.0.0", - org.apache.http.client.utils;version="4.0.0", - org.apache.http.conn;version="4.0.0", - org.apache.http.impl.client;version="4.0.0", + org.apache.http, + org.apache.http.client, + org.apache.http.client.methods, + org.apache.http.client.utils, + org.apache.http.conn, + org.apache.http.impl.client, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.comet;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", diff --git a/modules/binding-jsonrpc-runtime/pom.xml b/modules/binding-jsonrpc-runtime/pom.xml index 00c0e0d37b..3a5c43cccb 100644 --- a/modules/binding-jsonrpc-runtime/pom.xml +++ b/modules/binding-jsonrpc-runtime/pom.xml @@ -148,7 +148,7 @@ httpunit httpunit - 1.6.1 + 1.7 test diff --git a/modules/binding-rest-runtime/pom.xml b/modules/binding-rest-runtime/pom.xml index 08d38bf4aa..5c8d4fb4ca 100644 --- a/modules/binding-rest-runtime/pom.xml +++ b/modules/binding-rest-runtime/pom.xml @@ -188,7 +188,7 @@ httpunit httpunit - 1.6.1 + 1.7 test diff --git a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF index 98360d8566..843251bee0 100644 --- a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF +++ b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF @@ -93,6 +93,7 @@ Import-Package: javax.servlet, org.apache.axis2.engine, org.apache.axis2.handlers, org.apache.axis2.receivers, + org.apache.axis2.transport, org.apache.axis2.transport.http, org.apache.axis2.transport.jms, org.apache.axis2.transport.local, diff --git a/modules/databinding-json/pom.xml b/modules/databinding-json/pom.xml index 71c52e9632..b7197d516b 100644 --- a/modules/databinding-json/pom.xml +++ b/modules/databinding-json/pom.xml @@ -59,6 +59,19 @@ 1.3.1 + + org.slf4j + slf4j-api + 1.6.1 + runtime + + + org.slf4j + slf4j-jdk14 + 1.6.1 + runtime + + org.codehaus.jettison jettison diff --git a/modules/implementation-bpel-runtime/pom.xml b/modules/implementation-bpel-runtime/pom.xml index a68b866f09..b5a67a2a98 100644 --- a/modules/implementation-bpel-runtime/pom.xml +++ b/modules/implementation-bpel-runtime/pom.xml @@ -325,6 +325,10 @@ xml-apis xml-apis + + xerces + xercesImpl + diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.10.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.10.MF new file mode 100644 index 0000000000..66eb85a28b --- /dev/null +++ b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axiom-api-1.2.10.MF @@ -0,0 +1,58 @@ +Manifest-Version: 1.0 +Service-Component: OSGI-INF/serviceComponents.xml +Built-By: veithen +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Import-Package: javax.activation,javax.mail,javax.mail.internet,javax. + mail.util,javax.xml.namespace,javax.xml.stream,javax.xml.stream.util, + javax.xml.transform,javax.xml.transform.sax,org.apache.commons.loggin + g,org.jaxen;resolution:=optional,org.jaxen.saxpath;resolution:=option + al,org.jaxen.util;resolution:=optional,org.w3c.dom,org.xml.sax,org.xm + l.sax.ext,org.xml.sax.helpers, org.apache.axiom.om.impl.dom.factory;r + esolution:=optional,org.apache.axiom.om.impl.llom.factory;resolution: + =optional,org.apache.axiom.soap.impl.dom.factory;resolution:=optional + ,org.apache.axiom.soap.impl.llom.soap11;resolution:=optional,org.apac + he.axiom.soap.impl.llom.soap12;resolution:=optional +Include-Resource: META-INF/DEPENDENCIES=target/maven-shared-archive-re + sources/META-INF/DEPENDENCIES,META-INF/LICENSE=target/maven-shared-ar + chive-resources/META-INF/LICENSE,META-INF/NOTICE=target/maven-shared- + archive-resources/META-INF/NOTICE,OSGI-INF/metatype/metatype.xml=targ + et/scr-plugin-generated/OSGI-INF/metatype/metatype.xml,OSGI-INF/scr-p + lugin/scrinfo.xml=target/scr-plugin-generated/OSGI-INF/scr-plugin/scr + info.xml,OSGI-INF/serviceComponents.xml=target/scr-plugin-generated/O + SGI-INF/serviceComponents.xml +Implementation-Vendor-Id: org.apache.ws.commons.axiom +Bnd-LastModified: 1288443040121 +Bundle-Version: 1.2.10 +Bundle-Name: Axiom API +Bundle-Description: The Axiom API +Build-Jdk: 1.5.0_24 +Bundle-ManifestVersion: 2 +Tool: Bnd-0.0.238 +Specification-Vendor: The Apache Software Foundation +Implementation-Version: 1.2.10 +Implementation-Vendor: The Apache Software Foundation +Specification-Title: Axiom API +Created-By: Apache Maven Bundle Plugin +Specification-Version: 1.2.10 +Export-Package: org.apache.axiom.util.stax,org.apache.axiom.om.impl,or + g.apache.axiom.om.impl.serialize,org.apache.axiom.util,org.apache.axi + om.soap.impl.builder,org.apache.axiom.util.base64,org.apache.axiom.ex + t.io,org.apache.axiom.ext.stax.datahandler,org.apache.axiom.om.impl.u + til,org.apache.axiom.om.impl.exception,org.apache.axiom.mime,org.apac + he.axiom.util.stax.xop,org.apache.axiom.util.blob,org.apache.axiom.os + gi,org.apache.axiom.util.stax.dialect,org.apache.axiom.om,org.apache. + axiom.util.stax.wrapper,org.apache.axiom.om.impl.jaxp,org.apache.axio + m.om.ds.custombuilder,org.apache.axiom.attachments.impl,org.apache.ax + iom.om.xpath,org.apache.axiom.util.activation,org.apache.axiom.om.uti + l,org.apache.axiom.attachments.lifecycle,org.apache.axiom.util.namesp + ace,org.apache.axiom.om.impl.traverse,org.apache.axiom.util.stax.debu + g,org.apache.axiom.attachments.utils,org.apache.axiom.soap,org.apache + .axiom.ext.activation,org.apache.axiom.attachments,org.apache.axiom.m + ime.impl.javamail,org.apache.axiom.ext.stax,org.apache.axiom.attachme + nts.lifecycle.impl,org.apache.axiom.om.ds,org.apache.axiom.om.impl.bu + ilder +Bundle-DocURL: http://www.apache.org/ +Bundle-Vendor: The Apache Software Foundation +Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api +Implementation-Title: Axiom API + From 8ab948f282ad2cb864b4f20b12ff15af07c9724f Mon Sep 17 00:00:00 2001 From: Zhaohui Feng Date: Wed, 8 Dec 2010 23:46:24 +0000 Subject: [PATCH 064/174] Update to latest OASIS XSDs git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043780 13f79535-47bb-0310-9956-ffa450edef68 --- ...a-policy-1.1-intents-definitions-cd04.xml} | 498 +++++++++--------- ...he.tuscany.sca.definitions.xml.Definitions | 2 +- .../tuscany/sca/assembly/xsd/Constants.java | 2 +- ...ca.contribution.processor.ValidationSchema | 2 +- .../src/main/resources/sca-1.1-cd05-rev1.xsd | 38 -- .../src/main/resources/sca-1.1-cd05.xsd | 38 -- .../src/main/resources/sca-1.1-cd06.xsd | 40 ++ ....xsd => sca-binding-ejb-1.1-cd02-rev2.xsd} | 2 +- ....xsd => sca-binding-jca-1.1-cd04-rev2.xsd} | 2 +- ...-rev1.xsd => sca-binding-sca-1.1-cd06.xsd} | 2 +- ...1.xsd => sca-binding-ws-1.1-cd04-rev2.xsd} | 2 +- ...sca-binding-ws-callback-1.1-cd04-rev1.xsd} | 1 - ...rev1.xsd => sca-contribution-1.1-cd06.xsd} | 2 +- ...v1.xsd => sca-contribution-c-1.1-cd06.xsd} | 70 +-- ....xsd => sca-contribution-cpp-1.1-cd06.xsd} | 68 +-- ...xsd => sca-contribution-java-1.1-cd03.xsd} | 4 +- ....1-cd05-rev1.xsd => sca-core-1.1-cd06.xsd} | 2 +- ...-rev1.xsd => sca-definitions-1.1-cd06.xsd} | 4 +- .../sca-implementation-bpel-1.1-cd03.xsd | 4 +- ....xsd => sca-implementation-c-1.1-cd06.xsd} | 110 ++-- ...sca-implementation-composite-1.1-cd06.xsd} | 2 +- ...sd => sca-implementation-cpp-1.1-cd06.xsd} | 126 ++--- ...d => sca-implementation-java-1.1-cd03.xsd} | 2 +- .../sca-implementation-spring-1.1-cd01.xsd | 4 +- ...-rev1.xsd => sca-interface-c-1.1-cd06.xsd} | 102 ++-- .../resources/sca-interface-cpp-1.1-cd04.xsd | 51 -- ...ev1.xsd => sca-interface-cpp-1.1-cd06.xsd} | 102 ++-- ...v1.xsd => sca-interface-java-1.1-cd05.xsd} | 4 +- ...v1.xsd => sca-interface-wsdl-1.1-cd06.xsd} | 2 +- .../src/main/resources/sca-jee-1.1-wd03.xsd | 2 +- ...-cd03-rev1.xsd => sca-policy-1.1-cd04.xsd} | 263 ++++----- ...a-policy-1.1-intents-definitions-cd04.xml} | 491 ++++++++--------- .../src/main/resources/tuscany-sca-1.1.xsd | 2 +- .../tuscany/sca/xsd/xml/XSDModelResolver.java | 22 +- .../main/resources/META-INF/definitions.xml | 4 +- 35 files changed, 1000 insertions(+), 1072 deletions(-) rename modules/{assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd03.xml => assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd04.xml} (97%) delete mode 100644 modules/assembly-xsd/src/main/resources/sca-1.1-cd05-rev1.xsd delete mode 100644 modules/assembly-xsd/src/main/resources/sca-1.1-cd05.xsd create mode 100644 modules/assembly-xsd/src/main/resources/sca-1.1-cd06.xsd rename modules/assembly-xsd/src/main/resources/{sca-binding-ejb-1.1-cd02-rev1.xsd => sca-binding-ejb-1.1-cd02-rev2.xsd} (94%) rename modules/assembly-xsd/src/main/resources/{sca-binding-jca-1.1-cd04-rev1.xsd => sca-binding-jca-1.1-cd04-rev2.xsd} (99%) rename modules/assembly-xsd/src/main/resources/{sca-binding-sca-1.1-cd05-rev1.xsd => sca-binding-sca-1.1-cd06.xsd} (92%) rename modules/assembly-xsd/src/main/resources/{sca-binding-ws-1.1-cd04-rev1.xsd => sca-binding-ws-1.1-cd04-rev2.xsd} (95%) rename modules/assembly-xsd/src/main/resources/{sca-binding-ws-callback-1.1-cd04.xsd => sca-binding-ws-callback-1.1-cd04-rev1.xsd} (98%) rename modules/assembly-xsd/src/main/resources/{sca-contribution-1.1-cd05-rev1.xsd => sca-contribution-1.1-cd06.xsd} (98%) rename modules/assembly-xsd/src/main/resources/{sca-contribution-c-1.1-cd05-rev1.xsd => sca-contribution-c-1.1-cd06.xsd} (91%) rename modules/assembly-xsd/src/main/resources/{sca-contribution-cpp-1.1-cd05-rev1.xsd => sca-contribution-cpp-1.1-cd06.xsd} (91%) rename modules/assembly-xsd/src/main/resources/{sca-contribution-java-1.1-cd02-rev1.xsd => sca-contribution-java-1.1-cd03.xsd} (93%) rename modules/assembly-xsd/src/main/resources/{sca-core-1.1-cd05-rev1.xsd => sca-core-1.1-cd06.xsd} (99%) rename modules/assembly-xsd/src/main/resources/{sca-definitions-1.1-cd05-rev1.xsd => sca-definitions-1.1-cd06.xsd} (90%) rename modules/assembly-xsd/src/main/resources/{sca-implementation-c-1.1-cd05-rev1.xsd => sca-implementation-c-1.1-cd06.xsd} (95%) rename modules/assembly-xsd/src/main/resources/{sca-implementation-composite-1.1-cd05-rev1.xsd => sca-implementation-composite-1.1-cd06.xsd} (94%) rename modules/assembly-xsd/src/main/resources/{sca-implementation-cpp-1.1-cd05-rev1.xsd => sca-implementation-cpp-1.1-cd06.xsd} (95%) rename modules/assembly-xsd/src/main/resources/{sca-implementation-java-1.1-cd02-rev1.xsd => sca-implementation-java-1.1-cd03.xsd} (93%) rename modules/assembly-xsd/src/main/resources/{sca-interface-c-1.1-cd05-rev1.xsd => sca-interface-c-1.1-cd06.xsd} (94%) delete mode 100644 modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd04.xsd rename modules/assembly-xsd/src/main/resources/{sca-interface-cpp-1.1-cd05-rev1.xsd => sca-interface-cpp-1.1-cd06.xsd} (94%) rename modules/assembly-xsd/src/main/resources/{sca-interface-java-1.1-cd04-rev1.xsd => sca-interface-java-1.1-cd05.xsd} (93%) rename modules/assembly-xsd/src/main/resources/{sca-interface-wsdl-1.1-cd05-rev1.xsd => sca-interface-wsdl-1.1-cd06.xsd} (94%) rename modules/assembly-xsd/src/main/resources/{sca-policy-1.1-cd03-rev1.xsd => sca-policy-1.1-cd04.xsd} (94%) rename modules/{assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd03.xml => assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd04.xml} (92%) diff --git a/modules/assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd03.xml b/modules/assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd04.xml similarity index 97% rename from modules/assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd03.xml rename to modules/assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd04.xml index 4505850072..0d6c5ac714 100644 --- a/modules/assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd03.xml +++ b/modules/assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd04.xml @@ -1,249 +1,249 @@ - - - - - - - - Communication through the binding requires that the - server is authenticated by the client - - - - - - - - Communication through the binding requires that the - client is authenticated by the server - - - - - - - - A convenience intent to help migration - - - - - - Communication through the binding requires that the - client and server to authenticate each other - - - - - - Communication through the binding prevents unauthorized - users from reading the messages - - - - - - - - Communication through the binding prevents tampering - with the messages sent between the client and the service. - - - - - - - - Ensures clients are authorized to use services. - - - - - - - - This intent is used to indicate that a message sent - by a client is always delivered to the component. - - - - - - This intent is used to indicate that a message that was - successfully sent by a client is not delivered more than - once to the component. - - - - - - This profile intent is used to indicate that a message sent - by a client is always delivered to the component. It also - indicates that duplicate messages are not delivered to the - component. - - - - - - This intent is used to indicate that all the messages are - delivered to the component in the order they were sent by - the client. - - - - - - - A managed transaction environment is necessary in order to - run the component. The specific type of managed transaction - needed is not constrained. - - - - For a component marked with managedTransaction.global - a global transaction needs to be present before dispatching - any method on the component - using any transaction - propagated from the client or else beginning and completing - a new transaction. - - - - - A component marked with managedTransaction.local needs to - run within a local transaction containment (LTC) that - is started and ended by the SCA runtime. - - - - - - - A component marked with noManagedTransaction needs to run without - a managed transaction, under neither a global transaction nor - an LTC. A transaction propagated to the hosting SCA runtime - is not joined by the hosting runtime on behalf of a - component marked with noManagedtransaction. - - - - - - For a reference marked as transactedOneWay any OneWay invocation - messages are transacted as part of a client global - transaction. - For a service marked as transactedOneWay any OneWay invocation - message are received from the transport binding in a - transacted fashion, under the service’s global transaction. - - - - - - For a reference indicates that any OneWay invocation messages - are sent immediately regardless of any client transaction. - For a service indicates that any OneWay invocation is - received immediately regardless of any target service - transaction. - - - - - - A service marked with propagatesTransaction is dispatched - under any propagated (client) transaction and the service binding - needs to be capable of receiving a transaction context. - A reference marked with propagatesTransaction propagates any - transaction context under which the client runs when the - reference is used for a request-response interaction and the - binding of a reference marked with propagatesTransaction needs to - be capable of propagating a transaction context. - - - - - - A service marked with suspendsTransaction is not dispatched - under any propagated (client) transaction. - A reference marked with suspendsTransaction does not propagate - any transaction context under which the client runs when the - reference is used. - - - - - - Used to indicate that the component requires both the - managedTransaction.global and the propagatesTransactions - intents - - - - - - - Indicates that request/response operations for the - interface of this wire are "long running" and must be - treated as two separate message transmissions - - - - - - Specifies that the EJB API is needed to communicate with - the service or reference. - - - - - - Specifies that the SOAP messaging model is used for delivering - messages. - - - - - - - - Requires that the messages are delivered and received via the - JMS API. - - - - - - This intent can only be used on a reference. Indicates that the - client is not able to handle new inbound connections. The binding - and callback binding are configured so that any - response or callback comes either through a back channel of the - connection from the client to the server or by having the client - poll the server for messages. - - - - + + + + + + + + Communication through the binding requires that the + server is authenticated by the client + + + + + + + + Communication through the binding requires that the + client is authenticated by the server + + + + + + + + A convenience intent to help migration + + + + + + Communication through the binding requires that the + client and server to authenticate each other + + + + + + Communication through the binding prevents unauthorized + users from reading the messages + + + + + + + + Communication through the binding prevents tampering + with the messages sent between the client and the service. + + + + + + + + Ensures clients are authorized to use services. + + + + + + + + This intent is used to indicate that a message sent + by a client is always delivered to the component. + + + + + + This intent is used to indicate that a message that was + successfully sent by a client is not delivered more than + once to the component. + + + + + + This profile intent is used to indicate that a message sent + by a client is always delivered to the component. It also + indicates that duplicate messages are not delivered to the + component. + + + + + + This intent is used to indicate that all the messages are + delivered to the component in the order they were sent by + the client. + + + + + + + A managed transaction environment is necessary in order to + run the component. The specific type of managed transaction + needed is not constrained. + + + + For a component marked with managedTransaction.global + a global transaction needs to be present before dispatching + any method on the component - using any transaction + propagated from the client or else beginning and completing + a new transaction. + + + + + A component marked with managedTransaction.local needs to + run within a local transaction containment (LTC) that + is started and ended by the SCA runtime. + + + + + + + A component marked with noManagedTransaction needs to run without + a managed transaction, under neither a global transaction nor + an LTC. A transaction propagated to the hosting SCA runtime + is not joined by the hosting runtime on behalf of a + component marked with noManagedtransaction. + + + + + + For a reference marked as transactedOneWay any OneWay invocation + messages are transacted as part of a client global + transaction. + For a service marked as transactedOneWay any OneWay invocation + message are received from the transport binding in a + transacted fashion, under the service’s global transaction. + + + + + + For a reference indicates that any OneWay invocation messages + are sent immediately regardless of any client transaction. + For a service indicates that any OneWay invocation is + received immediately regardless of any target service + transaction. + + + + + + A service marked with propagatesTransaction is dispatched + under any propagated (client) transaction and the service binding + needs to be capable of receiving a transaction context. + A reference marked with propagatesTransaction propagates any + transaction context under which the client runs when the + reference is used for a request-response interaction and the + binding of a reference marked with propagatesTransaction needs to + be capable of propagating a transaction context. + + + + + + A service marked with suspendsTransaction is not dispatched + under any propagated (client) transaction. + A reference marked with suspendsTransaction does not propagate + any transaction context under which the client runs when the + reference is used. + + + + + + Used to indicate that the component requires both the + managedTransaction.global and the propagatesTransactions + intents + + + + + + + Indicates that request/response operations for the + interface of this wire are "long running" and must be + treated as two separate message transmissions + + + + + + Specifies that the EJB API is needed to communicate with + the service or reference. + + + + + + Specifies that the SOAP messaging model is used for delivering + messages. + + + + + + + + Requires that the messages are delivered and received via the + JMS API. + + + + + + This intent can only be used on a reference. Indicates that the + client is not able to handle new inbound connections. The binding + and callback binding are configured so that any + response or callback comes either through a back channel of the + connection from the client to the server or by having the client + poll the server for messages. + + + + \ No newline at end of file diff --git a/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions index 381c0ba23b..7e75c402e3 100644 --- a/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions +++ b/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions @@ -14,4 +14,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -META-INF/sca-policy-1.1-intents-definitions-cd03.xml +META-INF/sca-policy-1.1-intents-definitions-cd04.xml diff --git a/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java b/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java index d782b20a4f..6a42cdbd2e 100644 --- a/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java +++ b/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java @@ -108,7 +108,7 @@ public interface Constants { static class XSDCache { static Map cache() { Map cachedXSDs = new HashMap(); - cachedXSDs.put(Constants.SCA11_NS, Constants.class.getResource("/sca-1.1-cd05.xsd")); + cachedXSDs.put(Constants.SCA11_NS, Constants.class.getResource("/sca-1.1-cd06.xsd")); cachedXSDs .put("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", Constants.class diff --git a/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema index ba25c9908a..863d161954 100644 --- a/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema +++ b/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema @@ -16,4 +16,4 @@ # under the License. # tuscany-sca-1.1.xsd -sca-1.1-cd05-rev1.xsd +sca-1.1-cd06.xsd diff --git a/modules/assembly-xsd/src/main/resources/sca-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-1.1-cd05-rev1.xsd deleted file mode 100644 index d85a905c3e..0000000000 --- a/modules/assembly-xsd/src/main/resources/sca-1.1-cd05-rev1.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/assembly-xsd/src/main/resources/sca-1.1-cd05.xsd b/modules/assembly-xsd/src/main/resources/sca-1.1-cd05.xsd deleted file mode 100644 index 5f3c796810..0000000000 --- a/modules/assembly-xsd/src/main/resources/sca-1.1-cd05.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/assembly-xsd/src/main/resources/sca-1.1-cd06.xsd b/modules/assembly-xsd/src/main/resources/sca-1.1-cd06.xsd new file mode 100644 index 0000000000..b6be5df43b --- /dev/null +++ b/modules/assembly-xsd/src/main/resources/sca-1.1-cd06.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/assembly-xsd/src/main/resources/sca-binding-ejb-1.1-cd02-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-binding-ejb-1.1-cd02-rev2.xsd similarity index 94% rename from modules/assembly-xsd/src/main/resources/sca-binding-ejb-1.1-cd02-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-binding-ejb-1.1-cd02-rev2.xsd index 0ac63d4a86..0b388fcf17 100644 --- a/modules/assembly-xsd/src/main/resources/sca-binding-ejb-1.1-cd02-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-binding-ejb-1.1-cd02-rev2.xsd @@ -6,7 +6,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + diff --git a/modules/assembly-xsd/src/main/resources/sca-binding-jca-1.1-cd04-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-binding-jca-1.1-cd04-rev2.xsd similarity index 99% rename from modules/assembly-xsd/src/main/resources/sca-binding-jca-1.1-cd04-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-binding-jca-1.1-cd04-rev2.xsd index 789918f41e..75446411db 100644 --- a/modules/assembly-xsd/src/main/resources/sca-binding-jca-1.1-cd04-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-binding-jca-1.1-cd04-rev2.xsd @@ -5,7 +5,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + diff --git a/modules/assembly-xsd/src/main/resources/sca-binding-sca-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-binding-sca-1.1-cd06.xsd similarity index 92% rename from modules/assembly-xsd/src/main/resources/sca-binding-sca-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-binding-sca-1.1-cd06.xsd index 6cdbf1656e..9cc22601b3 100644 --- a/modules/assembly-xsd/src/main/resources/sca-binding-sca-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-binding-sca-1.1-cd06.xsd @@ -6,7 +6,7 @@ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + - + diff --git a/modules/assembly-xsd/src/main/resources/sca-binding-ws-callback-1.1-cd04.xsd b/modules/assembly-xsd/src/main/resources/sca-binding-ws-callback-1.1-cd04-rev1.xsd similarity index 98% rename from modules/assembly-xsd/src/main/resources/sca-binding-ws-callback-1.1-cd04.xsd rename to modules/assembly-xsd/src/main/resources/sca-binding-ws-callback-1.1-cd04-rev1.xsd index 72d84b31ff..7d5482e9f0 100644 --- a/modules/assembly-xsd/src/main/resources/sca-binding-ws-callback-1.1-cd04.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-binding-ws-callback-1.1-cd04-rev1.xsd @@ -13,7 +13,6 @@ maxOccurs="unbounded"/> - diff --git a/modules/assembly-xsd/src/main/resources/sca-contribution-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-contribution-1.1-cd06.xsd similarity index 98% rename from modules/assembly-xsd/src/main/resources/sca-contribution-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-contribution-1.1-cd06.xsd index 346bfe485e..a3dea7eab4 100644 --- a/modules/assembly-xsd/src/main/resources/sca-contribution-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-contribution-1.1-cd06.xsd @@ -6,7 +6,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + diff --git a/modules/assembly-xsd/src/main/resources/sca-contribution-c-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-contribution-c-1.1-cd06.xsd similarity index 91% rename from modules/assembly-xsd/src/main/resources/sca-contribution-c-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-contribution-c-1.1-cd06.xsd index 9e29607c5d..2a0feadac9 100644 --- a/modules/assembly-xsd/src/main/resources/sca-contribution-c-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-contribution-c-1.1-cd06.xsd @@ -1,35 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/assembly-xsd/src/main/resources/sca-contribution-cpp-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-contribution-cpp-1.1-cd06.xsd similarity index 91% rename from modules/assembly-xsd/src/main/resources/sca-contribution-cpp-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-contribution-cpp-1.1-cd06.xsd index 94813bf6ac..a5201661c1 100644 --- a/modules/assembly-xsd/src/main/resources/sca-contribution-cpp-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-contribution-cpp-1.1-cd06.xsd @@ -1,35 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/assembly-xsd/src/main/resources/sca-contribution-java-1.1-cd02-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-contribution-java-1.1-cd03.xsd similarity index 93% rename from modules/assembly-xsd/src/main/resources/sca-contribution-java-1.1-cd02-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-contribution-java-1.1-cd03.xsd index 92642591cd..89b90965a4 100644 --- a/modules/assembly-xsd/src/main/resources/sca-contribution-java-1.1-cd02-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-contribution-java-1.1-cd03.xsd @@ -6,7 +6,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + - + \ No newline at end of file diff --git a/modules/assembly-xsd/src/main/resources/sca-core-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-core-1.1-cd06.xsd similarity index 99% rename from modules/assembly-xsd/src/main/resources/sca-core-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-core-1.1-cd06.xsd index 541a5c324c..668e3b1ce3 100644 --- a/modules/assembly-xsd/src/main/resources/sca-core-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-core-1.1-cd06.xsd @@ -6,7 +6,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + diff --git a/modules/assembly-xsd/src/main/resources/sca-definitions-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-definitions-1.1-cd06.xsd similarity index 90% rename from modules/assembly-xsd/src/main/resources/sca-definitions-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-definitions-1.1-cd06.xsd index fcd3cc0f8d..4781421138 100644 --- a/modules/assembly-xsd/src/main/resources/sca-definitions-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-definitions-1.1-cd06.xsd @@ -6,8 +6,8 @@ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - - + + diff --git a/modules/assembly-xsd/src/main/resources/sca-implementation-bpel-1.1-cd03.xsd b/modules/assembly-xsd/src/main/resources/sca-implementation-bpel-1.1-cd03.xsd index 967dadf395..ad5daf8224 100644 --- a/modules/assembly-xsd/src/main/resources/sca-implementation-bpel-1.1-cd03.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-implementation-bpel-1.1-cd03.xsd @@ -1,5 +1,5 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/assembly-xsd/src/main/resources/sca-implementation-composite-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-implementation-composite-1.1-cd06.xsd similarity index 94% rename from modules/assembly-xsd/src/main/resources/sca-implementation-composite-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-implementation-composite-1.1-cd06.xsd index 5ca0e598de..77ef5f3b0c 100644 --- a/modules/assembly-xsd/src/main/resources/sca-implementation-composite-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-implementation-composite-1.1-cd06.xsd @@ -6,7 +6,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/assembly-xsd/src/main/resources/sca-implementation-java-1.1-cd02-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-implementation-java-1.1-cd03.xsd similarity index 93% rename from modules/assembly-xsd/src/main/resources/sca-implementation-java-1.1-cd02-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-implementation-java-1.1-cd03.xsd index 90fe13c015..4fbbff25e2 100644 --- a/modules/assembly-xsd/src/main/resources/sca-implementation-java-1.1-cd02-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-implementation-java-1.1-cd03.xsd @@ -6,7 +6,7 @@ targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + - - + diff --git a/modules/assembly-xsd/src/main/resources/sca-interface-c-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-interface-c-1.1-cd06.xsd similarity index 94% rename from modules/assembly-xsd/src/main/resources/sca-interface-c-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-interface-c-1.1-cd06.xsd index 0dca94a6d5..33abeb456a 100644 --- a/modules/assembly-xsd/src/main/resources/sca-interface-c-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-interface-c-1.1-cd06.xsd @@ -1,51 +1,51 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd04.xsd b/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd04.xsd deleted file mode 100644 index b07bf01f1d..0000000000 --- a/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd04.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd06.xsd similarity index 94% rename from modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd06.xsd index 0dee25b649..e4881e5bb4 100644 --- a/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-interface-cpp-1.1-cd06.xsd @@ -1,51 +1,51 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/assembly-xsd/src/main/resources/sca-interface-java-1.1-cd04-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-interface-java-1.1-cd05.xsd similarity index 93% rename from modules/assembly-xsd/src/main/resources/sca-interface-java-1.1-cd04-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-interface-java-1.1-cd05.xsd index 7dcf79a797..a505ddd3fc 100644 --- a/modules/assembly-xsd/src/main/resources/sca-interface-java-1.1-cd04-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-interface-java-1.1-cd05.xsd @@ -6,7 +6,7 @@ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + - + \ No newline at end of file diff --git a/modules/assembly-xsd/src/main/resources/sca-interface-wsdl-1.1-cd05-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-interface-wsdl-1.1-cd06.xsd similarity index 94% rename from modules/assembly-xsd/src/main/resources/sca-interface-wsdl-1.1-cd05-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-interface-wsdl-1.1-cd06.xsd index 532c0a6bd0..6db2ca7d22 100644 --- a/modules/assembly-xsd/src/main/resources/sca-interface-wsdl-1.1-cd05-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-interface-wsdl-1.1-cd06.xsd @@ -6,7 +6,7 @@ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" elementFormDefault="qualified"> - + - + diff --git a/modules/assembly-xsd/src/main/resources/sca-policy-1.1-cd03-rev1.xsd b/modules/assembly-xsd/src/main/resources/sca-policy-1.1-cd04.xsd similarity index 94% rename from modules/assembly-xsd/src/main/resources/sca-policy-1.1-cd03-rev1.xsd rename to modules/assembly-xsd/src/main/resources/sca-policy-1.1-cd04.xsd index 8de738cf73..adc66487fe 100644 --- a/modules/assembly-xsd/src/main/resources/sca-policy-1.1-cd03-rev1.xsd +++ b/modules/assembly-xsd/src/main/resources/sca-policy-1.1-cd04.xsd @@ -1,131 +1,134 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd03.xml b/modules/assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd04.xml similarity index 92% rename from modules/assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd03.xml rename to modules/assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd04.xml index 58770f71a0..0d6c5ac714 100644 --- a/modules/assembly-xml/src/main/resources/META-INF/sca-policy-1.1-intents-definitions-cd03.xml +++ b/modules/assembly-xsd/src/main/resources/sca-policy-1.1-intents-definitions-cd04.xml @@ -1,242 +1,249 @@ - - - - - - - - Communication through the binding requires that the - server is authenticated by the client - - - - - - - - Communication through the binding requires that the - client is authenticated by the server - - - - - - - - A convenience intent to help migration - - - - - - Communication through the binding requires that the - client and server to authenticate each other - - - - - - Communication through the binding prevents unauthorized - users from reading the messages - - - - - - - - Communication through the binding prevents tampering - with the messages sent between the client and the service. - - - - - - - - Ensures clients are authorized to use services. - - - - - - - - - This intent is used to indicate that a message sent - by a client is always delivered to the component. - - - - - - This intent is used to indicate that a message that was - successfully sent by a client is not delivered more than - once to the component. - - - - - - This profile intent is used to indicate that a message sent - by a client is always delivered to the component. It also - indicates that duplicate messages are not delivered to the - component. - - - - - - This intent is used to indicate that all the messages are - delivered to the component in the order they were sent by - the client. - - - - - - - A managed transaction environment is necessary in order to - run the component. The specific type of managed transaction - needed is not constrained. - - - - For a component marked with managedTransaction.global - a global transaction needs to be present before dispatching - any method on the component - using any transaction - propagated from the client or else beginning and completing - a new transaction. - - - - - A component marked with managedTransaction.local needs to - run within a local transaction containment (LTC) that - is started and ended by the SCA runtime. - - - - - - - A component marked with noManagedTransaction needs to run without - a managed transaction, under neither a global transaction nor - an LTC. A transaction propagated to the hosting SCA runtime - is not joined by the hosting runtime on behalf of a - component marked with noManagedtransaction. - - - - - - For a reference marked as transactedOneWay any OneWay invocation - messages are transacted as part of a client global - transaction. - For a service marked as transactedOneWay any OneWay invocation - message are received from the transport binding in a - transacted fashion, under the service’s global transaction. - - - - - - For a reference indicates that any OneWay invocation messages - are sent immediately regardless of any client transaction. - For a service indicates that any OneWay invocation is - received immediately regardless of any target service - transaction. - - - - - - A service marked with propagatesTransaction is dispatched - under any propagated (client) transaction and the service binding - needs to be capable of receiving a transaction context. - A reference marked with propagatesTransaction propagates any - transaction context under which the client runs when the - reference is used for a request-response interaction and the - binding of a reference marked with propagatesTransaction needs to - be capable of propagating a transaction context. - - - - - - A service marked with suspendsTransaction is not dispatched - under any propagated (client) transaction. - A reference marked with suspendsTransaction does not propagate - any transaction context under which the client runs when the - reference is used. - - - - - - Used to indicate that the component requires both the - managedTransaction.global and the propagatesTransactions - intents - - - - - - - Indicates that request/response operations for the - interface of this wire are "long running" and must be - treated as two separate message transmissions - - - - - - Specifies that the SOAP messaging model is used for delivering - messages. - - - - - - - - Requires that the messages are delivered and received via the - JMS API. - - - - - - This intent can only be used on a reference. Indicates that the - client is not able to handle new inbound connections. The binding - and callback binding are configured so that any - response or callback comes either through a back channel of the - connection from the client to the server or by having the client - poll the server for messages. - - - - + + + + + + + + Communication through the binding requires that the + server is authenticated by the client + + + + + + + + Communication through the binding requires that the + client is authenticated by the server + + + + + + + + A convenience intent to help migration + + + + + + Communication through the binding requires that the + client and server to authenticate each other + + + + + + Communication through the binding prevents unauthorized + users from reading the messages + + + + + + + + Communication through the binding prevents tampering + with the messages sent between the client and the service. + + + + + + + + Ensures clients are authorized to use services. + + + + + + + + This intent is used to indicate that a message sent + by a client is always delivered to the component. + + + + + + This intent is used to indicate that a message that was + successfully sent by a client is not delivered more than + once to the component. + + + + + + This profile intent is used to indicate that a message sent + by a client is always delivered to the component. It also + indicates that duplicate messages are not delivered to the + component. + + + + + + This intent is used to indicate that all the messages are + delivered to the component in the order they were sent by + the client. + + + + + + + A managed transaction environment is necessary in order to + run the component. The specific type of managed transaction + needed is not constrained. + + + + For a component marked with managedTransaction.global + a global transaction needs to be present before dispatching + any method on the component - using any transaction + propagated from the client or else beginning and completing + a new transaction. + + + + + A component marked with managedTransaction.local needs to + run within a local transaction containment (LTC) that + is started and ended by the SCA runtime. + + + + + + + A component marked with noManagedTransaction needs to run without + a managed transaction, under neither a global transaction nor + an LTC. A transaction propagated to the hosting SCA runtime + is not joined by the hosting runtime on behalf of a + component marked with noManagedtransaction. + + + + + + For a reference marked as transactedOneWay any OneWay invocation + messages are transacted as part of a client global + transaction. + For a service marked as transactedOneWay any OneWay invocation + message are received from the transport binding in a + transacted fashion, under the service’s global transaction. + + + + + + For a reference indicates that any OneWay invocation messages + are sent immediately regardless of any client transaction. + For a service indicates that any OneWay invocation is + received immediately regardless of any target service + transaction. + + + + + + A service marked with propagatesTransaction is dispatched + under any propagated (client) transaction and the service binding + needs to be capable of receiving a transaction context. + A reference marked with propagatesTransaction propagates any + transaction context under which the client runs when the + reference is used for a request-response interaction and the + binding of a reference marked with propagatesTransaction needs to + be capable of propagating a transaction context. + + + + + + A service marked with suspendsTransaction is not dispatched + under any propagated (client) transaction. + A reference marked with suspendsTransaction does not propagate + any transaction context under which the client runs when the + reference is used. + + + + + + Used to indicate that the component requires both the + managedTransaction.global and the propagatesTransactions + intents + + + + + + + Indicates that request/response operations for the + interface of this wire are "long running" and must be + treated as two separate message transmissions + + + + + + Specifies that the EJB API is needed to communicate with + the service or reference. + + + + + + Specifies that the SOAP messaging model is used for delivering + messages. + + + + + + + + Requires that the messages are delivered and received via the + JMS API. + + + + + + This intent can only be used on a reference. Indicates that the + client is not able to handle new inbound connections. The binding + and callback binding are configured so that any + response or callback comes either through a back channel of the + connection from the client to the server or by having the client + poll the server for messages. + + + + \ No newline at end of file diff --git a/modules/assembly-xsd/src/main/resources/tuscany-sca-1.1.xsd b/modules/assembly-xsd/src/main/resources/tuscany-sca-1.1.xsd index 0259a17abb..115c789225 100644 --- a/modules/assembly-xsd/src/main/resources/tuscany-sca-1.1.xsd +++ b/modules/assembly-xsd/src/main/resources/tuscany-sca-1.1.xsd @@ -23,7 +23,7 @@ - + diff --git a/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java b/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java index d87f1a3ef1..80bdeb1a41 100644 --- a/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java +++ b/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java @@ -24,7 +24,6 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -366,13 +365,20 @@ public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace, return new InputSource(schemaLocation); } } else { - // look to see whether Tuscany has a local version of the - // required schema. It can load the local version rather - // than going out to the network in order to improve performance - url = Constants.CACHED_XSDS.get(targetNamespace); - - if (url == null) { - url = new URL(new URL(baseUri), schemaLocation); + url = new URL(new URL(baseUri), schemaLocation); + String scheme = url.getProtocol(); + if ("file".equalsIgnoreCase(scheme) || "jar".equalsIgnoreCase(scheme) + || "zip".equalsIgnoreCase(scheme) + || "wsjar".equalsIgnoreCase(scheme)) { + // For local URLs, use as-is + } else { + // look to see whether Tuscany has a local version of the + // required schema. It can load the local version rather + // than going out to the network in order to improve performance + URL cached = Constants.CACHED_XSDS.get(targetNamespace); + if (cached != null) { + url = cached; + } } } return XMLDocumentHelper.getInputSource(url); diff --git a/testing/itest/policies/src/main/resources/META-INF/definitions.xml b/testing/itest/policies/src/main/resources/META-INF/definitions.xml index d607832554..38ee71d76a 100644 --- a/testing/itest/policies/src/main/resources/META-INF/definitions.xml +++ b/testing/itest/policies/src/main/resources/META-INF/definitions.xml @@ -51,9 +51,9 @@ attachTo="IntentRefs('sca:suspendsTransaction')"/> + attachTo="IntentRefs('sca:authorization')"/> Date: Wed, 8 Dec 2010 23:46:33 +0000 Subject: [PATCH 065/174] Make http client dependency optional git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043781 13f79535-47bb-0310-9956-ffa450edef68 --- distribution/all/src/main/release/bin/LICENSE | 3 +-- modules/binding-atom-runtime/pom.xml | 20 +++++++++++------ modules/binding-jsonrpc-runtime/pom.xml | 6 +++++ modules/host-http/META-INF/MANIFEST.MF | 22 +++++++++---------- modules/host-http/pom.xml | 3 +++ 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/distribution/all/src/main/release/bin/LICENSE b/distribution/all/src/main/release/bin/LICENSE index a9cd8cee9d..055bd32ed5 100644 --- a/distribution/all/src/main/release/bin/LICENSE +++ b/distribution/all/src/main/release/bin/LICENSE @@ -215,7 +215,7 @@ conditions of the following licenses. The following components come under Apache Software License 2.0 - abdera-client-1.1.1jar + abdera-client-1.1.1.jar abdera-core-1.1.1.jar abdera-extensions-html-1.1.1.jar abdera-extensions-json-1.1.1.jar @@ -250,7 +250,6 @@ The following components come under Apache Software License 2.0 commons-discovery-0.4.jar commons-fileupload-1.2.jar commons-httpclient-3.1.jar - commons-io-1.4.jar commons-lang-2.3.jar commons-logging-1.1.1.jar commons-pool-1.3.jar diff --git a/modules/binding-atom-runtime/pom.xml b/modules/binding-atom-runtime/pom.xml index 373d55c3ce..cc59f117ff 100644 --- a/modules/binding-atom-runtime/pom.xml +++ b/modules/binding-atom-runtime/pom.xml @@ -83,7 +83,19 @@ tuscany-host-http 2.0-SNAPSHOT + + + org.apache.httpcomponents + httpclient + 4.0.3 + + + org.apache.httpcomponents + httpcore + 4.0.1 + + javax.servlet servlet-api @@ -151,13 +163,7 @@ commons-codec commons-codec - 1.3 - - - commons-codec - commons-codec - - + 1.4 diff --git a/modules/binding-jsonrpc-runtime/pom.xml b/modules/binding-jsonrpc-runtime/pom.xml index 3a5c43cccb..b585c3b0b8 100644 --- a/modules/binding-jsonrpc-runtime/pom.xml +++ b/modules/binding-jsonrpc-runtime/pom.xml @@ -71,6 +71,12 @@ httpclient 4.0.3 + + + org.apache.httpcomponents + httpcore + 4.0.1 + org.apache.tuscany.sca diff --git a/modules/host-http/META-INF/MANIFEST.MF b/modules/host-http/META-INF/MANIFEST.MF index 3ab8b6de73..2077368e95 100644 --- a/modules/host-http/META-INF/MANIFEST.MF +++ b/modules/host-http/META-INF/MANIFEST.MF @@ -15,19 +15,19 @@ Bundle-Description: Apache Tuscany SCA HTTP Servlet Host Extension Poi nt Import-Package: javax.servlet, javax.servlet.http, + org.apache.http;resolution:=optional, + org.apache.http.client;resolution:=optional, + org.apache.http.conn;resolution:=optional, + org.apache.http.conn.params;resolution:=optional, + org.apache.http.conn.scheme;resolution:=optional, + org.apache.http.conn.ssl;resolution:=optional, + org.apache.http.impl.client;resolution:=optional, + org.apache.http.impl.conn.tsccm;resolution:=optional, + org.apache.http.params;resolution:=optional, + org.apache.http.protocol;resolution:=optional, org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", - org.apache.tuscany.sca.host.http;version="2.0.0", - org.apache.http, - org.apache.http.client, - org.apache.http.conn, - org.apache.http.conn.params, - org.apache.http.conn.scheme, - org.apache.http.conn.ssl, - org.apache.http.impl.client, - org.apache.http.impl.conn.tsccm, - org.apache.http.params, - org.apache.http.protocol + org.apache.tuscany.sca.host.http;version="2.0.0" Bundle-SymbolicName: org.apache.tuscany.sca.host.http Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/modules/host-http/pom.xml b/modules/host-http/pom.xml index 0204cad136..6fb8bc4c9a 100644 --- a/modules/host-http/pom.xml +++ b/modules/host-http/pom.xml @@ -42,16 +42,19 @@ provided + org.apache.httpcomponents httpclient 4.0.3 + true org.apache.httpcomponents httpcore 4.0.1 + true From 7fbd6e8925ecb527215a2d888c52019135ddaff6 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Thu, 9 Dec 2010 10:09:49 +0000 Subject: [PATCH 066/174] Update to use NodeFactory.getInstance() instead of newInstance to see if that fixes the port conflict some are seeing git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043881 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/java/itest/helloworld/UnknownEndpointTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java index d6c56d6dc3..f35a71b30e 100644 --- a/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java +++ b/testing/itest/scabindingmapper/src/test/java/itest/helloworld/UnknownEndpointTestCase.java @@ -37,9 +37,9 @@ public class UnknownEndpointTestCase { @Test public void testUnknownEndpoints() throws IOException, InterruptedException { - servicesnode = NodeFactory.newInstance().createNode("services.composite", new String[]{"target/test-classes"}) ; + servicesnode = NodeFactory.getInstance().createNode("services.composite", new String[]{"target/test-classes"}) ; servicesnode.start(); - node = NodeFactory.newInstance().createNode("clients.composite", new String[]{"target/test-classes"}) ; + node = NodeFactory.getInstance().createNode("clients.composite", new String[]{"target/test-classes"}) ; node.start(); // test the service invocations work From 280d6d674212af9008b2153c3ac3cbc5c1ba3544 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Thu, 9 Dec 2010 10:26:39 +0000 Subject: [PATCH 067/174] Exclude the recently added tests that we haven't brought up in tuscany yet git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043886 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/java-caa/pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/compliance-tests/java-caa/pom.xml b/testing/compliance-tests/java-caa/pom.xml index 6b6bb6fcb7..e76a9a9d69 100644 --- a/testing/compliance-tests/java-caa/pom.xml +++ b/testing/compliance-tests/java-caa/pom.xml @@ -79,6 +79,15 @@ -Xms256m -Xmx1024m **/JCA_11021_TestCase.java + + **/JCA_10029_TestCase.java + **/JCA_10030_TestCase.java + **/JCA_10031_TestCase.java + **/JCA_10032_TestCase.java + **/JCA_10033_TestCase.java + **/JCA_10034_TestCase.java + **/JCA_10035_TestCase.java + **/JCA_11022_TestCase.java From 7b4dbde17fd73d363432d214f7f9f05ca852918d Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 9 Dec 2010 11:56:11 +0000 Subject: [PATCH 068/174] TUSCANY-3801 - Make the async invoker creation signature more consistent with the invoke creation signature git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043910 13f79535-47bb-0310-9956-ffa450edef68 --- .../provider/ImplementationAsyncProvider.java | 3 +-- .../assembly/impl/RuntimeEndpointImpl.java | 2 +- .../sca/core/invocation/RuntimeInvoker.java | 20 +++++++++++++++---- .../sampleasync/impl/SampleAsyncProvider.java | 9 +++------ .../sampleasync/impl/SampleWSDLInvoker.java | 4 +--- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java index 1ddf015568..2941483ede 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationAsyncProvider.java @@ -45,13 +45,12 @@ public interface ImplementationAsyncProvider extends ImplementationProvider { * createInvoker is that the Endpoint is passed in so that the invoker can * engineer the async response * - * @param endpoint the endoint at the head of this invocation chain * @param service The component service * @param operation The operation that the interceptor will handle * @return An invoker that handles the invocation logic, null should be * returned if no invoker is required */ - InvokerAsyncRequest createAsyncInvoker(Endpoint endpoint, RuntimeComponentService service, Operation operation); + InvokerAsyncRequest createAsyncInvoker(RuntimeComponentService service, Operation operation); /** * TUSCANY-3801 diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index e353af92e2..f4408429df 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -713,7 +713,7 @@ private void addImplementationInterceptor(Component component, } } else if (isAsyncInvocation() && provider instanceof ImplementationAsyncProvider){ - invoker = (Invoker)((ImplementationAsyncProvider)provider).createAsyncInvoker(this, (RuntimeComponentService)service, operation); + invoker = (Invoker)((ImplementationAsyncProvider)provider).createAsyncInvoker((RuntimeComponentService)service, operation); } else { invoker = provider.createInvoker((RuntimeComponentService)service, operation); } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index 4b2e72ac6b..f894290b3e 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -39,6 +39,7 @@ import org.apache.tuscany.sca.runtime.Invocable; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.work.WorkScheduler; +import org.oasisopen.sca.ServiceRuntimeException; /** * Invoker for a endpoint or endpoint reference @@ -120,14 +121,23 @@ public Message invoke(InvocationChain chain, Message msg) { */ public void invokeAsync(Message msg) { if (invocable instanceof Endpoint) { - msg.setTo((Endpoint)invocable); + Endpoint ep = (Endpoint)invocable; + msg.setTo(ep); + if (!ep.isAsyncInvocation()){ + throw new ServiceRuntimeException("Calling invokeAsync on a non-async endpoint - " + + ep); + } } else if (invocable instanceof EndpointReference) { RuntimeEndpointReference epr = (RuntimeEndpointReference)invocable; + if (!epr.isAsyncInvocation()){ + throw new ServiceRuntimeException("Calling invokeAsync on a non-async endpoint reference - " + + epr); + } if (epr.isOutOfDate()) { epr.rebuild(); } - msg.setFrom((EndpointReference)invocable); - msg.setTo(((EndpointReference)invocable).getTargetEndpoint()); + msg.setFrom(epr); + msg.setTo(epr.getTargetEndpoint()); } Operation operation = msg.getOperation(); @@ -153,8 +163,10 @@ public void invokeAsync(Message msg) { // temporary fix to swallow the dummy exception that's // thrown back to get past the response chain processing. if (!(ex instanceof AsyncResponseException)){ - // TODO send the exception in through the + // send the exception in through the // async response processing path + msg.setFaultBody(ex); + invokeAsyncResponse(msg); } } } finally { diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java index 8387285e3d..10eb78f6c8 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.interfacedef.Interface; @@ -88,17 +87,15 @@ public boolean supportsOneWayInvocation() { } public Invoker createInvoker(final RuntimeComponentService s, final Operation op) { - // TODO - we're passing EP into the WSDL invoker so this isn't going to work - // properly for sync calls - return (Invoker)createAsyncInvoker(null, s, op); + return (Invoker)createAsyncInvoker(s, op); } - public InvokerAsyncRequest createAsyncInvoker(Endpoint endpoint, final RuntimeComponentService s, final Operation op) { + public InvokerAsyncRequest createAsyncInvoker(final RuntimeComponentService s, final Operation op) { try { // Creating an invoker for a Java or WSDL-typed implementation if(op instanceof JavaOperation) return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance); - return new SampleWSDLInvoker(endpoint, (WSDLOperation)op, impl.clazz, instance); + return new SampleWSDLInvoker((WSDLOperation)op, impl.clazz, instance); } catch(Exception e) { throw new RuntimeException(e); } diff --git a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java index b0d9c07d86..26412ab281 100644 --- a/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ b/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java @@ -36,13 +36,11 @@ * @version $Rev$ $Date$ */ class SampleWSDLInvoker extends InterceptorAsyncImpl { - final Endpoint endpoint; final String name; final Object instance; final Method method; - SampleWSDLInvoker(Endpoint endpoint, final WSDLOperation op, final Class clazz, final Object instance) throws SecurityException, NoSuchMethodException { - this.endpoint = endpoint; + SampleWSDLInvoker(final WSDLOperation op, final Class clazz, final Object instance) throws SecurityException, NoSuchMethodException { this.name = op.getName(); this.instance = instance; this.method = clazz.getMethod("call", String.class, Element.class); From d2072bf964402e0acb916f509714deae16f66a5e Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 9 Dec 2010 11:58:51 +0000 Subject: [PATCH 069/174] TUSCANY-3801 - Start adding an async dimension to the implementation extension sample git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043914 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation-sample/pom.xml | 3 +- .../main/java/sample/api/WSDLReference.java | 3 +- .../impl/SampleAsyncResponseInvoker.java | 66 +++++++++++++++++ .../main/java/sample/impl/SampleProvider.java | 29 +++++++- .../sample/impl/SampleProviderFactory.java | 4 +- .../java/sample/impl/SampleWSDLInvoker.java | 35 ++++++++- .../java/sample/impl/SampleWSDLProxy.java | 41 ++++++++++- .../sample/UpperSampleAsyncReferenceImpl.java | 73 +++++++++++++++++++ .../sample/UpperSampleAsyncServiceImpl.java | 45 ++++++++++++ .../impl/SampleNativeAsyncTestCase.java | 63 ++++++++++++++++ .../src/test/resources/Upper-async.wsdl | 65 +++++++++++++++++ .../test/resources/testnativeasync.composite | 34 +++++++++ 12 files changed, 451 insertions(+), 10 deletions(-) create mode 100644 samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java create mode 100644 samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java create mode 100644 samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java create mode 100644 samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java create mode 100644 samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl create mode 100644 samples/extending-tuscany/implementation-sample/src/test/resources/testnativeasync.composite diff --git a/samples/extending-tuscany/implementation-sample/pom.xml b/samples/extending-tuscany/implementation-sample/pom.xml index 7ec143e4ed..7435c8dba0 100644 --- a/samples/extending-tuscany/implementation-sample/pom.xml +++ b/samples/extending-tuscany/implementation-sample/pom.xml @@ -32,7 +32,8 @@ org.apache.tuscany.sca - tuscany-base-runtime + tuscany-base-runtime-pom + pom 2.0-SNAPSHOT diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/api/WSDLReference.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/api/WSDLReference.java index cad8478a2a..bc0d5cc5d8 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/api/WSDLReference.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/api/WSDLReference.java @@ -24,5 +24,6 @@ public interface WSDLReference { Element call(String op, Element e); - + void callAsync(String op, Element e); + } diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java new file mode 100644 index 0000000000..2366deeb33 --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +package sample.impl; + +import java.lang.reflect.Method; +import java.util.Map; + +import org.apache.tuscany.sca.core.invocation.Constants; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; +import org.apache.tuscany.sca.invocation.Message; +import org.w3c.dom.Element; + +/** + * Invoker for Sample components that implement a WSDL interface using a generic + * call method. + * + * @version $Rev$ $Date$ + */ +class SampleAsyncResponseInvoker implements InvokerAsyncResponse { + final String name; + final Object instance; + final Operation op; + Map asyncMessageMap; + + SampleAsyncResponseInvoker(Map asyncMessageMap, final Operation op, final Class clazz, final Object instance) { + this.asyncMessageMap = asyncMessageMap; + this.name = op.getName(); + this.instance = instance; + this.op = op; + } + + public void invokeAsyncResponse(final Message msg) { + try { + String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); + String forwardOpName = (String)asyncMessageMap.get(messageID); + + // process the async response + //Object response = ((Object[])msg.getBody())[0]; + Object response = msg.getBody(); + + Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); + method.invoke(instance, response); + } catch(Exception e) { + e.printStackTrace(); + // TODO - need to throw this to somewhere? + } + } +} diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProvider.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProvider.java index 5d946b037b..a7e68cfee6 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProvider.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProvider.java @@ -20,8 +20,11 @@ package sample.impl; import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; @@ -29,7 +32,9 @@ import org.apache.tuscany.sca.interfacedef.java.JavaOperation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; +import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -38,16 +43,19 @@ * * @version $Rev$ $Date$ */ -class SampleProvider implements ImplementationProvider { +class SampleProvider implements ImplementationAsyncProvider { final RuntimeComponent comp; final SampleImplementation impl; final ProxyFactory pxf; + final ExtensionPointRegistry ep; Object instance; + Map asyncMessageMap = new HashMap(); - SampleProvider(final RuntimeComponent comp, final SampleImplementation impl, ProxyFactory pf) { + SampleProvider(final RuntimeComponent comp, final SampleImplementation impl, ProxyFactory pf, ExtensionPointRegistry ep) { this.comp = comp; this.impl = impl; this.pxf = pf; + this.ep = ep; } public void start() { @@ -63,7 +71,7 @@ public void start() { if(i instanceof JavaInterface) f.set(instance, pxf.createProxy(comp.getComponentContext().getServiceReference(f.getType(), r.getName()))); else - f.set(instance, new SampleWSDLProxy(r.getEndpointReferences().get(0), i)); + f.set(instance, new SampleWSDLProxy(asyncMessageMap, r.getEndpointReferences().get(0), i, ep)); } } catch(Exception e) { throw new RuntimeException(e); @@ -88,4 +96,17 @@ public Invoker createInvoker(final RuntimeComponentService s, final Operation op throw new RuntimeException(e); } } + + public InvokerAsyncRequest createAsyncInvoker(RuntimeComponentService service, Operation operation) { + // Only providing Async support through WSDL interfaces in this test + try { + return new SampleWSDLInvoker((WSDLOperation)operation, impl.clazz, instance); + } catch(Exception e) { + throw new RuntimeException(e); + } + } + + public InvokerAsyncResponse createAsyncResponseInvoker(Operation operation) { + return new SampleAsyncResponseInvoker(asyncMessageMap, operation, impl.clazz, instance); + } } diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProviderFactory.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProviderFactory.java index 4ad24d33ff..86ddd50ea6 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProviderFactory.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleProviderFactory.java @@ -33,13 +33,15 @@ */ public class SampleProviderFactory implements ImplementationProviderFactory { final ProxyFactory pxf; + final ExtensionPointRegistry ep; public SampleProviderFactory(final ExtensionPointRegistry ep) { + this.ep = ep; pxf = ExtensibleProxyFactory.getInstance(ep); } public ImplementationProvider createImplementationProvider(final RuntimeComponent comp, final SampleImplementation impl) { - return new SampleProvider(comp, impl, pxf); + return new SampleProvider(comp, impl, pxf, ep); } public Class getModelType() { diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java index 6c5317274f..4d33a956a8 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java @@ -21,9 +21,11 @@ import java.lang.reflect.Method; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.w3c.dom.Element; /** @@ -32,7 +34,7 @@ * * @version $Rev$ $Date$ */ -class SampleWSDLInvoker implements Invoker { +class SampleWSDLInvoker extends InterceptorAsyncImpl { final String name; final Object instance; final Method method; @@ -43,14 +45,43 @@ class SampleWSDLInvoker implements Invoker { this.method = clazz.getMethod("call", String.class, Element.class); } + public Invoker getNext() { + // Can't get next for an implementation invoker + return null; + } + public Message invoke(final Message msg) { + return processRequest(msg); + } + + public void invokeAsyncRequest(Message msg) { + Message responseMsg = processRequest(msg); + + // in this sample programming model we make the async + // response from the implementation provider. The + // component implementation itself doesn't get a chance to + // do async responses. + + // At this point we could serialize the ??? and pick it up again + // later to send the async response + + ((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg); + } + + public Message processRequest(Message msg) { try { + //AsyncHeader asyncHeader = (String) message.getHeaders().get("ASYNC-HEADER"); // Invoke the generic call method - msg.setBody(method.invoke(instance, name, ((Object[])msg.getBody())[0])); + Object response = method.invoke(instance, name, ((Object[])msg.getBody())[0]); + msg.setBody(response); } catch(Exception e) { e.printStackTrace(); msg.setFaultBody(e.getCause()); } return msg; } + + public Message processResponse(Message msg) { + return msg; + } } diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java index a6882a0103..0fc8403cf1 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java @@ -24,8 +24,12 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.Constants; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.w3c.dom.Element; @@ -37,8 +41,14 @@ class SampleWSDLProxy implements WSDLReference { final RuntimeEndpointReference repr; final Map ops; + final ExtensionPointRegistry ep; + final MessageFactory mf; + Map asyncMessageMap; - SampleWSDLProxy(EndpointReference epr, Interface wi) { + SampleWSDLProxy(Map asyncMessageMap, EndpointReference epr, Interface wi, ExtensionPointRegistry ep) { + this.asyncMessageMap = asyncMessageMap; + this.ep = ep; + mf = ep.getExtensionPoint(MessageFactory.class); repr = (RuntimeEndpointReference)epr; ops = new HashMap(); for(Operation o: wi.getOperations()) @@ -54,4 +64,33 @@ public Element call(String op, Element e) { throw new RuntimeException(ex); } } + + @Override + public void callAsync(String op, Element e) { + // Asynchronously invoke the named operation on the endpoint reference + Message message = mf.createMessage(); + message.setBody(new Object[]{e}); + + // We could MESSAGE_ID here if required. If not the infrastructure + // will generate a UUID + String messageID = "myuniqueid"; + message.getHeaders().put(Constants.MESSAGE_ID, messageID); + + // save the message id ready for when we process the response + asyncMessageMap.put(messageID, op); + + // We could add implementation specific headers here if required + //message.getHeaders().put(Constants.???, ???); + + try { + repr.invokeAsync(ops.get(op), message); + } catch (Throwable ex) { + ex.printStackTrace(); + } + + // if we don't provide a message id we can get the one the + // infrastructure generates + //String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); + //asyncMessageMap.put(messageID, op); + } } diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java new file mode 100644 index 0000000000..b6f59515cc --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +package sample; + +import static java.lang.System.out; +import static sample.Xutil.elem; +import static sample.Xutil.text; +import static sample.Xutil.xdom; + +import org.w3c.dom.Element; + +import sample.api.Java; +import sample.api.WSDL; +import sample.api.WSDLReference; + +/** + * Sample component implementation that uses Java interfaces. + * + * @version $Rev$ $Date$ + */ +@Java(Upper.class) +public class UpperSampleAsyncReferenceImpl { + + @WSDL("http://sample/upper-async#Upper") + WSDLReference upper; + + Element response; + + public String upper(String s) { + out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); + + // TODO - I'm passing in the non-wrapped version of the parameter + // here which doesn't seem right. Need to test that databinding + // wraps it correctly + final Element ureq = xdom("http://sample/upper-async", "s", text(s)); + upper.callAsync("upper", ureq); + + try { + Thread.sleep(500); + } catch (Exception ex) { + // do nothing + } + + return response.getTextContent(); + } + + /** + * In this implementation the convention is that the + * async callback arrives at an operation named + * operationName + Callback + */ + public void upperCallback(Element response) { + out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response.getTextContent() + ")"); + this.response = response; + } +} diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java new file mode 100644 index 0000000000..69d6cb9ecf --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncServiceImpl.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +package sample; + +import static java.lang.System.out; +import static sample.Xutil.elem; +import static sample.Xutil.text; +import static sample.Xutil.xdom; + +import org.w3c.dom.Element; + +import sample.api.WSDL; + +/** + * Sample component implementation that uses Java interfaces. + * + * @version $Rev$ $Date$ + */ +@WSDL("http://sample/upper-async#Upper") +public class UpperSampleAsyncServiceImpl { + + public Element call(String op, Element e) { + String input = e.getTextContent(); + out.println("UpperSampleAsyncServiceImpl.upper(" + input + ")"); + String output = input.toUpperCase(); + return xdom("http://sample/upper-async", "upperResponse", elem("result", text(output))); + } +} diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java new file mode 100644 index 0000000000..eeadb48b24 --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java @@ -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. + */ + +package sample.impl; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import sample.Upper; + +/** + * Test how to run an SCA contribution containing a test composite on a + * Tuscany runtime node. + * + * @version $Rev$ $Date$ + */ +public class SampleNativeAsyncTestCase { + static Node node; + + @BeforeClass + public static void setUp() throws Exception { + final NodeFactory nf = NodeFactory.newInstance(); + String here = SampleNativeAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); + node = nf.createNode(new Contribution("test", here)); + node.start(); + } + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testReference() { + System.out.println("SampleNaiveAsyncTestCase.testReference"); + Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference"); + final String r = upper.upper("async"); + System.out.println(r); + assertEquals("ASYNC", r); + } +} diff --git a/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl b/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl new file mode 100644 index 0000000000..d8d9065ca8 --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/resources/Upper-async.wsdl @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/extending-tuscany/implementation-sample/src/test/resources/testnativeasync.composite b/samples/extending-tuscany/implementation-sample/src/test/resources/testnativeasync.composite new file mode 100644 index 0000000000..6610b66815 --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/resources/testnativeasync.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + From 93a759a26f6a2f563771dba0cb30d2bff6c492c3 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 9 Dec 2010 14:36:28 +0000 Subject: [PATCH 070/174] Cleaning the ResponseDispatchImpl to correct the model for capturing the async response location - as described under TUSCANY-3787 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043984 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation/java/invocation/ResponseDispatchImpl.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ResponseDispatchImpl.java b/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ResponseDispatchImpl.java index dc0bb94bde..af40d07409 100644 --- a/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ResponseDispatchImpl.java +++ b/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ResponseDispatchImpl.java @@ -80,14 +80,11 @@ public class ResponseDispatchImpl implements ResponseDispatch, Serializabl // Service Reference used for the callback private ServiceReference> callbackRef; - private String callbackAddress; private String messageID; public ResponseDispatchImpl( Message msg ) { super(); callbackRef = getAsyncCallbackRef( msg ); - - callbackAddress = msg.getFrom().getCallbackEndpoint().getURI(); // TODO - why is WS stuff bleeding into general code? messageID = (String) msg.getHeaders().get(MESSAGE_ID); From 2548428fd373e32392975e761fad896620dac2e7 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 9 Dec 2010 15:01:38 +0000 Subject: [PATCH 071/174] provide additional necessary information in the Service Endpoint for all binding types in support of async services, as under TUSCANY-3807 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1043990 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/invocation/impl/AsyncJDKInvocationHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/AsyncJDKInvocationHandler.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/AsyncJDKInvocationHandler.java index 4af9ce585b..be65a51c1b 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/AsyncJDKInvocationHandler.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/AsyncJDKInvocationHandler.java @@ -47,6 +47,7 @@ import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.BindingBuilder; import org.apache.tuscany.sca.assembly.builder.BuilderContext; import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; @@ -515,6 +516,14 @@ private RuntimeEndpoint createAsyncCallbackEndpoint(RuntimeEndpointReference epr service.setInterfaceContract(interfaceContract); String serviceName = epr.getReference().getName() + "_asyncCallback"; service.setName(serviceName); + // MJE 06/12/2010 - fixup for JMS binding code which looks at the implementation service + // as well as the component service... + // Create a pseudo implementation service... + Service implService = assemblyFactory.createService(); + implService.setName(serviceName); + implService.setInterfaceContract(interfaceContract); + service.setService(implService); + // endpoint.setService(service); // Set pseudo-service onto the pseudo-component List services = fakeComponent.getServices(); From fbf9938e11f7665beee7b9a6a687ce27e8361af4 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 9 Dec 2010 15:26:05 +0000 Subject: [PATCH 072/174] Provide necessary additional in the service endpoint for Async service support for all binding types, as under TUSCANY-3807 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044003 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/assembly/impl/RuntimeEndpointImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index f4408429df..bdacdda53b 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -44,6 +44,7 @@ import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.BindingBuilder; import org.apache.tuscany.sca.assembly.builder.BuilderContext; @@ -423,7 +424,7 @@ private RuntimeEndpointReference createAsyncEPR( RuntimeEndpoint endpoint ){ // Create pseudo-reference ComponentReference reference = assemblyFactory.createComponentReference(); - ExtensionPointRegistry registry = compositeContext.getExtensionPointRegistry(); + ExtensionPointRegistry registry = compositeContext.getExtensionPointRegistry(); FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class); JavaInterfaceFactory javaInterfaceFactory = (JavaInterfaceFactory)modelFactories.getFactory(JavaInterfaceFactory.class); JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract(); @@ -436,6 +437,14 @@ private RuntimeEndpointReference createAsyncEPR( RuntimeEndpoint endpoint ){ String referenceName = endpoint.getService().getName() + "_asyncCallback"; reference.setName(referenceName); reference.setForCallback(true); + // Add in "implementation" reference (really a dummy, but with correct interface) + Reference implReference = assemblyFactory.createReference(); + implReference.setInterfaceContract(interfaceContract); + implReference.setName(referenceName); + implReference.setForCallback(true); + + reference.setReference(implReference); + // Set the created ComponentReference into the EPR epr.setReference(reference); // Create a binding From 494b50d6a548a077645220762bc11832f4c70879 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 9 Dec 2010 16:59:17 +0000 Subject: [PATCH 073/174] Enable binding.jms to deal with the MessageID sent as part of an async service invocation - as described in TUSCANY-3809 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044035 13f79535-47bb-0310-9956-ffa450edef68 --- .../headers/HeaderReferenceInterceptor.java | 7 +++++++ .../jms/headers/HeaderServiceInterceptor.java | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java index 61c5dc8263..ad07655730 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java @@ -144,6 +144,13 @@ public Message invokeRequest(Message tuscanyMsg) { context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE); } + // Adding MESSAGE_ID field to the JMS message, which is used to correlate async callbacks + String msgID = (String)tuscanyMsg.getHeaders().get("MESSAGE_ID"); + if( msgID != null ) { + jmsMsg.setObjectProperty("MESSAGE_ID", msgID); + } // end if + // + return tuscanyMsg; } catch (JMSException e) { throw new JMSBindingException(e); diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java index 178a87a53f..e899448760 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java @@ -40,9 +40,30 @@ public HeaderServiceInterceptor(JMSBinding jmsBinding) { } public Message invoke(Message msg) { + msg = invokeRequest( msg ); return invokeResponse(next.invoke(msg)); } + public Message invokeRequest(Message tuscanyMsg) { + + try { + + javax.jms.Message jmsMsg = tuscanyMsg.getBody(); + + // Handle MESSAGE_ID field of the JMS message, which is used to correlate async callbacks + String msgID = (String)jmsMsg.getObjectProperty("MESSAGE_ID"); + if( msgID != null ) { + tuscanyMsg.getHeaders().put("MESSAGE_ID", msgID); + } // end if + // + + } catch (JMSException e) { + throw new JMSBindingException(e); + } // end try + + return tuscanyMsg; + } // end method invokeRequest + public Message invokeResponse(Message tuscanyMsg) { try { From 496b26b72e790aaf06634b8f39030ebfa12b63a3 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Thu, 9 Dec 2010 17:03:26 +0000 Subject: [PATCH 074/174] Restructure the handling of callback destination in CallbackDestinationInterceptor to deal with Async service invocation as well as true Callback interfaces - as in TUSCANY-3809 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044038 13f79535-47bb-0310-9956-ffa450edef68 --- .../wire/CallbackDestinationInterceptor.java | 83 +++++++++++-------- 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java index 0678f1edaa..290ce77e5d 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java @@ -36,6 +36,10 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +/** + * JMS Binding Interceptor class that deals with a callback destination address on the service side + * + */ public class CallbackDestinationInterceptor implements Interceptor { private Invoker next; private RuntimeComponentService service; @@ -59,51 +63,60 @@ public Message invoke(Message msg) { return next.invoke(invokeRequest(msg)); } + /** + * Handle an invocation request messaage + * @param msg the message + * @return the updated message + */ public Message invokeRequest(Message msg) { try { // get the jms context JMSBindingContext context = msg.getBindingContext(); - javax.jms.Message jmsMsg = context.getJmsMsg(); + javax.jms.Message jmsMsg = context.getJmsMsg(); + + // Extract the Callback destination name header, if present + String callbackdestName = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY); - - if (service.getInterfaceContract().getCallbackInterface() != null) { - - String callbackdestName = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY); - if (( callbackdestName == null) && ( jmsMsg.getJMSReplyTo() != null ) && msg.getOperation().isNonBlocking() ) { - Destination replyTo = jmsMsg.getJMSReplyTo(); - if (replyTo != null) { - callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName(); - } + if (callbackdestName != null) { + // If present, strip any leading "jms:jndi:" string + if (!callbackdestName.startsWith("jms:jndi:")) { + throw new JMSBindingException("message property " + JMSBindingConstants.CALLBACK_Q_PROPERTY + " does not start with 'jms:jndi:' found: " + callbackdestName); } else { - if (callbackdestName != null) { - if (!callbackdestName.startsWith("jms:jndi:")) { - throw new JMSBindingException("message property " + JMSBindingConstants.CALLBACK_Q_PROPERTY + " does not start with 'jms:jndi:' found: " + callbackdestName); - } else { - callbackdestName = callbackdestName.substring(9); - } - } - } + callbackdestName = callbackdestName.substring(9); + } // end if + } else { + // If there is no Callback destination name header present, but the service is a callback, use the JMS ReplyTo header + if (service.getInterfaceContract().getCallbackInterface() != null) { + if ( ( jmsMsg.getJMSReplyTo() != null ) && msg.getOperation().isNonBlocking() ) { + Destination replyTo = jmsMsg.getJMSReplyTo(); + if (replyTo != null) { + callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName(); + } + } // end if + } // end if + } // end if - if (callbackdestName != null) { - List refs = endpoint.getCallbackEndpointReferences(); - for (EndpointReference ref : refs ) { - if (ref.getBinding() instanceof JMSBinding ) { - JMSBinding callbackBinding = (JMSBinding) ref.getBinding(); - callbackBinding.setDestinationName(callbackdestName); - } - } - } + // Place the Callback destination name into the Callback EPRs for the service endpoint + if (callbackdestName != null) { + List refs = endpoint.getCallbackEndpointReferences(); + for (EndpointReference ref : refs ) { + if (ref.getBinding() instanceof JMSBinding ) { + JMSBinding callbackBinding = (JMSBinding) ref.getBinding(); + callbackBinding.setDestinationName(callbackdestName); + } // end if + } // end for + } // end if - String callbackID = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY); - if (callbackID != null) { -// parameters.setCallbackID(callbackID); - } - } +// Callback ID not used at present +// String callbackID = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY); +// if (callbackID != null) { +// parameters.setCallbackID(callbackID); +// } } catch (JMSException e) { throw new JMSBindingException(e); - } + } // end try return msg; - } -} \ No newline at end of file + } // end method invokeRequest +} // end class \ No newline at end of file From 63486fa6b16733ebe7673f5f0cff830f76003238 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Fri, 10 Dec 2010 10:34:28 +0000 Subject: [PATCH 075/174] Add a new module for a JMS binding resource factory that can be specific for ActiveMQ git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044273 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-jms-runtime-activemq/LICENSE | 205 ++++++++++++++++++ .../META-INF/MANIFEST.MF | 43 ++++ modules/binding-jms-runtime-activemq/NOTICE | 6 + modules/binding-jms-runtime-activemq/pom.xml | 68 ++++++ .../activemq/ActiveMQJMSResourceFactory.java | 60 +++++ ...iveMQJMSResourceFactoryExtensionPoint.java | 33 +++ ....provider.JMSResourceFactoryExtensionPoint | 18 ++ 7 files changed, 433 insertions(+) create mode 100644 modules/binding-jms-runtime-activemq/LICENSE create mode 100644 modules/binding-jms-runtime-activemq/META-INF/MANIFEST.MF create mode 100644 modules/binding-jms-runtime-activemq/NOTICE create mode 100644 modules/binding-jms-runtime-activemq/pom.xml create mode 100644 modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactory.java create mode 100644 modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactoryExtensionPoint.java create mode 100644 modules/binding-jms-runtime-activemq/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint diff --git a/modules/binding-jms-runtime-activemq/LICENSE b/modules/binding-jms-runtime-activemq/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/modules/binding-jms-runtime-activemq/LICENSE @@ -0,0 +1,205 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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/modules/binding-jms-runtime-activemq/META-INF/MANIFEST.MF b/modules/binding-jms-runtime-activemq/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..2abd76b91a --- /dev/null +++ b/modules/binding-jms-runtime-activemq/META-INF/MANIFEST.MF @@ -0,0 +1,43 @@ +Manifest-Version: 1.0 +SCA-Version: 1.1 +Bundle-Name: Apache Tuscany SCA JMS Binding Runtime ActiveMQ +Bundle-Vendor: The Apache Software Foundation +Bundle-Version: 2.0.0 +Bundle-ManifestVersion: 2 +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Bundle-Description: Apache Tuscany SCA JMS Binding Runtime ActiveMQ +Import-Package: javax.jms, + javax.naming, + javax.resource.spi, + javax.security.auth, + javax.xml.namespace, + javax.xml.stream, + org.apache.axiom.om, + org.apache.axiom.om.impl.builder, + org.apache.tuscany.sca.assembly;version="2.0.0", + org.apache.tuscany.sca.binding.jms;version="2.0.0", + org.apache.tuscany.sca.binding.jms.operationselector;version="2.0.0", + org.apache.tuscany.sca.binding.jms.policy.authentication.token;version="2.0.0", + org.apache.tuscany.sca.binding.jms.policy.header;version="2.0.0", + org.apache.tuscany.sca.binding.jms.wireformat;version="2.0.0", + org.apache.tuscany.sca.binding.ws;version="2.0.0", + org.apache.tuscany.sca.binding.ws.wsdlgen;version="2.0.0", + org.apache.tuscany.sca.common.xml.dom;version="2.0.0", + org.apache.tuscany.sca.core;version="2.0.0", + org.apache.tuscany.sca.databinding.xml;version="2.0.0", + org.apache.tuscany.sca.interfacedef;version="2.0.0", + org.apache.tuscany.sca.interfacedef.impl;version="2.0.0", + org.apache.tuscany.sca.interfacedef.util;version="2.0.0", + org.apache.tuscany.sca.invocation;version="2.0.0", + org.apache.tuscany.sca.monitor;version="2.0.0", + org.apache.tuscany.sca.policy;version="2.0.0", + org.apache.tuscany.sca.policy.authentication.token;version="2.0.0", + org.apache.tuscany.sca.policy.security;version="2.0.0", + org.apache.tuscany.sca.provider;version="2.0.0", + org.apache.tuscany.sca.runtime;version="2.0.0", + org.apache.tuscany.sca.work;version="2.0.0", + org.oasisopen.sca;version="2.0.0", + org.oasisopen.sca.annotation;version="2.0.0" +Bundle-SymbolicName: org.apache.tuscany.sca.binding.jms.runtime.activemq +Bundle-DocURL: http://www.apache.org/ +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/modules/binding-jms-runtime-activemq/NOTICE b/modules/binding-jms-runtime-activemq/NOTICE new file mode 100644 index 0000000000..fdfa0e9faa --- /dev/null +++ b/modules/binding-jms-runtime-activemq/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2008 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/modules/binding-jms-runtime-activemq/pom.xml b/modules/binding-jms-runtime-activemq/pom.xml new file mode 100644 index 0000000000..556fd74d56 --- /dev/null +++ b/modules/binding-jms-runtime-activemq/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0-SNAPSHOT + ../pom.xml + + tuscany-binding-jms-runtime-activemq + Apache Tuscany SCA JMS Binding Runtime AcytiveMQ + + + + + org.apache.tuscany.sca + tuscany-binding-jms + 2.0-SNAPSHOT + provided + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1.1 + provided + + + + org.apache.geronimo.specs + geronimo-j2ee-connector_1.5_spec + 2.0.0 + provided + + + + junit + junit + 4.8.1 + test + + + + diff --git a/modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactory.java b/modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactory.java new file mode 100644 index 0000000000..4dbe6dca06 --- /dev/null +++ b/modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactory.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.binding.jms.runtime.activemq; + +import java.util.Properties; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl; + +public class ActiveMQJMSResourceFactory extends JMSResourceFactoryImpl { + + public ActiveMQJMSResourceFactory(String connectionFactoryName, + String responseConnectionFactoryName, + String initialContextFactoryName, + String jndiURL) { + super(connectionFactoryName, responseConnectionFactoryName, initialContextFactoryName, jndiURL); + } + + @Override + protected synchronized Context getInitialContext() throws NamingException { + + System.out.println("************************** ActiveMQJMSResourceFactory.getInitialContext"); + + if (context == null) { + Properties props = new Properties(); + + if (initialContextFactoryName != null) { + props.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName); + } + if (jndiURL != null) { + props.setProperty(Context.PROVIDER_URL, jndiURL); + } + + initJREEnvironment(props); + + context = new InitialContext(props); + } + return context; + } +} diff --git a/modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactoryExtensionPoint.java b/modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactoryExtensionPoint.java new file mode 100644 index 0000000000..d04e1be79a --- /dev/null +++ b/modules/binding-jms-runtime-activemq/src/main/java/org/apache/tuscany/sca/binding/jms/runtime/activemq/ActiveMQJMSResourceFactoryExtensionPoint.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.binding.jms.runtime.activemq; + +import org.apache.tuscany.sca.binding.jms.JMSBinding; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint; + +public class ActiveMQJMSResourceFactoryExtensionPoint implements JMSResourceFactoryExtensionPoint { + + @Override + public JMSResourceFactory createJMSResourceFactory(JMSBinding binding) { + return new ActiveMQJMSResourceFactory(binding.getConnectionFactoryName(), binding.getResponseConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL()); + } + +} diff --git a/modules/binding-jms-runtime-activemq/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint b/modules/binding-jms-runtime-activemq/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint new file mode 100644 index 0000000000..b437109674 --- /dev/null +++ b/modules/binding-jms-runtime-activemq/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint @@ -0,0 +1,18 @@ +# 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. +org.apache.tuscany.sca.binding.jms.runtime.activemq.ActiveMQJMSResourceFactoryExtensionPoint + From 134a541b7b08246b2edae458515c2490e72ebfb2 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Fri, 10 Dec 2010 10:35:08 +0000 Subject: [PATCH 076/174] Delete redundant folder git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044274 13f79535-47bb-0310-9956-ffa450edef68 From feac549b1349dd75ff6a740ae5366932febe9535 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Fri, 10 Dec 2010 12:34:10 +0000 Subject: [PATCH 077/174] Initial fixes to enable JMS runtime to work under OSGi as described in TUSCANY-3808 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044330 13f79535-47bb-0310-9956-ffa450edef68 --- features/eclipse-pde/pom.xml | 8 ++++ .../binding-jms-runtime/META-INF/MANIFEST.MF | 2 + modules/binding-jms-runtime/pom.xml | 10 ++++- .../jms/provider/JMSMessageProcessorUtil.java | 6 ++- .../jms/provider/JMSResourceFactoryImpl.java | 37 ++++++++++++++++++- 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/features/eclipse-pde/pom.xml b/features/eclipse-pde/pom.xml index 36c778d044..949bbe55b0 100644 --- a/features/eclipse-pde/pom.xml +++ b/features/eclipse-pde/pom.xml @@ -57,6 +57,14 @@ 1.0.1 + + + org.apache.activemq + activemq-core + 5.3.0 + + + diff --git a/modules/binding-jms-runtime/META-INF/MANIFEST.MF b/modules/binding-jms-runtime/META-INF/MANIFEST.MF index 4d7f88a476..beeb3a366e 100644 --- a/modules/binding-jms-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-jms-runtime/META-INF/MANIFEST.MF @@ -12,6 +12,7 @@ Import-Package: javax.jms, javax.security.auth, javax.xml.namespace, javax.xml.stream, + org.apache.activemq.jndi;resolution:=optional, org.apache.axiom.om, org.apache.axiom.om.impl.builder, org.apache.tuscany.sca.assembly;version="2.0.0", @@ -25,6 +26,7 @@ Import-Package: javax.jms, org.apache.tuscany.sca.common.xml.dom;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.databinding.xml;version="2.0.0", + org.apache.tuscany.sca.extensibility;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", org.apache.tuscany.sca.interfacedef.impl;version="2.0.0", org.apache.tuscany.sca.interfacedef.util;version="2.0.0", diff --git a/modules/binding-jms-runtime/pom.xml b/modules/binding-jms-runtime/pom.xml index 01ab3dd8f9..cca26fec30 100644 --- a/modules/binding-jms-runtime/pom.xml +++ b/modules/binding-jms-runtime/pom.xml @@ -58,7 +58,15 @@ 2.0.0 provided - + + + + org.apache.activemq + activemq-core + 5.3.0 + + + junit junit diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java index b7622c942e..4b96f23d65 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java @@ -85,7 +85,11 @@ private static Object instantiate(ClassLoader cl, String className, JMSBinding b try { clazz = cl.loadClass(className); } catch (ClassNotFoundException e) { - clazz = binding.getClass().getClassLoader().loadClass(className); + // MJE 07/12/2010 - for OSGi the default message processor belongs to the same bundle as + // this JMSMessageProcessorUtil itself and so the "correct" classloader to use is the classloader + // for THIS class, and not the binding class (which is a different bundle) + // clazz = binding.getClass().getClassLoader().loadClass(className); + clazz = JMSMessageProcessorUtil.class.getClassLoader().loadClass(className); } Constructor constructor = clazz.getDeclaredConstructor(new Class[] {JMSBinding.class, ExtensionPointRegistry.class}); diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java index 9c1a384c7a..4ab2f5ab2c 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java @@ -31,6 +31,8 @@ import javax.resource.spi.ActivationSpec; import org.apache.tuscany.sca.binding.jms.JMSBindingException; +import org.apache.tuscany.sca.extensibility.ClassLoaderContext; +import org.apache.activemq.jndi.ActiveMQInitialContextFactory; /** * Abstracts away any JMS provide specific feature from the JMS binding @@ -139,7 +141,8 @@ protected void createConnection() throws NamingException, JMSException { ConnectionFactory connectionFactory = (ConnectionFactory)o; connection = connectionFactory.createConnection(); } - + + static final String ACTIVEMQ_FACTORY = "org.apache.activemq.jndi.ActiveMQInitialContextFactory"; protected synchronized Context getInitialContext() throws NamingException { if (context == null) { Properties props = new Properties(); @@ -152,8 +155,38 @@ protected synchronized Context getInitialContext() throws NamingException { } initJREEnvironment(props); + + /** + * For OSGi, need to provide access to the InitialContextFactory for the JMS provider that is going to be used. + * + * The situation is that the InitialContext constructor instantiates an instance of the InitialContextFactory by + * calling "new" using the TCCL - thus there is a need to prepare the TCCL. + * 03/12/2010 MJE - for the present, only worry about ActiveMQ - other providers can be added later + * 10/12/2010 MJE - the following code attempts to get the classloader for the ActiveMQ initial context factory + * it will fail if the ActiveMQ classes are not available in the runtime, but the code will still + * execute (although under OSGi the new InitialContext() operation will fail to find a suitable + * InitialContextFactory object...) + */ + ClassLoader ActiveMQCl = null; + try { + if( initialContextFactoryName == null || ACTIVEMQ_FACTORY.equals(initialContextFactoryName) ) { + ActiveMQCl = ActiveMQInitialContextFactory.class.getClassLoader(); + props.setProperty(Context.INITIAL_CONTEXT_FACTORY, ACTIVEMQ_FACTORY); + } // end if + } catch (Exception e) { + // Nothing to do in this case - the ActiveMQCl classloader will simply be null + } // end try - context = new InitialContext(props); + ClassLoader tccl = ClassLoaderContext.setContextClassLoader(JMSResourceFactoryImpl.class.getClassLoader(), + ActiveMQCl, + Thread.currentThread().getContextClassLoader() ); + try { + // Load the JNDI InitialContext (will load the InitialContextFactory, if present) + context = new InitialContext(props); + } finally { + // Restore the TCCL if we changed it + if( tccl != null ) Thread.currentThread().setContextClassLoader(tccl); + } // end try } return context; } From c6be0ff08ebfc1ec3790358c9eba844170bcae4a Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Fri, 10 Dec 2010 14:53:03 +0000 Subject: [PATCH 078/174] Adding a testcase that uses to connect reference to an async service git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044379 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation-sample/pom.xml | 6 ++ .../impl/SampleNativeAsyncTestCase.java | 3 +- .../impl/SampleNativeJMSAsyncTestCase.java | 64 +++++++++++++++++++ .../resources/testnativejmsasync.composite | 37 +++++++++++ 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java create mode 100644 samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite diff --git a/samples/extending-tuscany/implementation-sample/pom.xml b/samples/extending-tuscany/implementation-sample/pom.xml index 7435c8dba0..94dbe0ddb7 100644 --- a/samples/extending-tuscany/implementation-sample/pom.xml +++ b/samples/extending-tuscany/implementation-sample/pom.xml @@ -42,6 +42,12 @@ tuscany-binding-ws-runtime-axis2 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + org.mortbay.jetty diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java index eeadb48b24..f5198e7df0 100644 --- a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java @@ -43,7 +43,8 @@ public class SampleNativeAsyncTestCase { public static void setUp() throws Exception { final NodeFactory nf = NodeFactory.newInstance(); String here = SampleNativeAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); - node = nf.createNode(new Contribution("test", here)); + // Create the node using the pattern "name of composite file to start" / Contribution to use + node = nf.createNode("testnativeasync.composite", new Contribution("test", here)); node.start(); } diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java new file mode 100644 index 0000000000..ea988981ce --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +package sample.impl; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import sample.Upper; + +/** + * Test how to run an SCA contribution containing a test composite on a + * Tuscany runtime node. + * + * @version $Rev$ $Date$ + */ +public class SampleNativeJMSAsyncTestCase { + static Node node; + + @BeforeClass + public static void setUp() throws Exception { + final NodeFactory nf = NodeFactory.newInstance(); + String here = SampleNativeJMSAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); + // Create the node using the pattern "name of composite file to start" / Contribution to use + node = nf.createNode("testnativejmsasync.composite", new Contribution("test", here)); + node.start(); + } + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testReference() { + System.out.println("SampleNaiveAsyncTestCase.testReference"); + Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference"); + final String r = upper.upper("async"); + System.out.println(r); + assertEquals("ASYNC", r); + } +} diff --git a/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite b/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite new file mode 100644 index 0000000000..6012cb25af --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + From 65bd0b83eb7d1ffd8eb1266010f4978271f369f7 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Fri, 10 Dec 2010 16:31:34 +0000 Subject: [PATCH 079/174] Adding a testcase that uses to connect reference to an async service git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044423 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/resources/jndi.properties | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 samples/extending-tuscany/implementation-sample/src/test/resources/jndi.properties diff --git a/samples/extending-tuscany/implementation-sample/src/test/resources/jndi.properties b/samples/extending-tuscany/implementation-sample/src/test/resources/jndi.properties new file mode 100644 index 0000000000..a38e1778c6 --- /dev/null +++ b/samples/extending-tuscany/implementation-sample/src/test/resources/jndi.properties @@ -0,0 +1,38 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +#java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +#connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +#queue.HelloWorldService = HelloWorldService + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi From 465c2af080dfa82c667770c11b82b1f2eb1067ed Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 07:43:30 +0000 Subject: [PATCH 080/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044575 13f79535-47bb-0310-9956-ffa450edef68 --- modules/assembly-xml/pom.xml | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/modules/assembly-xml/pom.xml b/modules/assembly-xml/pom.xml index 93e0879c77..f8bbc345b6 100644 --- a/modules/assembly-xml/pom.xml +++ b/modules/assembly-xml/pom.xml @@ -53,34 +53,6 @@ 2.0-SNAPSHOT - - - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0.1 - compile - - - - org.codehaus.woodstox - wstx-asl - 3.2.6 - runtime - - - stax - stax-api - - - - org.apache.tuscany.sca tuscany-assembly-xsd @@ -88,6 +60,12 @@ runtime + + org.codehaus.woodstox + wstx-asl + 3.2.9 + test + From 5a1fde5fcce20ac174527776dc0f5e463afd025f Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 07:44:31 +0000 Subject: [PATCH 081/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044576 13f79535-47bb-0310-9956-ffa450edef68 --- modules/common-xml/pom.xml | 51 -------------------------------------- 1 file changed, 51 deletions(-) diff --git a/modules/common-xml/pom.xml b/modules/common-xml/pom.xml index 5504f0fd50..eb967a6ab4 100644 --- a/modules/common-xml/pom.xml +++ b/modules/common-xml/pom.xml @@ -44,55 +44,4 @@ - - - - From 05f3ae06fc664c2d1eef8a508c07603b3003cb0f Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 07:50:57 +0000 Subject: [PATCH 082/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044577 13f79535-47bb-0310-9956-ffa450edef68 --- modules/core-spi/pom.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/modules/core-spi/pom.xml b/modules/core-spi/pom.xml index 578eb0715e..ec8f1a680f 100644 --- a/modules/core-spi/pom.xml +++ b/modules/core-spi/pom.xml @@ -53,19 +53,6 @@ 2.0-SNAPSHOT - - org.codehaus.woodstox - wstx-asl - 3.2.6 - runtime - - - stax - stax-api - - - - From c4ccbc9c621df88e9ef0e2b4055bd039d4bfe909 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 07:51:32 +0000 Subject: [PATCH 083/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044578 13f79535-47bb-0310-9956-ffa450edef68 --- modules/core/pom.xml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/modules/core/pom.xml b/modules/core/pom.xml index 586dc0e5df..8354a8e925 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -53,25 +53,6 @@ 2.0-SNAPSHOT - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0.1 - - - - org.codehaus.woodstox - wstx-asl - 3.2.6 - runtime - - - stax - stax-api - - - - cglib cglib From fac9aeec90966bc1e16a8e5587eda77888b300e9 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:06:03 +0000 Subject: [PATCH 084/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044580 13f79535-47bb-0310-9956-ffa450edef68 --- modules/contribution/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/contribution/pom.xml b/modules/contribution/pom.xml index 809b983c09..56d8f1af3a 100644 --- a/modules/contribution/pom.xml +++ b/modules/contribution/pom.xml @@ -58,12 +58,6 @@ tuscany-common-java 2.0-SNAPSHOT - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0.1 - compile - From f3c9e4807c9c1441d13ab7f3602d9622278fd09c Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:06:44 +0000 Subject: [PATCH 085/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044581 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/databinding/pom.xml b/modules/databinding/pom.xml index 354d31c05a..dcbd4c103d 100644 --- a/modules/databinding/pom.xml +++ b/modules/databinding/pom.xml @@ -75,7 +75,7 @@ org.codehaus.woodstox wstx-asl - 3.2.4 + 3.2.9 runtime From 55c1ea58f9dc7fe8fa513b25a98714ce8173e262 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:34:11 +0000 Subject: [PATCH 086/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044583 13f79535-47bb-0310-9956-ffa450edef68 --- modules/core-databinding/pom.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/modules/core-databinding/pom.xml b/modules/core-databinding/pom.xml index 35b5f41b06..a1f2235b13 100644 --- a/modules/core-databinding/pom.xml +++ b/modules/core-databinding/pom.xml @@ -73,19 +73,6 @@ runtime - - org.codehaus.woodstox - wstx-asl - runtime - 3.2.6 - - - stax - stax-api - - - - From a1525cb2811e44ed32dc1494ad32eddfb8afff22 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:47:12 +0000 Subject: [PATCH 087/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044584 13f79535-47bb-0310-9956-ffa450edef68 --- modules/implementation-java/pom.xml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/modules/implementation-java/pom.xml b/modules/implementation-java/pom.xml index 0922650a18..573214cc6d 100644 --- a/modules/implementation-java/pom.xml +++ b/modules/implementation-java/pom.xml @@ -59,12 +59,6 @@ 2.0-SNAPSHOT - - javax.jws - jsr181-api - 1.0-MR1 - - org.apache.tuscany.sca tuscany-assembly-xml @@ -112,13 +106,4 @@ - - - java.net - java.net Maven 1.x Repository - http://download.java.net/maven/1 - legacy - - - From 829ef8d0b37cc7567c579545bc64ae4ba6257718 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:47:33 +0000 Subject: [PATCH 088/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044585 13f79535-47bb-0310-9956-ffa450edef68 --- modules/contribution-resource/pom.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/modules/contribution-resource/pom.xml b/modules/contribution-resource/pom.xml index 576670176a..2df499917f 100644 --- a/modules/contribution-resource/pom.xml +++ b/modules/contribution-resource/pom.xml @@ -41,17 +41,5 @@ 2.0-SNAPSHOT - - org.codehaus.woodstox - wstx-asl - 3.2.4 - runtime - - - stax - stax-api - - - From 9181f9ef6a8c82d00ea1ff2379bb80ece342199b Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:48:09 +0000 Subject: [PATCH 089/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044586 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-jaxb/pom.xml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/modules/databinding-jaxb/pom.xml b/modules/databinding-jaxb/pom.xml index 23ba8ac8d9..323f1c9c3f 100644 --- a/modules/databinding-jaxb/pom.xml +++ b/modules/databinding-jaxb/pom.xml @@ -44,29 +44,12 @@ tuscany-interface-java 2.0-SNAPSHOT - - javax.xml.bind - jaxb-api - 2.1 - - - javax.xml.stream - stax-api - - - - - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0.1 - com.sun.xml.bind jaxb-impl 2.1.12 - runtime + test From 088aa42c5a182d7748ae50669676be5bdef5d86f Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:53:01 +0000 Subject: [PATCH 090/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044589 13f79535-47bb-0310-9956-ffa450edef68 --- modules/interface-java-jaxws/pom.xml | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/modules/interface-java-jaxws/pom.xml b/modules/interface-java-jaxws/pom.xml index a628d825da..84d829f51d 100644 --- a/modules/interface-java-jaxws/pom.xml +++ b/modules/interface-java-jaxws/pom.xml @@ -53,29 +53,10 @@ - javax.xml.ws - jaxws-api - 2.1 - - - javax.xml.soap - saaj-api - - - - - - - javax.jws - jsr181-api - 1.0-MR1 - - - javax.annotation - jsr250-api - 1.0 + com.sun.xml.bind + jaxb-impl + 2.1.12 + test From 870658093ab641747c3e22992e6254897be8b62b Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:53:51 +0000 Subject: [PATCH 091/174] Fix testcase to close the writer git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044590 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/implementation/jaxrs/xml/WriteTestCase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/implementation-jaxrs/src/test/java/org/apache/tuscany/sca/implementation/jaxrs/xml/WriteTestCase.java b/modules/implementation-jaxrs/src/test/java/org/apache/tuscany/sca/implementation/jaxrs/xml/WriteTestCase.java index 7dcf70c711..4957f39c92 100644 --- a/modules/implementation-jaxrs/src/test/java/org/apache/tuscany/sca/implementation/jaxrs/xml/WriteTestCase.java +++ b/modules/implementation-jaxrs/src/test/java/org/apache/tuscany/sca/implementation/jaxrs/xml/WriteTestCase.java @@ -24,6 +24,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; import junit.framework.TestCase; @@ -60,8 +61,9 @@ public void testReadWriteComposite() throws Exception { Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is), context); assertNotNull(composite); ByteArrayOutputStream bos = new ByteArrayOutputStream(); - staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos), context); - + XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); + staxProcessor.write(composite, writer, context); + writer.close(); assertTrue(bos.toString().contains("application=\"test.MyJAXRSapp\"")); } From eab84f49516852ddef4560532d1df9656c40f55c Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:51:18 +0000 Subject: [PATCH 092/174] Fix testcase to close the writer git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044591 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/implementation/web/xml/WriteTestCase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java b/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java index ebad994033..57bfdbe822 100644 --- a/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java +++ b/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java @@ -24,6 +24,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; import junit.framework.TestCase; @@ -60,7 +61,9 @@ public void testReadWriteComposite() throws Exception { Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is), context); assertNotNull(composite); ByteArrayOutputStream bos = new ByteArrayOutputStream(); - staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos), context); + XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); + staxProcessor.write(composite, writer, context); + writer.close(); assertTrue(bos.toString().contains("web-uri=\"MyWebapp\"")); From c3415ab3bc75e20282fb3f04ec23bf5410c009f7 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 08:55:00 +0000 Subject: [PATCH 093/174] Fix testcase to close the stream git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044592 13f79535-47bb-0310-9956-ffa450edef68 --- .../configuration/xml/NodeConfigurationProcessorTestCase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java b/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java index a10f2cccd4..f591a4ea68 100644 --- a/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java +++ b/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java @@ -64,7 +64,6 @@ public void testRead() throws Exception { InputStream is = getClass().getResourceAsStream("/org/apache/tuscany/sca/node/configuration/node1.xml"); XMLInputFactory xmlInputFactory = factories.getFactory(XMLInputFactory.class); XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(is); - is.close(); reader.nextTag(); NodeConfiguration config = (NodeConfiguration) processor.read(reader, context); StringWriter sw = new StringWriter(); From fee3b5ff7e4c855b54acd841e0f2cf3ea6e47f1c Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:06:26 +0000 Subject: [PATCH 094/174] Remove dependencies now included in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044595 13f79535-47bb-0310-9956-ffa450edef68 --- modules/policy-wspolicy/pom.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/modules/policy-wspolicy/pom.xml b/modules/policy-wspolicy/pom.xml index 71cafc147c..388fa4ad40 100644 --- a/modules/policy-wspolicy/pom.xml +++ b/modules/policy-wspolicy/pom.xml @@ -108,19 +108,6 @@ - - org.codehaus.woodstox - wstx-asl - 3.2.6 - runtime - - - stax - stax-api - - - - commons-logging commons-logging From 726a483e951c8388289ae3cbab1521114134b0e8 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:07:34 +0000 Subject: [PATCH 095/174] Fix testcase to close the writer git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044596 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/implementation/python/ReadWriteTestCase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/implementation-python/src/test/java/org/apache/tuscany/sca/implementation/python/ReadWriteTestCase.java b/modules/implementation-python/src/test/java/org/apache/tuscany/sca/implementation/python/ReadWriteTestCase.java index 6e5a70f734..b3fd07b158 100644 --- a/modules/implementation-python/src/test/java/org/apache/tuscany/sca/implementation/python/ReadWriteTestCase.java +++ b/modules/implementation-python/src/test/java/org/apache/tuscany/sca/implementation/python/ReadWriteTestCase.java @@ -28,6 +28,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.Contribution; @@ -82,7 +83,9 @@ public void testReadWrite() throws Exception { final InputStream is = getClass().getClassLoader().getResourceAsStream("domain-test.composite"); final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - xproc.write(c, xof.createXMLStreamWriter(bos), ctx); + XMLStreamWriter writer = xof.createXMLStreamWriter(bos); + xproc.write(c, writer, ctx); + writer.close(); assertTrue(bos.toString().contains("script=\"server_test.py\"")); } } From f44299896e778cc899ff1a22687d9c97061d93a1 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:08:04 +0000 Subject: [PATCH 096/174] Set svn ignores git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044597 13f79535-47bb-0310-9956-ffa450edef68 From 6cddf89afea0888c7840e672606b02bcb29b98c0 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:11:39 +0000 Subject: [PATCH 097/174] Update to clean up numerous dependencies, many i think left over from previous Axis releases. Also take out the JMS and rampart function for now as it doesn't appear to work anymore and there are no testcase or samples for those in 2.x git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044598 13f79535-47bb-0310-9956-ffa450edef68 --- .../META-INF/MANIFEST.MF | 3 - modules/binding-ws-runtime-axis2/pom.xml | 315 ++++-------------- .../provider/Axis2EngineIntegration.java | 4 +- .../provider/Axis2ServiceBindingProvider.java | 59 ---- .../ws/axis2/engine/conf/tuscany-axis2.xml | 8 +- .../engine/repository/modules/modules.list | 1 - 6 files changed, 59 insertions(+), 331 deletions(-) diff --git a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF index 843251bee0..cfa5f0fd2b 100644 --- a/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF +++ b/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF @@ -16,7 +16,6 @@ Export-Package: org.apache.tuscany.sca.binding.ws.axis2;version="2.0.0"; org.oasisopen.sca, org.apache.axis2.i18n, org.apache.axis2.transport, - org.apache.axis2.transport.jms, org.apache.axis2.client, org.apache.axis2.context, org.apache.axiom.om.impl.builder, @@ -95,8 +94,6 @@ Import-Package: javax.servlet, org.apache.axis2.receivers, org.apache.axis2.transport, org.apache.axis2.transport.http, - org.apache.axis2.transport.jms, - org.apache.axis2.transport.local, org.apache.axis2.util.threadpool, org.apache.commons.httpclient, org.apache.commons.httpclient.params, diff --git a/modules/binding-ws-runtime-axis2/pom.xml b/modules/binding-ws-runtime-axis2/pom.xml index 09ce75a412..1fe048b522 100644 --- a/modules/binding-ws-runtime-axis2/pom.xml +++ b/modules/binding-ws-runtime-axis2/pom.xml @@ -49,261 +49,88 @@ - org.apache.axis2 - axis2-kernel - 1.5.3 - - - xerces - xmlParserAPIs - - - org.apache.axis2 - axis2-adb - - - org.apache.ant - ant - - - org.apache.ant - ant-launcher - - + org.apache.axis2 + axis2 + 1.5.3 + jar + + + org.apache.axis2 + axis2-transport-http + 1.5.3 + + + org.apache.axis2 + axis2-kernel + + + org.apache.httpcomponents + httpcore + + + + + commons-httpclient + commons-httpclient + 3.1 - org.apache.axis2 - axis2-java2wsdl - 1.5.3 + org.apache.ws.commons.axiom + axiom-api + 1.2.10 - org.apache.ant - ant + org.apache.geronimo.specs + geronimo-activation_1.1_spec + - org.apache.ant - ant-launcher + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec - xom - xom + jaxen + jaxen - - - - org.apache.axis2 - axis2-codegen - 1.5.3 - runtime - - - org.apache.axis2 - axis2-adb - - - stax - stax-api - - - - - - org.apache.axis2 - axis2-mtompolicy - 1.5.3 - - - - org.apache.axis2 - mex - 1.5.3 - impl - - - - org.apache.axis2 - axis2-transport-http - 1.5.3 - - - - org.apache.axis2 - axis2-transport-local - 1.5.3 - - - - org.apache.axis2 - axis2-transport-jms - 1.0.0 - - - - org.apache.ws.commons.axiom - axiom-api - 1.2.10 org.apache.ws.commons.axiom axiom-impl 1.2.10 - - - - org.apache.ws.commons.axiom - axiom-dom - 1.2.10 - - - - org.apache.neethi - neethi - 2.0.4 - - - org.codehaus.woodstox - wstx-asl - - - - - - commons-httpclient - commons-httpclient - 3.1 - - - - org.apache.httpcomponents - httpcore - 4.0.1 - - - - org.apache.httpcomponents - httpcore-nio - 4.0.1 - - - - commons-logging - commons-logging - 1.1.1 - - - - commons-collections - commons-collections - 3.2 - - - - commons-discovery - commons-discovery - 0.4 - - - - org.apache.santuario - xmlsec - 1.4.3 - - - - org.apache.ws.security - wss4j - 1.5.4 - bouncycastle - bcprov-jdk13 - - - bouncycastle - bcprov-jdk15 + org.apache.geronimo.specs + geronimo-activation_1.1_spec - junit - junit + org.apache.geronimo.specs + geronimo-javamail_1.4_spec - xml-apis - xml-apis + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec - opensaml - opensaml + org.codehaus.woodstox + wstx-asl - - + + - org.apache.rampart - rampart-core - 1.4 + org.apache.neethi + neethi + 2.0.4 - org.apache.ant - ant-nodeps - - - org.apache.axis2 - addressing - - - org.apache.axis2 - axis2-xmlbeans - - - org.apache.axis2 - mex - - - org.apache.axis2 - axis2-adb - - - org.apache.axis2 - axis2-codegen - - - org.apache.axis2 - axis2-adb-codegen - - - xmlbeans - xbean - - - org.apache.ws.commons.schema - XmlSchema - - - stax - stax-api - - - bouncycastle - bcprov-jdk13 - - - bouncycastle - bcprov-jdk15 - - - junit - junit - - - xml-apis - xml-apis - - - opensaml - opensaml + org.codehaus.woodstox + wstx-asl @@ -315,32 +142,6 @@ provided - - - xalan - xalan - 2.7.0 - optional - - - xml-apis - xml-apis - - - - - - xerces - xercesImpl - 2.8.1 - - - xml-apis - xml-apis - - - - org.apache.tuscany.sca @@ -372,14 +173,12 @@ test - + org.codehaus.woodstox + wstx-asl + 3.2.6 + test + diff --git a/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java b/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java index a8d35c3381..9827f62abb 100644 --- a/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java +++ b/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java @@ -59,7 +59,6 @@ import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.description.WSDLToAxisServiceBuilder; import org.apache.axis2.engine.MessageReceiver; -import org.apache.axis2.transport.local.LocalResponder; import org.apache.tuscany.sca.assembly.AbstractContract; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.common.xml.XMLDocumentHelper; @@ -141,9 +140,8 @@ public Axis2Config run() throws AxisFault, MalformedURLException { // document builder. ClassLoader wsBindingCL = getClass().getClassLoader(); ClassLoader axis2CL = URLBasedAxisConfigurator.class.getClassLoader(); - ClassLoader localtransportCL = LocalResponder.class.getClassLoader(); ClassLoaderContext classLoaderContext = - new ClassLoaderContext(wsBindingCL, axis2CL, localtransportCL); + new ClassLoaderContext(wsBindingCL, axis2CL); classLoaderContext = new ClassLoaderContext(classLoaderContext.getClassLoader(), serviceDiscovery, diff --git a/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java b/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java index e327be86be..e38b97284a 100644 --- a/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java +++ b/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java @@ -34,8 +34,6 @@ import org.apache.axis2.description.TransportInDescription; import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.ListenerManager; -import org.apache.axis2.transport.jms.JMSListener; -import org.apache.axis2.transport.jms.JMSSender; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; @@ -70,10 +68,6 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem private String deployedURI; private InterfaceContract contract; - // The Axis2 configuration that the binding creates - private JMSSender jmsSender; - private JMSListener jmsListener; - public Axis2ServiceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpoint endpoint, ServletHost servletHost ) { @@ -203,49 +197,6 @@ public void start() { } else { deployedURI = servletHost.addServletMapping(endpointURI, servlet); } - } else if (deployedURI.startsWith("jms")) { - logger.log(Level.INFO, "Axis2 JMS URL=" + deployedURI); - - jmsListener = new JMSListener(); - jmsSender = new JMSSender(); - ListenerManager listenerManager = configContext.getListenerManager(); - TransportInDescription trsIn = - configContext.getAxisConfiguration().getTransportIn(org.apache.axis2.Constants.TRANSPORT_JMS); - - // get JMS transport parameters from the computed URL -//not in Axis2 1.5.1 -// Map jmsProps = JMSUtils.getProperties(endpointURL); - - // collect the parameters used to configure the JMS transport - OMFactory fac = OMAbstractFactory.getOMFactory(); - OMElement parms = fac.createOMElement(DEFAULT_QUEUE_CONNECTION_FACTORY, null); -/* - for (String key : jmsProps.keySet()) { - OMElement param = fac.createOMElement("parameter", null); - param.addAttribute("name", key, null); - param.addChild(fac.createOMText(param, jmsProps.get(key))); - parms.addChild(param); - } -*/ - Parameter queueConnectionFactory = new Parameter(DEFAULT_QUEUE_CONNECTION_FACTORY, parms); - trsIn.addParameter(queueConnectionFactory); - - trsIn.setReceiver(jmsListener); - - configContext.getAxisConfiguration().addTransportIn(trsIn); - TransportOutDescription trsOut = - configContext.getAxisConfiguration().getTransportOut(org.apache.axis2.Constants.TRANSPORT_JMS); - //configContext.getAxisConfiguration().addTransportOut( trsOut ); - trsOut.setSender(jmsSender); - - if (listenerManager == null) { - listenerManager = new ListenerManager(); - listenerManager.init(configContext); - } - listenerManager.addListener(trsIn, true); - jmsSender.init(configContext, trsOut); - jmsListener.init(configContext, trsIn); - jmsListener.start(); } } catch (AxisFault e) { throw new RuntimeException(e); @@ -254,17 +205,7 @@ public void start() { public void stop() { try { - if (jmsListener != null) { - jmsListener.stop(); - jmsListener.destroy(); - } else { servletHost.removeServletMapping(endpointURI); - } - - if (jmsSender != null) { - jmsSender.stop(); - } - servletHost = null; // get the path to the service diff --git a/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/conf/tuscany-axis2.xml b/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/conf/tuscany-axis2.xml index 28fb6fac45..d1d1203bb9 100644 --- a/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/conf/tuscany-axis2.xml +++ b/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/conf/tuscany-axis2.xml @@ -147,8 +147,6 @@ - @@ -163,15 +161,13 @@ class="org.apache.axis2.builder.ApplicationXMLBuilder"/> - + class="org.apache.axis2.transport.http.AxisServletListener"> 6060 @@ -290,8 +286,6 @@ --> - diff --git a/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/repository/modules/modules.list b/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/repository/modules/modules.list index e6e70dfd4b..e69de29bb2 100644 --- a/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/repository/modules/modules.list +++ b/modules/binding-ws-runtime-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/repository/modules/modules.list @@ -1 +0,0 @@ -rampart-1.4.mar \ No newline at end of file From 160619c354a3345e50733a746ad484f7bb305a7a Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:14:04 +0000 Subject: [PATCH 098/174] Remove JDK5 dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044599 13f79535-47bb-0310-9956-ffa450edef68 --- modules/base-runtime-pom/pom.xml | 79 -------------------------------- 1 file changed, 79 deletions(-) diff --git a/modules/base-runtime-pom/pom.xml b/modules/base-runtime-pom/pom.xml index 4d2ad66567..5241e4a784 100644 --- a/modules/base-runtime-pom/pom.xml +++ b/modules/base-runtime-pom/pom.xml @@ -218,85 +218,6 @@ ${pom.version} - - - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0.1 - provided - - - - org.codehaus.woodstox - wstx-asl - 3.2.4 - provided - - - stax - stax-api - - - - - - javax.xml.bind - jaxb-api - 2.1 - provided - - - - javax.activation - activation - 1.1 - provided - - - - com.sun.xml.bind - jaxb-impl - 2.1.12 - provided - - - - - javax.xml.ws - jaxws-api - 2.1 - provided - - - javax.xml.soap - saaj-api - - - - - - javax.annotation - jsr250-api - 1.0 - provided - - - - javax.jws - jsr181-api - 1.0-MR1 - provided - - - - javax.xml.stream - stax-api - 1.0-2 - provided - - - From 6b2620344fc9cad2654dac348833f9016b4ea23e Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:20:10 +0000 Subject: [PATCH 099/174] Excludes for many base java dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044602 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-atom-runtime/pom.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/binding-atom-runtime/pom.xml b/modules/binding-atom-runtime/pom.xml index cc59f117ff..f582807f7c 100644 --- a/modules/binding-atom-runtime/pom.xml +++ b/modules/binding-atom-runtime/pom.xml @@ -108,6 +108,20 @@ axiom-impl 1.2.10 runtime + + + org.apache.geronimo.specs + geronimo-activation_1.1_spec + + + org.apache.geronimo.specs + geronimo-javamail_1.4_spec + + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + + @@ -119,6 +133,10 @@ org.apache.geronimo.specs geronimo-activation_1.0.2_spec + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + @@ -131,6 +149,10 @@ stax stax-api + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + xom xom @@ -158,6 +180,12 @@ org.apache.abdera abdera-extensions-json 1.1.1 + + + javax.activation + activation + + From 63b6af3ab04c762a9b5b590e66d27f59de866fc0 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:21:13 +0000 Subject: [PATCH 100/174] Remove base java dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044603 13f79535-47bb-0310-9956-ffa450edef68 --- modules/base-runtime/pom.xml | 78 ------------------------------------ 1 file changed, 78 deletions(-) diff --git a/modules/base-runtime/pom.xml b/modules/base-runtime/pom.xml index 37c38aadbd..f33352252b 100644 --- a/modules/base-runtime/pom.xml +++ b/modules/base-runtime/pom.xml @@ -212,84 +212,6 @@ ${pom.version} - - - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0.1 - provided - - - - org.codehaus.woodstox - wstx-asl - 3.2.4 - provided - - - stax - stax-api - - - - - - javax.xml.bind - jaxb-api - 2.1 - provided - - - - javax.activation - activation - 1.1 - provided - - - - com.sun.xml.bind - jaxb-impl - 2.1.12 - provided - - - - - javax.xml.ws - jaxws-api - 2.1 - provided - - - javax.xml.soap - saaj-api - - - - - - javax.annotation - jsr250-api - 1.0 - provided - - - - javax.jws - jsr181-api - 1.0-MR1 - provided - - - - javax.xml.stream - stax-api - 1.0-2 - provided - - From f41eda82f3ad7de30e15b9b1cfd5d7c88cce663a Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:22:08 +0000 Subject: [PATCH 101/174] Add test dependecy on woodstox git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044604 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-rest/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/binding-rest/pom.xml b/modules/binding-rest/pom.xml index 6c5ea2e44e..791dce4fa5 100644 --- a/modules/binding-rest/pom.xml +++ b/modules/binding-rest/pom.xml @@ -56,5 +56,12 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.9 + test + + From c169d804663dbabdab6c24637f2dc58e509bbf17 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:37:55 +0000 Subject: [PATCH 102/174] Exclude base java dependencies and add test dependency on woodstox to get a testcase working git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044606 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-json/pom.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/databinding-json/pom.xml b/modules/databinding-json/pom.xml index b7197d516b..793307bff3 100644 --- a/modules/databinding-json/pom.xml +++ b/modules/databinding-json/pom.xml @@ -106,6 +106,14 @@ stax stax-api + + org.apache.geronimo.specs + geronimo-activation_1.1_spec + + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + @@ -114,6 +122,20 @@ axiom-impl 1.2.10 runtime + + + org.apache.geronimo.specs + geronimo-activation_1.1_spec + + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + + + org.codehaus.woodstox + wstx-asl + + @@ -139,5 +161,11 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.6 + test + From 6b7bf6df8b7c69652cf225bdddf5007ee2341055 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:38:54 +0000 Subject: [PATCH 103/174] Exclude woodstox from sdo git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044607 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-sdo/pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/databinding-sdo/pom.xml b/modules/databinding-sdo/pom.xml index d8e5d79742..7b2bfab812 100644 --- a/modules/databinding-sdo/pom.xml +++ b/modules/databinding-sdo/pom.xml @@ -66,6 +66,10 @@ stax stax-api + + org.codehaus.woodstox + wstx-asl + From a50e65f258a355d185ae7d72d415c0ddfc0bd2a9 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:39:26 +0000 Subject: [PATCH 104/174] Add test dependency on jaxb impl git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044608 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-jaxb-axiom/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/databinding-jaxb-axiom/pom.xml b/modules/databinding-jaxb-axiom/pom.xml index 7f74a09a9c..2f59a1bf31 100644 --- a/modules/databinding-jaxb-axiom/pom.xml +++ b/modules/databinding-jaxb-axiom/pom.xml @@ -67,6 +67,12 @@ 1.2.10 runtime + + com.sun.xml.bind + jaxb-impl + 2.1.12 + test + From d4f3a0a1fc7e0095b6ebdceee2d15ee3e08c50dc Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:40:45 +0000 Subject: [PATCH 105/174] Exclude activation dependency thats in base java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044609 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-rest-runtime/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/binding-rest-runtime/pom.xml b/modules/binding-rest-runtime/pom.xml index 5c8d4fb4ca..ce88df7efc 100644 --- a/modules/binding-rest-runtime/pom.xml +++ b/modules/binding-rest-runtime/pom.xml @@ -121,6 +121,10 @@ org.slf4j slf4j-api + + javax.activation + activation + @@ -141,6 +145,10 @@ org.slf4j slf4j-api + + javax.activation + activation + From e434a766396109c691d5b5f5e4407504061618ab Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:41:41 +0000 Subject: [PATCH 106/174] Remove base java dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044610 13f79535-47bb-0310-9956-ffa450edef68 --- modules/implementation-jaxrs-runtime/pom.xml | 21 -------------------- 1 file changed, 21 deletions(-) diff --git a/modules/implementation-jaxrs-runtime/pom.xml b/modules/implementation-jaxrs-runtime/pom.xml index 389aecf5ee..937a51927c 100644 --- a/modules/implementation-jaxrs-runtime/pom.xml +++ b/modules/implementation-jaxrs-runtime/pom.xml @@ -63,27 +63,6 @@ 2.0-SNAPSHOT - org.apache.wink wink-server From 6bdbbd584cba243dc709b89013dddcf88485ab13 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:42:25 +0000 Subject: [PATCH 107/174] Add test dependency on woodstox to get a testcase working git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044612 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-ws/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/binding-ws/pom.xml b/modules/binding-ws/pom.xml index 0798b530c8..bb46f69049 100644 --- a/modules/binding-ws/pom.xml +++ b/modules/binding-ws/pom.xml @@ -54,6 +54,13 @@ 1.6.2 + + org.codehaus.woodstox + wstx-asl + 3.2.9 + test + + From 084ec1e1d0134b9836818d4bbc276f5eb7705b0e Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 09:42:46 +0000 Subject: [PATCH 108/174] Add test dependency on woodstox to get a testcase working git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044614 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-jms/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/binding-jms/pom.xml b/modules/binding-jms/pom.xml index dc3133cfd2..4d05f777a3 100644 --- a/modules/binding-jms/pom.xml +++ b/modules/binding-jms/pom.xml @@ -43,6 +43,13 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.9 + test + + From d4a97843b8ae6ebf9ec00379235853f666891b87 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:08:30 +0000 Subject: [PATCH 109/174] Correct import git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044619 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java b/testing/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java index ef88c22baa..1c36073cf1 100644 --- a/testing/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java +++ b/testing/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java @@ -18,9 +18,9 @@ */ package org.apache.tuscany.sca.itest.oneway.impl; -import org.apache.tuscany.sca.itest.oneway.OneWayService; +import java.util.concurrent.atomic.AtomicInteger; -import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; +import org.apache.tuscany.sca.itest.oneway.OneWayService; /** * The service for the oneway itest. From fe0c07772912d8b3ce2d2c35fd0fd0c441a19fbc Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:32:02 +0000 Subject: [PATCH 110/174] Correct dependency name git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044623 13f79535-47bb-0310-9956-ffa450edef68 --- .../learning-more/implementation-web/helloworld-servlet/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/learning-more/implementation-web/helloworld-servlet/pom.xml b/samples/learning-more/implementation-web/helloworld-servlet/pom.xml index d812ddb186..79154be46a 100644 --- a/samples/learning-more/implementation-web/helloworld-servlet/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-servlet/pom.xml @@ -34,7 +34,7 @@ org.apache.tuscany.sca - tuscany-base-runtime-nodep + tuscany-base-runtime 2.0-SNAPSHOT From a8ac72dcd98eb01cd4b59bd7a28de58d9114a6c5 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:32:51 +0000 Subject: [PATCH 111/174] Correct dependency name git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044624 13f79535-47bb-0310-9956-ffa450edef68 --- samples/learning-more/implementation-web/helloworld-jsf/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/learning-more/implementation-web/helloworld-jsf/pom.xml b/samples/learning-more/implementation-web/helloworld-jsf/pom.xml index cbda8bc601..cd260705d8 100644 --- a/samples/learning-more/implementation-web/helloworld-jsf/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-jsf/pom.xml @@ -41,7 +41,7 @@ org.apache.tuscany.sca - tuscany-implementation-web-runtime + tuscany-base-runtime 2.0-SNAPSHOT runtime From 20512249b0052d8988d040d3dcf415407d9ac1be Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:33:48 +0000 Subject: [PATCH 112/174] Correct dependency name and add exclude git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044625 13f79535-47bb-0310-9956-ffa450edef68 --- .../helloworld-jaxrs/pom.xml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml b/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml index 94ab56cc30..a7d2fd5e22 100644 --- a/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml @@ -35,7 +35,7 @@ org.apache.tuscany.sca - tuscany-base-runtime-nodep + tuscany-base-runtime 2.0-SNAPSHOT @@ -48,22 +48,22 @@ org.apache.wink wink-server - 1.1.2-incubating - - - javax.xml.bind - jaxb-api - - - com.sun.xml.bind - jaxb-impl - - - org.slf4j - slf4j-api - + 1.1.2-incubating + + + javax.xml.bind + jaxb-api + + + com.sun.xml.bind + jaxb-impl + + + org.slf4j + slf4j-api + - + org.slf4j From e746dec5dfceccaf09f87b54eecdf5683cc23d97 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:43:38 +0000 Subject: [PATCH 113/174] Add woodstox as test dependency to fix tests git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044626 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/builder/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing/itest/builder/pom.xml b/testing/itest/builder/pom.xml index b4851dacc2..121adefffe 100644 --- a/testing/itest/builder/pom.xml +++ b/testing/itest/builder/pom.xml @@ -47,6 +47,13 @@ 6.1.19 + + xerces + xercesImpl + 2.9.1 + test + + From 7dc4feab0bc51ad55a63e340afad6e1132273ac7 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:44:13 +0000 Subject: [PATCH 114/174] Add woodstox as test dependency to fix tests git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044627 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/java-ci/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testing/compliance-tests/java-ci/pom.xml b/testing/compliance-tests/java-ci/pom.xml index c9a5eb7bb1..5b8b938157 100644 --- a/testing/compliance-tests/java-ci/pom.xml +++ b/testing/compliance-tests/java-ci/pom.xml @@ -55,6 +55,12 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.9 + + From 0e4c430afd10045c59aafb277d4e16d4d4f8a722 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:45:07 +0000 Subject: [PATCH 115/174] Add woodstox as test dependency to fix tests, and log4j as the oasis artifacts include it in the log config git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044628 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/java-caa/pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/testing/compliance-tests/java-caa/pom.xml b/testing/compliance-tests/java-caa/pom.xml index e76a9a9d69..acfe75a243 100644 --- a/testing/compliance-tests/java-caa/pom.xml +++ b/testing/compliance-tests/java-caa/pom.xml @@ -57,6 +57,12 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.9 + + junit junit @@ -64,6 +70,13 @@ test + + log4j + log4j + 1.2.16 + test + + From 7e13180c593cba93856311330ca263ea3fb2eb48 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:45:50 +0000 Subject: [PATCH 116/174] Add woodstox as test dependency to fix tests git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044629 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/binding-ws/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing/compliance-tests/binding-ws/pom.xml b/testing/compliance-tests/binding-ws/pom.xml index e09c910a47..f659186c75 100644 --- a/testing/compliance-tests/binding-ws/pom.xml +++ b/testing/compliance-tests/binding-ws/pom.xml @@ -50,6 +50,13 @@ 2.0-SNAPSHOT + + org.codehaus.woodstox + wstx-asl + 3.2.9 + runtime + + org.mortbay.jetty jetty From c72dcab76822aa11a6ddb282dd3c61a440250a5e Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:46:21 +0000 Subject: [PATCH 117/174] Add woodstox as test dependency to fix tests git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044630 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/assembly/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testing/compliance-tests/assembly/pom.xml b/testing/compliance-tests/assembly/pom.xml index 973bec43be..650db484e7 100644 --- a/testing/compliance-tests/assembly/pom.xml +++ b/testing/compliance-tests/assembly/pom.xml @@ -57,6 +57,12 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.9 + + junit junit From 0d49e40a7513066427698f00fd2ef6078ecf5c43 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:46:57 +0000 Subject: [PATCH 118/174] Add woodstox as test dependency to fix tests git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044631 13f79535-47bb-0310-9956-ffa450edef68 --- testing/compliance-tests/policy/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testing/compliance-tests/policy/pom.xml b/testing/compliance-tests/policy/pom.xml index dc8d4dd199..afdc97a1af 100644 --- a/testing/compliance-tests/policy/pom.xml +++ b/testing/compliance-tests/policy/pom.xml @@ -57,6 +57,12 @@ test + + org.codehaus.woodstox + wstx-asl + 3.2.9 + + junit junit From 10a9175a05585de0bf866c4268f1940473d359f8 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 10:48:11 +0000 Subject: [PATCH 119/174] Remove old dependencies from LICENSE git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044632 13f79535-47bb-0310-9956-ffa450edef68 --- distribution/all/src/main/release/bin/LICENSE | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/distribution/all/src/main/release/bin/LICENSE b/distribution/all/src/main/release/bin/LICENSE index 055bd32ed5..09fca794ce 100644 --- a/distribution/all/src/main/release/bin/LICENSE +++ b/distribution/all/src/main/release/bin/LICENSE @@ -225,21 +225,12 @@ The following components come under Apache Software License 2.0 abdera-server-1.1.1.jar addressing-1.3.mar aopalliance-1.0.jar - annogen-0.1.0.jar aspectjrt-1.6.8.jar aspectjweaver-1.6.8.jar axiom-api-1.2.10.jar - axiom-dom-1.2.10.jar axiom-impl-1.2.10.jar - axis2-codegen-1.5.3.jar - axis2-kernel-1.5.3.jar - axis2-java2wsdl-1.5.3.jar - axis2-mtompolicy-1.5.3.jar - axis2-transport-base-1.0.0.jar - axis2-transport-jms-1.0.0.jar - axis2-transport-local-1.5.3.jar + axis2-1.5.3-jar.jar axis2-transport-http-1.5.3.jar - axis-ant-1.4.jar bsf-utils-3.1.jar cglib-2.2.jar commons-beanutils-1.7.0.jar @@ -248,34 +239,28 @@ The following components come under Apache Software License 2.0 commons-codec-1.4.jar commons-digester-1.8.jar commons-discovery-0.4.jar - commons-fileupload-1.2.jar commons-httpclient-3.1.jar commons-lang-2.3.jar commons-logging-1.1.1.jar commons-pool-1.3.jar derby-10.4.1.3.jar dwr-2.0.3.jar - geronimo-activation_1.1_spec-1.0.2.jar geronimo-annotation_1.1_spec-1.0.jar geronimo-connector-2.1.4.jar geronimo-ejb_3.0_spec-1.0.1.jar geronimo-javamail_1.4_spec-1.6.jar geronimo-jms_1.1_spec-1.1.1.jar geronimo-jpa_3.0_spec-1.1.1.jar - geronimo-jta_1.0.1B_spec-1.0.jar geronimo-jta_1.1_spec-1.1.1.jar geronimo-j2ee-connector_1.5_spec-2.0.0.jar geronimo-kernel-2.0.1.jar - geronimo-stax-api_1.0_spec-1.0.1.jar geronimo-transaction-2.1.4.jar - geronimo-ws-metadata_2.0_spec-1.1.2.jar groovy-all-1.7.1.jar gson-1.4.jar hazelcast-1.8.3.jar hazelcast-client-1.8.3.jar httpclient-4.0.3.jar httpcore-4.0.1.jar - httpcore-nio-4.0.1.jar jabsorb-1.3.1.jar jackson-core-asl-1.6.3.jar jackson-mapper-asl-1.6.3.jar @@ -285,7 +270,6 @@ The following components come under Apache Software License 2.0 jetty-util-6.1.19.jar juli-6.0.26.jar log4j-1.2.15.jar - mex-1.5.3-impl.jar myfaces-api-1.2.2.jar myfaces-impl-1.2.2.jar neethi-2.0.4.jar @@ -305,9 +289,6 @@ The following components come under Apache Software License 2.0 ode-scheduler-simple-1.3.2.jar ode-utils-1.3.2.jar openjpa-1.2.1.jar - rampart-core-1.4.jar - rampart-policy-1.4.jar - rampart-trust-1.4.jar regexp-1.3.jar spring-aop-3.0.2.RELEASE.jar spring-asm-3.0.2.RELEASE.jar @@ -321,14 +302,9 @@ The following components come under Apache Software License 2.0 wink-common-1.1.2-incubating.jar wink-client-1.1.2-incubating.jar wink-server-1.1.2-incubating.jar - woden-api-1.0M8.jar - woden-impl-dom-1.0M8.jar - wss4j-1.5.4.jar - wstx-asl-3.2.9.jar xalan-2.7.0.jar xercesImpl-2.8.1.jar xmlbeans-2.3.0.jar - xmlsec-1.4.3.jar XmlSchema-1.4.3.jar =============================================================================== @@ -691,7 +667,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================ The jars; -activation-1.1.jar, atmosphere-annotations-0.6.1.jar, atmosphere-commons-0.6.1.jar, atmosphere-compat-jbossweb-0.6.1.jar, @@ -699,13 +674,8 @@ atmosphere-compat-tomcat-0.6.1.jar, atmosphere-compat-weblogic-0.6.1.jar, atmosphere-jersey-0.6.1.jar, atmosphere-runtime-0.6.1.jar, -jaxb-api-2.1.jar, -jaxb-impl-2.1.12.jar, -jaxws-api-2.1.jar, jersey-core-1.3.jar, jersey-server-1.3.jar, -jsr181-api-1.0-MR1.jar, -jsr250-api-1.0.jar, jstl-1.1.2.jar, mail-1.4.jar, servlet-api-2.5.jar, From 52cfeaf4d75463e664d25cc313a1e0598269b5f9 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 11:49:07 +0000 Subject: [PATCH 120/174] Use a consistent version of woodstox git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044638 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/policies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/itest/policies/pom.xml b/testing/itest/policies/pom.xml index c15d9422d5..3c784fef62 100644 --- a/testing/itest/policies/pom.xml +++ b/testing/itest/policies/pom.xml @@ -44,7 +44,7 @@ org.codehaus.woodstox wstx-asl - 3.2.6 + 3.2.9 runtime From bdb54e5507c51dee2be8403bde9ff4e894bffc45 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 12:42:15 +0000 Subject: [PATCH 121/174] Add woodstox to get tests to pass git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044643 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/ws/endpoint-references/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testing/itest/ws/endpoint-references/pom.xml b/testing/itest/ws/endpoint-references/pom.xml index f69c303a50..ed5dee78fe 100644 --- a/testing/itest/ws/endpoint-references/pom.xml +++ b/testing/itest/ws/endpoint-references/pom.xml @@ -49,6 +49,12 @@ 6.1.19 + + org.codehaus.woodstox + wstx-asl + 3.2.9 + + From 2bad8f9773a2d236b40a535f04e1d60967b9fc9c Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 13:39:04 +0000 Subject: [PATCH 122/174] Add woodstox to get tests to pass git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044653 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/ws/authentication-basic/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testing/itest/ws/authentication-basic/pom.xml b/testing/itest/ws/authentication-basic/pom.xml index ea79c1a91f..92ff953edd 100644 --- a/testing/itest/ws/authentication-basic/pom.xml +++ b/testing/itest/ws/authentication-basic/pom.xml @@ -49,6 +49,11 @@ 6.1.19 + + org.codehaus.woodstox + wstx-asl + 3.2.9 + From 004e557ef8d3ad7b46925d28d06c4253861039ce Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sat, 11 Dec 2010 13:39:57 +0000 Subject: [PATCH 123/174] Correct dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044654 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation-bpel/helloworld-bpel-webapp/pom.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml b/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml index e17919fd4c..eeed686667 100644 --- a/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml +++ b/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml @@ -41,17 +41,10 @@ org.apache.tuscany.sca - tuscany-sca-api + tuscany-base-runtime ${tuscany.version} - - org.apache.tuscany.sca - tuscany-implementation-web-runtime - ${tuscany.version} - runtime - - org.apache.tuscany.sca tuscany-implementation-bpel-runtime From 6f9d7bf4580140fc4bc3f622083b1482a2331005 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Sun, 12 Dec 2010 09:40:43 +0000 Subject: [PATCH 124/174] Add a few more excludes for APIs in base Java git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1044777 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-axiom/pom.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/databinding-axiom/pom.xml b/modules/databinding-axiom/pom.xml index c783cdc7ab..8a1e41fa7c 100644 --- a/modules/databinding-axiom/pom.xml +++ b/modules/databinding-axiom/pom.xml @@ -54,6 +54,22 @@ xml-apis xml-apis + + org.apache.geronimo.specs + geronimo-activation_1.1_spec + + + org.apache.geronimo.specs + geronimo-javamail_1.4_spec + + + jaxen + jaxen + + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + @@ -67,6 +83,14 @@ stax stax-api + + org.apache.geronimo.specs + geronimo-activation_1.1_spec + + + org.apache.geronimo.specs + geronimo-javamail_1.4_spec + From d8a6a4d7241f6b36bf9527069890e549918e9037 Mon Sep 17 00:00:00 2001 From: Florian Moga Date: Mon, 13 Dec 2010 09:12:10 +0000 Subject: [PATCH 125/174] Corrected wrong parent poms. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045041 13f79535-47bb-0310-9956-ffa450edef68 --- samples/applications/eightball-demo/pom.xml | 4 ++-- samples/applications/logging-scribe/helloworld-scribe/pom.xml | 2 +- samples/applications/logging-scribe/pom.xml | 2 +- samples/applications/store-webapp/pom.xml | 2 +- samples/applications/store/pom.xml | 2 +- samples/extending-tuscany/binding-sample/pom.xml | 4 ++-- samples/extending-tuscany/implementation-sample/pom.xml | 4 ++-- samples/getting-started/callback-api/pom.xml | 2 +- samples/getting-started/helloworld-contribution/pom.xml | 2 +- samples/getting-started/helloworld-webapp/pom.xml | 4 ++-- samples/getting-started/sca-scopes/pom.xml | 2 +- samples/getting-started/scdl-include-contribution/pom.xml | 2 +- samples/learning-more/async/calculator-contribution/pom.xml | 2 +- samples/learning-more/async/pom.xml | 2 +- samples/learning-more/binding-comet/pom.xml | 4 ++-- samples/learning-more/binding-comet/weather-webapp/pom.xml | 2 +- samples/learning-more/binding-jms/helloworld-webapp/pom.xml | 4 ++-- samples/learning-more/binding-jms/pom.xml | 2 +- .../binding-jsonrpc/calculator-contribution/pom.xml | 2 +- .../learning-more/binding-jsonrpc/calculator-webapp/pom.xml | 2 +- samples/learning-more/binding-jsonrpc/pom.xml | 4 ++-- .../binding-rmi/calculator-reference-contribution/pom.xml | 2 +- .../binding-rmi/calculator-service-contribution/pom.xml | 2 +- samples/learning-more/binding-rmi/pom.xml | 2 +- .../learning-more/binding-sca/calculator-contribution/pom.xml | 2 +- samples/learning-more/binding-sca/pom.xml | 2 +- .../learning-more/binding-ws/calculator-contribution/pom.xml | 2 +- .../binding-ws/helloworld-ws-sdo-contribution/pom.xml | 2 +- samples/learning-more/binding-ws/holder-ws-service/pom.xml | 2 +- samples/learning-more/binding-ws/pom.xml | 2 +- .../dosgi-dynamic-calculator-operations/pom.xml | 2 +- .../distributed-osgi/dosgi-dynamic-calculator/pom.xml | 2 +- samples/learning-more/distributed-osgi/pom.xml | 2 +- .../implementation-bpel/helloworld-bpel-contribution/pom.xml | 2 +- .../implementation-bpel/helloworld-bpel-webapp/pom.xml | 4 ++-- samples/learning-more/implementation-bpel/pom.xml | 4 ++-- .../implementation-composite/helloworld-recursive-ws/pom.xml | 2 +- .../implementation-composite/helloworld-recursive/pom.xml | 2 +- samples/learning-more/implementation-composite/pom.xml | 4 ++-- .../implementation-java/calculator-contribution/pom.xml | 2 +- samples/learning-more/implementation-java/pom.xml | 2 +- .../implementation-osgi/dosgi-calculator-operations/pom.xml | 2 +- .../implementation-osgi/dosgi-calculator/pom.xml | 2 +- samples/learning-more/implementation-osgi/pom.xml | 2 +- .../implementation-script/calculator-contribution/pom.xml | 2 +- samples/learning-more/implementation-script/pom.xml | 2 +- .../helloworld-spring-contribution/pom.xml | 2 +- .../implementation-spring/helloworld-spring-webapp/pom.xml | 4 ++-- samples/learning-more/implementation-spring/pom.xml | 4 ++-- .../learning-more/implementation-web/helloworld-jaxrs/pom.xml | 4 ++-- .../implementation-web/helloworld-js-client/pom.xml | 4 ++-- .../learning-more/implementation-web/helloworld-jsf/pom.xml | 4 ++-- .../learning-more/implementation-web/helloworld-jsp/pom.xml | 4 ++-- .../implementation-web/helloworld-servlet/pom.xml | 4 ++-- .../implementation-web/helloworld-stripes/pom.xml | 4 ++-- samples/learning-more/implementation-web/pom.xml | 2 +- samples/learning-more/sca-client/calculator-scaclient/pom.xml | 2 +- samples/learning-more/sca-client/helloworld-scaclient/pom.xml | 2 +- samples/learning-more/sca-client/pom.xml | 2 +- samples/running-tuscany/embedded-jse/pom.xml | 2 +- samples/running-tuscany/embedded-osgi-base/pom.xml | 2 +- samples/running-tuscany/embedded-osgi/pom.xml | 2 +- .../maven-junit/calculator-contribution/pom.xml | 2 +- samples/running-tuscany/maven-junit/pom.xml | 2 +- samples/running-tuscany/shell/pom.xml | 2 +- 65 files changed, 83 insertions(+), 83 deletions(-) diff --git a/samples/applications/eightball-demo/pom.xml b/samples/applications/eightball-demo/pom.xml index 2499576fec..b58b73c0d4 100644 --- a/samples/applications/eightball-demo/pom.xml +++ b/samples/applications/eightball-demo/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-applications 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml tuscany-eightball-demo pom diff --git a/samples/applications/logging-scribe/helloworld-scribe/pom.xml b/samples/applications/logging-scribe/helloworld-scribe/pom.xml index c16751f579..7cef24e977 100644 --- a/samples/applications/logging-scribe/helloworld-scribe/pom.xml +++ b/samples/applications/logging-scribe/helloworld-scribe/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-logging-scribe 2.0-SNAPSHOT ../pom.xml diff --git a/samples/applications/logging-scribe/pom.xml b/samples/applications/logging-scribe/pom.xml index 0a12d8577a..dd759ff2f0 100644 --- a/samples/applications/logging-scribe/pom.xml +++ b/samples/applications/logging-scribe/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-applications 2.0-SNAPSHOT ../pom.xml diff --git a/samples/applications/store-webapp/pom.xml b/samples/applications/store-webapp/pom.xml index 427bba3f45..a68bce2ea6 100644 --- a/samples/applications/store-webapp/pom.xml +++ b/samples/applications/store-webapp/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-applications 2.0-SNAPSHOT ../pom.xml diff --git a/samples/applications/store/pom.xml b/samples/applications/store/pom.xml index 965f8583a3..94778a4833 100644 --- a/samples/applications/store/pom.xml +++ b/samples/applications/store/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-applications 2.0-SNAPSHOT ../pom.xml diff --git a/samples/extending-tuscany/binding-sample/pom.xml b/samples/extending-tuscany/binding-sample/pom.xml index 4af16a6871..fa2b574338 100644 --- a/samples/extending-tuscany/binding-sample/pom.xml +++ b/samples/extending-tuscany/binding-sample/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-extending-tuscany 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-binding-extension diff --git a/samples/extending-tuscany/implementation-sample/pom.xml b/samples/extending-tuscany/implementation-sample/pom.xml index 94dbe0ddb7..8d54e83ed8 100644 --- a/samples/extending-tuscany/implementation-sample/pom.xml +++ b/samples/extending-tuscany/implementation-sample/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-extending-tuscany 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-extension Apache Tuscany SCA Sample Implementation Extension diff --git a/samples/getting-started/callback-api/pom.xml b/samples/getting-started/callback-api/pom.xml index 6d0515a003..2fb5eb9b15 100644 --- a/samples/getting-started/callback-api/pom.xml +++ b/samples/getting-started/callback-api/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-getting-started-contributions 2.0-SNAPSHOT ../pom.xml diff --git a/samples/getting-started/helloworld-contribution/pom.xml b/samples/getting-started/helloworld-contribution/pom.xml index 4a33c10971..4c9e17d553 100644 --- a/samples/getting-started/helloworld-contribution/pom.xml +++ b/samples/getting-started/helloworld-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-getting-started-contributions 2.0-SNAPSHOT ../pom.xml diff --git a/samples/getting-started/helloworld-webapp/pom.xml b/samples/getting-started/helloworld-webapp/pom.xml index d1876b94d8..058ba84bd8 100644 --- a/samples/getting-started/helloworld-webapp/pom.xml +++ b/samples/getting-started/helloworld-webapp/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-getting-started-contributions 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-helloworld-webapp diff --git a/samples/getting-started/sca-scopes/pom.xml b/samples/getting-started/sca-scopes/pom.xml index 318763759f..404c8cc4ff 100644 --- a/samples/getting-started/sca-scopes/pom.xml +++ b/samples/getting-started/sca-scopes/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-getting-started-contributions 2.0-SNAPSHOT ../pom.xml diff --git a/samples/getting-started/scdl-include-contribution/pom.xml b/samples/getting-started/scdl-include-contribution/pom.xml index ee18154669..a4afa47cb3 100644 --- a/samples/getting-started/scdl-include-contribution/pom.xml +++ b/samples/getting-started/scdl-include-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-getting-started-contributions 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/async/calculator-contribution/pom.xml b/samples/learning-more/async/calculator-contribution/pom.xml index 1e339d8d0d..01555e08df 100644 --- a/samples/learning-more/async/calculator-contribution/pom.xml +++ b/samples/learning-more/async/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-sca + sample-tuscany-async 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/async/pom.xml b/samples/learning-more/async/pom.xml index 0f46f8399f..265b9fea8c 100644 --- a/samples/learning-more/async/pom.xml +++ b/samples/learning-more/async/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-comet/pom.xml b/samples/learning-more/binding-comet/pom.xml index e869146778..fefce3bdd2 100644 --- a/samples/learning-more/binding-comet/pom.xml +++ b/samples/learning-more/binding-comet/pom.xml @@ -21,11 +21,11 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml - tuscany-sample-binding-comet + tuscany-samples-binding-comet pom Apache Tuscany SCA Sample binding.comet diff --git a/samples/learning-more/binding-comet/weather-webapp/pom.xml b/samples/learning-more/binding-comet/weather-webapp/pom.xml index 8cb729e00d..95c1ede7c2 100644 --- a/samples/learning-more/binding-comet/weather-webapp/pom.xml +++ b/samples/learning-more/binding-comet/weather-webapp/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-binding-comet 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-jms/helloworld-webapp/pom.xml b/samples/learning-more/binding-jms/helloworld-webapp/pom.xml index ec59d4f0a0..e4e495d65a 100644 --- a/samples/learning-more/binding-jms/helloworld-webapp/pom.xml +++ b/samples/learning-more/binding-jms/helloworld-webapp/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-jms 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-binding-jms-helloworld-webapp diff --git a/samples/learning-more/binding-jms/pom.xml b/samples/learning-more/binding-jms/pom.xml index 7ae0cc6c55..760f74b2fc 100644 --- a/samples/learning-more/binding-jms/pom.xml +++ b/samples/learning-more/binding-jms/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-jsonrpc/calculator-contribution/pom.xml b/samples/learning-more/binding-jsonrpc/calculator-contribution/pom.xml index ffaf2d15eb..c511880900 100644 --- a/samples/learning-more/binding-jsonrpc/calculator-contribution/pom.xml +++ b/samples/learning-more/binding-jsonrpc/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-binding-jsonrpc 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-jsonrpc/calculator-webapp/pom.xml b/samples/learning-more/binding-jsonrpc/calculator-webapp/pom.xml index ff434d28da..bb56cd4eaf 100644 --- a/samples/learning-more/binding-jsonrpc/calculator-webapp/pom.xml +++ b/samples/learning-more/binding-jsonrpc/calculator-webapp/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-binding-jsonrpc 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-jsonrpc/pom.xml b/samples/learning-more/binding-jsonrpc/pom.xml index cabcc8ea00..7426d1ee31 100644 --- a/samples/learning-more/binding-jsonrpc/pom.xml +++ b/samples/learning-more/binding-jsonrpc/pom.xml @@ -21,11 +21,11 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml - tuscany-sample-binding-jsonrpc + tuscany-samples-binding-jsonrpc pom Apache Tuscany SCA Sample binding.jsonrpc diff --git a/samples/learning-more/binding-rmi/calculator-reference-contribution/pom.xml b/samples/learning-more/binding-rmi/calculator-reference-contribution/pom.xml index fd2fb1683c..4fda33803a 100644 --- a/samples/learning-more/binding-rmi/calculator-reference-contribution/pom.xml +++ b/samples/learning-more/binding-rmi/calculator-reference-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-rmi 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-rmi/calculator-service-contribution/pom.xml b/samples/learning-more/binding-rmi/calculator-service-contribution/pom.xml index 9a719441e0..7c862beee7 100644 --- a/samples/learning-more/binding-rmi/calculator-service-contribution/pom.xml +++ b/samples/learning-more/binding-rmi/calculator-service-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-rmi 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-rmi/pom.xml b/samples/learning-more/binding-rmi/pom.xml index 9e27c39e34..81a309ed9f 100644 --- a/samples/learning-more/binding-rmi/pom.xml +++ b/samples/learning-more/binding-rmi/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-sca/calculator-contribution/pom.xml b/samples/learning-more/binding-sca/calculator-contribution/pom.xml index 688eec7314..6f08be42ed 100644 --- a/samples/learning-more/binding-sca/calculator-contribution/pom.xml +++ b/samples/learning-more/binding-sca/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-sca 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-sca/pom.xml b/samples/learning-more/binding-sca/pom.xml index 6497c5b719..6b90dd713f 100644 --- a/samples/learning-more/binding-sca/pom.xml +++ b/samples/learning-more/binding-sca/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-ws/calculator-contribution/pom.xml b/samples/learning-more/binding-ws/calculator-contribution/pom.xml index edc6c4f387..76cd542889 100644 --- a/samples/learning-more/binding-ws/calculator-contribution/pom.xml +++ b/samples/learning-more/binding-ws/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-ws 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-ws/helloworld-ws-sdo-contribution/pom.xml b/samples/learning-more/binding-ws/helloworld-ws-sdo-contribution/pom.xml index 3ab5472638..d2472291e1 100644 --- a/samples/learning-more/binding-ws/helloworld-ws-sdo-contribution/pom.xml +++ b/samples/learning-more/binding-ws/helloworld-ws-sdo-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-ws 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-ws/holder-ws-service/pom.xml b/samples/learning-more/binding-ws/holder-ws-service/pom.xml index 98b347a15e..37e9fef9f7 100644 --- a/samples/learning-more/binding-ws/holder-ws-service/pom.xml +++ b/samples/learning-more/binding-ws/holder-ws-service/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-binding-ws 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/binding-ws/pom.xml b/samples/learning-more/binding-ws/pom.xml index 7787c641cb..5cf72633fe 100644 --- a/samples/learning-more/binding-ws/pom.xml +++ b/samples/learning-more/binding-ws/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator-operations/pom.xml b/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator-operations/pom.xml index c52aac5e6d..3f06c2665f 100644 --- a/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator-operations/pom.xml +++ b/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator-operations/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-distributed-osgi 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator/pom.xml b/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator/pom.xml index fadfdff1ab..9739662478 100644 --- a/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator/pom.xml +++ b/samples/learning-more/distributed-osgi/dosgi-dynamic-calculator/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-distributed-osgi 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/distributed-osgi/pom.xml b/samples/learning-more/distributed-osgi/pom.xml index fefbffb638..a68ee3fbed 100644 --- a/samples/learning-more/distributed-osgi/pom.xml +++ b/samples/learning-more/distributed-osgi/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-bpel/helloworld-bpel-contribution/pom.xml b/samples/learning-more/implementation-bpel/helloworld-bpel-contribution/pom.xml index 8f7a97c555..f847ff9322 100644 --- a/samples/learning-more/implementation-bpel/helloworld-bpel-contribution/pom.xml +++ b/samples/learning-more/implementation-bpel/helloworld-bpel-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-implementation-bpel 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml b/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml index eeed686667..0c7c4c230c 100644 --- a/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml +++ b/samples/learning-more/implementation-bpel/helloworld-bpel-webapp/pom.xml @@ -23,9 +23,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-implementation-bpel 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-bpel-helloworld-webapp diff --git a/samples/learning-more/implementation-bpel/pom.xml b/samples/learning-more/implementation-bpel/pom.xml index 31ba2f291f..e5945d2f52 100644 --- a/samples/learning-more/implementation-bpel/pom.xml +++ b/samples/learning-more/implementation-bpel/pom.xml @@ -21,11 +21,11 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml - tuscany-samples-implememtation-bpel + tuscany-sample-implementation-bpel pom Apache Tuscany SCA Implementation BPEL Samples diff --git a/samples/learning-more/implementation-composite/helloworld-recursive-ws/pom.xml b/samples/learning-more/implementation-composite/helloworld-recursive-ws/pom.xml index 1248e6236a..9aea2223b3 100644 --- a/samples/learning-more/implementation-composite/helloworld-recursive-ws/pom.xml +++ b/samples/learning-more/implementation-composite/helloworld-recursive-ws/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-composite 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-composite/helloworld-recursive/pom.xml b/samples/learning-more/implementation-composite/helloworld-recursive/pom.xml index 509714c5cd..ab959a5f54 100644 --- a/samples/learning-more/implementation-composite/helloworld-recursive/pom.xml +++ b/samples/learning-more/implementation-composite/helloworld-recursive/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-composite 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-composite/pom.xml b/samples/learning-more/implementation-composite/pom.xml index f19bdfc99c..baad81945e 100644 --- a/samples/learning-more/implementation-composite/pom.xml +++ b/samples/learning-more/implementation-composite/pom.xml @@ -21,11 +21,11 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml - tuscany-samples-implememtation-composite + tuscany-samples-implementation-composite pom Apache Tuscany SCA Implementation Composite Samples diff --git a/samples/learning-more/implementation-java/calculator-contribution/pom.xml b/samples/learning-more/implementation-java/calculator-contribution/pom.xml index 3782f60128..5b5375f6db 100644 --- a/samples/learning-more/implementation-java/calculator-contribution/pom.xml +++ b/samples/learning-more/implementation-java/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-implementation-java 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-java/pom.xml b/samples/learning-more/implementation-java/pom.xml index 7014c1dde1..65fe334e33 100644 --- a/samples/learning-more/implementation-java/pom.xml +++ b/samples/learning-more/implementation-java/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-osgi/dosgi-calculator-operations/pom.xml b/samples/learning-more/implementation-osgi/dosgi-calculator-operations/pom.xml index 13525a8cc8..770a20b58f 100644 --- a/samples/learning-more/implementation-osgi/dosgi-calculator-operations/pom.xml +++ b/samples/learning-more/implementation-osgi/dosgi-calculator-operations/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-distributed-osgi-static 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-osgi/dosgi-calculator/pom.xml b/samples/learning-more/implementation-osgi/dosgi-calculator/pom.xml index 18c7b7dc60..f15cab63b1 100644 --- a/samples/learning-more/implementation-osgi/dosgi-calculator/pom.xml +++ b/samples/learning-more/implementation-osgi/dosgi-calculator/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-distributed-osgi-static 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-osgi/pom.xml b/samples/learning-more/implementation-osgi/pom.xml index 56d975dea8..ad5421c32a 100644 --- a/samples/learning-more/implementation-osgi/pom.xml +++ b/samples/learning-more/implementation-osgi/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-script/calculator-contribution/pom.xml b/samples/learning-more/implementation-script/calculator-contribution/pom.xml index 3930949766..11836ec19b 100644 --- a/samples/learning-more/implementation-script/calculator-contribution/pom.xml +++ b/samples/learning-more/implementation-script/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-implementation-script 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-script/pom.xml b/samples/learning-more/implementation-script/pom.xml index 4f415a6fa5..6dcf2bb71f 100644 --- a/samples/learning-more/implementation-script/pom.xml +++ b/samples/learning-more/implementation-script/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-spring/helloworld-spring-contribution/pom.xml b/samples/learning-more/implementation-spring/helloworld-spring-contribution/pom.xml index 9f3660b00f..a1e1c86706 100644 --- a/samples/learning-more/implementation-spring/helloworld-spring-contribution/pom.xml +++ b/samples/learning-more/implementation-spring/helloworld-spring-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-spring 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/implementation-spring/helloworld-spring-webapp/pom.xml b/samples/learning-more/implementation-spring/helloworld-spring-webapp/pom.xml index da6e36fe36..5b96d7d913 100644 --- a/samples/learning-more/implementation-spring/helloworld-spring-webapp/pom.xml +++ b/samples/learning-more/implementation-spring/helloworld-spring-webapp/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-spring 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-spring-helloworld-webapp diff --git a/samples/learning-more/implementation-spring/pom.xml b/samples/learning-more/implementation-spring/pom.xml index f3e96c70bd..89acc85399 100644 --- a/samples/learning-more/implementation-spring/pom.xml +++ b/samples/learning-more/implementation-spring/pom.xml @@ -21,11 +21,11 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml - tuscany-samples-implememtation-spring + tuscany-samples-implementation-spring pom Apache Tuscany SCA Implementation Spring Samples diff --git a/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml b/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml index a7d2fd5e22..43b0e64daa 100644 --- a/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-jaxrs/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-webapp 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-web-helloworld-jaxrs-webapp diff --git a/samples/learning-more/implementation-web/helloworld-js-client/pom.xml b/samples/learning-more/implementation-web/helloworld-js-client/pom.xml index b0801d79f2..bbde1b0d65 100644 --- a/samples/learning-more/implementation-web/helloworld-js-client/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-js-client/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-webapp 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-web-helloworld-js-client-webapp diff --git a/samples/learning-more/implementation-web/helloworld-jsf/pom.xml b/samples/learning-more/implementation-web/helloworld-jsf/pom.xml index cd260705d8..d93f1475ab 100644 --- a/samples/learning-more/implementation-web/helloworld-jsf/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-jsf/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-webapp 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-web-helloworld-jsf-webapp diff --git a/samples/learning-more/implementation-web/helloworld-jsp/pom.xml b/samples/learning-more/implementation-web/helloworld-jsp/pom.xml index 66478f9963..0aeed87589 100644 --- a/samples/learning-more/implementation-web/helloworld-jsp/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-jsp/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-webapp 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-web-helloworld-jsp-webapp diff --git a/samples/learning-more/implementation-web/helloworld-servlet/pom.xml b/samples/learning-more/implementation-web/helloworld-servlet/pom.xml index 79154be46a..8892949405 100644 --- a/samples/learning-more/implementation-web/helloworld-servlet/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-servlet/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-webapp 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-web-helloworld-servlet-webapp diff --git a/samples/learning-more/implementation-web/helloworld-stripes/pom.xml b/samples/learning-more/implementation-web/helloworld-stripes/pom.xml index c264235b47..fd96fc3367 100644 --- a/samples/learning-more/implementation-web/helloworld-stripes/pom.xml +++ b/samples/learning-more/implementation-web/helloworld-stripes/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-implementation-webapp 2.0-SNAPSHOT - ../../pom.xml + ../pom.xml sample-implementation-web-helloworld-stripes-webapp diff --git a/samples/learning-more/implementation-web/pom.xml b/samples/learning-more/implementation-web/pom.xml index 0a66bf9f04..94b39e5561 100644 --- a/samples/learning-more/implementation-web/pom.xml +++ b/samples/learning-more/implementation-web/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/sca-client/calculator-scaclient/pom.xml b/samples/learning-more/sca-client/calculator-scaclient/pom.xml index 1e3c23aec1..2122876b47 100644 --- a/samples/learning-more/sca-client/calculator-scaclient/pom.xml +++ b/samples/learning-more/sca-client/calculator-scaclient/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-sca-client 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/sca-client/helloworld-scaclient/pom.xml b/samples/learning-more/sca-client/helloworld-scaclient/pom.xml index 88cfc7e094..a123478729 100644 --- a/samples/learning-more/sca-client/helloworld-scaclient/pom.xml +++ b/samples/learning-more/sca-client/helloworld-scaclient/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-sca-client 2.0-SNAPSHOT ../pom.xml diff --git a/samples/learning-more/sca-client/pom.xml b/samples/learning-more/sca-client/pom.xml index 1ac1a64c3f..5c125bead3 100644 --- a/samples/learning-more/sca-client/pom.xml +++ b/samples/learning-more/sca-client/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-learning-more 2.0-SNAPSHOT ../pom.xml diff --git a/samples/running-tuscany/embedded-jse/pom.xml b/samples/running-tuscany/embedded-jse/pom.xml index 4e5119ea5d..c17594033b 100644 --- a/samples/running-tuscany/embedded-jse/pom.xml +++ b/samples/running-tuscany/embedded-jse/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-running-tuscany 2.0-SNAPSHOT ../pom.xml diff --git a/samples/running-tuscany/embedded-osgi-base/pom.xml b/samples/running-tuscany/embedded-osgi-base/pom.xml index a9b1617afb..d20dd90b35 100644 --- a/samples/running-tuscany/embedded-osgi-base/pom.xml +++ b/samples/running-tuscany/embedded-osgi-base/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-running-tuscany 2.0-SNAPSHOT ../pom.xml diff --git a/samples/running-tuscany/embedded-osgi/pom.xml b/samples/running-tuscany/embedded-osgi/pom.xml index fae8540337..06b2945c17 100644 --- a/samples/running-tuscany/embedded-osgi/pom.xml +++ b/samples/running-tuscany/embedded-osgi/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-running-tuscany 2.0-SNAPSHOT ../pom.xml diff --git a/samples/running-tuscany/maven-junit/calculator-contribution/pom.xml b/samples/running-tuscany/maven-junit/calculator-contribution/pom.xml index d5df7fdbbc..82e0845349 100644 --- a/samples/running-tuscany/maven-junit/calculator-contribution/pom.xml +++ b/samples/running-tuscany/maven-junit/calculator-contribution/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-sample-maven-junit 2.0-SNAPSHOT ../pom.xml diff --git a/samples/running-tuscany/maven-junit/pom.xml b/samples/running-tuscany/maven-junit/pom.xml index 715d92016f..5dbce2ca59 100644 --- a/samples/running-tuscany/maven-junit/pom.xml +++ b/samples/running-tuscany/maven-junit/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-running-tuscany 2.0-SNAPSHOT ../pom.xml diff --git a/samples/running-tuscany/shell/pom.xml b/samples/running-tuscany/shell/pom.xml index 5fea678288..bfaabcd774 100644 --- a/samples/running-tuscany/shell/pom.xml +++ b/samples/running-tuscany/shell/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.apache.tuscany.sca - tuscany-samples + tuscany-samples-running-tuscany 2.0-SNAPSHOT ../pom.xml From 79752fd8c26f66641811f35d929f0835fcc526d8 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Mon, 13 Dec 2010 11:16:51 +0000 Subject: [PATCH 126/174] TUSCANY-3801, update the databinding transformer so that it can be used with native async git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045067 13f79535-47bb-0310-9956-ffa450edef68 --- modules/core-databinding/META-INF/MANIFEST.MF | 1 + .../wire/DataTransformationInterceptor.java | 54 +++++++++++++++---- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/modules/core-databinding/META-INF/MANIFEST.MF b/modules/core-databinding/META-INF/MANIFEST.MF index fe68b72498..a05843081e 100644 --- a/modules/core-databinding/META-INF/MANIFEST.MF +++ b/modules/core-databinding/META-INF/MANIFEST.MF @@ -12,6 +12,7 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Core/DataBinding Integration Import-Package: javax.xml.namespace, org.apache.tuscany.sca.core;version="2.0.0", + org.apache.tuscany.sca.core.invocation;version="2.0.0", org.apache.tuscany.sca.databinding;version="2.0.0", org.apache.tuscany.sca.databinding.annotation;version="2.0.0", org.apache.tuscany.sca.databinding.impl;version="2.0.0", diff --git a/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java b/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java index 3b4891af9d..8b15d616ac 100644 --- a/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java +++ b/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java @@ -26,12 +26,11 @@ import java.util.List; import java.util.Map; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.Invocable; @@ -40,8 +39,7 @@ * * @version $Rev$ $Date$ */ -public class DataTransformationInterceptor implements Interceptor { - private Invoker next; +public class DataTransformationInterceptor extends InterceptorAsyncImpl { private Operation sourceOperation; @@ -64,11 +62,49 @@ public DataTransformationInterceptor(Invocable invocable, this.mediator = mediator; this.invocable = invocable; } - - public Invoker getNext() { - return next; + + public Message processRequest(Message msg) { + Map metadata = new HashMap(); + metadata.put(Invocable.class.getName(), invocable); + Object input = mediator.mediateInput(msg.getBody(), sourceOperation, targetOperation, metadata); + msg.setBody(input); + return msg; } + public Message processResponse(Message msg) { + Message resultMsg = msg; + Map metadata = new HashMap(); + metadata.put(Invocable.class.getName(), invocable); + + if (sourceOperation.isNonBlocking()) { + // Not to reset the message body + return resultMsg; + } + + Object result = resultMsg.getBody(); + + if (resultMsg.isFault()) { + Object transformedFault = null; + if ((result instanceof Exception) && !(result instanceof RuntimeException)) { + transformedFault = mediator.mediateFault(result, sourceOperation, targetOperation, metadata); + if (transformedFault != result) { + resultMsg.setFaultBody(transformedFault); + } + } + // + // Leave it to another layer to actually throw the Exception which constitutes + // the message body. We don't throw it here. + // + } else { + assert !(result instanceof Throwable) : "Expected messages that are not throwable " + result; + Object newResult = mediator.mediateOutput(result, sourceOperation, targetOperation, metadata); + resultMsg.setBody(newResult); + } + + return resultMsg; + } + +/* public Message invoke(Message msg) { Map metadata = new HashMap(); metadata.put(Invocable.class.getName(), invocable); @@ -103,10 +139,8 @@ public Message invoke(Message msg) { return resultMsg; } +*/ - public void setNext(Invoker next) { - this.next = next; - } /** * Returns return type for first Holder in input list. From ff6b4159ca0bc636948df4ed2d8ad7b3f788c8ff Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Mon, 13 Dec 2010 11:18:55 +0000 Subject: [PATCH 127/174] TUSCANY-3801 - reorder code so that the RuntimeInvoker does not take part in the async response "previous" chain git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045068 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/assembly/impl/RuntimeEndpointImpl.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index bdacdda53b..2d87e50ed0 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -605,13 +605,10 @@ private void initServiceBindingInvocationChains() { } } - - // Add the runtime invoker to the end of the binding chain. - // It mediates between the binding chain and selects the - // correct invocation chain based on the operation that's - // been selected - bindingInvocationChain.addInvoker(invoker); + // This is strategically placed before the RuntimeInvoker is added to the end of the + // binding chain as the RuntimeInvoker doesn't need to take part in the response + // processing and doesn't implement InvokerAsyncResponse if (isAsyncInvocation()){ // fix up the invocation chains to point back to the // binding chain so that async response messages @@ -641,6 +638,12 @@ private void initServiceBindingInvocationChains() { //TODO - throw error once the old async code is removed } } + + // Add the runtime invoker to the end of the binding chain. + // It mediates between the binding chain and selects the + // correct invocation chain based on the operation that's + // been selected + bindingInvocationChain.addInvoker(invoker); } /** From 45532aaa4e8d6a0aba7736a51c1f83d42003bd0f Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 13 Dec 2010 11:31:17 +0000 Subject: [PATCH 128/174] Add exclude for an old version of commons logging the seems to mess up the osgi junit tests git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045070 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-ws-runtime-axis2/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/binding-ws-runtime-axis2/pom.xml b/modules/binding-ws-runtime-axis2/pom.xml index 1fe048b522..8c2b595b60 100644 --- a/modules/binding-ws-runtime-axis2/pom.xml +++ b/modules/binding-ws-runtime-axis2/pom.xml @@ -73,6 +73,12 @@ commons-httpclient commons-httpclient 3.1 + + + commons-logging + commons-logging + + From c0b8946b675022c119f11384fcc0fb6bb7e5bb9d Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 13 Dec 2010 11:32:53 +0000 Subject: [PATCH 129/174] update the manifest that node-launcher-equinox uses for axis2 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045072 13f79535-47bb-0310-9956-ffa450edef68 --- ...is2-kernel-1.5.3.MF => axis2-1.5.3-jar.MF} | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) rename modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/{axis2-kernel-1.5.3.MF => axis2-1.5.3-jar.MF} (86%) diff --git a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-1.5.3-jar.MF similarity index 86% rename from modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF rename to modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-1.5.3-jar.MF index 88a7f690a8..54b4fdde41 100644 --- a/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-kernel-1.5.3.MF +++ b/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/axis2-1.5.3-jar.MF @@ -1,19 +1,19 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.axis2.axis2-kernel -Bundle-Name: org.apache.axis2.axis2-kernel +Bundle-SymbolicName: org.apache.axis2.axis2 +Bundle-Name: org.apache.axis2.axis2 Bundle-Version: 1.5.3 DynamicImport-Package: javax.transaction;version="1.1",javax.transacti on.xa;version="1.1",* -Bundle-ClassPath: axis2-kernel-1.5.3.jar +Bundle-ClassPath: axis2-1.5.3-jar.jar Export-Package: org.apache.axis2.client;version=1.5.3,org.apache.axis2 .transaction;version=1.5.3,org.apache.axis2.classloader;version=1.5.3 ,org.apache.axis2.wsdl.util;version=1.5.3,org.apache.axis2.descriptio n.java2wsdl.bytecode;version=1.5.3,org.apache.axis2.handlers;version= 1.5.3,org.apache.axis2.dispatchers;version=1.5.3,org.apache.axis2.clu stering.configuration;version=1.5.3,org.apache.axis2.java.security;ve - rsion=1.5.3,org.apache.axis2.phaseresolver;version=1.5.3,org.apache.a - xis2.transport.http.util;version=1.5.3,org.apache.axis2.addressing.ws + rsion=1.5.3,org.apache.axis2.phaseresolver;version=1.5.3, + org.apache.axis2.addressing.ws dl;version=1.5.3,org.apache.axis2.description;version=1.5.3,org.apach e.axis2.description.java2wsdl;version=1.5.3,org.apache.axis2.addressi ng.i18n;version=1.5.3,org.apache.axis2.deployment.repository.util;ver @@ -24,13 +24,13 @@ Export-Package: org.apache.axis2.client;version=1.5.3,org.apache.axis2 s2.clustering.context;version=1.5.3,org.apache.axis2.builder.unknownc ontent;version=1.5.3,org.apache.axis2.dataretrieval.client;version=1. 5.3,org.apache.axis2.context.externalize;version=1.5.3,org.apache.axi - s2.dataretrieval;version=1.5.3,org.apache.axis2.addressing.metadata;v - ersion=1.5.3,org.apache.axis2.receivers;version=1.5.3,org.apache.axis - 2.deployment.scheduler;version=1.5.3,org.apache.axis2;version=1.5.3,o - rg.apache.axis2.deployment;version=1.5.3,org.apache.axis2.deployment. - util;version=1.5.3,org.apache.axis2.util.threadpool;version=1.5.3,org - .apache.axis2.i18n;version=1.5.3,org.apache.axis2.engine;version=1.5. - 3,org.apache.axis2.wsdl;version=1.5.3,org.apache.axis2.transport;vers - ion=1.5.3,org.apache.axis2.addressing;version=1.5.3,org.apache.axis2. - namespace;version=1.5.3,org.apache.axis2.context;version=1.5.3,org.ap + s2.dataretrieval;version=1.5.3,org.apache.axis2.addressing.metadata;v + ersion=1.5.3,org.apache.axis2.receivers;version=1.5.3,org.apache.axis + 2.deployment.scheduler;version=1.5.3,org.apache.axis2;version=1.5.3,o + rg.apache.axis2.deployment;version=1.5.3,org.apache.axis2.deployment. + util;version=1.5.3,org.apache.axis2.util.threadpool;version=1.5.3,org + .apache.axis2.i18n;version=1.5.3,org.apache.axis2.engine;version=1.5. + 3,org.apache.axis2.wsdl;version=1.5.3,org.apache.axis2.transport;vers + ion=1.5.3,org.apache.axis2.addressing;version=1.5.3,org.apache.axis2. + namespace;version=1.5.3,org.apache.axis2.context;version=1.5.3,org.ap ache.axis2.service;version=1.5.3 From 4ec9f4327527a606503be2181122b273b6d9cd97 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 13 Dec 2010 11:33:59 +0000 Subject: [PATCH 130/174] Update the axis2 manifest used in the all distribution git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045073 13f79535-47bb-0310-9956-ffa450edef68 --- ...is2-kernel-1.5.3.MF => axis2-1.5.3-jar.MF} | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) rename distribution/all/manifests/{axis2-kernel-1.5.3.MF => axis2-1.5.3-jar.MF} (86%) diff --git a/distribution/all/manifests/axis2-kernel-1.5.3.MF b/distribution/all/manifests/axis2-1.5.3-jar.MF similarity index 86% rename from distribution/all/manifests/axis2-kernel-1.5.3.MF rename to distribution/all/manifests/axis2-1.5.3-jar.MF index 88a7f690a8..54b4fdde41 100644 --- a/distribution/all/manifests/axis2-kernel-1.5.3.MF +++ b/distribution/all/manifests/axis2-1.5.3-jar.MF @@ -1,19 +1,19 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.axis2.axis2-kernel -Bundle-Name: org.apache.axis2.axis2-kernel +Bundle-SymbolicName: org.apache.axis2.axis2 +Bundle-Name: org.apache.axis2.axis2 Bundle-Version: 1.5.3 DynamicImport-Package: javax.transaction;version="1.1",javax.transacti on.xa;version="1.1",* -Bundle-ClassPath: axis2-kernel-1.5.3.jar +Bundle-ClassPath: axis2-1.5.3-jar.jar Export-Package: org.apache.axis2.client;version=1.5.3,org.apache.axis2 .transaction;version=1.5.3,org.apache.axis2.classloader;version=1.5.3 ,org.apache.axis2.wsdl.util;version=1.5.3,org.apache.axis2.descriptio n.java2wsdl.bytecode;version=1.5.3,org.apache.axis2.handlers;version= 1.5.3,org.apache.axis2.dispatchers;version=1.5.3,org.apache.axis2.clu stering.configuration;version=1.5.3,org.apache.axis2.java.security;ve - rsion=1.5.3,org.apache.axis2.phaseresolver;version=1.5.3,org.apache.a - xis2.transport.http.util;version=1.5.3,org.apache.axis2.addressing.ws + rsion=1.5.3,org.apache.axis2.phaseresolver;version=1.5.3, + org.apache.axis2.addressing.ws dl;version=1.5.3,org.apache.axis2.description;version=1.5.3,org.apach e.axis2.description.java2wsdl;version=1.5.3,org.apache.axis2.addressi ng.i18n;version=1.5.3,org.apache.axis2.deployment.repository.util;ver @@ -24,13 +24,13 @@ Export-Package: org.apache.axis2.client;version=1.5.3,org.apache.axis2 s2.clustering.context;version=1.5.3,org.apache.axis2.builder.unknownc ontent;version=1.5.3,org.apache.axis2.dataretrieval.client;version=1. 5.3,org.apache.axis2.context.externalize;version=1.5.3,org.apache.axi - s2.dataretrieval;version=1.5.3,org.apache.axis2.addressing.metadata;v - ersion=1.5.3,org.apache.axis2.receivers;version=1.5.3,org.apache.axis - 2.deployment.scheduler;version=1.5.3,org.apache.axis2;version=1.5.3,o - rg.apache.axis2.deployment;version=1.5.3,org.apache.axis2.deployment. - util;version=1.5.3,org.apache.axis2.util.threadpool;version=1.5.3,org - .apache.axis2.i18n;version=1.5.3,org.apache.axis2.engine;version=1.5. - 3,org.apache.axis2.wsdl;version=1.5.3,org.apache.axis2.transport;vers - ion=1.5.3,org.apache.axis2.addressing;version=1.5.3,org.apache.axis2. - namespace;version=1.5.3,org.apache.axis2.context;version=1.5.3,org.ap + s2.dataretrieval;version=1.5.3,org.apache.axis2.addressing.metadata;v + ersion=1.5.3,org.apache.axis2.receivers;version=1.5.3,org.apache.axis + 2.deployment.scheduler;version=1.5.3,org.apache.axis2;version=1.5.3,o + rg.apache.axis2.deployment;version=1.5.3,org.apache.axis2.deployment. + util;version=1.5.3,org.apache.axis2.util.threadpool;version=1.5.3,org + .apache.axis2.i18n;version=1.5.3,org.apache.axis2.engine;version=1.5. + 3,org.apache.axis2.wsdl;version=1.5.3,org.apache.axis2.transport;vers + ion=1.5.3,org.apache.axis2.addressing;version=1.5.3,org.apache.axis2. + namespace;version=1.5.3,org.apache.axis2.context;version=1.5.3,org.ap ache.axis2.service;version=1.5.3 From ce601949d91aa6903516d17a7935af68b112fcf0 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 13 Dec 2010 11:42:54 +0000 Subject: [PATCH 131/174] Add stax exclude git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045077 13f79535-47bb-0310-9956-ffa450edef68 --- modules/assembly-xml/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/assembly-xml/pom.xml b/modules/assembly-xml/pom.xml index f8bbc345b6..ab5ae2b6db 100644 --- a/modules/assembly-xml/pom.xml +++ b/modules/assembly-xml/pom.xml @@ -65,6 +65,12 @@ wstx-asl 3.2.9 test + + + stax + stax-api + + From e462927abafba8b7caa252e2cc31083c050f1f23 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Mon, 13 Dec 2010 11:43:19 +0000 Subject: [PATCH 132/174] Remove explicit version from manifest git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045078 13f79535-47bb-0310-9956-ffa450edef68 --- modules/implementation-widget-runtime-dojo/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/implementation-widget-runtime-dojo/META-INF/MANIFEST.MF b/modules/implementation-widget-runtime-dojo/META-INF/MANIFEST.MF index c55ce4de46..b3c9bb1367 100644 --- a/modules/implementation-widget-runtime-dojo/META-INF/MANIFEST.MF +++ b/modules/implementation-widget-runtime-dojo/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-ManifestVersion: 2 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Widget Implementation Model Import-Package: javax.xml.namespace, - javax.xml.stream;version="1.0", + javax.xml.stream, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.monitor;version="2.0.0" Bundle-SymbolicName: org.apache.tuscany.sca.implementation.widget.runtime.dojo From 8cd55426a071aa2c013b343e2b4f7617bd91ac08 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 13 Dec 2010 11:53:54 +0000 Subject: [PATCH 133/174] Removing all references to jaxb-api as described under TUSCANY-3810 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045082 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-jaxb/pom.xml | 33 -------------------------------- 1 file changed, 33 deletions(-) diff --git a/modules/databinding-jaxb/pom.xml b/modules/databinding-jaxb/pom.xml index 323f1c9c3f..71216663e0 100644 --- a/modules/databinding-jaxb/pom.xml +++ b/modules/databinding-jaxb/pom.xml @@ -45,13 +45,6 @@ 2.0-SNAPSHOT - - com.sun.xml.bind - jaxb-impl - 2.1.12 - test - - @@ -76,32 +69,6 @@ - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - generate-sources - - copy - - - - - javax.xml.bind - jaxb-api - 2.1 - jar - - - ${project.build.directory}/endorsed - false - true - - - - org.apache.maven.plugins maven-surefire-plugin From 7b64d4d1fa6e9f864a891cdbf037492a32978213 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 13 Dec 2010 11:57:06 +0000 Subject: [PATCH 134/174] Removing all references to jaxb-api as described under TUSCANY-3810 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045085 13f79535-47bb-0310-9956-ffa450edef68 --- modules/databinding-jaxb-axiom/pom.xml | 33 +------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/modules/databinding-jaxb-axiom/pom.xml b/modules/databinding-jaxb-axiom/pom.xml index 2f59a1bf31..7bfaa760c1 100644 --- a/modules/databinding-jaxb-axiom/pom.xml +++ b/modules/databinding-jaxb-axiom/pom.xml @@ -67,42 +67,11 @@ 1.2.10 runtime - - com.sun.xml.bind - jaxb-impl - 2.1.12 - test - + - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - generate-sources - - copy - - - - - javax.xml.bind - jaxb-api - 2.1 - jar - - - ${project.build.directory}/endorsed - false - true - - - - org.apache.maven.plugins maven-surefire-plugin From dcfbe0f7df5f0ca06d8607cf5bf52dc11c2c11f4 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 13 Dec 2010 12:01:04 +0000 Subject: [PATCH 135/174] Removing all references to jaxb-api as described under TUSCANY-3810 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045087 13f79535-47bb-0310-9956-ffa450edef68 --- modules/interface-java-jaxws/pom.xml | 46 ---------------------------- 1 file changed, 46 deletions(-) diff --git a/modules/interface-java-jaxws/pom.xml b/modules/interface-java-jaxws/pom.xml index 84d829f51d..87c099c741 100644 --- a/modules/interface-java-jaxws/pom.xml +++ b/modules/interface-java-jaxws/pom.xml @@ -52,13 +52,6 @@ test - - com.sun.xml.bind - jaxb-impl - 2.1.12 - test - - asm asm @@ -104,45 +97,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - -Djava.endorsed.dirs=target/endorsed - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - generate-sources - - copy - - - - - javax.xml.ws - jaxws-api - 2.1 - jar - - - javax.xml.bind - jaxb-api - 2.1 - jar - - - ${project.build.directory}/endorsed - false - true - - - - org.codehaus.mojo build-helper-maven-plugin From 31b2e219af7987261783ac8c8d2af9e6f4f8ef11 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 13 Dec 2010 12:03:23 +0000 Subject: [PATCH 136/174] Removing all references to jaxb-api as described under TUSCANY-3810 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1045089 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-ws-runtime-jaxws/pom.xml | 41 ------------------------ 1 file changed, 41 deletions(-) diff --git a/modules/binding-ws-runtime-jaxws/pom.xml b/modules/binding-ws-runtime-jaxws/pom.xml index f0adefc38f..129d1e4641 100644 --- a/modules/binding-ws-runtime-jaxws/pom.xml +++ b/modules/binding-ws-runtime-jaxws/pom.xml @@ -123,47 +123,6 @@ - - apache.ws.zone - Apache WS Zone Repository - http://ws.zones.apache.org/repository2 - - true - - - false - - - - diff --git a/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java b/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java index 9051dc0af7..2041a0ff91 100644 --- a/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java +++ b/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java @@ -24,13 +24,12 @@ import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.dom.DOMSource; +import org.apache.tuscany.sca.common.xml.stax.StAXHelper; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -63,10 +62,10 @@ public static Element readEndPointReference(XMLStreamReader reader) { /** * Write a wsa:endpointReference from a DOM Element */ - public static void writeEndPointReference(Element element, XMLStreamWriter writer) { + public static void writeEndPointReference(Element element, XMLStreamWriter writer, StAXHelper staxHelper) { try { - saveElement(element, writer); + saveElement(element, writer, staxHelper); } catch (XMLStreamException e) { throw new RuntimeException(e); @@ -174,10 +173,9 @@ private static void declareNamespace(Element element, String prefix, String ns) } } - private static void saveElement(Element element, XMLStreamWriter writer) throws XMLStreamException{ + private static void saveElement(Element element, XMLStreamWriter writer, StAXHelper staxHelper) throws XMLStreamException{ - XMLStreamReader reader = - XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(element)); + XMLStreamReader reader = staxHelper.createXMLStreamReader(element); while (reader.hasNext()) { switch (reader.next()) { diff --git a/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index d528516160..f5384caf16 100644 --- a/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -45,6 +45,7 @@ import org.apache.tuscany.sca.assembly.xml.PolicySubjectProcessor; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; +import org.apache.tuscany.sca.common.xml.stax.StAXHelper; import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; @@ -78,6 +79,7 @@ public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implem private PolicyFactory policyFactory; private PolicySubjectProcessor policyProcessor; //private PolicyFactory intentAttachPointTypeFactory; + private StAXHelper staxHelper; public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints) { @@ -87,6 +89,7 @@ public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints) { this.wsFactory = modelFactories.getFactory(WebServiceBindingFactory.class); this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class); this.policyProcessor = new PolicySubjectProcessor(policyFactory); + staxHelper = StAXHelper.getInstance(extensionPoints); } /** @@ -358,7 +361,7 @@ public void write(WebServiceBinding wsBinding, XMLStreamWriter writer, Processor } if (wsBinding.getEndPointReference() != null) { - EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer); + EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer, staxHelper); } writer.writeEndElement(); From e99e095e75cfe47c18f05cc902bc74379d768774 Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Tue, 14 Dec 2010 10:32:59 +0000 Subject: [PATCH 142/174] Remove no longer required wstx dependency git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1049026 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-ws-runtime-axis2/pom.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/binding-ws-runtime-axis2/pom.xml b/modules/binding-ws-runtime-axis2/pom.xml index d8a94dfe3d..7de2b6f2a0 100644 --- a/modules/binding-ws-runtime-axis2/pom.xml +++ b/modules/binding-ws-runtime-axis2/pom.xml @@ -182,13 +182,6 @@ test - - org.codehaus.woodstox - wstx-asl - 3.2.6 - test - - From 77feeca4f2b03c2230aec39986ea3e0bc823d3f3 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Wed, 15 Dec 2010 07:16:40 +0000 Subject: [PATCH 143/174] Updating the fix for OSGi support to deal with error cases git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1049443 13f79535-47bb-0310-9956-ffa450edef68 --- .../jms/provider/JMSResourceFactoryImpl.java | 86 ++++++++++++------- 1 file changed, 56 insertions(+), 30 deletions(-) diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java index 4ab2f5ab2c..7e56fb2329 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java @@ -28,6 +28,7 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import javax.naming.NoInitialContextException; import javax.resource.spi.ActivationSpec; import org.apache.tuscany.sca.binding.jms.JMSBindingException; @@ -142,7 +143,6 @@ protected void createConnection() throws NamingException, JMSException { connection = connectionFactory.createConnection(); } - static final String ACTIVEMQ_FACTORY = "org.apache.activemq.jndi.ActiveMQInitialContextFactory"; protected synchronized Context getInitialContext() throws NamingException { if (context == null) { Properties props = new Properties(); @@ -156,40 +156,66 @@ protected synchronized Context getInitialContext() throws NamingException { initJREEnvironment(props); - /** - * For OSGi, need to provide access to the InitialContextFactory for the JMS provider that is going to be used. - * - * The situation is that the InitialContext constructor instantiates an instance of the InitialContextFactory by - * calling "new" using the TCCL - thus there is a need to prepare the TCCL. - * 03/12/2010 MJE - for the present, only worry about ActiveMQ - other providers can be added later - * 10/12/2010 MJE - the following code attempts to get the classloader for the ActiveMQ initial context factory - * it will fail if the ActiveMQ classes are not available in the runtime, but the code will still - * execute (although under OSGi the new InitialContext() operation will fail to find a suitable - * InitialContextFactory object...) - */ - ClassLoader ActiveMQCl = null; try { - if( initialContextFactoryName == null || ACTIVEMQ_FACTORY.equals(initialContextFactoryName) ) { - ActiveMQCl = ActiveMQInitialContextFactory.class.getClassLoader(); - props.setProperty(Context.INITIAL_CONTEXT_FACTORY, ACTIVEMQ_FACTORY); - } // end if - } catch (Exception e) { - // Nothing to do in this case - the ActiveMQCl classloader will simply be null - } // end try - - ClassLoader tccl = ClassLoaderContext.setContextClassLoader(JMSResourceFactoryImpl.class.getClassLoader(), - ActiveMQCl, - Thread.currentThread().getContextClassLoader() ); - try { // Load the JNDI InitialContext (will load the InitialContextFactory, if present) context = new InitialContext(props); - } finally { - // Restore the TCCL if we changed it - if( tccl != null ) Thread.currentThread().setContextClassLoader(tccl); - } // end try + if( context == null ) { + throw new NamingException(); + } else if ( context.getEnvironment().get(InitialContext.INITIAL_CONTEXT_FACTORY) == null ) { + throw new NamingException(); + } // end if + } catch (NamingException e ) { + context = getInitialContextOsgi( props ); + } // end try + // In the case where the InitialContext fails, check whether performing an OSGi based load succeeds... + + } return context; - } + } // end method getInitialContext + + static final String ACTIVEMQ_FACTORY = "org.apache.activemq.jndi.ActiveMQInitialContextFactory"; + private Context getInitialContextOsgi( Properties props ) throws NamingException { + /** + * For OSGi, need to provide access to the InitialContextFactory for the JMS provider that is going to be used. + * + * The situation is that the InitialContext constructor instantiates an instance of the InitialContextFactory by + * calling "new" using the TCCL - thus there is a need to prepare the TCCL. + * 03/12/2010 MJE - for the present, only worry about ActiveMQ - other providers can be added later + * 10/12/2010 MJE - the following code attempts to get the classloader for the ActiveMQ initial context factory + * it will fail if the ActiveMQ classes are not available in the runtime, but the code will still + * execute (although under OSGi the new InitialContext() operation will fail to find a suitable + * InitialContextFactory object...) + */ + + String contextFactoryName = (String)props.get(Context.INITIAL_CONTEXT_FACTORY); + + ClassLoader ActiveMQCl = null; + try { + if( contextFactoryName == null || ACTIVEMQ_FACTORY.equals(contextFactoryName) ) { + ActiveMQCl = ActiveMQInitialContextFactory.class.getClassLoader(); + props.setProperty(Context.INITIAL_CONTEXT_FACTORY, ACTIVEMQ_FACTORY); + if( props.getProperty(Context.PROVIDER_URL) == null ) { + props.setProperty(Context.PROVIDER_URL, "vm://localhost?broker.persistent=false" ); + } // end if + } // end if + } catch (Exception e) { + // Nothing to do in this case - the ActiveMQCl classloader will simply be null + } // end try + + ClassLoader tccl = ClassLoaderContext.setContextClassLoader(JMSResourceFactoryImpl.class.getClassLoader(), + ActiveMQCl, + Thread.currentThread().getContextClassLoader() ); + try { + // Load the JNDI InitialContext (will load the InitialContextFactory, if present) + return new InitialContext(props); + } finally { + // Restore the TCCL if we changed it + if( tccl != null ) Thread.currentThread().setContextClassLoader(tccl); + } // end try + + } // end method getInitialContextOsgi + /** * If using the WAS JMS Client with a non-IBM JRE then an additional From ef4eb6d14b263c792e767c571b48e169dd7b9f9d Mon Sep 17 00:00:00 2001 From: Anthony Elder Date: Wed, 15 Dec 2010 14:09:06 +0000 Subject: [PATCH 144/174] Use the mapped binding when looking up the provider git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1049556 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/sca/provider/DefaultSCABindingMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java index 9a1c4777a8..5219cab15d 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java @@ -102,7 +102,7 @@ private BindingBuilder getBindingBuilder(QName binding) { try { if (processor != null) { - Binding bindingTemplate = createDelegatingBinding(defaultMappedBinding); + Binding bindingTemplate = createDelegatingBinding(binding); ProviderFactory providerFactory = providerFactories.getProviderFactory(bindingTemplate.getClass()); if (providerFactory == null) { logger.warning("Mapped binding for binding.sca is not supported: " + binding); From 638359ad649431c133b3b6a969fcdd595b0172c9 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 20 Dec 2010 19:19:32 +0000 Subject: [PATCH 145/174] Updating core invocation code to support bindings that provide native async support - as described in TUSCANY-3801 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051247 13f79535-47bb-0310-9956-ffa450edef68 --- .../corba/testing/service/mocks/TestRuntimeWire.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java index 04e4fa3b3b..d1c7c325c5 100644 --- a/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java +++ b/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java @@ -317,4 +317,11 @@ public boolean isAsyncInvocation() { // TODO Auto-generated method stub return false; } + + + @Override + public void invokeAsync(Message msg) { + // TODO Auto-generated method stub + + } } From 63bedcb09306e9f835263078c0002f10aef69488 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 20 Dec 2010 19:26:33 +0000 Subject: [PATCH 146/174] Updating core invocation code to support bindings that provide native async support - as described in TUSCANY-3801 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051249 13f79535-47bb-0310-9956-ffa450edef68 --- .../assembly/impl/RuntimeEndpointImpl.java | 6 +- .../impl/RuntimeEndpointReferenceImpl.java | 17 +++++- .../core/invocation/AsyncResponseInvoker.java | 55 +++++++++++++++---- .../core/invocation/InterceptorAsyncImpl.java | 39 +++++++++++-- .../sca/core/invocation/RuntimeInvoker.java | 30 ++++++++-- .../invocation/impl/InvocationChainImpl.java | 7 +++ 6 files changed, 127 insertions(+), 27 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 2d87e50ed0..6339b96a1b 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -291,10 +291,14 @@ public Message invoke(Operation operation, Message msg) { return invoker.invoke(operation, msg); } + public void invokeAsync(Message msg){ + invoker.invokeBindingAsync(msg); + } // end method invokeAsync(Message) + public void invokeAsync(Operation operation, Message msg){ msg.setOperation(operation); invoker.invokeAsync(msg); - } + } // end method invokeAsync(Operation, Message) public void invokeAsyncResponse(Message msg){ invoker.invokeAsyncResponse(msg); diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index ad5c9124fa..0a1d5b87eb 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -248,9 +248,22 @@ public void invokeAsync(Operation operation, Message msg){ invoker.invokeAsync(msg); } + public void invokeAsync(Message msg){ + invoker.invokeAsync(msg); + } + public void invokeAsyncResponse(Message msg){ - invoker.invokeAsyncResponse(msg); - } + // If there is a Binding Chain, invoke it first... + InvocationChain chain = this.getBindingInvocationChain(); + if( chain != null ) { + Invoker tailInvoker = chain.getTailInvoker(); + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); + } // end if + + chain = this.getInvocationChain(msg.getOperation()); + Invoker tailInvoker = chain.getTailInvoker(); + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); + } // end method invokeAsyncResponse /** * Navigate the component/componentType inheritence chain to find the leaf contract diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java index 9c327defbd..fd07911084 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java @@ -19,6 +19,8 @@ package org.apache.tuscany.sca.core.invocation; +import java.io.Serializable; + import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.provider.EndpointAsyncProvider; @@ -30,20 +32,33 @@ * and hides the decision about whether the response will be processed * natively or non-natively */ -public class AsyncResponseInvoker implements InvokerAsyncResponse { - - RuntimeEndpoint requestEndpoint; - RuntimeEndpointReference responseEndpointReference; +public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializable { - public AsyncResponseInvoker(Message requestMessage){ - requestEndpoint = (RuntimeEndpoint)requestMessage.getTo(); - responseEndpointReference = (RuntimeEndpointReference)requestMessage.getFrom(); - } + /** + * + */ + private static final long serialVersionUID = -7992598227671386588L; + RuntimeEndpoint requestEndpoint; + RuntimeEndpointReference responseEndpointReference; + String responseTargetAddress; + String relatesToMsgID; + + public AsyncResponseInvoker(RuntimeEndpoint requestEndpoint, + RuntimeEndpointReference responseEndpointReference, + String responseTargetAddress, String relatesToMsgID) { + super(); + this.requestEndpoint = requestEndpoint; + this.responseEndpointReference = responseEndpointReference; + this.responseTargetAddress = responseTargetAddress; + this.relatesToMsgID = relatesToMsgID; + } // end constructor + /** * If you have a Tuscany message you can call this */ public void invokeAsyncResponse(Message responseMessage) { + responseMessage.getHeaders().put("ASYNC_RESPONSE_INVOKER", this); if ((requestEndpoint.getBindingProvider() instanceof EndpointAsyncProvider) && (((EndpointAsyncProvider)requestEndpoint.getBindingProvider()).supportsNativeAsync())){ // process the response as a native async response @@ -52,9 +67,25 @@ public void invokeAsyncResponse(Message responseMessage) { // process the response as a non-native async response responseEndpointReference.invoke(responseMessage); } - } + } // end method invokeAsyncReponse(Message) - /** + public String getResponseTargetAddress() { + return responseTargetAddress; + } + + public void setResponseTargetAddress(String responseTargetAddress) { + this.responseTargetAddress = responseTargetAddress; + } + + public String getRelatesToMsgID() { + return relatesToMsgID; + } + + public void setRelatesToMsgID(String relatesToMsgID) { + this.relatesToMsgID = relatesToMsgID; + } + + /** * If you have Java beans you can call this and we'll create * a Tuscany message * @@ -66,5 +97,5 @@ public void invokeAsyncResponse(Object args) { // turn args into a message Message responseMessage = null; invokeAsyncResponse(responseMessage); - } -} + } // end method invokeAsyncResponse(Object) +} // end class diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java index 8495445951..265311fe6b 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InterceptorAsyncImpl.java @@ -60,15 +60,42 @@ public Message invoke(Message msg) { return resultMsg; } - public void invokeAsyncRequest(Message msg) { - msg = processRequest(msg); - ((InvokerAsyncRequest)getNext()).invokeAsyncRequest(msg); - } + public void invokeAsyncRequest(Message msg) throws Throwable { + try{ + msg = processRequest(msg); + InvokerAsyncRequest theNext = (InvokerAsyncRequest)getNext(); + if( theNext != null ) theNext.invokeAsyncRequest(msg); + postProcessRequest(msg); + } catch (Throwable e) { + postProcessRequest(msg, e); + } // end try + } // end method invokeAsyncRequest public void invokeAsyncResponse(Message msg) { msg = processResponse(msg); - ((InvokerAsyncResponse)getPrevious()).invokeAsyncResponse(msg); - } + InvokerAsyncResponse thePrevious = (InvokerAsyncResponse)getPrevious(); + if (thePrevious != null ) thePrevious.invokeAsyncResponse(msg); + } // end method invokeAsyncResponse + + /** + * Basic null version of postProcessRequest - subclasses should override for any required + * real processing + */ + public Message postProcessRequest(Message msg) { + // Default processing is to do nothing + return msg; + } // end method postProcessRequest + + /** + * Basic null version of postProcessRequest - subclasses should override for any required + * real processing + * @throws Throwable + */ + public Message postProcessRequest(Message msg, Throwable e) throws Throwable { + // Default processing is to rethrow the exception + throw e; + } // end method postProcessRequest + /** * A testing method while I use the local SCA binding wire to look diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index f894290b3e..62593ba895 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -45,7 +45,7 @@ * Invoker for a endpoint or endpoint reference * @version $Rev$ $Date$ */ -public class RuntimeInvoker implements Invoker{ +public class RuntimeInvoker implements Invoker, InvokerAsyncRequest { protected ExtensionPointRegistry registry; protected MessageFactory messageFactory; protected Invocable invocable; @@ -70,7 +70,22 @@ public Message invokeBinding(Message msg) { } finally { ThreadMessageContext.setMessageContext(context); } - } + } // end method invokeBinding + + /** + * Async Invoke of the Binding Chain + * @param msg - the message to use in the invocation + */ + public void invokeBindingAsync(Message msg) { + Message context = ThreadMessageContext.setMessageContext(msg); + try { + ((InvokerAsyncRequest)invocable.getBindingInvocationChain().getHeadInvoker()).invokeAsyncRequest(msg); + } catch (Throwable t ) { + // TODO - consider what best to do with exception + } finally { + ThreadMessageContext.setMessageContext(context); + } // end try + } // end method invokeBindingAsync public Message invoke(Message msg) { return invoke(msg.getOperation(), msg); @@ -183,10 +198,13 @@ public void invokeAsync(Message msg) { * @param msg the response message */ public void invokeAsyncResponse(Message msg) { - - InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); + InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); Invoker tailInvoker = chain.getTailInvoker(); - ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); - } + } // end method invokeAsyncResponse + + @Override + public void invokeAsyncRequest(Message msg) throws Throwable { + invokeAsync(msg); + } // end method invokeAsyncRequest } diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java index 69158683ef..fff5fb3991 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java @@ -94,6 +94,13 @@ public Invoker getHeadInvoker() { } public Invoker getTailInvoker() { + // *** + int nodeCount = nodes.size(); + if( nodeCount > 0 ) { + return nodes.get( nodeCount - 1).getInvoker(); + } // end if + // *** + // find the tail invoker Invoker next = getHeadInvoker(); Invoker tail = null; From 87b6e3d63b301a7826abfc28294778345aecfde6 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 20 Dec 2010 19:28:04 +0000 Subject: [PATCH 147/174] Updating core invocation code to support bindings that provide native async support - as described in TUSCANY-3801 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051250 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/invocation/InterceptorAsync.java | 26 ++++++++++++++++--- .../sca/invocation/InvokerAsyncRequest.java | 3 ++- .../apache/tuscany/sca/runtime/Invocable.java | 9 +++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java index 806feccca2..f29dfddf6a 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java @@ -47,16 +47,36 @@ public interface InterceptorAsync extends Interceptor, InvokerAsyncRequest, Invo * */ Message processRequest(Message msg); + + /** + * Post processing for a request message. Intended to be called after + * the invocation of the request chain returns, to permit cleanup/error handling + * if required + * @param msg The request Message + * @return the processed message + */ + Message postProcessRequest(Message msg); + + /** + * Post processing for a request message where an exception was thrown. + * Intended to be called after the invocation of the request chain returns, + * to permit cleanup/error handling if required + * @param msg The request Message + * @param e a Thowable which is some form of exception thrown during the processing + * of the request message by the invocation chain + * @return the processed message + */ + Message postProcessRequest(Message msg, Throwable e) throws Throwable; /** * Process a response message. Provided so that the synchronous * and asynchronous patterns can re-use the response message * processing * - * @param msg The request Message + * @param msg The response Message * @return the processed message * */ Message processResponse(Message msg); - -} + +} // end interface InterceptorAsync diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java index 48fad02b53..025010a076 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java @@ -32,8 +32,9 @@ public interface InvokerAsyncRequest { * * @param msg The request Message * @return the processed message + * @throws Throwable * */ - void invokeAsyncRequest(Message msg); + void invokeAsyncRequest(Message msg) throws Throwable; } diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index 948063f480..eef7a88046 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -138,6 +138,15 @@ public interface Invocable { */ void invokeAsync(Operation operation, Message msg); + /** + * Asynchronously invoke an operation with a context message + * This invoke method assumes that the binding invocation chain is in force + * and that there will be an operation selector element there to + * determine which operation to call + * @param msg The request message + */ + void invokeAsync(Message msg); + /** * Asynchronously invoke an operation with a context message * @param tailInvoker the invoker at the end of the chain From ee72cbe5e9035af6a82706ebd9b23a68ae2d15dd Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Mon, 20 Dec 2010 19:36:27 +0000 Subject: [PATCH 148/174] Extending binding-jms-runtime to provide native async service invocation with separate forward request messages and back response messages - as described in TUSCANY-3809 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051255 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding-jms-runtime/META-INF/MANIFEST.MF | 1 + .../headers/HeaderReferenceInterceptor.java | 70 +++-- .../jms/headers/HeaderServiceInterceptor.java | 34 ++- .../host/AsyncResponseJMSServiceListener.java | 272 ++++++++++++++++++ .../jms/host/DefaultServiceInvoker.java | 10 +- .../jms/host/JMSAsyncResponseInvoker.java | 98 +++++++ ...nSelectorJMSDefaultServiceInterceptor.java | 14 +- ...SelectorJMSUserPropServiceInterceptor.java | 10 +- .../JMSBindingAsyncResponseInvoker.java | 43 +++ .../JMSBindingReferenceBindingProvider.java | 77 ++++- .../JMSBindingServiceBindingProvider.java | 23 +- .../jms/provider/RRBJMSBindingInvoker.java | 106 ++++++- .../TransportReferenceInterceptor.java | 29 +- .../TransportServiceInterceptor.java | 91 +++++- .../AsyncResponseDestinationInterceptor.java | 193 +++++++++++++ .../wire/CallbackDestinationInterceptor.java | 11 +- .../wire/OperationPropertiesInterceptor.java | 10 +- ...ireFormatJMSBytesReferenceInterceptor.java | 12 +- .../WireFormatJMSBytesServiceInterceptor.java | 12 +- ...FormatJMSBytesXMLReferenceInterceptor.java | 12 +- ...reFormatJMSBytesXMLServiceInterceptor.java | 12 +- ...eFormatJMSDefaultReferenceInterceptor.java | 11 +- ...ireFormatJMSDefaultServiceInterceptor.java | 29 +- ...reFormatJMSObjectReferenceInterceptor.java | 12 +- ...WireFormatJMSObjectServiceInterceptor.java | 12 +- ...WireFormatJMSTextReferenceInterceptor.java | 12 +- .../WireFormatJMSTextServiceInterceptor.java | 12 +- ...eFormatJMSTextXMLReferenceInterceptor.java | 14 +- ...ireFormatJMSTextXMLServiceInterceptor.java | 12 +- 29 files changed, 1151 insertions(+), 103 deletions(-) create mode 100644 modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/AsyncResponseJMSServiceListener.java create mode 100644 modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSAsyncResponseInvoker.java create mode 100644 modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingAsyncResponseInvoker.java create mode 100644 modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java diff --git a/modules/binding-jms-runtime/META-INF/MANIFEST.MF b/modules/binding-jms-runtime/META-INF/MANIFEST.MF index beeb3a366e..985d99f457 100644 --- a/modules/binding-jms-runtime/META-INF/MANIFEST.MF +++ b/modules/binding-jms-runtime/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Import-Package: javax.jms, org.apache.tuscany.sca.binding.ws.wsdlgen;version="2.0.0", org.apache.tuscany.sca.common.xml.dom;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", + org.apache.tuscany.sca.core.invocation;version="2.0.0", org.apache.tuscany.sca.databinding.xml;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java index ad07655730..87c6ddd08b 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java @@ -18,9 +18,7 @@ */ package org.apache.tuscany.sca.binding.jms.headers; - - - +import java.util.List; import java.util.Map; import java.util.UUID; @@ -38,6 +36,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -49,31 +48,30 @@ * * @version $Rev$ $Date$ */ -public class HeaderReferenceInterceptor implements Interceptor { +public class HeaderReferenceInterceptor extends InterceptorAsyncImpl { - private Invoker next; private RuntimeEndpointReference runtimeWire; private JMSBinding jmsBinding; private JMSMessageProcessor requestMessageProcessor; + private List operations; - public HeaderReferenceInterceptor(ExtensionPointRegistry extensions, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) { + public HeaderReferenceInterceptor(ExtensionPointRegistry extensions, JMSBinding jmsBinding, + JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) { super(); this.jmsBinding = jmsBinding; this.runtimeWire = runtimeWire; - this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(extensions, jmsBinding); - - } + this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(extensions, jmsBinding); + this.operations = runtimeWire.getReference().getInterfaceContract().getInterface().getOperations(); + } // end constructor public Message invoke(Message msg) { - return next.invoke(invokeRequest(msg)); - - } + } // end method invoke public Message invokeRequest(Message tuscanyMsg) { try { - // get the jms context + // Get the JMS context JMSBindingContext context = tuscanyMsg.getBindingContext(); javax.jms.Message jmsMsg = tuscanyMsg.getBody(); @@ -81,12 +79,10 @@ public Message invokeRequest(Message tuscanyMsg) { String operationName = operation.getName(); RuntimeEndpointReference reference = runtimeWire; - // I think the OASIS spec suggests we do not need to do anything with + // OASIS spec suggests we do not need to do anything with // @nativeOperation here on the reference side. requestMessageProcessor.setOperationName(operationName, jmsMsg); - - - + if (jmsBinding.getEffectiveJMSDeliveryMode(operationName) != null) { if (jmsBinding.getEffectiveJMSDeliveryMode(operationName)) { jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT); @@ -157,8 +153,7 @@ public Message invokeRequest(Message tuscanyMsg) { } catch (NamingException e) { throw new JMSBindingException(e); } - } - + } // end method invokeRequest protected String getCallbackDestinationName(RuntimeEndpointReference reference) { RuntimeEndpoint endpoint = (RuntimeEndpoint) reference.getCallbackEndpoint(); @@ -169,14 +164,35 @@ protected String getCallbackDestinationName(RuntimeEndpointReference reference) return null; } + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } + public Message processResponse(Message msg) { + // When the response message arrives, there may be information about the + // operation and the related request message ID in the headers - extract it into the + // Tuscany message + + javax.jms.Message responseMsg = msg.getBody(); + try { + // Operation name... + String operationName = responseMsg.getStringProperty("scaOperationName"); + for( Operation op : operations ) { + if( operationName.equals(op.getName())) { + msg.setOperation(op); + break; + } // end if + } // end for + + // Relates to header... + String relatesTo = responseMsg.getStringProperty("RELATES_TO"); + if( relatesTo != null ) { + msg.getHeaders().put("RELATES_TO", relatesTo); + } // end if + } catch (JMSException e) { + // TODO Auto-generated catch block + } // end try + return msg; + } // end method processResponse - } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java index e899448760..6dac182d9a 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java @@ -24,12 +24,13 @@ import org.apache.tuscany.sca.binding.jms.JMSBinding; import org.apache.tuscany.sca.binding.jms.JMSBindingException; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; -public class HeaderServiceInterceptor implements Interceptor { +public class HeaderServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private JMSBinding jmsBinding; @@ -75,30 +76,43 @@ public Message invokeResponse(Message tuscanyMsg) { for (String propName : jmsBinding.getPropertyNames()) { Object value = jmsBinding.getProperty(propName); jmsMsg.setObjectProperty(propName, value); - } + } // end for Map operationProperties = jmsBinding.getOperationProperties(operationName); if (operationProperties != null) { for (String propName : operationProperties.keySet()) { Object value = operationProperties.get(propName); jmsMsg.setObjectProperty(propName, value); - } - } + } // end for + } // end if + + // Put a "RELATES_TO" property into the response message + String relatesTo = (String)tuscanyMsg.getHeaders().get("RELATES_TO"); + if( relatesTo != null ) { + jmsMsg.setStringProperty("RELATES_TO", relatesTo); + } // end if return tuscanyMsg; } catch (JMSException e) { throw new JMSBindingException(e); - } - } + } // end try + } // end method invokeResponse public Invoker getNext() { return next; - } + } // end method getNext public void setNext(Invoker next) { this.next = next; } - - -} + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + +} // end class diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/AsyncResponseJMSServiceListener.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/AsyncResponseJMSServiceListener.java new file mode 100644 index 0000000000..1aa316f81b --- /dev/null +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/AsyncResponseJMSServiceListener.java @@ -0,0 +1,272 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.binding.jms.host; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageListener; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.Topic; +import javax.naming.NamingException; +import javax.resource.spi.ActivationSpec; + +import org.apache.tuscany.sca.binding.jms.JMSBinding; +import org.apache.tuscany.sca.binding.jms.JMSBindingConstants; +import org.apache.tuscany.sca.binding.jms.JMSBindingException; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.work.WorkScheduler; + +/** + * Implementation of a JMS response queue handler for async responses + * + * @version $Rev$ $Date$ + */ +public class AsyncResponseJMSServiceListener implements JMSServiceListener { + private static final Logger logger = Logger.getLogger(AsyncResponseJMSServiceListener.class.getName()); + + private MessageListener listener; + private String serviceName; + private JMSBinding jmsBinding; + private WorkScheduler workScheduler; + + private JMSResourceFactory jmsResourceFactory; + private MessageConsumer consumer; + private boolean running; + + private Destination destination; + + public AsyncResponseJMSServiceListener(MessageListener listener, String serviceName, + JMSBinding jmsBinding, WorkScheduler workScheduler, JMSResourceFactory rf) { + this.listener = listener; + this.serviceName = serviceName; + this.jmsBinding = jmsBinding; + this.workScheduler = workScheduler; + this.jmsResourceFactory = rf; + } + + public void start() { + this.running = true; + + try { + registerListener(); + } catch (Exception e) { + if (e instanceof JMSBindingException) throw (JMSBindingException)e; + throw new JMSBindingException("Error starting JMSAsyncResponse endpoint", e); + } + } // end start + + public void stop() { + this.running = false; + try { + consumer.close(); + jmsResourceFactory.closeConnection(); + jmsResourceFactory.closeResponseConnection(); + } catch (Exception e) { + // if using an embedded broker then when shutting down Tuscany the broker may get closed + // before this stop method is called. I can't see how to detect that so for now just + // ignore the exception if the message is that the transport is already disposed + if ((e.getMessage() == null) || !e.getMessage().contains("disposed")) { + throw new JMSBindingException("Error stopping JMSServiceBinding", e); + } + } + } // end stop + + private void registerListener() throws NamingException, JMSException { + + Session session = jmsResourceFactory.createSession(); + lookupActivationSpec(); + destination = lookupQueue( jmsBinding.getResponseDestinationName() ); + if (destination == null) { + throw new JMSBindingException("Unable to create Async Response queue"); + } // end if + + if (jmsBinding.getJMSSelector() != null) { + consumer = session.createConsumer(destination, jmsBinding.getJMSSelector()); + } else { + consumer = session.createConsumer(destination); + } // end if + + try { + + consumer.setMessageListener(listener); + jmsResourceFactory.startConnection(); + + } catch (javax.jms.JMSException e) { + + // setMessageListener not allowed in JEE container so use Tuscany threads + + jmsResourceFactory.startConnection(); + workScheduler.scheduleWork(new Runnable() { + public void run() { + try { + while (running) { + final Message msg = consumer.receive(); + workScheduler.scheduleWork(new Runnable() { + public void run() { + try { + listener.onMessage(msg); + } catch (Exception e) { + e.printStackTrace(); + } // end try + } // end method run + }); + } // end while + } catch (Exception e) { + e.printStackTrace(); + } // end try + } // end method run + }); + } // end try + logger.log(Level.INFO, "JMS AsyncResponse handler '" + + serviceName + + "' listening on destination " + + ((destination instanceof Queue) ? ((Queue)destination).getQueueName() : ((Topic)destination).getTopicName())); + } // end method registerListener + + // Stub code for ActivationSpec support that throws appropriate errors + private void lookupActivationSpec() { + if ( jmsBinding.getActivationSpecName() != null ) { + String createMode = jmsBinding.getActivationSpecCreate(); + if ( JMSBindingConstants.CREATE_ALWAYS.equals(createMode) ) { + ActivationSpec spec = jmsResourceFactory.lookupActivationSpec(jmsBinding.getActivationSpecName()); + if ( spec != null ) { + throw new JMSBindingException("ActivationSpec specifies create mode of \"always\" but resource already exists."); + } + throw new JMSBindingException("Can not create ActivationSpec"); + } else if ( JMSBindingConstants.CREATE_IF_NOT_EXIST.equals(createMode)) { + ActivationSpec spec = jmsResourceFactory.lookupActivationSpec(jmsBinding.getActivationSpecName()); + if ( spec == null ) { + throw new JMSBindingException("Can not create ActivationSpec"); + } + } else if ( JMSBindingConstants.CREATE_NEVER.equals(createMode)) { + ActivationSpec spec = jmsResourceFactory.lookupActivationSpec(jmsBinding.getActivationSpecName()); + if ( spec == null ) + throw new JMSBindingException("ActivationSpec specifies create mode of \"never\" but resource does not exist at jndiName " + jmsBinding.getActivationSpecName()); + + } // end if + } // end if + } // end method lookupActivationSpec + + /** + * Looks up the Async Response Queue for the JMS Binding. + *

+ * What happens in the look up will depend on the create mode specified for the JMS Binding: + *

    + *
  • always - the JMS queue is always created. It is an error if the queue already exists + *
  • ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists + *
  • never - the JMS queue is never created. It is an error if the queue does not exist + *
+ * See the SCA JMS Binding specification for more information. + *

+ * @param queueName - the name of the Async Response queue + * @return The Async Response queue. + * @throws NamingException Failed to lookup JMS queue + * @throws JMSBindingException Failed to lookup JMS Queue. Probable cause is that the JMS queue's current existence/non-existence is not + * compatible with the create mode specified on the binding + */ + private Destination lookupQueue(String queueName ) throws NamingException, JMSBindingException { + + Destination destination = jmsResourceFactory.lookupDestination(queueName); + + String qCreateMode = jmsBinding.getDestinationCreate(); + if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) { + // In this mode, the queue must not already exist as we are creating it + if (destination != null) { + throw new JMSBindingException("JMS Destination " + queueName + + " already exists but has create mode of \"" + + qCreateMode + + "\" while registering service " + + serviceName + + " listener"); + } // end if + + // Create the queue + destination = jmsResourceFactory.createDestination(queueName); + + } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) { + // In this mode, the queue may nor may not exist. It will be created if it does not exist + // but don't create when using jms:jndi uri format + if (destination == null && !"jndi".equals(jmsBinding.getDestinationType())) { + destination = jmsResourceFactory.createDestination(queueName); + } // end if + + } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) { + // In this mode, the queue must have already been created. + if (destination == null) { + throw new JMSBindingException("JMS Destination " + queueName + + " not found but create mode of \"" + + qCreateMode + + "\" while registering service " + + serviceName + + " listener"); + } // end if + } // end if + + // Make sure we ended up with a queue + if (destination == null) { + throw new JMSBindingException("JMS Destination " + queueName + + " not found with create mode of \"" + + qCreateMode + + "\" while registering service " + + serviceName + + " listener"); + } // end if + + // Make sure its the expected type (queue or topic) + String type = (destination instanceof Queue) ? JMSBindingConstants.DESTINATION_TYPE_QUEUE : JMSBindingConstants.DESTINATION_TYPE_TOPIC; + if ("jndi".equals(jmsBinding.getDestinationType())) { + jmsBinding.setDestinationType(type); + } else { + if (!type.equals(jmsBinding.getDestinationType())) { + throw new JMSBindingException("JMS Destination " + queueName + + " expecting type of " + + jmsBinding.getDestinationType() + + " but found " + + type + + " while registering service " + + serviceName + + " listener"); + } // end if + } // end if + + return destination; + } // end method lookupDestinationQueue(String) + + public String getDestinationName() { + try { + if (destination instanceof Queue) { + return ((Queue)destination).getQueueName(); + } else if (destination instanceof Topic) { + return ((Topic)destination).getTopicName(); + } else { + return null; + } + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } // end method getDestinationName + +} // end class AsyncResponseJMSServiceListener diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java index 9f3062f065..566284fda6 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java @@ -90,9 +90,15 @@ protected void invokeService(Message requestJMSMsg) throws JMSException, Invocat // call the runtime wire - the response is handled by the // transport interceptor - getEndpoint(targetBinding).invoke(tuscanyMsg); + //getEndpoint(targetBinding).invoke(tuscanyMsg); + RuntimeEndpoint endpoint = getEndpoint(targetBinding); + if( endpoint.isAsyncInvocation() ) { + endpoint.invokeAsync(tuscanyMsg); + } else { + endpoint.invoke(tuscanyMsg); + } // end if - } + } // end method invokeService private RuntimeEndpoint getEndpoint(Binding targetBinding) { for(Endpoint ep: service.getEndpoints()) { diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSAsyncResponseInvoker.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSAsyncResponseInvoker.java new file mode 100644 index 0000000000..386cb54700 --- /dev/null +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSAsyncResponseInvoker.java @@ -0,0 +1,98 @@ +/* + * 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. + */ +package org.apache.tuscany.sca.binding.jms.host; + +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.naming.NamingException; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.binding.jms.JMSBinding; +import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + +/** + * TODO RRB experiement + * Listener for the JMSBinding. + * + * @version $Rev$ $Date$ + */ +public class JMSAsyncResponseInvoker implements MessageListener { + + private static final Logger logger = Logger.getLogger(JMSAsyncResponseInvoker.class.getName()); + + private RuntimeEndpointReference endpointReference; + private JMSBinding jmsBinding; + private JMSResourceFactory jmsResourceFactory; + private RuntimeComponentReference reference; + private MessageFactory messageFactory; + + public JMSAsyncResponseInvoker(RuntimeEndpointReference endpointReference, + MessageFactory messageFactory, + JMSResourceFactory rf) throws NamingException { + this.endpointReference = endpointReference; + this.jmsBinding = (JMSBinding) endpointReference.getBinding(); + this.jmsResourceFactory = rf; + this.reference = (RuntimeComponentReference) endpointReference.getReference(); + this.messageFactory = messageFactory; + } + + public void onMessage(Message requestJMSMsg) { + logger.log(Level.FINE, "JMS reference '" + reference.getName() + "' received message " + requestJMSMsg); + try { + invokeReference(requestJMSMsg); + } catch (Throwable e) { + logger.log(Level.SEVERE, "Exception send fault response '" + reference.getName(), e); + } + } // end method onMessage + + protected void invokeReference(Message requestJMSMsg) throws JMSException, InvocationTargetException { + + // create the Tuscany message + org.apache.tuscany.sca.invocation.Message tuscanyMsg = messageFactory.createMessage(); + + // populate the message context with JMS binding information + JMSBindingContext context = new JMSBindingContext(); + tuscanyMsg.setBindingContext(context); + + context.setJmsMsg(requestJMSMsg); + context.setJmsResourceFactory(jmsResourceFactory); + context.setReplyToDestination(requestJMSMsg.getJMSReplyTo()); + + + + // set the message body + tuscanyMsg.setBody(requestJMSMsg); + + // call the runtime wire - the response is handled by the + // transport interceptor + endpointReference.invokeAsyncResponse(tuscanyMsg); + + } // end method invokeReference + +} // end class AsyncResponseInvoker diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java index aae81fbac1..b9c4166233 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java @@ -35,6 +35,7 @@ import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML; import org.apache.tuscany.sca.common.xml.dom.DOMHelper; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -50,7 +51,7 @@ * * @version $Rev$ $Date$ */ -public class OperationSelectorJMSDefaultServiceInterceptor implements Interceptor { +public class OperationSelectorJMSDefaultServiceInterceptor extends InterceptorAsyncImpl { private static final String ON_MESSAGE_METHOD_NAME = "onMessage"; @@ -193,6 +194,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; - } - + } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return msg; + } // end method processResponse } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java index 343aa8d52a..52a7c58027 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java @@ -26,6 +26,7 @@ import org.apache.tuscany.sca.binding.jms.JMSBindingException; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSUserProp; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -39,7 +40,7 @@ * * */ -public class OperationSelectorJMSUserPropServiceInterceptor implements Interceptor { +public class OperationSelectorJMSUserPropServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpoint endpoint; @@ -104,4 +105,11 @@ public void setNext(Invoker next) { this.next = next; } + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return msg; + } // end method processResponse } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingAsyncResponseInvoker.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingAsyncResponseInvoker.java new file mode 100644 index 0000000000..f07e9de29f --- /dev/null +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingAsyncResponseInvoker.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.binding.jms.provider; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; + +/** + * @version $Rev$ $Date$ + */ +public class JMSBindingAsyncResponseInvoker implements InvokerAsyncResponse { + + RuntimeEndpoint endpoint; + + public JMSBindingAsyncResponseInvoker(ExtensionPointRegistry extensionPoints, + RuntimeEndpoint endpoint) { + this.endpoint = endpoint; + } // end constructor + + public void invokeAsyncResponse(Message msg) { + // TODO + } // end method invokeAsyncResponse +} // end class JMSBindingAsyncResponseInvoker \ No newline at end of file diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java index 4ee0719707..3471e68d6f 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java @@ -20,37 +20,45 @@ package org.apache.tuscany.sca.binding.jms.provider; import javax.jms.JMSException; +import javax.jms.MessageListener; +import javax.naming.NamingException; import org.apache.tuscany.sca.binding.jms.JMSBinding; import org.apache.tuscany.sca.binding.jms.JMSBindingException; import org.apache.tuscany.sca.binding.jms.headers.HeaderReferenceInterceptor; +import org.apache.tuscany.sca.binding.jms.host.AsyncResponseJMSServiceListener; +import org.apache.tuscany.sca.binding.jms.host.JMSAsyncResponseInvoker; import org.apache.tuscany.sca.binding.jms.transport.TransportReferenceInterceptor; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.provider.EndpointReferenceProvider; +import org.apache.tuscany.sca.provider.EndpointReferenceAsyncProvider; import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; import org.apache.tuscany.sca.provider.WireFormatProvider; import org.apache.tuscany.sca.provider.WireFormatProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; +import org.apache.tuscany.sca.work.WorkScheduler; /** * Implementation of the JMS reference binding provider. * + * This version supports native async service invocations + * * @version $Rev$ $Date$ */ -public class JMSBindingReferenceBindingProvider implements EndpointReferenceProvider { +public class JMSBindingReferenceBindingProvider implements EndpointReferenceAsyncProvider { private RuntimeEndpointReference endpointReference; private RuntimeComponentReference reference; private JMSBinding jmsBinding; private JMSResourceFactory jmsResourceFactory; - private RuntimeComponent component; private InterfaceContract interfaceContract; private ExtensionPointRegistry extensions; @@ -61,13 +69,14 @@ public class JMSBindingReferenceBindingProvider implements EndpointReferenceProv private WireFormatProviderFactory responseWireFormatProviderFactory; private WireFormatProvider responseWireFormatProvider; + + private AsyncResponseJMSServiceListener responseQueue = null; public JMSBindingReferenceBindingProvider(RuntimeEndpointReference endpointReference, ExtensionPointRegistry extensions, JMSResourceFactory jmsResourceFactory) { this.endpointReference = endpointReference; this.reference = (RuntimeComponentReference) endpointReference.getReference(); this.jmsBinding = (JMSBinding) endpointReference.getBinding(); this.extensions = extensions; - this.component = (RuntimeComponent) endpointReference.getComponent(); this.jmsResourceFactory = jmsResourceFactory; // Get the factories/providers for operation selection @@ -95,16 +104,21 @@ public JMSBindingReferenceBindingProvider(RuntimeEndpointReference endpointRefer responseWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract); } catch (CloneNotSupportedException ex){ interfaceContract = reference.getInterfaceContract(); - } - } + } // end try + + // If the service is asyncInvocation, then create a fixed response location + if( endpointReference.isAsyncInvocation() ) { + String asyncCallbackName = endpointReference.getReference().getName() + "_asyncResponse"; + jmsBinding.setResponseDestinationName(asyncCallbackName); + } // end if + + } // end constructor public Invoker createInvoker(Operation operation) { if (jmsBinding.getDestinationName() == null) { -// if (!reference.isCallback()) { // TODO: 2.x migration, is this check needed? throw new JMSBindingException("No destination specified for reference " + reference.getName()); -// } - } + } // end if if ( jmsBinding.getActivationSpecName() != null ) { throw new JMSBindingException("Activation spec can not be specified on an SCA reference binding."); @@ -113,7 +127,7 @@ public Invoker createInvoker(Operation operation) { invoker = new RRBJMSBindingInvoker(operation, jmsResourceFactory, endpointReference); return invoker; - } + } // end method createInvoker public boolean supportsOneWayInvocation() { return true; @@ -124,17 +138,43 @@ public InterfaceContract getBindingInterfaceContract() { } public void start() { + // If the reference is async invocation, then a response queue handler and associated JMS listener must be created + // and started + if (endpointReference.isAsyncInvocation()) { + // Create the JMS listener + FactoryExtensionPoint modelFactories = extensions.getExtensionPoint(FactoryExtensionPoint.class); + MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class); + MessageListener listener; + try { + listener = new JMSAsyncResponseInvoker(endpointReference, messageFactory, jmsResourceFactory); + } catch (NamingException e) { + throw new JMSBindingException("Unable to create JMSResponseInvoker", e); + } // end try + + // Create the response queue handler + UtilityExtensionPoint utilities = extensions.getExtensionPoint(UtilityExtensionPoint.class); + WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class); + + responseQueue = new AsyncResponseJMSServiceListener(listener, + jmsBinding.getResponseDestinationName(), + jmsBinding, workScheduler, jmsResourceFactory); + responseQueue.start(); + } // end if - } + } // end method start public void stop() { try { + if( responseQueue != null ) { + responseQueue.stop(); + } // end if + jmsResourceFactory.closeConnection(); jmsResourceFactory.closeResponseConnection(); } catch (JMSException e) { throw new JMSBindingException(e); } - } + } // end method stop /* * set up the reference binding wire with the right set of jms reference @@ -167,6 +207,13 @@ public void configure() { jmsBinding, jmsResourceFactory, endpointReference) ); - } + } + + /** + * Indicates that this binding supports async invocations natively + */ + public boolean supportsNativeAsync() { + return true; + } // end method supportsNativeAsync -} +} // end class diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java index 8428a45c6e..b96376eb15 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java @@ -29,14 +29,18 @@ import org.apache.tuscany.sca.binding.jms.host.JMSServiceListenerDetails; import org.apache.tuscany.sca.binding.jms.host.JMSServiceListenerFactory; import org.apache.tuscany.sca.binding.jms.transport.TransportServiceInterceptor; +import org.apache.tuscany.sca.binding.jms.wire.AsyncResponseDestinationInterceptor; import org.apache.tuscany.sca.binding.jms.wire.CallbackDestinationInterceptor; import org.apache.tuscany.sca.binding.jms.wire.OperationPropertiesInterceptor; +import org.apache.tuscany.sca.binding.sca.provider.SCABindingAsyncResponseInvoker; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.provider.EndpointAsyncProvider; import org.apache.tuscany.sca.provider.EndpointProvider; import org.apache.tuscany.sca.provider.OperationSelectorProvider; import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory; @@ -52,7 +56,7 @@ * * @version $Rev$ $Date$ */ -public class JMSBindingServiceBindingProvider implements EndpointProvider, JMSServiceListenerDetails { +public class JMSBindingServiceBindingProvider implements EndpointAsyncProvider, JMSServiceListenerDetails { private static final Logger logger = Logger.getLogger(JMSBindingServiceBindingProvider.class.getName()); private ExtensionPointRegistry registry; @@ -202,7 +206,11 @@ public void configure() { new CallbackDestinationInterceptor(endpoint)); bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, new HeaderServiceInterceptor(jmsBinding)); - + + // add async response interceptor after header interceptor + bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, + new AsyncResponseDestinationInterceptor(endpoint)); + // add request wire format bindingChain.addInterceptor(requestWireFormatProvider.getPhase(), requestWireFormatProvider.createInterceptor()); @@ -243,4 +251,15 @@ public RuntimeEndpoint getEndpoint() { return endpoint; } + /** + * Indicates that this service binding does support native async service invocations + */ + public boolean supportsNativeAsync() { + return true; + } // end method supportsNativeAsync + + public InvokerAsyncResponse createAsyncResponseInvoker() { + return new JMSBindingAsyncResponseInvoker(null, endpoint); + } // end method createAsyncResponseInvoker + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java index 098bdde3ae..0e88b283dc 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java @@ -29,9 +29,11 @@ import org.apache.tuscany.sca.binding.jms.JMSBindingConstants; import org.apache.tuscany.sca.binding.jms.JMSBindingException; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.util.FaultException; import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.oasisopen.sca.ServiceRuntimeException; @@ -40,7 +42,7 @@ * * @version $Rev$ $Date$ */ -public class RRBJMSBindingInvoker implements Invoker { +public class RRBJMSBindingInvoker extends InterceptorAsyncImpl { protected Operation operation; protected String operationName; @@ -65,14 +67,12 @@ public RRBJMSBindingInvoker(Operation operation, JMSResourceFactory jmsResourceF // properties of the inbound service request. We should not look for or require a // statically-configured destination unless a message is received that does not have // the necessary properties. -// if (!reference.isCallback()) { // TODO: 2.x migration, is this check needed? - bindingRequestDest = lookupDestination(); -// } + bindingRequestDest = lookupDestination(); bindingReplyDest = lookupResponseDestination(); } catch (NamingException e) { throw new JMSBindingException(e); - } - } + } // end try + } // end constructor /** * Looks up the Destination Queue for the JMS Binding @@ -136,7 +136,7 @@ protected Destination lookupDestinationQueue(boolean isReponseQueue) throws Nami qCreateMode = jmsBinding.getDestinationCreate(); } - // FIXME: [rfeng] A hack to remove jms:jndi: prefix + // Remove jms:jndi: prefix if present if (queueName.startsWith("jms:jndi:")) { queueName = queueName.substring("jms:jndi:".length()); } @@ -186,7 +186,15 @@ protected Destination lookupDestinationQueue(boolean isReponseQueue) throws Nami } return dest; - } + } // end method lookupDestinationQueue + + /** + * Get the next in the chain from the binding invocation chain + */ + public Invoker getNext() { + return (Invoker)endpointReference.getBindingInvocationChain().getHeadInvoker(); + } // end method getNext + public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message tuscanyMsg) { try { @@ -264,6 +272,86 @@ protected Destination getReplyToDestination(Session session) throws JMSException } } return replyToDest; - } + } + + /** + * Process forward request message + * @param tuscanyMsg - the request message + * @return the processed version of the request message + */ + public Message processRequest(Message tuscanyMsg) { + try { + // populate the message context with JMS binding information + JMSBindingContext context = new JMSBindingContext(); + context.setJmsResourceFactory(jmsResourceFactory); + tuscanyMsg.setBindingContext(context); + + // get a JMS session to cover the creation and sending of the message + Session session = context.getJmsSession(); + + context.setRequestDestination(getRequestDestination(tuscanyMsg, session)); + context.setReplyToDestination(getReplyToDestination(session)); + + return tuscanyMsg; + } catch (Exception e) { + throw new JMSBindingException(e); + } // end try + } // end method processRequest + + /** + * Post processing for a request message where an error occurred + * @param tuscanyMsg + * @return the post processed message + */ + public Message postProcessRequest(Message tuscanyMsg, Throwable e) { + // Exception handling + if ( e instanceof ServiceRuntimeException ) { + if (e.getCause() instanceof InvocationTargetException) { + if ((e.getCause().getCause() instanceof RuntimeException)) { + tuscanyMsg.setFaultBody(e.getCause()); + } else { + tuscanyMsg.setFaultBody(((InvocationTargetException)e.getCause()).getTargetException()); + } // end if + } else if (e.getCause() instanceof FaultException) { + tuscanyMsg.setFaultBody(e.getCause()); + } else { + tuscanyMsg.setFaultBody(e); + } // end if + } else { + tuscanyMsg.setFaultBody(e); + } // end if + + return postProcessRequest( tuscanyMsg ); + } // end method postProcessRequest + + /** + * General post processing for a request message + * - close out the JMS session & connection + * @param tuscanyMsg + * @return the post processed message + */ + public Message postProcessRequest(Message tuscanyMsg) { + // Close of JMS session + try { + JMSBindingContext context = tuscanyMsg.getBindingContext(); + context.closeJmsSession(); + if (jmsResourceFactory.isConnectionClosedAfterUse()) { + jmsResourceFactory.closeConnection(); + } // end if + } catch (JMSException ex) { + throw new JMSBindingException(ex); + } // end try + return tuscanyMsg; + } // end method postProcessRequest + + /** + * Process response message + * @param tuscanyMsg - the response message + * @return the processed version of the response message + */ + public Message processResponse(Message tuscanyMsg) { + // For async handling, there is nothing to do here + return tuscanyMsg; + } } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java index 3ed8021107..cba6022fb1 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java @@ -30,6 +30,7 @@ import org.apache.tuscany.sca.binding.jms.JMSBindingException; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -41,7 +42,7 @@ * * @version $Rev$ $Date$ */ -public class TransportReferenceInterceptor implements Interceptor { +public class TransportReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private JMSResourceFactory jmsResourceFactory; @@ -91,8 +92,7 @@ public Message invokeRequest(Message msg) { Boolean deliveryModePersistent = jmsBinding.getEffectiveJMSDeliveryMode(opName); if (deliveryModePersistent != null) { producer.setDeliveryMode( deliveryModePersistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT); - } - + } try { producer.send((javax.jms.Message)msg.getBody()); @@ -102,8 +102,8 @@ public Message invokeRequest(Message msg) { return msg; } catch (JMSException e) { throw new JMSBindingException(e); - } - } + } // end try + } // end method invokeRequest public Message invokeResponse(Message msg) { JMSBindingContext context = msg.getBindingContext(); @@ -165,4 +165,23 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + /** + * Process forward request message + * @param tuscanyMsg - the request message + * @return the processed version of the request message + */ + public Message processRequest(Message tuscanyMsg) { + return invokeRequest(tuscanyMsg); + } // end method processRequest + + /** + * Process response message + * @param tuscanyMsg - the response message + * @return the processed version of the response message + */ + public Message processResponse(Message tuscanyMsg) { + // TODO Auto-generated method stub + return tuscanyMsg; + } // end method processResponse } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java index d371bbba86..df8f33bac3 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java @@ -40,6 +40,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -51,7 +52,7 @@ * * @version $Rev$ $Date$ */ -public class TransportServiceInterceptor implements Interceptor { +public class TransportServiceInterceptor extends InterceptorAsyncImpl { private static final Logger logger = Logger.getLogger(TransportServiceInterceptor.class.getName()); private Invoker next; @@ -96,7 +97,6 @@ public Message invoke(Message msg) { } public Message invokeRequest(Message msg) { -// try { EndpointReference from = assemblyFactory.createEndpointReference(); Endpoint fromEndpoint = assemblyFactory.createEndpoint(); @@ -109,10 +109,8 @@ public Message invokeRequest(Message msg) { from.setCallbackEndpoint(callbackEndpoint); return msg; -// } catch (JMSException e) { -// throw new JMSBindingException(e); -// } - } + + } // end method invokeRequest public Message invokeResponse(Message msg) { JMSBindingContext context = msg.getBindingContext(); @@ -202,6 +200,85 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; - } + } + + public Message processRequest(Message msg) { + return invokeRequest( msg ); + } // end method processRequest + + public Message processResponse(Message msg) { + JMSBindingContext context = msg.getBindingContext(); + try { + Session session = context.getJmsResponseSession(); + javax.jms.Message requestJMSMsg = context.getJmsMsg(); + javax.jms.Message responseJMSMsg = msg.getBody(); + + Destination replyDest = requestJMSMsg.getJMSReplyTo(); + if (replyDest == null) { + if (jmsBinding.getResponseDestinationName() != null) { + try { + replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName()); + } catch (NamingException e) { + throw new JMSBindingException("Exception lookingup response destination", e); + } + } + } // end if + + if (replyDest == null) { + // assume no reply is expected + if (msg.getBody() != null) { + logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo"); + } + return msg; + } // end if + + if ((msg.getOperation() != null)) { + String operationName = msg.getOperation().getName(); + if (jmsBinding.getEffectiveJMSPriority(operationName) != null) { + responseJMSMsg.setJMSPriority(jmsBinding.getEffectiveJMSPriority(operationName)); + } + + if ( jmsBinding.getEffectiveJMSType(operationName) != null) { + responseJMSMsg.setJMSType(jmsBinding.getEffectiveJMSType(operationName)); + } + + if ((jmsBinding.getEffectiveJMSDeliveryMode(operationName) != null)) { + responseJMSMsg.setJMSDeliveryMode(jmsBinding.getEffectiveJMSDeliveryMode(operationName) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT); + } + + if ((jmsBinding.getEffectiveJMSTimeToLive(operationName) != null)) { + responseJMSMsg.setJMSExpiration(jmsBinding.getEffectiveJMSTimeToLive(operationName).longValue()); + } + } + + if (correlationScheme == null || + JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) { + responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID()); + } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) { + responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID()); + } + + MessageProducer producer = session.createProducer(replyDest); + + // Set jms header attributes in producer, not message. + int deliveryMode = requestJMSMsg.getJMSDeliveryMode(); + producer.setDeliveryMode(deliveryMode); + int deliveryPriority = requestJMSMsg.getJMSPriority(); + producer.setPriority(deliveryPriority); + long timeToLive = requestJMSMsg.getJMSExpiration(); + producer.setTimeToLive(timeToLive); + + producer.send((javax.jms.Message)msg.getBody()); + + producer.close(); + + return msg; + + } catch (JMSException e) { + throw new JMSBindingException(e); + } finally { + context.closeJmsResponseSession(); + } // end try + } // end method processResponse } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java new file mode 100644 index 0000000000..7bb91f3081 --- /dev/null +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java @@ -0,0 +1,193 @@ +/* + * 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. + */ +package org.apache.tuscany.sca.binding.jms.wire; + +import java.util.Iterator; +import java.util.List; + +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Queue; +import javax.jms.Topic; +import javax.naming.NamingException; + +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.binding.jms.JMSBinding; +import org.apache.tuscany.sca.binding.jms.JMSBindingConstants; +import org.apache.tuscany.sca.binding.jms.JMSBindingException; +import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.core.invocation.AsyncResponseInvoker; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; + +/** + * JMS Binding Interceptor class that deals with destination address & ID for an async response on the service side + * + */ +public class AsyncResponseDestinationInterceptor extends InterceptorAsyncImpl { + private Invoker next; + private RuntimeComponentService service; + private RuntimeEndpoint endpoint; + + public AsyncResponseDestinationInterceptor(RuntimeEndpoint endpoint) { + super(); + this.service = (RuntimeComponentService) endpoint.getService(); + this.endpoint = endpoint; + } + + public Invoker getNext() { + return next; + } + + public void setNext(Invoker next) { + this.next = next; + } + + public Message invoke(Message msg) { + return next.invoke(invokeRequest(msg)); + } + + /** + * Handle an invocation request messaage + * @param msg the message + * @return the updated message + */ + public Message invokeRequest(Message msg) { + try { + // Get the JMS context + JMSBindingContext context = msg.getBindingContext(); + javax.jms.Message jmsMsg = context.getJmsMsg(); + + // Extract the Callback destination name header, if present + String asyncRespAddr = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY); + + if (asyncRespAddr != null) { + asyncRespAddr = stripJMSPrefix( asyncRespAddr ); + } else { + // If there is no Callback destination name header present, but the service is async, use the JMS ReplyTo header + if ( isAsync(service) ) { + if ( ( jmsMsg.getJMSReplyTo() != null ) ) { + Destination replyTo = jmsMsg.getJMSReplyTo(); + if (replyTo != null) { + asyncRespAddr = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName(); + } + } // end if + } // end if + } // end if + + // If there is no response address, we're done + if( asyncRespAddr == null ) return msg; + + // Get the message ID - assume that the interceptor for obtaining the message ID is earlier in the chain + // than this interceptor + String msgID = (String)msg.getHeaders().get("MESSAGE_ID"); + + // Create a response invoker and add it to the message headers + AsyncResponseInvoker respInvoker = new AsyncResponseInvoker(endpoint, null, asyncRespAddr, msgID); + msg.getHeaders().put("ASYNC_RESPONSE_INVOKER", respInvoker); + + } catch (JMSException e) { + throw new JMSBindingException(e); + } // end try + + return msg; + } // end method invokeRequest + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + /** + * Process a response message + * - if it is an async response, there will be a header "ASYNC_RESPONSE_INVOKER" which contains + * the address of the JMS queue to reply to plus a message ID of the original message + * These values are used to create the Destination for the JMS message and to add a "RELATES_TO" + * header which is sent with the response message to allow the client to correlate the response + * to the original request + * @param msg - the Tuscany message + * @returns - the updated Tuscany message + */ + public Message processResponse(Message msg) { + AsyncResponseInvoker respInvoker = (AsyncResponseInvoker)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER"); + if ( respInvoker == null ) return msg; + + String responseAddress = respInvoker.getResponseTargetAddress(); + String relatedMsg = respInvoker.getRelatesToMsgID(); + + // Get the JMS context + JMSBindingContext context = msg.getBindingContext(); + JMSResourceFactory jmsResourceFactory = context.getJmsResourceFactory(); + Destination dest; + try { + dest = jmsResourceFactory.lookupDestination(responseAddress); + if( dest == null ) { + dest = jmsResourceFactory.createDestination(responseAddress); + } // end if + } catch (NamingException e) { + throw new JMSBindingException(e); + } + context.setReplyToDestination(dest); + msg.getHeaders().put("RELATES_TO", relatedMsg); + + return msg; + } // end method processResponse + + /** + * Utility that strips the leading "jms:jndi:" prefix from a JMS address + * @param asyncRespAddr - the JMS address + * @return - the JMS address with the prefix removed + * @throws JMSBindingException if the JMS address does not have a prefix + */ + private String stripJMSPrefix(String asyncRespAddr) { + // If present, strip any leading "jms:jndi:" string + if (!asyncRespAddr.startsWith("jms:jndi:")) { + throw new JMSBindingException("message property " + JMSBindingConstants.CALLBACK_Q_PROPERTY + " does not start with 'jms:jndi:' found: " + asyncRespAddr); + } else { + return asyncRespAddr.substring(9); + } // end if + } // end method stripJMSPrefix + + /** + * Determines if a service has an interface that is async invocation + * @param service - the service + * @return true if the service is async, false otherwise + */ + private boolean isAsync( RuntimeComponentService service ) { + service.getInterfaceContract().getInterface(); + + Iterator intents = service.getRequiredIntents().iterator(); + while ( intents.hasNext() ) { + Intent intent = intents.next(); + if ( intent.getName().getLocalPart().equals("asyncInvocation") ) return true; + } // end while + + intents = service.getInterfaceContract().getInterface().getRequiredIntents().iterator(); + while ( intents.hasNext() ) { + Intent intent = intents.next(); + if ( intent.getName().getLocalPart().equals("asyncInvocation") ) return true; + } // end while + return false; + } // end method isAsync +} // end class \ No newline at end of file diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java index 290ce77e5d..9e14ad0b1a 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java @@ -30,6 +30,7 @@ import org.apache.tuscany.sca.binding.jms.JMSBindingConstants; import org.apache.tuscany.sca.binding.jms.JMSBindingException; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -40,7 +41,7 @@ * JMS Binding Interceptor class that deals with a callback destination address on the service side * */ -public class CallbackDestinationInterceptor implements Interceptor { +public class CallbackDestinationInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeComponentService service; private RuntimeEndpoint endpoint; @@ -119,4 +120,12 @@ public Message invokeRequest(Message msg) { return msg; } // end method invokeRequest + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return msg; + } // end method processResponse } // end class \ No newline at end of file diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java index bf046b473e..682c9ee48c 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.tuscany.sca.binding.jms.JMSBinding; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -28,7 +29,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -public class OperationPropertiesInterceptor implements Interceptor { +public class OperationPropertiesInterceptor extends InterceptorAsyncImpl { private Invoker next; private JMSBinding jmsBinding; private RuntimeComponentService service; @@ -65,5 +66,12 @@ public Message invokeRequest(Message msg) { } return msg; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + public Message processResponse(Message msg) { + return msg; + } // end method processResponse } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java index 4620063076..0b2bcbd7b3 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java @@ -32,6 +32,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -41,7 +42,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSBytesReferenceInterceptor implements Interceptor { +public class WireFormatJMSBytesReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpointReference endpointReference; @@ -120,4 +121,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java index 506d47f8a3..835734f45e 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java @@ -27,6 +27,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -39,7 +40,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSBytesServiceInterceptor implements Interceptor { +public class WireFormatJMSBytesServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpoint endpoint; private JMSResourceFactory jmsResourceFactory; @@ -112,4 +113,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java index e453940d30..6a32344f94 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java @@ -31,6 +31,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.util.FaultException; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -39,7 +40,7 @@ import org.w3c.dom.Node; -public class WireFormatJMSBytesXMLReferenceInterceptor implements Interceptor { +public class WireFormatJMSBytesXMLReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpointReference endpointReference; @@ -120,4 +121,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java index c1e97a93d0..6ff27d4660 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java @@ -27,13 +27,14 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -public class WireFormatJMSBytesXMLServiceInterceptor implements Interceptor { +public class WireFormatJMSBytesXMLServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpoint endpoint; private JMSResourceFactory jmsResourceFactory; @@ -106,4 +107,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java index 87d99a014e..33e73a69ef 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java @@ -33,6 +33,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.util.FaultException; @@ -46,7 +47,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSDefaultReferenceInterceptor implements Interceptor { +public class WireFormatJMSDefaultReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpointReference endpointReference; @@ -172,4 +173,12 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java index da6f283ff9..b66dd0154f 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java @@ -33,6 +33,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; @@ -46,8 +47,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSDefaultServiceInterceptor implements Interceptor { - private Invoker next; +public class WireFormatJMSDefaultServiceInterceptor extends InterceptorAsyncImpl { private RuntimeEndpoint endpoint; private JMSResourceFactory jmsResourceFactory; private JMSBinding jmsBinding; @@ -137,6 +137,11 @@ public Message invokeResponse(Message msg) { // get the jms context JMSBindingContext context = msg.getBindingContext(); + // The Binding Context may be null on an asynchronous response - in which case, create a new one + if(context == null) { + context = createBindingContext(); + msg.setBindingContext(context); + } // end if Session session = context.getJmsResponseSession(); javax.jms.Message responseJMSMsg; @@ -177,11 +182,19 @@ public Message invokeResponse(Message msg) { return msg; } - public Invoker getNext() { - return next; - } + private JMSBindingContext createBindingContext() { + JMSBindingContext context = new JMSBindingContext(); + context.setJmsResourceFactory(jmsResourceFactory); - public void setNext(Invoker next) { - this.next = next; - } + return context; + } // end method createBindingContext + + public Message processRequest(Message msg) { + return invokeRequest( msg ); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse( msg ); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java index ec110ea0d2..842bb791d6 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java @@ -34,6 +34,7 @@ import org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -43,7 +44,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSObjectReferenceInterceptor implements Interceptor { +public class WireFormatJMSObjectReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpointReference endpointReference; @@ -139,4 +140,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java index 19baddd9da..e04501e8b7 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java @@ -30,6 +30,7 @@ import org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -42,7 +43,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSObjectServiceInterceptor implements Interceptor { +public class WireFormatJMSObjectServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpoint endpoint; private JMSResourceFactory jmsResourceFactory; @@ -136,4 +137,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java index fd512f7d27..c2b6881c91 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java @@ -32,6 +32,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; @@ -41,7 +42,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSTextReferenceInterceptor implements Interceptor { +public class WireFormatJMSTextReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpointReference endpointReference; @@ -121,4 +122,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java index c3f3660211..1ba0744593 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java @@ -27,6 +27,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -39,7 +40,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSTextServiceInterceptor implements Interceptor { +public class WireFormatJMSTextServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpoint endpoint; private JMSResourceFactory jmsResourceFactory; @@ -112,4 +113,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java index 4d62022196..25e476f837 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java @@ -34,6 +34,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.util.FaultException; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -45,7 +46,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSTextXMLReferenceInterceptor implements Interceptor { +public class WireFormatJMSTextXMLReferenceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpointReference endpointReference; @@ -125,5 +126,14 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; - } + } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java index 8e4f8fb90b..d914bd9e2e 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java @@ -27,6 +27,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; @@ -39,7 +40,7 @@ * * @version $Rev$ $Date$ */ -public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor { +public class WireFormatJMSTextXMLServiceInterceptor extends InterceptorAsyncImpl { private Invoker next; private RuntimeEndpoint endpoint; private JMSResourceFactory jmsResourceFactory; @@ -113,4 +114,13 @@ public Invoker getNext() { public void setNext(Invoker next) { this.next = next; } + + public Message processRequest(Message msg) { + return invokeRequest(msg); + } // end method processRequest + + public Message processResponse(Message msg) { + return invokeResponse(msg); + } // end method processResponse + } From 9f86a0cbedc54fe8a37f47d7048a17e0c66954b7 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Tue, 21 Dec 2010 07:22:12 +0000 Subject: [PATCH 149/174] Tweaks and extensions to better match the async service implementation in core + JMS binding git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051397 13f79535-47bb-0310-9956-ffa450edef68 --- .../sample/impl/SampleAsyncResponseInvoker.java | 6 +++++- .../main/java/sample/impl/SampleWSDLInvoker.java | 13 ++++++++++--- .../src/main/java/sample/impl/SampleWSDLProxy.java | 14 ++++++-------- .../java/sample/UpperSampleAsyncReferenceImpl.java | 14 ++++++++++++-- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java index 2366deeb33..aed21ecc4e 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleAsyncResponseInvoker.java @@ -49,7 +49,11 @@ class SampleAsyncResponseInvoker implements InvokerAsyncResponse { public void invokeAsyncResponse(final Message msg) { try { - String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); + String messageID = (String) msg.getHeaders().get("RELATES_TO"); + if (messageID == null ) { + messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); + } // end if + String forwardOpName = (String)asyncMessageMap.get(messageID); // process the async response diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java index 4d33a956a8..6758c1fc1f 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLInvoker.java @@ -21,11 +21,13 @@ import java.lang.reflect.Method; +import org.apache.tuscany.sca.core.invocation.AsyncResponseInvoker; import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.oasisopen.sca.ServiceRuntimeException; import org.w3c.dom.Element; /** @@ -55,6 +57,10 @@ public Message invoke(final Message msg) { } public void invokeAsyncRequest(Message msg) { + // Retrieve the async callback information + AsyncResponseInvoker respInvoker = (AsyncResponseInvoker)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER"); + if( respInvoker == null ) throw new ServiceRuntimeException("Async Implementation invoked with no response invoker"); + Message responseMsg = processRequest(msg); // in this sample programming model we make the async @@ -62,11 +68,12 @@ public void invokeAsyncRequest(Message msg) { // component implementation itself doesn't get a chance to // do async responses. - // At this point we could serialize the ??? and pick it up again + // At this point we could serialize the AsyncResponseInvoker and pick it up again // later to send the async response - ((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg); - } + //((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg); + respInvoker.invokeAsyncResponse(responseMsg); + } // end method invokeAsyncRequest public Message processRequest(Message msg) { try { diff --git a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java index 0fc8403cf1..176dac6b15 100644 --- a/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java +++ b/samples/extending-tuscany/implementation-sample/src/main/java/sample/impl/SampleWSDLProxy.java @@ -22,6 +22,8 @@ import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.core.ExtensionPointRegistry; @@ -50,7 +52,7 @@ class SampleWSDLProxy implements WSDLReference { this.ep = ep; mf = ep.getExtensionPoint(MessageFactory.class); repr = (RuntimeEndpointReference)epr; - ops = new HashMap(); + ops = new ConcurrentHashMap(); for(Operation o: wi.getOperations()) ops.put(o.getName(), o); } @@ -71,9 +73,9 @@ public void callAsync(String op, Element e) { Message message = mf.createMessage(); message.setBody(new Object[]{e}); - // We could MESSAGE_ID here if required. If not the infrastructure - // will generate a UUID - String messageID = "myuniqueid"; + // Generate MESSAGE_ID here. + // String messageID = "myuniqueid"; + String messageID = UUID.randomUUID().toString(); message.getHeaders().put(Constants.MESSAGE_ID, messageID); // save the message id ready for when we process the response @@ -88,9 +90,5 @@ public void callAsync(String op, Element e) { ex.printStackTrace(); } - // if we don't provide a message id we can get the one the - // infrastructure generates - //String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); - //asyncMessageMap.put(messageID, op); } } diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java index b6f59515cc..7a86d68043 100644 --- a/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/UpperSampleAsyncReferenceImpl.java @@ -24,8 +24,12 @@ import static sample.Xutil.text; import static sample.Xutil.xdom; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + import org.w3c.dom.Element; +import sample.Xutil.NodeBuilder; import sample.api.Java; import sample.api.WSDL; import sample.api.WSDLReference; @@ -42,6 +46,7 @@ public class UpperSampleAsyncReferenceImpl { WSDLReference upper; Element response; + CountDownLatch latch = new CountDownLatch( 1 ); public String upper(String s) { out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); @@ -49,16 +54,20 @@ public String upper(String s) { // TODO - I'm passing in the non-wrapped version of the parameter // here which doesn't seem right. Need to test that databinding // wraps it correctly - final Element ureq = xdom("http://sample/upper-async", "s", text(s)); + //final Element ureq = xdom("http://sample/upper-async", "s", text(s)); + NodeBuilder node1 = elem("s", text(s)); + final Element ureq = xdom("http://sample/upper-async", "upper", node1); upper.callAsync("upper", ureq); try { Thread.sleep(500); + latch.await(500, TimeUnit.SECONDS); } catch (Exception ex) { // do nothing } - return response.getTextContent(); + if( response != null ) return response.getTextContent(); + else return "upper did not get called back"; } /** @@ -69,5 +78,6 @@ public String upper(String s) { public void upperCallback(Element response) { out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response.getTextContent() + ")"); this.response = response; + latch.countDown(); } } From 0648cd8f5cf1e7c0e040b6cd0719bb4c502820a4 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Tue, 21 Dec 2010 11:32:58 +0000 Subject: [PATCH 150/174] Update POM to exclude Spring transitive dependencies of ActiveMQ git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051461 13f79535-47bb-0310-9956-ffa450edef68 --- features/eclipse-pde/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/features/eclipse-pde/pom.xml b/features/eclipse-pde/pom.xml index 949bbe55b0..6c10621348 100644 --- a/features/eclipse-pde/pom.xml +++ b/features/eclipse-pde/pom.xml @@ -62,6 +62,12 @@ org.apache.activemq activemq-core 5.3.0 + + + org.springframework + spring-context + + From 345271fd04fc6933aaf44434cf057c3d91f8e617 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Tue, 21 Dec 2010 11:36:36 +0000 Subject: [PATCH 151/174] Extend AsyncResponseInvoker to be Generic to cope with binding-specific response address information - under TUSCANY-3807 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051463 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/invocation/AsyncResponseInvoker.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java index fd07911084..0a28bed480 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java @@ -31,8 +31,11 @@ * A class that wraps the mechanics for sending async responses * and hides the decision about whether the response will be processed * natively or non-natively + * + * This class is generic, based on the type of targetAddress information required by + * the Binding that creates it */ -public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializable { +public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializable { /** * @@ -41,12 +44,12 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializable RuntimeEndpoint requestEndpoint; RuntimeEndpointReference responseEndpointReference; - String responseTargetAddress; + T responseTargetAddress; String relatesToMsgID; public AsyncResponseInvoker(RuntimeEndpoint requestEndpoint, RuntimeEndpointReference responseEndpointReference, - String responseTargetAddress, String relatesToMsgID) { + T responseTargetAddress, String relatesToMsgID) { super(); this.requestEndpoint = requestEndpoint; this.responseEndpointReference = responseEndpointReference; @@ -69,11 +72,11 @@ public void invokeAsyncResponse(Message responseMessage) { } } // end method invokeAsyncReponse(Message) - public String getResponseTargetAddress() { + public T getResponseTargetAddress() { return responseTargetAddress; } - public void setResponseTargetAddress(String responseTargetAddress) { + public void setResponseTargetAddress(T responseTargetAddress) { this.responseTargetAddress = responseTargetAddress; } From 07bfcd3c9ddf83a2cc6955178a30a6d6cd1b95cb Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Tue, 21 Dec 2010 11:37:46 +0000 Subject: [PATCH 152/174] Fix to invokeAsyncResponse method to cope with a Binding Chain with zero entries git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051464 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index 0a1d5b87eb..89d0e444af 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -257,7 +257,9 @@ public void invokeAsyncResponse(Message msg){ InvocationChain chain = this.getBindingInvocationChain(); if( chain != null ) { Invoker tailInvoker = chain.getTailInvoker(); - ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); + if (tailInvoker != null) { + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); + } // end if } // end if chain = this.getInvocationChain(msg.getOperation()); From 1b3ccb9d0a7be67a1ac4ddd841a2f7449ff7cbe3 Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Tue, 21 Dec 2010 11:39:24 +0000 Subject: [PATCH 153/174] Extend AsyncResponseInvoker to be Generic to cope with binding-specific response address information - under TUSCANY-3807 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051465 13f79535-47bb-0310-9956-ffa450edef68 --- .../jms/wire/AsyncResponseDestinationInterceptor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java index 7bb91f3081..43bf090796 100644 --- a/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java +++ b/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/AsyncResponseDestinationInterceptor.java @@ -105,7 +105,7 @@ public Message invokeRequest(Message msg) { String msgID = (String)msg.getHeaders().get("MESSAGE_ID"); // Create a response invoker and add it to the message headers - AsyncResponseInvoker respInvoker = new AsyncResponseInvoker(endpoint, null, asyncRespAddr, msgID); + AsyncResponseInvoker respInvoker = new AsyncResponseInvoker(endpoint, null, asyncRespAddr, msgID); msg.getHeaders().put("ASYNC_RESPONSE_INVOKER", respInvoker); } catch (JMSException e) { @@ -130,7 +130,8 @@ public Message processRequest(Message msg) { * @returns - the updated Tuscany message */ public Message processResponse(Message msg) { - AsyncResponseInvoker respInvoker = (AsyncResponseInvoker)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER"); + @SuppressWarnings("unchecked") + AsyncResponseInvoker respInvoker = (AsyncResponseInvoker)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER"); if ( respInvoker == null ) return msg; String responseAddress = respInvoker.getResponseTargetAddress(); From 5d18f090e22c84bba88d99e42d641a7edf53c90f Mon Sep 17 00:00:00 2001 From: Mike Edwards Date: Tue, 21 Dec 2010 11:42:38 +0000 Subject: [PATCH 154/174] Enable binding.sca to support async invocation in the local case - as under TUSCANY-3811 git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1051467 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/provider/SCABindingInvoker.java | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java index a131c88a0c..8ea754c8fc 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.binding.sca.provider; +import org.apache.tuscany.sca.core.invocation.AsyncResponseInvoker; import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.interfacedef.Operation; @@ -73,14 +74,24 @@ public void setNext(Invoker next) { public Message processRequest(Message msg){ if (passByValue) { msg.setBody(mediator.copyInput(msg.getBody(), sourceOperation, targetOperation)); - } - + } // end if + ep.getInvocationChains(); if ( !ep.getCallbackEndpointReferences().isEmpty() ) { RuntimeEndpointReference asyncEPR = (RuntimeEndpointReference) ep.getCallbackEndpointReferences().get(0); // Place a link to the callback EPR into the message headers... msg.getHeaders().put("ASYNC_CALLBACK", asyncEPR ); - } + } // end if + + if( ep.isAsyncInvocation() ) { + // Get the message ID + String msgID = (String)msg.getHeaders().get("MESSAGE_ID"); + + // Create a response invoker and add it to the message headers + AsyncResponseInvoker respInvoker = + new AsyncResponseInvoker(ep, null, epr, msgID); + msg.getHeaders().put("ASYNC_RESPONSE_INVOKER", respInvoker); + } // end if return msg; } @@ -93,12 +104,23 @@ public Message processResponse(Message msg){ } else { if (sourceOperation.getOutputType() != null) { msg.setBody(mediator.copyOutput(msg.getBody(), sourceOperation, targetOperation)); - } - } - } + } // end if + } // end if + } // end if + + // Handle async response Relates_To message ID value + @SuppressWarnings("unchecked") + AsyncResponseInvoker respInvoker = + (AsyncResponseInvoker)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER"); + if( respInvoker != null ) { + RuntimeEndpointReference responseEPR = respInvoker.getResponseTargetAddress(); + msg.setFrom(responseEPR); + String msgID = respInvoker.getRelatesToMsgID(); + msg.getHeaders().put("RELATES_TO", msgID); + } // end if return msg; - } + } // end method processResponse public boolean isLocalSCABIndingInvoker() { return true; From b29e7bef5909931d8cd83dc3ac53e5aa1baad3a8 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 12:54:23 +0000 Subject: [PATCH 155/174] Restrict test cases to starting a single composite git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052246 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/sample/impl/RunTestCase.java | 2 +- .../src/test/java/sample/impl/RunWSTestCase.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunTestCase.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunTestCase.java index 29bf02d26b..1faa5b2ca6 100644 --- a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunTestCase.java +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunTestCase.java @@ -44,7 +44,7 @@ public class RunTestCase { @BeforeClass public static void setUp() throws Exception { final NodeFactory nf = NodeFactory.newInstance(); - node = nf.createNode(new Contribution("test", here())); + node = nf.createNode("test.composite", new Contribution("test", here())); node.start(); } diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunWSTestCase.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunWSTestCase.java index 61133d0fbf..dcade6a818 100644 --- a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunWSTestCase.java +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/RunWSTestCase.java @@ -58,7 +58,7 @@ public class RunWSTestCase { public static void setUp() throws Exception { // Start test composite on a Tuscany node final NodeFactory nf = NodeFactory.newInstance(); - node = nf.createNode(new Contribution("test", here())); + node = nf.createNode("test.composite", new Contribution("test", here())); node.start(); // Mock up a test Web service on http://localhost:8086/wsupper From 59d6b0ac86d3ac0f7ac2f4ea109538a280aa7f13 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 12:55:23 +0000 Subject: [PATCH 156/174] Add ActiveMQ dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052247 13f79535-47bb-0310-9956-ffa450edef68 --- distribution/all/src/main/release/bin/LICENSE | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/distribution/all/src/main/release/bin/LICENSE b/distribution/all/src/main/release/bin/LICENSE index c62c58b846..cf291b9b80 100644 --- a/distribution/all/src/main/release/bin/LICENSE +++ b/distribution/all/src/main/release/bin/LICENSE @@ -223,6 +223,9 @@ The following components come under Apache Software License 2.0 abdera-i18n-1.1.1.jar abdera-parser-1.1.1.jar abdera-server-1.1.1.jar + activeio-core-3.1.2.jar + activemq-core-5.3.0.jar + activemq-protobuf-1.0.jar addressing-1.3.mar aopalliance-1.0.jar aspectjrt-1.6.8.jar @@ -240,6 +243,8 @@ The following components come under Apache Software License 2.0 commons-httpclient-3.1.jar commons-lang-2.3.jar commons-logging-1.1.1.jar + commons-logging-api-1.1.jar + commons-net-2.0.jar commons-pool-1.3.jar derby-10.4.1.3.jar dwr-2.0.3.jar @@ -251,6 +256,8 @@ The following components come under Apache Software License 2.0 geronimo-jpa_3.0_spec-1.1.1.jar geronimo-jta_1.1_spec-1.1.1.jar geronimo-j2ee-connector_1.5_spec-2.0.0.jar + geronimo-j2ee-management_1.0_spec-1.0.jar + geronimo-j2ee-management_1.1_spec-1.0.1.jar geronimo-kernel-2.0.1.jar geronimo-transaction-2.1.4.jar groovy-all-1.7.1.jar @@ -267,6 +274,7 @@ The following components come under Apache Software License 2.0 jetty-6.1.19.jar jetty-util-6.1.19.jar juli-6.0.26.jar + kahadb-5.3.0.jar log4j-1.2.15.jar myfaces-api-1.2.2.jar myfaces-impl-1.2.2.jar From b542837f77c28e83018dc5788c1be8af44a6f405 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 12:56:50 +0000 Subject: [PATCH 157/174] Add exclusion to ActiveMQ dependency. Also why is this dependency here and not in the ActiveMQ specific module? git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052248 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-jms-runtime/pom.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/binding-jms-runtime/pom.xml b/modules/binding-jms-runtime/pom.xml index cca26fec30..5cdfb78d3e 100644 --- a/modules/binding-jms-runtime/pom.xml +++ b/modules/binding-jms-runtime/pom.xml @@ -59,11 +59,18 @@ provided - + + org.apache.activemq activemq-core 5.3.0 + + + org.springframework + spring-context + + From 95ef8844cadadfafb726b4d5f5381624df2f0d5a Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 12:58:21 +0000 Subject: [PATCH 158/174] Add print out to show written XML git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052250 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java index a19ce79490..11d146e55e 100644 --- a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java +++ b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java @@ -89,6 +89,7 @@ public void testReadWriteComposite() throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); staxProcessor.write(composite, bos, context); bos.close(); + System.out.println("Writtent ouput is:\n" + bos); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); composite = staxProcessor.read(bis, Composite.class, context); From f480272e970623552b118408f127a16df5c499d0 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 12:59:11 +0000 Subject: [PATCH 159/174] Add print out to show written XML git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052251 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/assembly/xml/WriteNamespacesTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java index cafdbda506..6371e87040 100644 --- a/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java +++ b/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java @@ -83,7 +83,7 @@ public void testReadWriteComposite() throws Exception { XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); compositeProcessor.write(composite, writer, context); writer.close(); - System.out.println(bos); + System.out.println("Writtent ouput is:\n" + bos); // Read again is = new ByteArrayInputStream(bos.toByteArray()); From 7174d656d8d73a2bec3fed9a67c2d310945ebfb3 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 13:00:04 +0000 Subject: [PATCH 160/174] Correct module name git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052252 13f79535-47bb-0310-9956-ffa450edef68 --- modules/binding-sca-runtime/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/binding-sca-runtime/pom.xml b/modules/binding-sca-runtime/pom.xml index 3d260a30e6..0b2a431dc0 100644 --- a/modules/binding-sca-runtime/pom.xml +++ b/modules/binding-sca-runtime/pom.xml @@ -28,7 +28,7 @@ tuscany-binding-sca-runtime - Apache Tuscany SCA Binding SCA Model + Apache Tuscany SCA Binding SCA Runtime From 79331877d6fd4e69cd63b21bb06e41c4bd591dd3 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 13:02:14 +0000 Subject: [PATCH 161/174] Correct the order that the phase constants appear in to match the actual phase order and make the local binding.sca optimization link to the head of the service operation wire. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052253 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/binding/sca/provider/SCABindingInvoker.java | 2 +- .../src/main/java/org/apache/tuscany/sca/invocation/Phase.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java index 8ea754c8fc..3639ee9062 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java @@ -61,7 +61,7 @@ public SCABindingInvoker(InvocationChain chain, Operation sourceOperation, Media * @see org.apache.tuscany.sca.invocation.Interceptor#getNext() */ public Invoker getNext() { - return chain.getHeadInvoker(Phase.SERVICE_POLICY); + return chain.getHeadInvoker(Phase.SERVICE_INTERFACE); } /** diff --git a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java index 8bb81b7eda..4f81b763c7 100644 --- a/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java +++ b/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java @@ -52,8 +52,8 @@ public interface Phase { // Service operation chains String SERVICE_BINDING = "service.binding"; // The first phase for incoming invocations via a service - String SERVICE_POLICY = "service.policy"; // service policy handling String SERVICE_INTERFACE = "service.interface"; // data validation and transformation + String SERVICE_POLICY = "service.policy"; // service policy handling String SERVICE = "component.service"; // TODO: not sure if we need to have this phase String IMPLEMENTATION_POLICY = "implementation.policy"; // implementation policy handling String IMPLEMENTATION = "component.implementation"; // implementation invoker From c76afbe403c5c1c5bd1893b52843b7dc20357486 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 13:04:47 +0000 Subject: [PATCH 162/174] Close input stream when reading is finished git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052255 13f79535-47bb-0310-9956-ffa450edef68 --- .../configuration/xml/NodeConfigurationProcessorTestCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java b/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java index f591a4ea68..27c56dc6ec 100644 --- a/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java +++ b/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java @@ -66,6 +66,7 @@ public void testRead() throws Exception { XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(is); reader.nextTag(); NodeConfiguration config = (NodeConfiguration) processor.read(reader, context); + is.close(); StringWriter sw = new StringWriter(); XMLOutputFactory xmlOutputFactory = factories.getFactory(XMLOutputFactory.class); xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE); From 6c91fd3165eb4d56bd9e7145980ff58deb805b9f Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 13:06:07 +0000 Subject: [PATCH 163/174] Throw systematic errors as ServiceRuntimeExceptions git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052256 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/invocation/RuntimeInvoker.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java index 62593ba895..34c00dbb94 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeInvoker.java @@ -178,10 +178,7 @@ public void invokeAsync(Message msg) { // temporary fix to swallow the dummy exception that's // thrown back to get past the response chain processing. if (!(ex instanceof AsyncResponseException)){ - // send the exception in through the - // async response processing path - msg.setFaultBody(ex); - invokeAsyncResponse(msg); + throw new ServiceRuntimeException(ex); } } } finally { @@ -200,11 +197,15 @@ public void invokeAsync(Message msg) { public void invokeAsyncResponse(Message msg) { InvocationChain chain = invocable.getInvocationChain(msg.getOperation()); Invoker tailInvoker = chain.getTailInvoker(); - ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); + try { + ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg); + } catch (Throwable ex) { + throw new ServiceRuntimeException(ex); + } } // end method invokeAsyncResponse - @Override - public void invokeAsyncRequest(Message msg) throws Throwable { - invokeAsync(msg); - } // end method invokeAsyncRequest + @Override + public void invokeAsyncRequest(Message msg) throws Throwable { + invokeAsync(msg); + } // end method invokeAsyncRequest } From a02c17715738dd8ae931a4b4030ef11cf14407a4 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 13:07:30 +0000 Subject: [PATCH 164/174] Bring the unknown endpoint plugin into play at build and run time. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052258 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/EndpointReferenceBinderImpl.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 47c0ca4fc5..068f13f953 100644 --- a/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -279,21 +279,9 @@ public void bind(EndpointRegistry endpointRegistry, endpointReference.getTargetEndpoint().setBinding(endpointReference.getBinding()); endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING); } else { - Binding b = null; - if (unknownEndpointHandler != null) { - b = unknownEndpointHandler.handleUnknownEndpoint(endpointReference); - } - if (b != null) { - Endpoint matchedEndpoint = new RuntimeEndpointImpl(extensionPoints); - matchedEndpoint.setBinding(b); - matchedEndpoint.setRemote(true); - endpointReference.setTargetEndpoint(matchedEndpoint); - endpointReference.setBinding(b); - endpointReference.setUnresolved(false); - endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); - matchAudit.append("Match because the UnknownEndpointHandler provided a binding: " + b.getType() + " uri: " + b.getURI()); - matchAudit.appendSeperator(); - } else { + processUnknownEndpoint(endpointReference, matchAudit); + + if (!endpointReference.getStatus().equals(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED)){ Monitor.error(monitor, this, "endpoint-validation-messages", @@ -303,7 +291,11 @@ public void bind(EndpointRegistry endpointRegistry, monitor.getLastProblem().toString()); } } - } + } else { + // it's build time so just give the UnknownEndpoint code a chance + // without regard for the result + processUnknownEndpoint(endpointReference, matchAudit); + } } logger.fine(matchAudit.toString()); @@ -366,6 +358,24 @@ public void bind(EndpointRegistry endpointRegistry, // System.out.println("MATCH AUDIT:" + matchAudit.toString()); } + + private void processUnknownEndpoint(EndpointReference endpointReference, Audit matchAudit){ + Binding b = null; + if (unknownEndpointHandler != null) { + b = unknownEndpointHandler.handleUnknownEndpoint(endpointReference); + } + if (b != null) { + Endpoint matchedEndpoint = new RuntimeEndpointImpl(extensionPoints); + matchedEndpoint.setBinding(b); + matchedEndpoint.setRemote(true); + endpointReference.setTargetEndpoint(matchedEndpoint); + endpointReference.setBinding(b); + endpointReference.setUnresolved(false); + endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); + matchAudit.append("Match because the UnknownEndpointHandler provided a binding: " + b.getType() + " uri: " + b.getURI()); + matchAudit.appendSeperator(); + } + } /** * Returns true if the reference has a callback From 24df625bbb9b5372be1dd12f2183ab81d10ec0fe Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 13:24:31 +0000 Subject: [PATCH 165/174] Revert back to fetching the interceptors starting at SERVICE_POLICY in order to miss out any databinding transformation. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052265 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/binding/sca/provider/SCABindingInvoker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java index 3639ee9062..8ea754c8fc 100644 --- a/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java +++ b/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java @@ -61,7 +61,7 @@ public SCABindingInvoker(InvocationChain chain, Operation sourceOperation, Media * @see org.apache.tuscany.sca.invocation.Interceptor#getNext() */ public Invoker getNext() { - return chain.getHeadInvoker(Phase.SERVICE_INTERFACE); + return chain.getHeadInvoker(Phase.SERVICE_POLICY); } /** From c0cc2ff75d83e3f13f7b88e8e9b50c893a8e8cd4 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:36:26 +0000 Subject: [PATCH 166/174] Add missing dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052287 13f79535-47bb-0310-9956-ffa450edef68 --- modules/builder/META-INF/MANIFEST.MF | 3 ++- modules/core/META-INF/MANIFEST.MF | 2 ++ modules/deployment/META-INF/MANIFEST.MF | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/builder/META-INF/MANIFEST.MF b/modules/builder/META-INF/MANIFEST.MF index b85e8999f7..30e639f3f9 100644 --- a/modules/builder/META-INF/MANIFEST.MF +++ b/modules/builder/META-INF/MANIFEST.MF @@ -14,8 +14,9 @@ Import-Package: javax.xml.namespace, javax.xml.transform.sax, javax.xml.xpath, org.apache.tuscany.sca.assembly;version="2.0.0", - org.apache.tuscany.sca.assembly.xml;version="2.0.0", org.apache.tuscany.sca.assembly.builder;version="2.0.0", + org.apache.tuscany.sca.assembly.xml;version="2.0.0", + org.apache.tuscany.sca.assembly.xsd;version="2.0.0", org.apache.tuscany.sca.common.xml.dom;version="2.0.0", org.apache.tuscany.sca.common.xml.stax;version="2.0.0", org.apache.tuscany.sca.contribution.processor;version="2.0.0", diff --git a/modules/core/META-INF/MANIFEST.MF b/modules/core/META-INF/MANIFEST.MF index db05de34a7..e9fdadbd1f 100644 --- a/modules/core/META-INF/MANIFEST.MF +++ b/modules/core/META-INF/MANIFEST.MF @@ -39,6 +39,7 @@ Import-Package: javax.security.auth, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.assembly.builder;version="2.0.0", org.apache.tuscany.sca.assembly.impl;version="2.0.0", + org.apache.tuscany.sca.assembly.xml;version="2.0.0", org.apache.tuscany.sca.common.java.collection;version="2.0.0", org.apache.tuscany.sca.context;version="2.0.0", org.apache.tuscany.sca.contribution.processor;version="2.0.0", @@ -55,6 +56,7 @@ Import-Package: javax.security.auth, org.apache.tuscany.sca.interfacedef.impl;version="2.0.0";resolution:=optional, org.apache.tuscany.sca.interfacedef.java;version="2.0.0", org.apache.tuscany.sca.interfacedef.util;version="2.0.0", + org.apache.tuscany.sca.interfacedef.wsdl;version="2.0.0", org.apache.tuscany.sca.invocation;version="2.0.0", org.apache.tuscany.sca.monitor;version="2.0.0", org.apache.tuscany.sca.policy;version="2.0.0", diff --git a/modules/deployment/META-INF/MANIFEST.MF b/modules/deployment/META-INF/MANIFEST.MF index 65f35c59b0..ff37b7e5a3 100644 --- a/modules/deployment/META-INF/MANIFEST.MF +++ b/modules/deployment/META-INF/MANIFEST.MF @@ -39,6 +39,7 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.contribution.processor;version="2.0.0", org.apache.tuscany.sca.contribution.resolver;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", + org.apache.tuscany.sca.core.assembly.impl;version="2.0.0", org.apache.tuscany.sca.definitions;version="2.0.0", org.apache.tuscany.sca.definitions.util;version="2.0.0", org.apache.tuscany.sca.definitions.xml;version="2.0.0", From 8e83fb3173c2e738cf70916c088f90ce72e65133 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:37:51 +0000 Subject: [PATCH 167/174] Remove specific version numbers to allow us to pick up the latest git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052288 13f79535-47bb-0310-9956-ffa450edef68 --- modules/extensibility-equinox/META-INF/MANIFEST.MF | 4 ++-- modules/interface-java-jaxws/META-INF/MANIFEST.MF | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/extensibility-equinox/META-INF/MANIFEST.MF b/modules/extensibility-equinox/META-INF/MANIFEST.MF index 7ece048182..d67ade6ad7 100644 --- a/modules/extensibility-equinox/META-INF/MANIFEST.MF +++ b/modules/extensibility-equinox/META-INF/MANIFEST.MF @@ -15,9 +15,9 @@ Bundle-Description: Apache Tuscany SCA Extensibility for Eclipse Equin Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Import-Package: org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", - org.osgi.framework;version="1.4", + org.osgi.framework, org.osgi.framework.launch;version="1.0.0";resolution:=optional, - org.osgi.util.tracker;version="1.4.2" + org.osgi.util.tracker Tuscany-Comment2: The system bundle exports javax.transaction* packages that only contains a subset of the classes DynamicImport-Package: org.apache.tuscany.sca.extensibility.equinox, diff --git a/modules/interface-java-jaxws/META-INF/MANIFEST.MF b/modules/interface-java-jaxws/META-INF/MANIFEST.MF index 5c36422a33..a2f2dfb2ef 100644 --- a/modules/interface-java-jaxws/META-INF/MANIFEST.MF +++ b/modules/interface-java-jaxws/META-INF/MANIFEST.MF @@ -42,8 +42,8 @@ Import-Package: javax.jws, org.apache.tuscany.sca.policy;version="2.0.0", org.oasisopen.sca;version="2.0.0", org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional, - org.objectweb.asm;version="3.1", - org.objectweb.asm.util;version="3.1";resolution:=optional + org.objectweb.asm;resolution:=optional, + org.objectweb.asm.util;resolution:=optional Bundle-SymbolicName: org.apache.tuscany.sca.interface.java.jaxws Bundle-DocURL: http://www.apache.org/ -Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 From 586672427c007ecb7b424572a460fc5a226ac9c6 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:39:14 +0000 Subject: [PATCH 168/174] Add missing dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052289 13f79535-47bb-0310-9956-ffa450edef68 --- modules/builder/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/builder/pom.xml b/modules/builder/pom.xml index 5ea1b8052b..13e7ecc8a5 100644 --- a/modules/builder/pom.xml +++ b/modules/builder/pom.xml @@ -59,6 +59,12 @@ tuscany-assembly-xml 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-assembly-xsd + 2.0-SNAPSHOT + From 01cc3faeb5ee94bf7285729bfa2a2e63272f560d Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:40:28 +0000 Subject: [PATCH 169/174] remove redundant profile. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052290 13f79535-47bb-0310-9956-ffa450edef68 --- modules/common-java/pom.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/common-java/pom.xml b/modules/common-java/pom.xml index 3b01272ae1..655b3cf793 100644 --- a/modules/common-java/pom.xml +++ b/modules/common-java/pom.xml @@ -43,13 +43,4 @@ - - - jdk15 - - 1.5 - - - - From f77f40d597b6e68b983f0a5532c0821e9a4be538 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:42:20 +0000 Subject: [PATCH 170/174] remove redundant dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052291 13f79535-47bb-0310-9956-ffa450edef68 --- modules/deployment/pom.xml | 9 --------- modules/interface-wsdl/pom.xml | 8 +------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/modules/deployment/pom.xml b/modules/deployment/pom.xml index 31e380eaea..ad30c69d1a 100644 --- a/modules/deployment/pom.xml +++ b/modules/deployment/pom.xml @@ -74,16 +74,7 @@ 2.0-SNAPSHOT runtime - - - org.apache.tuscany.sca - tuscany-implementation-java - 2.0-SNAPSHOT - test - - - diff --git a/modules/interface-wsdl/pom.xml b/modules/interface-wsdl/pom.xml index 2dfd55644d..d6f17f03f6 100644 --- a/modules/interface-wsdl/pom.xml +++ b/modules/interface-wsdl/pom.xml @@ -58,13 +58,7 @@ tuscany-assembly-xml 2.0-SNAPSHOT - - + From 964f4e3a3da7673c0cecd08bddb8b35afafec9ab Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:43:33 +0000 Subject: [PATCH 171/174] convert to base pom dependency git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052292 13f79535-47bb-0310-9956-ffa450edef68 --- testing/itest/callback-two-nodes/pom.xml | 3 ++- testing/itest/scabindingmapper/pom.xml | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/testing/itest/callback-two-nodes/pom.xml b/testing/itest/callback-two-nodes/pom.xml index a20ab12476..805fcd0250 100644 --- a/testing/itest/callback-two-nodes/pom.xml +++ b/testing/itest/callback-two-nodes/pom.xml @@ -31,7 +31,8 @@ org.apache.tuscany.sca - tuscany-base-runtime + tuscany-base-runtime-pom + pom 2.0-SNAPSHOT diff --git a/testing/itest/scabindingmapper/pom.xml b/testing/itest/scabindingmapper/pom.xml index 59eb0b75a5..f6d2894f57 100644 --- a/testing/itest/scabindingmapper/pom.xml +++ b/testing/itest/scabindingmapper/pom.xml @@ -27,13 +27,14 @@ itest-scabindingmapper - Apache Tuscany Async Integration Tests SCA Binding Mapper + Apache Tuscany Integration Tests SCA Binding Mapper org.apache.tuscany.sca - tuscany-base-runtime + tuscany-base-runtime-pom 2.0-SNAPSHOT + pom @@ -41,6 +42,7 @@ tuscany-binding-ws-runtime-axis2 2.0-SNAPSHOT + org.apache.tuscany.sca tuscany-binding-jsonp-runtime From 3f46956c67044f5685893321658641e35d79e554 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Thu, 23 Dec 2010 14:44:33 +0000 Subject: [PATCH 172/174] Close the output writer before reading from it. git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052293 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/sample/impl/ReadWriteTestCase.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java index 8a4768cd9e..c165fcd94a 100644 --- a/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java +++ b/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/ReadWriteTestCase.java @@ -29,7 +29,9 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.DefaultContributionFactory; @@ -77,8 +79,15 @@ public void testRead() throws Exception { public void testReadWrite() throws Exception { final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite"); final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx); + System.out.println("Composite : " + c.getURI()); + for (Component component : c.getComponents()){ + System.out.println(" Component : " + component.getName()); + } final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - xproc.write(c, xof.createXMLStreamWriter(bos), ctx); + XMLStreamWriter writer = xof.createXMLStreamWriter(bos); + xproc.write(c, writer, ctx); + writer.close(); + System.out.println("Written XML = " + bos.toString()); assertTrue(bos.toString().contains("class=\"sample.WelloTest\"")); } } From 78f2314c32ea87304666999c05d952ca0798fd20 Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 24 Dec 2010 12:19:26 +0000 Subject: [PATCH 173/174] Add comment to remind me about domainRegistryURI properties git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052495 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/endpoint/hazelcast/HazelcastEndpointRegistry.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java index c041914de8..6d696dfaaa 100644 --- a/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java +++ b/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java @@ -154,6 +154,8 @@ protected Config getHazelcastConfig() { throw new IllegalArgumentException(configFile, e); } } else { + // TUSCANY-3675 - domainRegistryURI properties don't seem to be copied into the + // properties collection anywhere config = new XmlConfigBuilder().build(); RegistryConfig rc = new RegistryConfig(properties); config.setPort(rc.getBindPort()); From e3d337f6affaa19d7cc66a267543cc9043221c8d Mon Sep 17 00:00:00 2001 From: Simon Laws Date: Fri, 24 Dec 2010 12:21:13 +0000 Subject: [PATCH 174/174] add explicit dependency on binding sca runtime and reorder a couple of other dependencies git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk@1052496 13f79535-47bb-0310-9956-ffa450edef68 --- modules/base-runtime-pom/pom.xml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/base-runtime-pom/pom.xml b/modules/base-runtime-pom/pom.xml index 5241e4a784..9d8839a132 100644 --- a/modules/base-runtime-pom/pom.xml +++ b/modules/base-runtime-pom/pom.xml @@ -42,6 +42,24 @@ pom + + org.apache.tuscany.sca + tuscany-binding-sca-runtime + ${pom.version} + + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-jaxws-ri + ${pom.version} + + + + org.apache.tuscany.sca + tuscany-data-api + ${pom.version} + + org.apache.tuscany.sca tuscany-domain-node @@ -102,18 +120,6 @@ ${pom.version} - - org.apache.tuscany.sca - tuscany-binding-ws-runtime-jaxws-ri - ${pom.version} - - - - org.apache.tuscany.sca - tuscany-data-api - ${pom.version} - - org.apache.tuscany.sca tuscany-policy-security