diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-25 15:02:01 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-25 15:02:01 +0000 |
commit | b55bad231eba7a750c94e0fcfea8212260bff1f0 (patch) | |
tree | 3523f61400dbbaba70d784ccb758d5823b5c1719 /sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache | |
parent | 400a6d98bc4b9c140357a7ff3e9520b2613f8bb6 (diff) |
TUSCANY-3659 - Enable asynch operation over the local SCA binding. This does what I think is the right thing but it doesn't necessarily do it in an optimal way yet.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@989157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache')
2 files changed, 15 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java index 88c6888ba9..08f2bee3b3 100644 --- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java @@ -154,7 +154,7 @@ public class RuntimeSCAReferenceBindingProvider implements EndpointReferenceProv // it turns out that the chain source and target operations are the same, and are the operation // from the target, not sure if thats by design or a bug. The SCA binding invoker needs to know // the source and target class loaders so pass in the real source operation in the constructor - return chain == null ? null : new SCABindingInvoker(chain, operation, mediator, passByValue); + return chain == null ? null : new SCABindingInvoker(chain, operation, mediator, passByValue, epr); } } 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 a0b976c7ad..c2a9038367 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 @@ -26,6 +26,8 @@ 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.invocation.Phase; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; /** * @version $Rev$ $Date$ @@ -36,17 +38,21 @@ public class SCABindingInvoker implements Interceptor { private Operation sourceOperation; private Operation targetOperation; private boolean passByValue; + private RuntimeEndpointReference epr; + private RuntimeEndpoint ep; /** * Construct a SCABindingInvoker that delegates to the service invocaiton chain */ - public SCABindingInvoker(InvocationChain chain, Operation sourceOperation, Mediator mediator, boolean passByValue) { + public SCABindingInvoker(InvocationChain chain, Operation sourceOperation, Mediator mediator, boolean passByValue, RuntimeEndpointReference epr) { super(); this.chain = chain; this.mediator = mediator; this.sourceOperation = sourceOperation; this.targetOperation = chain.getTargetOperation(); this.passByValue = passByValue; + this.epr = epr; + this.ep = (RuntimeEndpoint)epr.getTargetEndpoint(); } /** @@ -71,6 +77,13 @@ public class SCABindingInvoker implements Interceptor { if (passByValue) { msg.setBody(mediator.copyInput(msg.getBody(), sourceOperation, targetOperation)); } + + 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 ); + } Message resultMsg = getNext().invoke(msg); |