You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by lookman sanni <lo...@gmail.com> on 2009/05/05 13:55:24 UTC

Thoughts and Interrogations on Tuscany Android 's Store

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?
   - 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?


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:

>
>
> 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.

Apart from answers to my questions, feel free guys to post any comment or
helpful advice.


Cdlt;
-- 
Lookman SANNI;

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by lookman sanni <lo...@gmail.com>.
Thx for your feedback luciano.
I was referencing the atom binding only for posting(from the client) the
shopping cart items purpose. For sure, the shopping cart total is retrieved
via JSON (no doubt about that anymore[?]).
Till now, after my researches it seems like there's not yet any native
support of atom on android.
Well, I was thinking of using just a part of Abdera as we're not going to
use so much features of it. It'll just be about building and posting an
Abdera entry to the store web "server".  The abdera-0.4.0 's jar already
weights about 1.5Mo, and it may need the referenced libraries in the its lib
folder. For a mobile platform i think it'll be nice if we have something
lightweight.

For the binding, i've seen atom-abdera in tuscany's extensions list. I then
thought it'll be more adapted as we'll be using abdera to post the
ressources.
On Tue, May 5, 2009 at 5:46 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Tue, May 5, 2009 at 4:55 AM, lookman sanni <lo...@gmail.com>
> 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...
>
> >
> >>
> >> 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;

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, May 7, 2009 at 3:28 PM, lookman sanni <lo...@gmail.com> wrote:
>
>
> On Fri, May 8, 2009 at 12:18 AM, lookman sanni <lo...@gmail.com> wrote:
>>
>>
>> 2009/5/7 Oscar Castañeda <oc...@apache.org>
>>>
>>> Hi Lookman,
>>>
>>> Congrats, you're doing really good! I'm happy you decided to follow my
>>> recommendation of jumping into the community bonding period with regular
>>> updates on your progress and posting of any questions you have along the
>>> way. I have followed all your threads until now and have a few suggestions
>>> which you will find below.
>>>
>>> On Thu, May 7, 2009 at 6:14 PM, Luciano Resende <lu...@gmail.com>
>>> wrote:
>>>>
>>>> On Thu, May 7, 2009 at 12:12 AM, lookman sanni <lo...@gmail.com>
>>>> wrote:
>>>> >
>>>> > 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.
>>>> >
>>>>
>>>> Just a thought, wow about for now, we try to parse the atom as xml ?
>>>> this could at least make you progress and get something working.
>>>
>>> While it is a good idea to simplify and try to get things running, also
>>> consider what might need to be done to get SCA running on Android. This is
>>> also part of your project, namely the part about Android SCA Runtime, or
>>> host-android, but of course you know that already. One idea is to try this
>>> part of the project in parallel to other efforts.
>>>
>>>>
>>>>
>>>> > 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 also found out an open source implementation of the QNAME class, i'm
>> going to add to my project, and see what it gives.
>> Glad to see you again oscar!! I'm going to have a look on how felix got
>> running on android, and start digesting the host-android part. In my last
>> mail , i told you that i'm focusing this week on how to consume the cart and
>> total services. Tha's what i've been then working on mainly.
>>>>
>>>> >
>>>>
>>>> I had a patch for that, but haven' t played with it for couple weeks
>>>> and might need update.
>>>
>>> If I'm not mistaken, Luciano's reference here is about the host-android
>>> part of the project. You might want to look into the thread: "Android
>>> progress update" on markmail. The last I tested on that can be found in [1].
>>> Afterwards I found out about a similar effort of getting an Apache project
>>> running on Android...This year at ApacheCon Europe there was a presentation
>>> by Marcel Offermans and Christian van Spaandonk, about getting Apache Felix
>>> running on Android. Here's an excerpt of what they said about getting Felix
>>> to run on Android:
>>>
>>> "When Android was first released, the first problem was getting Felix to
>>> run ... even without any bundles, just the plain framework. The framework is
>>> pretty portable by itself, so that wasn't too hard to do. The hard part
>>> started when we wanted to actually dynamically deploy bundles. That didn't
>>> work at first, because these bundles only contain OSGi Java code, and we
>>> somehow had to dex'ify these bundles and then try and load these dex'ified
>>> classes. And there wasn't and still isn't an API to officially do that."
>>>
>>> "...but, well, specifically I remember on a Friday evening was a little
>>> after 10 o'clock - found a way of doing that. So when we did that we
>>> immediately started to write a blog about that and it spread like wildfire,
>>> and in no time everybody was running this out. And actually we figured out
>>> the fix was pretty easy, so we even embedded that as part of Felix. So if
>>> you download Felix right now, you can just deploy it on Android, and it will
>>> run."
>>>
>>> I believe the blog Marcel was talking about is found in [2]. Hopefully
>>> it'll be helpful to get SCA running on Android. We can also try to contact
>>> him on the Felix mailing list to get more help if needed.
>>>
>>> [1] http://www.mail-archive.com/dev@tuscany.apache.org/msg05685.html
>>> [2] http://felix.apache.org/site/apache-felix-and-google-android.html
>
> It may be crazy but i already tried the steps quoted in [2], for abdera-core
> before given up as classes and packages that are recquired already had a
> light version on android!!
> I guess, it'll end up by a rebuilt of android.jar, option i'd like to choose
> at last.

