summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java24
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java24
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java32
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java22
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java2
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java13
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java19
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java4
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java14
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java17
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java65
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java3
12 files changed, 165 insertions, 74 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
index bbc812582e..f0cbcc669f 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java
@@ -51,6 +51,8 @@ import org.apache.tuscany.sca.policy.PolicySubject;
public class SCABindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCABinding> {
private static final String NAME = "name";
private static final String URI = "uri";
+ private static final String DELEGATE_BINDING_TYPE = "delegateBindingType";
+ private static final String DELEGATE_BINDING_URI = "delegateBindingURI";
private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912";
private static final String BINDING_SCA = "binding.sca";
@@ -100,6 +102,18 @@ public class SCABindingProcessor extends BaseStAXArtifactProcessor implements St
if (uri != null) {
scaBinding.setURI(uri);
}
+
+ // Read delegate binding type
+ String delegateBindingType = getString(reader, DELEGATE_BINDING_TYPE);
+ if (delegateBindingType != null) {
+ scaBinding.setDelegateBindingType(delegateBindingType);
+ }
+
+ // Read delegate binding URI
+ String delegateBindingURI = getURIString(reader, DELEGATE_BINDING_URI);
+ if (delegateBindingURI != null) {
+ scaBinding.setDelegateBindingURI(delegateBindingURI);
+ }
// Read any sub-elements
boolean endFound = false;
@@ -145,6 +159,16 @@ public class SCABindingProcessor extends BaseStAXArtifactProcessor implements St
writer.writeAttribute(URI, scaBinding.getURI());
}
+ // Write delegate binding type
+ if (scaBinding.getDelegateBindingType() != null) {
+ writer.writeAttribute(DELEGATE_BINDING_TYPE, scaBinding.getDelegateBindingType());
+ }
+
+ // Write delegate binding URI
+ if (scaBinding.getDelegateBindingURI() != null) {
+ writer.writeAttribute(DELEGATE_BINDING_URI, scaBinding.getDelegateBindingURI());
+ }
+
// write wireFormat
extensionProcessor.write(scaBinding.getRequestWireFormat(), writer, context);
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java b/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
index f83a2ebd14..3845fff14a 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
@@ -159,4 +159,28 @@ public class TestSCABindingImpl implements SCABinding, PolicySubject {
public void setOperationSelector(OperationSelector operationSelector) {
}
+
+ @Override
+ public String getDelegateBindingType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDelegateBindingType(String delegateBindingType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getDelegateBindingURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDelegateBindingURI(String delegateBindingURI) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
index aa356e3857..317655ee98 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
@@ -27,4 +27,36 @@ import javax.xml.namespace.QName;
*/
public interface SCABinding extends Binding {
QName TYPE = new QName(SCA11_NS, "binding.sca");
+
+ /**
+ * Retrieve the type of the binding that this binding.sca
+ * delegates to
+ *
+ * @return delegate binding type
+ */
+ String getDelegateBindingType();
+
+ /**
+ * Set the type of the binding that this binding.sca
+ * delegates to
+ *
+ * @param delegateBindingType
+ */
+ void setDelegateBindingType(String delegateBindingType);
+
+ /**
+ * Get the URI for the binding that this binding.sca
+ * delegates to
+ *
+ * @return delegate binding URI
+ */
+ String getDelegateBindingURI();
+
+ /**
+ * Set the URI for the binding that this binding.sca
+ * delegates to
+ *
+ * @param delegateBindingURI
+ */
+ void setDelegateBindingURI(String delegateBindingURI);
}
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
index 63e5f1e82c..bad560ab04 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
@@ -46,7 +46,9 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject {
private List<Intent> requiredIntents = new ArrayList<Intent>();
private List<PolicySet> policySets = new ArrayList<PolicySet>();
private ExtensionType extensionType;
- private WireFormat wireFormat ;
+ private WireFormat wireFormat;
+ private String delegateBindingType;
+ private String delegateBindingURI;
/**
* Constructs a new SCA binding.
@@ -147,5 +149,21 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject {
}
public void setOperationSelector(OperationSelector operationSelector) {
- }
+ }
+
+ public String getDelegateBindingType() {
+ return delegateBindingType;
+ }
+
+ public void setDelegateBindingType(String delegateBindingType) {
+ this.delegateBindingType = delegateBindingType;
+ }
+
+ public String getDelegateBindingURI() {
+ return delegateBindingURI;
+ }
+
+ public void setDelegateBindingURI(String delegateBindingURI) {
+ this.delegateBindingURI = delegateBindingURI;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
index 42c0ce6993..0dc137cf5e 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
@@ -127,7 +127,7 @@ public class TransportServiceInterceptor extends InterceptorAsyncImpl {
from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
msg.setFrom(from);
Endpoint callbackEndpoint = assemblyFactory.createEndpoint();
-// callbackEndpoint.setURI(callbackAddress); // TODO: is this needed? Seems to work without it
+ // binding is set into the callback endpoint in the CallbackDesitnationInterceptor
callbackEndpoint.setUnresolved(true);
from.setCallbackEndpoint(callbackEndpoint);
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
index f7573b182b..1bce6e8842 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
@@ -106,16 +106,13 @@ public class CallbackDestinationInterceptor extends InterceptorAsyncImpl {
throw new RuntimeException(e);
}
callbackBinding.setDestinationName(callbackdestName);
- msg.getHeaders().put("CALLBACK_BINDING", callbackBinding);
+ // the "from" EPR model is created in the TransportServiceInterceptor
+ // not sure which this destination calculation is not performed
+ // there as well
+ msg.getFrom().getCallbackEndpoint().setBinding(callbackBinding);
+// msg.getHeaders().put("CALLBACK_BINDING", callbackBinding);
}
}
-// List<EndpointReference> refs = endpoint.getCallbackEndpointReferences();
-// for (EndpointReference ref : refs ) {
-// if (ref.getBinding() instanceof JMSBinding ) {
-// JMSBinding callbackBinding = (JMSBinding) ref.getBinding();
-// callbackBinding.setDestinationName(callbackdestName);
-// } // end if
-// } // end for
} // end if
// Callback ID not used at present
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
index 6f843ff2d6..b8a70f0ba1 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
@@ -29,9 +29,11 @@ import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.sca.assembly.Base;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
import org.apache.tuscany.sca.assembly.builder.BuilderContext;
import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
+import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
@@ -61,6 +63,10 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
protected QName defaultMappedBinding;
protected QName defaultLocalBinding;
protected boolean alwaysDistributed;
+
+ // Test to look at supporting concurrent binding.sca delegations
+ protected QName [] activeDelegations = {new QName(Base.SCA11_TUSCANY_NS, "binding.local"),
+ new QName(Base.SCA11_NS, "binding.ws")};
public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map<String, String> attributes) {
this.registry = registry;
@@ -196,7 +202,14 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
try {
Binding binding = createDelegatingBinding(newBindingType);
binding.setName(scaBinding.getName());
- binding.setURI(scaBinding.getURI());
+ if (((SCABinding)scaBinding).getDelegateBindingURI() != null){
+ // if this is an SCA binding that's been resolved via the registry then
+ // the URI of the target service is delegate specific and is stored
+ // in this new slot in the binding model
+ binding.setURI(((SCABinding)scaBinding).getDelegateBindingURI());
+ } else {
+ binding.setURI(scaBinding.getURI());
+ }
binding.setOperationSelector(scaBinding.getOperationSelector());
binding.setRequestWireFormat(scaBinding.getRequestWireFormat());
binding.setResponseWireFormat(scaBinding.getResponseWireFormat());
@@ -285,5 +298,9 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
return defaultLocalBinding;
}
+
+ public QName[] getActiveDelegations(){
+ return activeDelegations;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
index bc57c47ba6..319661d7bb 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DelegatingSCAServiceBindingProvider.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.binding.sca.provider;
+import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.InvokerAsyncResponse;
import org.apache.tuscany.sca.provider.EndpointAsyncProvider;
@@ -94,7 +95,8 @@ public class DelegatingSCAServiceBindingProvider implements EndpointAsyncProvide
} else {
provider.start();
// Set the resolved binding URI back to the binding.sca
- endpoint.getBinding().setURI(delegateEndpoint.getBinding().getURI());
+ ((SCABinding)endpoint.getBinding()).setDelegateBindingType(delegateEndpoint.getBinding().getType().toString());
+ ((SCABinding)endpoint.getBinding()).setDelegateBindingURI(delegateEndpoint.getBinding().getURI());
endpoint.setDeployedURI(delegateEndpoint.getDeployedURI());
started = true;
}
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
index 488de5a769..994a67d632 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
@@ -53,6 +53,7 @@ import org.apache.axis2.context.MessageContext;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
@@ -90,7 +91,7 @@ public class Axis2ReferenceBindingInvoker implements Invoker {
public static final QName QNAME_WSA_MESSAGEID =
new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_MESSAGE_ID, AddressingConstants.WSA_DEFAULT_PREFIX);
- public static final QName QNAME_CALLACK_EP_URI = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA11_TUSCANY_NS, "CALLBACK_EP_URI");
+ //public static final QName QNAME_CALLACK_EP_URI = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA11_TUSCANY_NS, "CALLBACK_EP_URI");
private RuntimeEndpointReference endpointReference;
private ServiceClient serviceClient;
@@ -244,12 +245,19 @@ public class Axis2ReferenceBindingInvoker implements Invoker {
// Add WS-Addressing header for the invocation of a bidirectional service
if (callbackEndpoint != null) {
// Load the actual callback endpoint URI into an Axis EPR ready to form the content of the wsa:From header
- EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
+ // In Tuscany the ws binding is used as a remote delegate for the sca binding
+ // so we have to take care to pass the sca uri in the delegate case.
+ EndpointReference fromEPR = null;
+ if (callbackEndpoint.getBinding().getType().equals(SCABinding.TYPE)){
+ fromEPR = new EndpointReference(callbackEndpoint.getURI());
+ } else {
+ fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
+ }
// pass the callback structure URI as a reference parameter
// this allows callback endpoints to be looked up via the registry when
// the ws binding is being used as a delegate from the sca binding
- fromEPR.addReferenceParameter(QNAME_CALLACK_EP_URI, callbackEndpoint.getURI());
+ //fromEPR.addReferenceParameter(QNAME_CALLACK_EP_URI, callbackEndpoint.getURI());
addWSAFromHeader( sh, fromEPR );
addWSAActionHeader( sh );
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
index 04257f9b55..da9549a414 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java
@@ -254,15 +254,14 @@ public class TuscanyServiceProvider {
OMElement refParms = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
if( refParms != null ) {
msg.getHeaders().put(WS_REF_PARMS, refParms);
- Iterator iter = refParms.getChildrenWithLocalName("CALLBACK_EP_URI");
- if (iter != null && iter.hasNext()){
- OMElement callbackEPURI = (OMElement)iter.next();
- if (callbackEPURI != null){
- msg.getHeaders().put("CALLBACK_EP_URI", callbackEPURI.getText());
- }
- }
- }
-
+// Iterator iter = refParms.getChildrenWithLocalName("CALLBACK_EP_URI");
+// if (iter != null && iter.hasNext()){
+// OMElement callbackEPURI = (OMElement)iter.next();
+// if (callbackEPURI != null){
+// msg.getHeaders().put("CALLBACK_EP_URI", callbackEPURI.getText());
+// }
+// }
+ }
}
} // end if
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
index fb8249544e..61f9b7e2cb 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
@@ -134,58 +134,27 @@ public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> {
// TUSCANY-3932
// If it's the default binding then we're going to look the callback endpoint
// up in the registry. Most remote protocols, which may be used as delegates
- // or binding.sca will deal in absolution callback address and send the
- // callback enbdpoint strutural URL separately. In this case flip the binding
- // back to the structure URL.
- // TODO - all this creation of endpoints by the binding to represent callbacks
- // is confusing. Code here will change if we tidy it up.
+ // for binding.sca, will expect to deal with absolute URLs so flip the
+ // callback endpoint back to force the lookup to happen
if (epr.getBinding().getType().equals(SCABinding.TYPE)){
- // assume that we're going to look up the callback endpoint in the
- // registry
- Message msgContext = ThreadMessageContext.getMessageContext();
- if (msgContext != null){
- String callbackEPURI = (String)msgContext.getHeaders().get("CALLBACK_EP_URI");
- if (callbackEPURI != null){
- resolvedEndpoint.setURI(callbackEPURI);
- }
- }
- }
-
- // This is used by the JMS binding to enable setting the JMS callback destination from the
- // request, see CallbackDestinationInterceptor in the JMS binding module. It gets the JMS
- // compliance tests passing again but doesn't seem like the perfect fix, when the changes
- // mentioned below for TUSCANY-3932 happen it should fix this properly.
- Message msgContext = ThreadMessageContext.getMessageContext();
- if (msgContext != null){
- Binding b = (Binding)msgContext.getHeaders().get("CALLBACK_BINDING");
- if (b != null) {
- endpointReference.setBinding(b);
- }
- }
-
- /*
- // TUSCANY-3932
- // If the resolved endpoint has a binding with a absolute URI then assume
- // that URL has been passed in in the forward message and really treat it
- // as a resolved endpoint.
- Binding callbackBinding = resolvedEndpoint.getBinding();
- if ( callbackBinding != null){
- URI callbackBindingURI = null;
- try {
- callbackBindingURI = new URI(callbackBinding.getURI());
- } catch (Exception ex){
- // ignore it, we test for null next
- }
- if (callbackBindingURI != null &&
- callbackBindingURI.isAbsolute()){
+ epr.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND);
+ } else {
+ // just copy the callback binding from the callback endpoint to the
+ // callback EPR as the EPR is effectively already resolved
+ epr.setStatus(EndpointReference.Status.RESOLVED_BINDING);
+ Binding callbackBinding = resolvedEndpoint.getBinding();
+ if ( callbackBinding != null){
epr.setBinding(callbackBinding);
- // TODO - What else?
- build(epr);
- epr.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
- epr.setUnresolved(false);
+ // make sure that the chains are recreated for
+ // this new binding
+ epr.setBindingProvider(null);
+ epr.rebuild();
+ } else {
+ // do nothing and rely on whatever the user has configured
+ // in the SCDL
}
}
-*/
+
return epr;
} catch (CloneNotSupportedException e) {
// will not happen
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
index 6ae3dd415d..263fdcecbe 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
@@ -222,7 +222,8 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
endpointReference.getStatus() == EndpointReference.Status.RESOLVED_BINDING ) {
// The endpoint reference is already resolved to either
// a service endpoint local to this composite or it has
- // a remote binding
+ // a remote binding. Just make sure the binding is built
+ build(endpointReference);
// still need to check that the callback endpoint is set correctly
if (hasCallback(endpointReference) &&