tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raymond Feng" <enjoyj...@gmail.com>
Subject Mapping binding.sca to any bindings by configuration
Date Tue, 02 Mar 2010 23:35:52 GMT

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 
    boolean isRemotable(); // Control if an binding.sca endpoint with 
remotable interface should be published to the remote protocol

* Provide a default implementation 
  * Receive the mapped binding QName via the 
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 
  * 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 
system property
* Set the binding type via 
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.


If there is no objection, I'll clean them up as the next step.

[1] http://svn.apache.org/viewvc?rev=918261&view=rev

Raymond Feng
Apache Tuscany PMC Member: http://tuscany.apache.org
Co-author of Tuscany In Action (A book on Tuscany SCA): 

View raw message