I think this is what the OCM is doing :-)
Futhermore, I'm not sure that the OCM support will add more complexity if we
used the annotation support and only the nt:unstructured node type. I mean
any kind of java objects can be mapped into the nt:unstructured node type
like this :
@Node
class Article
{
@Field(path=true) field;
@Field String title;
@Field String content;
@Collection List relatedArticles;
....
}
Here is the code :
Article article = new Article();
article.setPath(...);
article.setTitle(...);
....
ocm.insert(article);
ocm.save();
No config file and no jcr node types are required. I think it will simplify
the template code (less verbose & cleaner).
Christophe
On 10/22/07, Thomas Mueller <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> What about a 'serialization' utility to convert a Node to a Java
> object and back? The node type could be anything, for example
> nt:unstructured
>
> Something like Apache Commons DB Utils (for JDBC):
>
> http://commons.apache.org/dbutils/apidocs/org/apache/commons/dbutils/BeanProcessor.html
>
> A utility class would be enough: JCRUtils
> static <T> T readObject(Node sourceNode, Class<T> javaClass)
> static void saveObject(Object javaObject, Node targetNode)
>
> This tool would use reflection and map as many properties as it finds.
> Nothing fancy, just enough to avoid hand-written 'serialization'.
>
> Thomas
>
>
> On 10/22/07, Lars Trieloff <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I do not think OCM is necessary for the type of applications I am
> > thinking of building with microsling and it does not adhere too much
> > to the nt:unstructured nature of JCR anyway.
> >
> > regards,
> >
> > Lars
> >
> > Am 22.10.2007 um 17:14 schrieb Bertrand Delacretaz:
> >
> > > Hi,
> > >
> > > I'm not sure if adding OCM mapping to microsling is worth the effort,
> > > given that microsling is targeted at small apps.
> > >
> > > And more important, that might make understanding microsling quite
> > > harder.
> > >
> > > Currently, microsling allows for mapped objects via the
> > > Resource.getData() method.
> > >
> > > If we agree that that's enough to allow "big Sling" to use OCM as it
> > > does now, I'd suggest dropping the OCM plan for microsling, i.e.
> > > closing SLING-76 as "wont' fix".
> > >
> > > WDYT?
> > >
> > > -Bertrand
> > >
> >
> >
>