summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2011-01-11 14:11:55 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2011-01-11 14:11:55 +0000
commit0a944a700462e4164981d159d497461f41b6df03 (patch)
treed73475383188d307043df6bea5e491c7bc55da10 /sca-java-2.x/trunk/modules/assembly
parente15b3ca2e2e485b641d9d474079e28bb30b172d1 (diff)
Add capability to support Bindings that support Async invocations natively - as under TUSCANY-3801
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1057645 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java4
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java29
2 files changed, 25 insertions, 8 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
index f4a8429f13..a101bcd3aa 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
@@ -281,11 +281,11 @@ public class EndpointImpl implements Endpoint {
}
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")){
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
index 96af9373cd..ebcc1e3e63 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
@@ -231,18 +231,35 @@ public class EndpointReferenceImpl implements EndpointReference {
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