cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <>
Subject Re: REST framework on to of Cayenne [Was [jira] [Commented] (CAY-1847) Make ConverterFactory extensible and injected via DI]
Date Thu, 11 Jul 2013 20:16:14 GMT
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 <>wrote:

> [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 Cayenne
> 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 and
> related entities (actually it is more fine grained - it can define the
> result up to individual attributes if needed). This information is matched
> with Cayenne mapping, and at the select stage is used to build SelectQuery
> 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
> 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 singleton
> Encoders for Joda classes.
> I wish we had a similar framework as open source. LOE creating it (once we
> 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… Maybe someone will like the idea, so
> that we can somehow start collaborating on it.
> Andrus

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message