On Wed, Mar 3, 2010 at 12:35 PM, Raymond Feng <[email protected]> wrote:
> 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
>

Without having looked in detail that all sounds good to me. One thing
that would be nice would be instead of having only the WS binding be
the default would be to check that is available first and if not try
something else like the RMI binding, so then it would still work
automatically with no extra config needed even if the WS binding isn't
available on the classpath but the RMI binding is (which makes simple
demos easier as RMI has far fewer dependencies).

   ...ant

Reply via email to