Ryan,
I have been looking at json-lib over the past few days, and have the
java -> json serialization all working, and some of the json -> java
serialization working (as BeanJsonLibConverter) with the classes
coming from a guice injector (so that the calls can bind to interfaces
rather than concrete classes). I was also going to look at Xstream
because I had heard it was good.... comparitive evidence being better
than guesswork.......but I will leave XStream if you are going to look
at it.

One thing that this has lead me to realize is that whatever the
serialization mechanism is, we need to have some test cases that can
validate as much of the API as possible without relying on hand coding
the test cases and risking transcription errors. I dont know if it
will work, but I am loading the opesocial-reference/features.xml into
a Rhino context and extracting the json definition direct from the js
api. Hopefully this will mean that the wire protocol stays in step
with the js api definition, and the unit tests wont rely on
hand-recoding each time the API is revision(ed).

Is this a dumb idea ?

and is completing a json-lib serializer a waste of effort ?

Ian (not wanting to duplicate effort unnecessarily)

2008/6/25 Louis Ryan <[EMAIL PROTECTED]>:
> Ok now that Im back to working on the RESTful side of things I took a look
> at Pauls suggestion to use XStream as the serialization mechanism at least
> for JSON handling and I think it has a lot of merit. Im going to do some
> prototyping in Shindig with this.
>
> I've been catching up on the code since Im back from vacation so Ill start
> to make contributions in this area mostly focused on the JSON APIs initially
> as this seems to be where the most interest is and where the implementation
> path is clearest. My goal will be to have the Shindig JSON implementation
> working end-to-end in Orkut in large part to provide feedback on the API
> stack based on a working implementation (I hate working in a bubble!)
>
>
> On Tue, Jun 10, 2008 at 3:11 PM, Paul Lindner <[EMAIL PROTECTED]> wrote:
>
>> It's not enunciate that provides the magic, it just uses xstream to do the
>> dirty work:
>>
>> http://xstream.codehaus.org/json-tutorial.html
>>
>> You can either use jettison or your own driver.
>>
>> For the jaxb mappings you can add something like this to the top of the
>> model classes:
>> @XmlRootElement(
>>            name = "person",
>>            namespace = "http://opensocial.org/2008/opensocial";
>>        )
>>
>> And add
>>
>> @XmlElement above each of the getters..
>>
>> For enums you need something like this:
>> @XmlJavaTypeAdapter(Enum.DrinkerAdapter.class)
>>
>> and a corresponding adapter.
>>
>> sample here:
>>
>>
>> http://www.hi5networks.com/platform/browser/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
>>
>>
>>
>> On Jun 10, 2008, at 2:57 PM, Cassie wrote:
>>
>>  Hmm.. I just worry that it would turn out like abdera... not providing
>>> enough benefit for the learning curve. I mean, the restful json spec is
>>> really very simple, I'm hoping we can just whip it up :)
>>>
>>> I could be convinced otherwise though - do you have any code you can share
>>> that uses enunciate?
>>>
>>> - Cassie
>>>
>>>
>>> On Tue, Jun 10, 2008 at 2:52 PM, Paul Lindner <[EMAIL PROTECTED]> wrote:
>>>
>>>  If you're going down this route you might want to consider using JAXB
>>>> annotations and a custom json converter.
>>>>
>>>> This type of situation is working quite well for us in the Enunicate
>>>> toolkit and is already implemented there.  In fact we've added JAXB
>>>> annotations to our internal shindig repo and it's worked out really,
>>>> really
>>>> well.
>>>>
>>>> As far as atom goes..  I have a set of classes that implement Atom in
>>>> JAXB
>>>> that I'd be happy to contribute.
>>>>
>>>> Check out http://enunciate.codehaus.org/
>>>>
>>>> Ryan, can you offer your thoughts?
>>>>
>>>>
>>>>
>>>> On Jun 10, 2008, at 2:44 PM, Cassie wrote:
>>>>
>>>> We tried to use abdera to implement the opensocial json restful format
>>>>
>>>>> within Shindig.. and it didn't work out very well. The code is clunky,
>>>>> overly complicated for simple json and is hard to come up to speed on.
>>>>>
>>>>> So... I am going to try an alternate implementation based on the
>>>>> existing
>>>>> older json wire format code. I was going to start coding something in a
>>>>> separate dir so that none of the current code is disturbed. Hopefully,
>>>>> in
>>>>> the next couple days we will have a cleaner impl of the restful json
>>>>> that
>>>>> is
>>>>> 90% the same as all of the current social code. (this means less
>>>>> migration
>>>>> for current social code users too, yea!)
>>>>>
>>>>> And as for atom... well, we can figure that out later :)
>>>>>
>>>>> Please let me know if you have any huge objections to this.
>>>>> And of course, if it turns out to be worse than the abdera impl.. we can
>>>>> always go back.
>>>>>
>>>>> - Cassie
>>>>>
>>>>>
>>>> Paul Lindner
>>>> [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>
>>>>
>> Paul Lindner
>> [EMAIL PROTECTED]
>>
>>
>>
>>
>

Reply via email to