If you are asking about QName, I had to add it to the android source
code, and generate a new android.jar


-- 
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by lookman sanni <lo...@gmail.com>.
On Fri, May 8, 2009 at 12:18 AM, lookman sanni <lo...@gmail.com> wrote:

>
>
> 2009/5/7 Oscar Castañeda <oc...@apache.org>
>
>> Hi Lookman,
>>
>> Congrats, you're doing really good! I'm happy you decided to follow my
>> recommendation of jumping into the community bonding period with regular
>> updates on your progress and posting of any questions you have along the
>> way. I have followed all your threads until now and have a few suggestions
>> which you will find below.
>>
>> On Thu, May 7, 2009 at 6:14 PM, Luciano Resende <lu...@gmail.com>wrote:
>>
>>> On Thu, May 7, 2009 at 12:12 AM, lookman sanni <lo...@gmail.com>
>>> wrote:
>>> >
>>> > 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.
>>> >
>>>
>>> Just a thought, wow about for now, we try to parse the atom as xml ?
>>> this could at least make you progress and get something working.
>>
>>
>> While it is a good idea to simplify and try to get things running, also
>> consider what might need to be done to get SCA running on Android. This is
>> also part of your project, namely the part about Android SCA Runtime, or
>> host-android, but of course you know that already. One idea is to try this
>> part of the project in parallel to other efforts.
>>
>>
>>>
>>> > 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 also found out an open source implementation of the QNAME class, i'm
> going to add to my project, and see what it gives.
> Glad to see you again oscar!! I'm going to have a look on how felix got
> running on android, and start digesting the host-android part. In my last
> mail , i told you that i'm focusing this week on how to consume the cart and
> total services. Tha's what i've been then working on mainly.
>
>>
>>> >
>>>
>>> I had a patch for that, but haven' t played with it for couple weeks
>>> and might need update.
>>>
>>
>> If I'm not mistaken, Luciano's reference here is about the host-android
>> part of the project. You might want to look into the thread: "Android
>> progress update" on markmail. The last I tested on that can be found in [1].
>> Afterwards I found out about a similar effort of getting an Apache project
>> running on Android...This year at ApacheCon Europe there was a presentation
>> by Marcel Offermans and Christian van Spaandonk, about getting Apache Felix
>> running on Android. Here's an excerpt of what they said about getting Felix
>> to run on Android:
>>
>>    - "When Android was first released, the first problem was getting
>>    Felix to run ... even without any bundles, just the plain framework. The
>>    framework is pretty portable by itself, so that wasn't too hard to do. The
>>    hard part started when we wanted to actually dynamically deploy bundles.
>>    That didn't work at first, because these bundles only contain OSGi Java
>>    code, and we somehow had to dex'ify these bundles and then try and load
>>    these dex'ified classes. And there wasn't and still isn't an API to
>>    officially do that."
>>
>>
>>    - "...but, well, specifically I remember on a Friday evening was a
>>    little after 10 o'clock - found a way of doing that. So when we did that we
>>    immediately started to write a blog about that and it spread like wildfire,
>>    and in no time everybody was running this out. And actually we figured out
>>    the fix was pretty easy, so we even embedded that as part of Felix. So
>>    if you download Felix right now, you can just deploy it on Android,
>>    and it will run."
>>
>> I believe the blog Marcel was talking about is found in [2]. Hopefully
>> it'll be helpful to get SCA running on Android. We can also try to contact
>> him on the Felix mailing list to get more help if needed.
>>
>> [1] http://www.mail-archive.com/dev@tuscany.apache.org/msg05685.html
>> [2] http://felix.apache.org/site/apache-felix-and-google-android.html
>>
>
It may be crazy but i already tried the steps quoted in [2], for abdera-core
before given up as classes and packages that are recquired already had a
light version on android!!
I guess, it'll end up by a rebuilt of android.jar, option i'd like to choose
at last.

