tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1041870 - in /tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime: META-INF/ src/main/java/org/apache/tuscany/sca/binding/sca/provider/
Date Fri, 03 Dec 2010 15:25:42 GMT
Author: slaws
Date: Fri Dec  3 15:25:42 2010
New Revision: 1041870

URL: http://svn.apache.org/viewvc?rev=1041870&view=rev
Log:
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).

Added:
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java
Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF?rev=1041870&r1=1041869&r2=1041870&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF Fri Dec  3
15:25:42 2010
@@ -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",

Added: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java?rev=1041870&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java
(added)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingAsyncResponseInvoker.java
Fri Dec  3 15:25:42 2010
@@ -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;
+    }
+}

Modified: tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java?rev=1041870&r1=1041869&r2=1041870&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/SCABindingInvoker.java
Fri Dec  3 15:25:42 2010
@@ -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
 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 implement
     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 implement
             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;
     }
 
 }



Mime
View raw message