Return-Path: X-Original-To: apmail-cayenne-dev-archive@www.apache.org Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD56110E4D for ; Thu, 11 Jul 2013 20:16:40 +0000 (UTC) Received: (qmail 92341 invoked by uid 500); 11 Jul 2013 20:16:40 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 92315 invoked by uid 500); 11 Jul 2013 20:16:40 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 92307 invoked by uid 99); 11 Jul 2013 20:16:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jul 2013 20:16:40 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of johnthuss@gmail.com designates 209.85.214.51 as permitted sender) Received: from [209.85.214.51] (HELO mail-bk0-f51.google.com) (209.85.214.51) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jul 2013 20:16:34 +0000 Received: by mail-bk0-f51.google.com with SMTP id ji1so3510565bkc.24 for ; Thu, 11 Jul 2013 13:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=qNTgDcnwXl/C5VDedUyiELJWLWZdbb+W6xz2boUyCvw=; b=m9DvzDXK8zozyktPJwyTJKfVRBok7y26mlQRgK7bCkRItcD8H97Qq+lHHEaKorinji GJ8nO547oZJNumsf3sBHhYtxKa6QYRdPZdenogYKPu9h09O/8ebMonhkp02pJJZVykzP 9cTxqfidFo4ePBfxSi3+j/8xriy+XMI9rq+iDK1dzKALlwdrY2RMZE25F2NXsGC3CPpn 5gqnzJdy8WIuSRXZMG+MHgIncuucVr3vAm//LWKzlgyhtY+S+As9msNYXrcwFiswb4Uv 8V6Xr25Jlcn3H4ixzukPm6I3Q6CtWwidqxgIvb0H3lB4zHwme5dEChCYFUfJ3LkTvrAj yaCw== MIME-Version: 1.0 X-Received: by 10.204.228.207 with SMTP id jf15mr5958694bkb.16.1373573774477; Thu, 11 Jul 2013 13:16:14 -0700 (PDT) Received: by 10.204.59.78 with HTTP; Thu, 11 Jul 2013 13:16:14 -0700 (PDT) In-Reply-To: <7CF47ED9-5675-40CB-8F78-D50793809AC8@objectstyle.org> References: <7CF47ED9-5675-40CB-8F78-D50793809AC8@objectstyle.org> Date: Thu, 11 Jul 2013 15:16:14 -0500 Message-ID: Subject: Re: REST framework on to of Cayenne [Was [jira] [Commented] (CAY-1847) Make ConverterFactory extensible and injected via DI] From: John Huss To: "dev@cayenne.apache.org" Content-Type: multipart/alternative; boundary=485b3970d474e6bbcd04e142106e X-Virus-Checked: Checked by ClamAV on apache.org --485b3970d474e6bbcd04e142106e Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable We have something that we could probably contribute. There some rough edges though since it is was built to meet our specific uses. I don't have much experience with other projects in this space (like Rails) so it's hard to know what is the best/standard way for doing things. The trickiest thing we found to deal with was avoiding infinite loops in serialization due to reverse relationships. If your model allows you to choose one side of the relationship in every case then you can avoid it, but if you need it to be dynamic it becomes more painful. On Thu, Jul 11, 2013 at 2:53 PM, Andrus Adamchik wr= ote: > [taking to dev] > > On Jul 11, 2013, at 10:21 PM, John Huss (JIRA) wrote: > > > Support in ConverterFactory is for integration with Jersey where I am > using PropertyUtils.setProperty to convert from strings like "2013-05-01 > 00:00:00.000" to DateTimes, etc. I'm currently doing this beforehand and > it works fine, but moving it into ConverterFactory will help reduce > duplication. I swear I've got at least 4 instances of this conversion in > various parts of apps. It's not really something that has to be in Cayen= ne > itself though; I'm just looking to create options. > > Interesting, I just wrote an entire JAX-RS engine on top of Cayenne > (closed source). With Joda date encoders coincidentally. > > The architecture is really simple. Request URL defines the root entity an= d > related entities (actually it is more fine grained - it can define the > result up to individual attributes if needed). This information is matche= d > with Cayenne mapping, and at the select stage is used to build SelectQuer= y > prefetches, and later when generating response - to build a hierarchical > encoder tree. Root encoder and result list are placed in the response > object, and it then handed to a special MessageBodyWriter that generates > JSON. > > Encoders are external to Cayenne and are not using PropertyUtils. I have > encoders for DataObjects (that access properties via 'readProperty'). And > for "simple" properties, I have my own encoder map, that includes singlet= on > Encoders for Joda classes. > > I wish we had a similar framework as open source. LOE creating it (once w= e > nailed the URL protocol details) was not that big, just a couple of weeks= . > I guess the most tricky part is to provide a flexible user-facing (REST) > protocol. My example was designed with Sencha/ExtJS in mind. Someone else > may probably want a different flavor. Although the basic operations are > going to be the same no matter what the client is. > > Anyways, just wanted to mention this=85 Maybe someone will like the idea,= so > that we can somehow start collaborating on it. > > Andrus --485b3970d474e6bbcd04e142106e--