Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 89167 invoked from network); 13 Apr 2010 07:19:08 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Apr 2010 07:19:08 -0000 Received: (qmail 83725 invoked by uid 500); 13 Apr 2010 07:19:06 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 83563 invoked by uid 500); 13 Apr 2010 07:19:06 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 83554 invoked by uid 99); 13 Apr 2010 07:19:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 07:19:05 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of darran.m.white@googlemail.com designates 74.125.82.52 as permitted sender) Received: from [74.125.82.52] (HELO mail-ww0-f52.google.com) (74.125.82.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 07:18:59 +0000 Received: by wwb39 with SMTP id 39so307810wwb.11 for ; Tue, 13 Apr 2010 00:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=GA+ZUl2c2Jaggg4f/XMSag9z1RGKOpNtHFx9ur3mxfE=; b=Jy+oZEsoNKBafnNNkyEnM0+kbjm9PaaNxNs6I0jVDVdbgJSfHi2oH9V1QoO+pIMQh9 P+YMRHVe2ncM0F8TsFd1N82MuFidVjWdUjESAVNbYyAUEhbJJQ2k52QxHVs8zTc8KAiI gG3Vi7IbxmYAHOQydnI2kHjw8gVuxBuxc+1cs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ihGEMUBkBRGoysNngOVVHOnnm3Sn4m+wVyQk3mGLlRmGsDLK+v5s+b/v5rH8GccgFV PY4NBqmlMQNEmrhbmnC6xPo7/MfwFPVFnjR4SVEB44J3PHLmABQEJ2/bHkG5KezS2qyw Qsli7s7qQWtsAQpFzdpPwZKywSPON7AZsmqwY= MIME-Version: 1.0 Received: by 10.216.2.76 with HTTP; Tue, 13 Apr 2010 00:18:38 -0700 (PDT) Date: Tue, 13 Apr 2010 08:18:38 +0100 Received: by 10.216.161.84 with SMTP id v62mr196662wek.58.1271143118945; Tue, 13 Apr 2010 00:18:38 -0700 (PDT) Message-ID: Subject: Java Document Object Mapper api From: Darran White To: CouchDB users mailing list Content-Type: multipart/alternative; boundary=0016363ba18c103c8804841912c3 X-Virus-Checked: Checked by ClamAV on apache.org --0016363ba18c103c8804841912c3 Content-Type: text/plain; charset=ISO-8859-1 Hi, I`ve started writing an annotation based couchdb Document Object Mapper called jBeanbag http://code.google.com/p/jbeanbag/. The approach I`ve taken is to use 100% annotations so the users domain model does not have to derive from the api. I`m also trying to make it CouchDB focused rather then JSON focused which a few of the other apis seem to be. The aim is to enable easy mapping to and from CouchDB documents to Java classes and also provide some infrastructure support for example @Linked annotation could be above a field meaning the field should be a linked document and handling conflicts by returning Java objects of the different versions in an exception. I`d also like to put in more annotations for other kinds of relationships like bi-directional. An example Java annotated class is at the bottom of this mail. I`m using the ASM library http://asm.ow2.org/ to create a Meta model of the Java classes ,including all the CouchDB configuration for that class, is then cached in ehcache and can be reused for serializing to/from the JSON. The JSON parsing I`m using the the Jackson JSON Streaming/Mapping apis. ASM helps by making it easy to analyze the class structure in advance ,using its visitor pattern, as well as giving access to Generics information. So I`m looking to the community for any CouchDB patterns they keep repeating in code which could be included in the framework as well as anyone else who could be interested in contributing to the code base. Going forward I`d also like to provide wrappers for Groovy to make it a bit more ,well Groovier and Scala wrappers. At the moment theres not a released version but I`m hoping to have a 0.01 version soon. But I have done most of the simple conversion to/from JSON for primitives,arrays,maps,lists, sets,Objects, Wrapper Objects e.g Integer class,enums and Dates. Currently it`ll struggle with things like Arrays of Maps or Lists of Lists but that should be fixed soon. I`m currently working on the HTTP client side of things. Thoughts,comments and especially help all appreciated. regards Darran @Document(location="people") public class Person{ @Id private String id; @Revision private String revision //Will be a list of embedded pet objects in the person document //not really needed as embedded is the default @Embedded @NotNullable private List pets; //List will be parsed and written as linked documents to this class @Linked private List cars; private String name;//Will be written as name: in document @Ignore private String dontWriteToDocument; //Won`t be written to the document ...... --0016363ba18c103c8804841912c3--