diff options
Diffstat (limited to 'sca-java-2.x/trunk')
3 files changed, 62 insertions, 17 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF index 0732ffc0d7..a992e8286f 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java b/sca-java-2.x/trunk/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/sca-java-2.x/trunk/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/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java index c2a9038367..95fd4cd934 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java +++ b/sca-java-2.x/trunk/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.invocation.Phase; 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 class SCABindingInvoker implements Interceptor { 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 class SCABindingInvoker implements Interceptor { 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; } } |