summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/sca/itest/pom.xml1
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java2
-rw-r--r--java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java9
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java14
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java119
-rw-r--r--java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java99
7 files changed, 107 insertions, 139 deletions
diff --git a/java/sca/itest/pom.xml b/java/sca/itest/pom.xml
index f3bc903087..b4628bbf46 100644
--- a/java/sca/itest/pom.xml
+++ b/java/sca/itest/pom.xml
@@ -51,6 +51,7 @@
-->
<module>callback-api</module>
<module>callback-basic</module>
+ <module>callback-basic-ws</module>
<module>callback-complex-type</module>
<module>callback-multiple-wires</module>
<module>callback-separatethread</module>
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
index 0f8ce0a600..46c97e7553 100644
--- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
+++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
@@ -251,7 +251,7 @@ public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
// add WS-Addressing header
//FIXME: is there any way to use the Axis2 addressing support for this?
if (callbackEndpoint != null) {
- EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
+ EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getURI());
SOAPEnvelope sev = requestMC.getEnvelope();
SOAPHeader sh = sev.getHeader();
OMElement epr =
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
index 780c11a577..cd3a6b38b8 100644
--- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
+++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
@@ -806,14 +806,17 @@ public class Axis2ServiceProvider {
//fill message with QoS context info
fillQoSContext(msg, inMC);
- // if reference parameters are needed, create a new "From" EPR to hold them
+ // Create a from EPR to hold the details of the callback endpoint
EndpointReference from = null;
if (callbackAddress != null ) {
from = assemblyFactory.createEndpointReference();
Endpoint fromEndpoint = assemblyFactory.createEndpoint();
from.setTargetEndpoint(fromEndpoint);
- // TODO - EPR - need to set callback address
- msg.setFrom(from);
+ msg.setFrom(from);
+ Endpoint callbackEndpoint = assemblyFactory.createEndpoint();
+ callbackEndpoint.setURI(callbackAddress);
+ callbackEndpoint.setUnresolved(true);
+ from.setCallbackEndpoint(callbackEndpoint);
}
/* TODO - EPR - not required in OASIS
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java
index 498d6b7db6..ada355d32e 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java
@@ -239,15 +239,18 @@ public class RuntimeWireImpl implements RuntimeWire {
*/
private void initInvocationChains() {
chains = new ArrayList<InvocationChain>();
- // InterfaceContract sourceContract = endpointReference.getInterfaceContract();
- // InterfaceContract targetContract = endpoint.getInterfaceContract();
- InterfaceContract sourceContract = getLeafInterfaceContract(endpointReference);
+ InterfaceContract sourceContract = endpointReference.getInterfaceContract();
+ // TODO - EPR why is this looking at the component types. The endpoint reference should have the right interface contract by this time
+ //InterfaceContract sourceContract = getLeafInterfaceContract(endpointReference);
if (isReferenceWire) {
// It's the reference wire
resolveEndpointReference();
- InterfaceContract targetContract = getLeafInterfaceContract(endpoint);
+ InterfaceContract targetContract = endpoint.getInterfaceContract();
+ // TODO - EPR why is this looking at the component types. The endpoint should have the right interface contract by this time
+ //InterfaceContract targetContract = getLeafInterfaceContract(endpoint);
+
RuntimeComponentReference reference = (RuntimeComponentReference)endpointReference.getReference();
Binding refBinding = endpointReference.getBinding();
for (Operation operation : sourceContract.getInterface().getOperations()) {
@@ -272,7 +275,10 @@ public class RuntimeWireImpl implements RuntimeWire {
RuntimeComponentService service = (RuntimeComponentService)endpoint.getService();
RuntimeComponent serviceComponent = (RuntimeComponent)endpoint.getComponent();
Binding serviceBinding = endpoint.getBinding();
+ //InterfaceContract targetContract = endpoint.getInterfaceContract();
+ // TODO - EPR - why is this looking at the component types. The endpoint should have the right interface contract by this time
InterfaceContract targetContract = getLeafInterfaceContract(endpoint);
+ endpoint.setInterfaceContract(targetContract);
for (Operation operation : sourceContract.getInterface().getOperations()) {
Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
if (targetOperation == null) {
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
index ed84de2dd5..f785cb8f37 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
@@ -116,7 +116,7 @@ public class RuntimeWireInvoker implements Invoker{
from.setBinding(epFrom.getBinding());
from.setInterfaceContract(epFrom.getInterfaceContract());
from.setTargetEndpoint(epFrom.getTargetEndpoint());
- from.setCallbackEndpoint(epFrom.getCallbackEndpoint());
+ //from.setCallbackEndpoint(epFrom.getCallbackEndpoint());
// TODO - EPR - what's going on here?
//from.mergeEndpoint(epFrom);
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java
index b132464a5c..c349e43615 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java
@@ -86,11 +86,6 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
throw new RuntimeException("No callback binding found for " + msgContext.getTo().toString());
}
resolvedEndpoint = msgContext.getFrom().getCallbackEndpoint();
-
- /* TODO - EPR - not required for OASIS
- convID = msgContext.getFrom().getReferenceParameters().getConversationID();
- callbackID = msgContext.getFrom().getReferenceParameters().getCallbackID();
- */
}
@Override
@@ -147,7 +142,7 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
}
try {
// TODO - EPR - is this correct?
-
+
// Fluff up a new response wire based on the callback endpoint
RuntimeComponentReference ref =
bind((RuntimeComponentReference)wire.getEndpointReference().getReference(),
@@ -156,48 +151,6 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
boundWire = ref.getRuntimeWires().get(0);
Binding binding = wire.getEndpointReference().getBinding();
- binding.setURI(resolvedEndpoint.getBinding().getURI());
-
-/* TODO - EPR - remove as there are no callback objects now
- * Contract contract = resolvedEndpoint.getContract();
- RuntimeComponentReference ref = null;
- if (contract == null) {
- //TODO - EPR - does it ever go through here?
- // in what situation is there no reference in the endpoint reference
- // pointing back to the callbac service
- boundWire = (RuntimeWire)wire.clone();
-
- } else if (contract instanceof RuntimeComponentReference) {
- // TODO - EPP - the endpoint reference pointing back to the
- // callback service holds a reference representing
- // a reference to the callback service. This is true if a
- // callback object has been set into the reference on the
- // client side
- ref = (RuntimeComponentReference)contract;
-
- // TODO - EPR - get the wire from the reference that matches the
- // injected callback reference wire. We don't have bindings yet as the
- // callback object wire hasn't been initialized
-
-// for (RuntimeWire runtimeWire : ref.getRuntimeWires()){
-// if (runtimeWire.getEndpointReference().getBinding().getName().equals(wire.getEndpointReference().getBinding().getName())){
-// boundWire = runtimeWire;
-// break;
-// }
-// }
-
- // just get the first one for now
- boundWire = ref.getRuntimeWires().get(0);
-
- } else { // contract instanceof RuntimeComponentService
- //TODO - EPR - I think it does this if no callback object has been set explicitly
- ref = bind((RuntimeComponentReference)wire.getEndpointReference().getReference(),
- resolvedEndpoint);
- boundWire = ref.getRuntimeWires().get(0);
- }
-
- configureWire(boundWire);
-*/
((RuntimeWireImpl)wire).addToCache(resolvedEndpoint, boundWire);
} catch (CloneNotSupportedException e) {
@@ -207,71 +160,29 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
return boundWire;
}
- // TODO - EPR - why static & convert to ne endpoint reference
+ // TODO - EPR - why static?
private static RuntimeComponentReference bind(RuntimeComponentReference reference,
- Endpoint resolvedEndpoint) throws CloneNotSupportedException {
- RuntimeComponent component = (RuntimeComponent)resolvedEndpoint.getComponent();
- RuntimeComponentService service = (RuntimeComponentService)resolvedEndpoint.getService();
+ Endpoint callbackEndpoint) throws CloneNotSupportedException {
+ // clone the callback reference ready to configure it for this callback endpoint
RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
- ref.getTargets().add(service);
+ ref.getTargets().clear();
ref.getBindings().clear();
-
- /* TODO - EPR - don't think this is require now we have endpoint references
- for (Binding binding : service.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
- optimizableBinding.setTargetBinding(binding);
- optimizableBinding.setTargetComponent(component);
- optimizableBinding.setTargetComponentService(service);
- ref.getBindings().add(optimizableBinding);
- } else {
- ref.getBindings().add(binding);
- }
- }
- */
-
ref.getEndpointReferences().clear();
- for(EndpointReference endpointReference : reference.getEndpointReferences()){
- EndpointReference clone = (EndpointReference)endpointReference.clone();
-
- clone.setReference(ref);
- clone.getBinding().setURI(resolvedEndpoint.getBinding().getURI());
-
- clone.getTargetEndpoint().setComponent(resolvedEndpoint.getComponent());
- clone.getTargetEndpoint().setService((ComponentService)resolvedEndpoint.getService());
- clone.getTargetEndpoint().setBinding(resolvedEndpoint.getBinding());
-
- ref.getEndpointReferences().add(clone);
- }
-
- return ref;
- }
+ // no access to the assembly factory so clone an existing epr
+ EndpointReference callbackEndpointReference = (EndpointReference)reference.getEndpointReferences().get(0).clone();
- /* TODO - EPR - remove
- private void configureWire(RuntimeWire wire ) {
-
- // TODO - EPR - do we actually need this code? Combine with bind?
- // need to set the endpoint on the binding also so that when the chains are created next
- // the sca binding can decide whether to provide local or remote invokers.
- // TODO - there is a problem here though in that I'm setting a target on a
- // binding that may possibly be trying to point at two things in the multi threaded
- // case. Need to confirm the general model here and how the clone and bind part
- // is intended to work
- Binding binding = wire.getEndpointReference().getBinding();
- binding.setURI(resolvedEndpoint.getBinding().getURI());
-
- // set the target contract as it varies for the sca binding depending on
- // whether it is local or remote
- RuntimeComponentReference ref = (RuntimeComponentReference)wire.getEndpointReference().getReference();
+ callbackEndpointReference.setReference(ref);
+ callbackEndpointReference.setTargetEndpoint(callbackEndpoint);
+ callbackEndpointReference.setUnresolved(true);
+
+ // The callback endpoint will be resolved with the registry
+ // when the wire chains are created
+ ref.getEndpointReferences().add(callbackEndpointReference);
- // TODO - EPR
- // needs to be set after the chains have been created for the first time
- // as now the binding provider won't be created until that time
- //wire.getEndpointReference().getTargetEndpoint().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
+ return ref;
}
- */
/**
* {@inheritDoc}
diff --git a/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java b/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java
index 201749e380..e963848c7f 100644
--- a/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java
+++ b/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java
@@ -215,7 +215,7 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR
}
if (endpointReference.isUnresolved()){
- throw new SCARuntimeException("EndpointReference can't be resolved");
+ throw new SCARuntimeException("Can't resolve " + endpointReference.toString());
}
}
@@ -231,28 +231,50 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR
List<Endpoint> matchedServiceEndpoint = new ArrayList<Endpoint>();
// Find the corresponding bindings from the service side
- for (Binding referenceBinding : endpointReference.getReference().getBindings()) {
- if (local) {
- for (Endpoint serviceEndpoint : endpoint.getService().getEndpoints()) {
-
+ if ((endpointReference.getReference().getBindings().size() == 0) ||
+ ((endpointReference.getReference().getBindings().size() == 1) &&
+ (endpointReference.getReference().getBindings().get(0) instanceof SCABinding))){
+ // OAISIS - choose a binding from the service side
+ // (could have been specified as part of the target string)
+ // last part of this test that is looking for binding SCA is
+ // bogus. Just a temporary fix until we get rid of the OSOA
+ // style reference side bindings.
+
+ // retrieve the user specified binding name.
+ // TODO - EPR - we don't support this yet
+
+ // otherwise pick the first binding from the service
+ endpointReference.setTargetEndpoint(endpoint.getService().getEndpoints().get(0));
+ endpointReference.setBinding(endpointReference.getTargetEndpoint().getBinding());
+ endpointReference.setUnresolved(false);
+ return;
+
+ } else {
+ // OAISIS - this is an error
+ // (for now let it match bindings while we rewrite OSOA tests)
+ for (Binding referenceBinding : endpointReference.getReference().getBindings()) {
+ if (local) {
+ for (Endpoint serviceEndpoint : endpoint.getService().getEndpoints()) {
+
+ if (referenceBinding.getClass() == serviceEndpoint.getBinding().getClass() && hasCompatiblePolicySets(referenceBinding,
+ serviceEndpoint
+ .getBinding())) {
+
+ matchedReferenceBinding.add(referenceBinding);
+ matchedServiceEndpoint.add(serviceEndpoint);
+ }
+ }
+ } else {
+ Endpoint serviceEndpoint = endpoint;
if (referenceBinding.getClass() == serviceEndpoint.getBinding().getClass() && hasCompatiblePolicySets(referenceBinding,
serviceEndpoint
.getBinding())) {
-
+
matchedReferenceBinding.add(referenceBinding);
matchedServiceEndpoint.add(serviceEndpoint);
+
}
}
- } else {
- Endpoint serviceEndpoint = endpoint;
- if (referenceBinding.getClass() == serviceEndpoint.getBinding().getClass() && hasCompatiblePolicySets(referenceBinding,
- serviceEndpoint
- .getBinding())) {
-
- matchedReferenceBinding.add(referenceBinding);
- matchedServiceEndpoint.add(serviceEndpoint);
-
- }
}
}
@@ -331,16 +353,41 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR
List<EndpointReference> callbackEndpointReferences = endpoint.getCallbackEndpointReferences();
List<Endpoint> matchedEndpoint = new ArrayList<Endpoint>();
-
- if ((callbackEndpoints != null) && (callbackEndpointReferences != null)){
- // Find the corresponding bindings from the service side
- for (EndpointReference epr : callbackEndpointReferences) {
- for (Endpoint ep : callbackEndpoints) {
-
- if (epr.getBinding().getClass() == ep.getBinding().getClass() &&
- hasCompatiblePolicySets(epr.getBinding(), ep.getBinding())) {
-
- matchedEndpoint.add(ep);
+
+ // Find the corresponding bindings from callback service side
+ if ((callbackEndpointReferences.get(0).getReference().getBindings().size() == 0) ||
+ ((callbackEndpointReferences.get(0).getReference().getBindings().size() == 1) &&
+ (callbackEndpointReferences.get(0).getReference().getBindings().get(0) instanceof SCABinding))){
+ // OAISIS - choose a binding from the service side
+ // (could have been specified as part of the target string)
+ // last part of this test that is looking for binding SCA is
+ // bogus. Just a temporary fix until we get rid of the OSOA
+ // style reference side bindings.
+
+ // retrieve the user specified binding name.
+ // TODO - EPR - we don't support this yet
+
+ // otherwise pick the first binding from the service
+ //endpointReference.setTargetEndpoint(endpoint.getService().getEndpoints().get(0));
+ //endpointReference.setBinding(endpointReference.getTargetEndpoint().getBinding());
+ endpointReference.setCallbackEndpoint(callbackEndpoints.get(0));
+ endpointReference.setUnresolved(false);
+ return;
+
+ } else {
+ // OAISIS - this is an error
+ // (for now let it match bindings while we rewrite OSOA tests)
+
+ if ((callbackEndpoints != null) && (callbackEndpointReferences != null)){
+ // Find the corresponding bindings from the service side
+ for (EndpointReference epr : callbackEndpointReferences) {
+ for (Endpoint ep : callbackEndpoints) {
+
+ if (epr.getBinding().getClass() == ep.getBinding().getClass() &&
+ hasCompatiblePolicySets(epr.getBinding(), ep.getBinding())) {
+
+ matchedEndpoint.add(ep);
+ }
}
}
}