On Tue, May 5, 2009 at 5:46 PM, Luciano Resende <[email protected]>wrote:

> On Tue, May 5, 2009 at 4:55 AM, lookman sanni <[email protected]>
> wrote:
> > Hi everyone.
> >
> >
> > I've been deeply reading the getting started with Tuscany, and i''m in
> > need of explanations on some points:
> >
> > What does the Tuscany SCA Data Collection stands for? What's the
> difference
> > between an org.apache.tuscany.sca.data.collection.Entry object  and a
> > java.util.Map object?
>
> The Tuscany Data Collection is a SPI that allow users to manipulate a
> collection of "things/data" in a way that it can be easily
> exposed/mapped as REST style services. You can see that it basically
> maps HTTP protocol operations to the SPI (e.g when you do a get
> passing a resource id, it maps to get(String id))......
>
> > In the shopping Cart implementation, is it because the component use the
> > atom binding, that put, post and delete methods are defined? What about
> the
> > keyring system key = "cart-" + UUID.randomUUID().toString(); in the post
> > method? What is it used for?
> >
>
> The cart have the CRUD operations, the only difference is that the
> method names are following the REST/ATOM PUB/HTTP names instead of
> Create, Read, Update and Delete. Again, this is to facilitate exposing
> these "things/data" in a REST way...
>
> > In order to handle the shopping cart items posting, and the shopping cart
> > total request  from the android app, I'm trying to use the Abdera
> project.
> > As it's going to be run from a mobile platform, i intend to build only
> the
> > needed part of Abdera, and export it to android as a Dex file.
> > I'll be posting the cart items like this:
> >
>
> Note that shopping cart total is using JSON-RPC and not ATOM, so you
> won't need Abdera for that.
> As for the atom support, I'd recommend two ways :
>   - Verify if there is native support for ATOM in Android (this is
> what we did for JSON)
>   - Try to use the full Abdera parser...


The full Abdera parser uses apache http client which is already natively
supported on Android. This induces a  conflict in the imported packages, and
i ended up with a null pointer exception when initiating an Abdera Client on
Android.

I tried then to import Abdera core sources to my workspace, and convert it
to an android application so that it'll include directly the native apache
httpclient, but that reveals that android's javax.xml is very classless
(missing the javax.xml.namespace.QNAME and may be some other classes).

I finally tried out something more generic: Initialize an httpClient,
perform an httppost of the xml section below using the
org.apache.http.client.methods<http://developer.android.com/reference/org/apache/http/client/methods/package-summary.html>
 package.

>
> "<entry xmlns='http://www.w3.org/2005/Atom'>" +
> "<title>item</title>" +
> "<content type='text/xml'>" +
> "<Item xmlns='http://services/'>" +
> "<name xmlns=''>" + item.getName()+ "</name>" +
> "<price xmlns=''>" +item.getPrice()+"</price>" +
> "</Item></content></entry>"
>
httpResponse return Internal Server error, while the binding atom section at
the server side fire a null pointer exception. Can this be due to the xml
content
schema (atom supposed) i'm posting?



>
> >
> >>
> >> Abdera abdera = new Abdera();
> >>         AbderaClient client = new AbderaClient(abdera);
> >>
> >>         Entry entry = abdera.newEntry();
> >>
> >>         entry.setContent("<entry xmlns='http://www.w3.org/2005/Atom'>"
> +
> >>                 "<title>item</title>" +
> >>                 "<content type='text/xml'>" +
> >>                     "<Item xmlns='http://services/'>" +
> >>                         "<name xmlns=''>" + item.getName()+ "</name>" +
> >>                         "<price xmlns=''>" +item.getPrice()+"</price>" +
> >>             "</Item></content></entry>");
> >>
> >>         ClientResponse resp = client.post(ServiceURI,entry);
> >
> >
> > And this requires the following classes:
> >>
> >> org.apache.abdera.Abdera;
> >> org.apache.abdera.model.Entry;
> >> org.apache.abdera.model.Feed;
> >> org.apache.abdera.protocol.Response.ResponseType;
> >> org.apache.abdera.protocol.client.AbderaClient;
> >> org.apache.abdera.protocol.client.ClientResponse;
> >
> >
> > I'd like to know if there's a tool i can use to quickly and easily pack
> > those classes with their dependencies in a jar file, before sealing them
> in
> > a dex file using the android dx utility.
> >
> > Surely all this will imply a switch of the shopping cart's binding from
> atom
> > to atom-abdera.
> >
>
> There should be no changes needed here....
>
> > Apart from answers to my questions, feel free guys to post any comment or
> > helpful advice.
> >
> >
> > Cdlt;
> > --
> > Lookman SANNI;
> >
>
>
>
> --
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>



-- 
Lookman SANNI;

Reply via email to