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