Hi, The change had a huge impact on all the binding invokers that rely on the service binding to resolve the deployed URIs when the endpoint reference is resolved to a target endpoint.
BTW, the use case applies to something like the following: <component name="A"> <service name="S1"> <tuscany:binding.rest uri="/a/b"/> </service> </component> <component name="B"> <reference name="r1" target="A/S1"/> </component> The r1 reference is now have /a/b as the uri instead of the deployed URI. Ideally, the binding invoker should ask for the target endpoint's deployed URI. But it involves quite a bit changes. I'll revert the change for now until we find a consistent solution. Thanks, Raymond On Mar 21, 2012, at 2:01 PM, Raymond Feng wrote: > Hi, > > This change breaks the case where we use @target in the <reference> element > to wire components using non-SCA bindings. For example, the > RESTBindingInvoker uses the binding.uri to find out the target address. Since > now it's a clone, the value won't be updated when the service binding set the > deployed URI. > > A better fix is to retrieve the deployed URI from the target endpoint. > > Thanks, > Raymond > > On Mar 19, 2012, at 1:09 AM, [email protected] wrote: > >> Author: antelder >> Date: Mon Mar 19 08:09:04 2012 >> New Revision: 1302317 >> >> URL: http://svn.apache.org/viewvc?rev=1302317&view=rev >> Log: >> TUSCANY-4029: Clone the binding when setting it on the EndpointReference to >> ensure its not the same instance as that used by the Endpoint. >> >> Modified: >> >> tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java >> >> Modified: >> tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java >> URL: >> http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=1302317&r1=1302316&r2=1302317&view=diff >> ============================================================================== >> --- >> tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java >> (original) >> +++ >> tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java >> Mon Mar 19 08:09:04 2012 >> @@ -42,7 +42,6 @@ import org.apache.tuscany.sca.assembly.b >> import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; >> import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; >> import org.apache.tuscany.sca.assembly.builder.PolicyBuilder; >> -import org.apache.tuscany.sca.assembly.xml.Messages; >> import org.apache.tuscany.sca.core.ExtensionPointRegistry; >> import org.apache.tuscany.sca.core.FactoryExtensionPoint; >> import org.apache.tuscany.sca.core.UtilityExtensionPoint; >> @@ -501,7 +500,12 @@ public class EndpointReferenceBinderImpl >> } else { >> endpointReference.setTargetEndpoint(matchedEndpoint); >> Binding binding = matchedEndpoint.getBinding(); >> - endpointReference.setBinding(binding); >> + try { >> + endpointReference.setBinding((Binding) >> binding.clone()); >> + } catch (CloneNotSupportedException e) { >> + // shouldn't happen >> + throw new RuntimeException(e); >> + } >> // TUSCANY-3873 - add policy from the service >> // we don't care about intents at this stage >> >> endpointReference.getPolicySets().addAll(matchedEndpoint.getPolicySets()); >> >> >
