You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2011/01/11 15:11:55 UTC

svn commit: r1057645 - in /tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl: EndpointImpl.java EndpointReferenceImpl.java

Author: edwardsmj
Date: Tue Jan 11 14:11:55 2011
New Revision: 1057645

URL: http://svn.apache.org/viewvc?rev=1057645&view=rev
Log:
Add capability to support Bindings that support Async invocations natively - as under TUSCANY-3801

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java?rev=1057645&r1=1057644&r2=1057645&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java Tue Jan 11 14:11:55 2011
@@ -281,11 +281,11 @@ public class EndpointImpl implements End
     }
     
     public boolean isAsyncInvocation() {
-        if (service.getName().endsWith("_asyncCallback")){
+    	if( service != null && service.getName().endsWith("_asyncCallback")){
             // this is a response service at the reference component so don't create a
             // response reference. 
             return false;
-        }
+        } // end if
         
         for(Intent intent : getRequiredIntents()){
             if (intent.getName().getLocalPart().equals("asyncInvocation")){

Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java?rev=1057645&r1=1057644&r2=1057645&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java Tue Jan 11 14:11:55 2011
@@ -231,18 +231,35 @@ public class EndpointReferenceImpl imple
         this.status = status;
     }
     
+    /**
+     * Indicates whether this EndpointReference is connected to a target service which is asynchronous.
+     * This can be marked in one of 3 ways:
+     * - the EndpointReference has the "asyncInvocation" intent set
+     * - the EndpointReference has a name ending with "_asyncCallback"
+     * - there is a target Endpoint configured that itself is marked as async invocation
+     * @return - true if the service is asynchronous invocation, false otherwise
+     */
     public boolean isAsyncInvocation() {
-        if (reference.getName().endsWith("_asyncCallback")){
+        if (reference != null && reference.getName().endsWith("_asyncCallback")){
             // this is a response reference at the service component so don't create a
             // response service. The response service will be at the reference component
             return false;
-        }
+        } // end if 
         
+        // Check if the EndpointReference is explicitly marked with the asyncInvocation intent
         for(Intent intent : getRequiredIntents()){
             if (intent.getName().getLocalPart().equals("asyncInvocation")){
                 return true;
-            }
-        }
+            } // end if 
+        } // end for
+        
+        // Check if the target Endpoint is marked as asyncInvocation
+        if( targetEndpoint != null ) {
+        	if (targetEndpoint.isAsyncInvocation()) {
+        		return true;
+			} // end if
+        } // end if
         return false;
-    }
-}
+    } // end method isAsyncInvocation
+    
+} // end class EndpointReferenceImpl