You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Andres P. Ferrando" <an...@pruna.com.ar> on 2010/01/25 18:24:02 UTC

Design question: hide binding details

Hi,

I've been looking at the binding docs, and for instance in http binding 
(http://tuscany.apache.org/sca-java-bindinghttp.html), it asks that the 
service either implements javax.servlet.Servlet interface or use a 
collection interface that matches the actions of the HTTP protocol 
(methods get, post, etc). Similar requirements exists for other bindings.

One of the main ideas behind SCA is to hide binding info from 
implementation.

So, if for instance I have an existent class with a single method that I 
want to expose only through GET, and doesn't follows any of these 
requirements, which is the best approach? Create a "proxy" SCA 
component? Or is there any way to define this in the binding itself? Or 
some other option I didn't see?

Regards,

-- 
   Andrés P. Ferrando
http://www.pruna.com.ar/


Re: Design question: hide binding details

Posted by Luciano Resende <lu...@gmail.com>.
On Mon, Jan 25, 2010 at 9:24 AM, Andres P. Ferrando <an...@pruna.com.ar> wrote:
> Hi,
>
> I've been looking at the binding docs, and for instance in http binding
> (http://tuscany.apache.org/sca-java-bindinghttp.html), it asks that the
> service either implements javax.servlet.Servlet interface or use a
> collection interface that matches the actions of the HTTP protocol (methods
> get, post, etc). Similar requirements exists for other bindings.
>
> One of the main ideas behind SCA is to hide binding info from
> implementation.
>
> So, if for instance I have an existent class with a single method that I
> want to expose only through GET, and doesn't follows any of these
> requirements, which is the best approach? Create a "proxy" SCA component? Or
> is there any way to define this in the binding itself? Or some other option
> I didn't see?
>

Hi Andrés

   The REST style services work a little different, as there is a need
to have a direct mapping to REST/HTTP operations, and based on this,
our HTTP and ATOM bindings have some specific behavior to accomodate
this requirement. One of the things I'm looking at, is to support
JAX-RS in Tuscany, where you would be able to map your business
interfaces to these REST/HTTP operations via annotations more like :

public interface Catalog {
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    Item[] getMyCatalog();
}

   Back to your issue, how does your method signature looks like ?
But, for now, a proxy component might be the simplest solution.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/