jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart" <christophe.lomb...@gmail.com>
Subject Re: dynamic mixins and jcr mapping
Date Fri, 17 Aug 2007 07:47:00 GMT
Thanks for your mail. All kind of ideas are welcome. I agree with you, the
OCM framework has to provide a nice way to map dynamically mixin types.

You are welcome to create a new jira issue. By this way, we can discuss in
more details.  Please add use cases. That can help to find a solution :-)

Maybe an solution is not something like this (not yet implemented of
course)  - This is just a brain storming. Not sure if it is a good solution.


Transmission transmission =  new Transmission();
transmission.setPath("/mytransmission");
transmission.set...();

ocm.insert(transmission);
ocm.save();

... later

Option option = new Option();
option.setPath("/mytransmission");
option.set...();
ocm.update(option);
ocm.save();


If Option is mapped to a mixin:type and if both objects use the same path,
this should work.  Later, you can make query/retrieve on both types.

Still thinking about that ...

FYI, I would like to drop the ocm:discriminator. It is used when the same
node type is applied on a complete java class hierarchy in order to find the
appropriate descendant class when a new object has to be instantiated. It is
tedious to support it just to solve this issue.


br,
Christophe





On 8/17/07, Padraic Hannon <pih@wasabicowboy.com> wrote:
>
> I was looking at the default object converter (ObjectConverterImpl) and
> noticed that it dynamically adds the ocm:discriminator mixin type to the
> jcr node on insert. Additionally I have been thinking about dynamic
> languages and looking at Freebase, to make a long story short I am
> thinking about dynamic typing of java objects. My thought was that
> through a typing (or tagging) mechanism one could create objects with
> attribute collections whose values could be validated via jcr if one
> could dynamically assign mixins based on a field in that object.
>
> For example, if you have a vehicle feature you may want to tag it as a
> transmission and an option. Each tag (or type) would carry a set of
> attribute definitions that one would want to see on a web page or in a
> data entry system. If you could inspect the object and look at how it is
> tagged you could write those tags in as mixins when persisting to jcr.
> Then jackrabbit could enforce data types, required fields, etc.
>
> This sort of functionality is a no brainer in dynamically typed systems
> such as javascript, ruby, etc. however is not strictly possible in java
> (or at least is way out of my league) via interfaces or superclasses,
> but could be done via a contract (getTags() getTypes() something like
> that) where a method returns mixin names? Does this make anyone
> immediately repulsed? I could submit a patch or two to jira if anyone is
> interested...
>
> -paddy
>

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