Hi,
I have checked in the changes to allow us to map binding.sca to any of the
bindings by configuration.
It turned out that the trick is as simple as follows:
* Add a new utility SPI
org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper which contains
the following methods to map Endpoint or EndpointReference with binding.sca
to other bindings:
public RuntimeEndpoint map(RuntimeEndpoint endpoint);
public RuntimeEndpointReference map(RuntimeEndpointReference
endpointReference);
boolean isRemotable(); // Control if an binding.sca endpoint with
remotable interface should be published to the remote protocol
* Provide a default implementation
org.apache.tuscany.sca.binding.sca.provider.DefaultSCABindingMapper
* Receive the mapped binding QName via the
org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding
attribute or system property. By default, it's mapped to sca:binding.ws.
* Create an instance of binding and copy all attributes from binding.sca
into the mapped binding (Simply speaking, <binding.sca/> is pretty much like
<binding.xyz/>)
* Map endpoint and endpoint reference by replacing the SCABinding with the
mapped binding instance
* Invoke the binding builder to build the mapped binding
* Create delegating SCA reference/service provider that delegates the
calls to the mapped binding provider
Now you can plug in binding.sca using one of the following ways:
* Set the binding type via
org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding
system property
* Set the binding type via
org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding
attribute from the NodeFactory
* Add a new
META-INF/org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper with
the mappedBinding attribute and higher ranking (this also allows a
customized SCABindingMapper to replace the default one from Tuscany).
With this improvement, we can now remove the following modules (merging the
tests into itest) as well as DistributedSCABinding model.
tuscany-binding-sca-axis2-runtime
tuscany-binding-sca-runtime-rmi
tuscany-sca-client-rmi
If there is no objection, I'll clean them up as the next step.
[1] http://svn.apache.org/viewvc?rev=918261&view=rev
Thanks,
Raymond
---
Raymond Feng
Apache Tuscany PMC Member: http://tuscany.apache.org
Co-author of Tuscany In Action (A book on Tuscany SCA):
http://tuscanyinaction.com/
www.enjoyjava.com
http://twitter.com/raymondfeng