Hi!
I've been thinking about the enhancement in GRFT54 [1]. Currently this is possible, using imbricated
beans. However, the intention would be to allow easier mappings for such examples.
At this moment, a bean is always considered to map to a child node (a one-to-one mapping). As GRFT54
is showing, this approach is not covering all possibilites. I guess a greater generality can be
reached by allowing a bean to specify its persister class.
The interface that a persister class should implement would be very simple:
[code]
/**
* @param jcrName mapping specified jcrName or fieldName
*/
insert(Session, Node parentNode, String jcrName, Object beanObject);
update(Session, Node parentNode, String jcrName, Object beanObject);
remove(Session, Node parentNode, String jcrName, Object beanObject);
Object load(Session, Node parentNode, String jcrName)
[/code]
For making things even simplier in some scenario, we can provide such specific persister
implementations for a few node types defined in the JSR170 (a good example would be nt:file).
Full example:
considering the GRFT54 example, you will write:
<bean-descriptor fieldName="file"
converterClass="NtFileConverter" />
and NtFileConverter will be responsible for creating the nt:file node structure. Same mechanism will
work for fetching.
I would like to hear you opinion, before starting to work on this idea.
[1] http://issues.apache.org/jira/browse/GRFT-54
cheers,
./alex
--
.w( the_mindstorm )p.