>
>>
>>
>>> > 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 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?
>>> >
>>> >
>>>
>>> Take a look at function addToCart() from [1], it should give you the
>>> proper atom payload to send when adding a new item to shoppingCart.
>>
>>
> I'm using the same!! I guess, the problem may be about the way i'm posting
> it (using a list of NameValuePair to hold the xml content and  httpost.
> setEntity(new UrlEncodedFormEntity(myList  cf[a]
> Well that was a quick thing, and i'll need to look deeper in it!
> [a]: http://www.anddev.org/http_post_connection_in_sdk-10-t2970.html
>
>
>>>
>>>
>>>
>>> [1]
>>> http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/store/src/main/resources/uiservices/store.html
>>>
>>>
>>> --
>>> Luciano Resende
>>> Apache Tuscany, Apache PhotArk
>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>> http://lresende.blogspot.com/
>>>
>>
>>
>>
>> --
>> best,
>> -oscar
>>
>> Oscar Castañeda
>> http://people.apache.org/~ocastaneda<http://people.apache.org/%7Eocastaneda>
>>
>
>
>
> --
> Best Regards
>
> Lookman SANNI
> http://blog.lookouster.org
> MSBI Intern at Umanis Tours Services;
>



-- 
Best Regards

Lookman SANNI
http://blog.lookouster.org
MSBI Intern at Umanis Tours Services;

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by lookman sanni <lo...@gmail.com>.
2009/5/7 Oscar Castañeda <oc...@apache.org>

> Hi Lookman,
>
> Congrats, you're doing really good! I'm happy you decided to follow my
> recommendation of jumping into the community bonding period with regular
> updates on your progress and posting of any questions you have along the
> way. I have followed all your threads until now and have a few suggestions
> which you will find below.
>
> On Thu, May 7, 2009 at 6:14 PM, Luciano Resende <lu...@gmail.com>wrote:
>
>> On Thu, May 7, 2009 at 12:12 AM, lookman sanni <lo...@gmail.com>
>> wrote:
>> >
>> > 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.
>> >
>>
>> Just a thought, wow about for now, we try to parse the atom as xml ?
>> this could at least make you progress and get something working.
>
>
> While it is a good idea to simplify and try to get things running, also
> consider what might need to be done to get SCA running on Android. This is
> also part of your project, namely the part about Android SCA Runtime, or
> host-android, but of course you know that already. One idea is to try this
> part of the project in parallel to other efforts.
>
>
>>
>> > 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 also found out an open source implementation of the QNAME class, i'm going
to add to my project, and see what it gives.
Glad to see you again oscar!! I'm going to have a look on how felix got
running on android, and start digesting the host-android part. In my last
mail , i told you that i'm focusing this week on how to consume the cart and
total services. Tha's what i've been then working on mainly.

>
>> >
>>
>> I had a patch for that, but haven' t played with it for couple weeks
>> and might need update.
>>
>
> If I'm not mistaken, Luciano's reference here is about the host-android
> part of the project. You might want to look into the thread: "Android
> progress update" on markmail. The last I tested on that can be found in [1].
> Afterwards I found out about a similar effort of getting an Apache project
> running on Android...This year at ApacheCon Europe there was a presentation
> by Marcel Offermans and Christian van Spaandonk, about getting Apache Felix
> running on Android. Here's an excerpt of what they said about getting Felix
> to run on Android:
>
>    - "When Android was first released, the first problem was getting Felix
>    to run ... even without any bundles, just the plain framework. The framework
>    is pretty portable by itself, so that wasn't too hard to do. The hard part
>    started when we wanted to actually dynamically deploy bundles. That didn't
>    work at first, because these bundles only contain OSGi Java code, and we
>    somehow had to dex'ify these bundles and then try and load these dex'ified
>    classes. And there wasn't and still isn't an API to officially do that."
>
>
>    - "...but, well, specifically I remember on a Friday evening was a
>    little after 10 o'clock - found a way of doing that. So when we did that we
>    immediately started to write a blog about that and it spread like wildfire,
>    and in no time everybody was running this out. And actually we figured out
>    the fix was pretty easy, so we even embedded that as part of Felix. So
>    if you download Felix right now, you can just deploy it on Android, and
>    it will run."
>
> I believe the blog Marcel was talking about is found in [2]. Hopefully
> it'll be helpful to get SCA running on Android. We can also try to contact
> him on the Felix mailing list to get more help if needed.
>
> [1] http://www.mail-archive.com/dev@tuscany.apache.org/msg05685.html
> [2] http://felix.apache.org/site/apache-felix-and-google-android.html
>
>
>> > 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 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?
>> >
>> >
>>
>> Take a look at function addToCart() from [1], it should give you the
>> proper atom payload to send when adding a new item to shoppingCart.
>
>
I'm using the same!! I guess, the problem may be about the way i'm posting
it (using a list of NameValuePair to hold the xml content and  httpost.
setEntity(new UrlEncodedFormEntity(myList  cf[a]
Well that was a quick thing, and i'll need to look deeper in it!
[a]: http://www.anddev.org/http_post_connection_in_sdk-10-t2970.html


>>
>>
>>
>> [1]
>> http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/store/src/main/resources/uiservices/store.html
>>
>>
>> --
>> Luciano Resende
>> Apache Tuscany, Apache PhotArk
>> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
>> http://lresende.blogspot.com/
>>
>
>
>
> --
> best,
> -oscar
>
> Oscar Castañeda
> http://people.apache.org/~ocastaneda<http://people.apache.org/%7Eocastaneda>
>



-- 
Best Regards

Lookman SANNI
http://blog.lookouster.org
MSBI Intern at Umanis Tours Services;

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by Oscar Castañeda <oc...@apache.org>.
Hi Lookman,

Congrats, you're doing really good! I'm happy you decided to follow my
recommendation of jumping into the community bonding period with regular
updates on your progress and posting of any questions you have along the
way. I have followed all your threads until now and have a few suggestions
which you will find below.

On Thu, May 7, 2009 at 6:14 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Thu, May 7, 2009 at 12:12 AM, lookman sanni <lo...@gmail.com>
> wrote:
> >
> > 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.
> >
>
> Just a thought, wow about for now, we try to parse the atom as xml ?
> this could at least make you progress and get something working.


While it is a good idea to simplify and try to get things running, also
consider what might need to be done to get SCA running on Android. This is
also part of your project, namely the part about Android SCA Runtime, or
host-android, but of course you know that already. One idea is to try this
part of the project in parallel to other efforts.


>
> > 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 had a patch for that, but haven' t played with it for couple weeks
> and might need update.
>

If I'm not mistaken, Luciano's reference here is about the host-android part
of the project. You might want to look into the thread: "Android progress
update" on markmail. The last I tested on that can be found in [1].
Afterwards I found out about a similar effort of getting an Apache project
running on Android...This year at ApacheCon Europe there was a presentation
by Marcel Offermans and Christian van Spaandonk, about getting Apache Felix
running on Android. Here's an excerpt of what they said about getting Felix
to run on Android:

   - "When Android was first released, the first problem was getting Felix
   to run ... even without any bundles, just the plain framework. The framework
   is pretty portable by itself, so that wasn't too hard to do. The hard part
   started when we wanted to actually dynamically deploy bundles. That didn't
   work at first, because these bundles only contain OSGi Java code, and we
   somehow had to dex'ify these bundles and then try and load these dex'ified
   classes. And there wasn't and still isn't an API to officially do that."


   - "...but, well, specifically I remember on a Friday evening was a little
   after 10 o'clock - found a way of doing that. So when we did that we
   immediately started to write a blog about that and it spread like wildfire,
   and in no time everybody was running this out. And actually we figured out
   the fix was pretty easy, so we even embedded that as part of Felix. So if
   you download Felix right now, you can just deploy it on Android, and it
   will run."

I believe the blog Marcel was talking about is found in [2]. Hopefully it'll
be helpful to get SCA running on Android. We can also try to contact him on
the Felix mailing list to get more help if needed.

[1] http://www.mail-archive.com/dev@tuscany.apache.org/msg05685.html
[2] http://felix.apache.org/site/apache-felix-and-google-android.html


> > 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 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?
> >
> >
>
> Take a look at function addToCart() from [1], it should give you the
> proper atom payload to send when adding a new item to shoppingCart.
>
>
>
> [1]
> http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/store/src/main/resources/uiservices/store.html
>
>
> --
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>



-- 
best,
-oscar

Oscar Castañeda
http://people.apache.org/~ocastaneda

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, May 7, 2009 at 12:12 AM, lookman sanni <lo...@gmail.com> wrote:
>
> 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.
>

Just a thought, wow about for now, we try to parse the atom as xml ?
this could at least make you progress and get something working.

> 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 had a patch for that, but haven' t played with it for couple weeks
and might need update.

> 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 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?
>
>

Take a look at function addToCart() from [1], it should give you the
proper atom payload to send when adding a new item to shoppingCart.



[1] http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/store/src/main/resources/uiservices/store.html


-- 
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by lookman sanni <lo...@gmail.com>.
On Tue, May 5, 2009 at 5:46 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Tue, May 5, 2009 at 4:55 AM, lookman sanni <lo...@gmail.com>
> 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;

Re: Thoughts and Interrogations on Tuscany Android 's Store

Posted by Luciano Resende <lu...@gmail.com>.
On Tue, May 5, 2009 at 4:55 AM, lookman sanni <lo...@gmail.com> 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...

>
>>
>> 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/