You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2007/10/22 17:14:54 UTC

[microsling] do we really want OCM mapping for microsling?

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

Re: [microsling] do we really want OCM mapping for microsling?

Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> 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?

Yepp, I think this makes sense. For ms based applications you most
likely do not need/use OCM, so lets make this a plus for the "big Sling".

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: [microsling] do we really want OCM mapping for microsling?

Posted by Carsten Ziegeler <cz...@apache.org>.
Jukka Zitting schrieb:
> Hi,
> 
> On 10/23/07, Christophe Lombart <ch...@gmail.com> wrote:
>> 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 [...]
> 
> You still need the Java class and the explicit annotations. This can
> be a relatively big barrier if you just want to write a simple
> template script.
> 
And the ocm library (jar) :)

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: [microsling] do we really want OCM mapping for microsling?

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 10/23/07, Christophe Lombart <ch...@gmail.com> wrote:
> 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 [...]

You still need the Java class and the explicit annotations. This can
be a relatively big barrier if you just want to write a simple
template script.

BR,

Jukka Zitting

Re: [microsling] do we really want OCM mapping for microsling?

Posted by Christophe Lombart <ch...@gmail.com>.
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 <th...@gmail.com> 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 <la...@trieloff.net> 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
> > >
> >
> >
>

Re: [microsling] do we really want OCM mapping for microsling?

Posted by Thomas Mueller <th...@gmail.com>.
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 <la...@trieloff.net> 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
> >
>
>

Re: [microsling] do we really want OCM mapping for microsling?

Posted by Lars Trieloff <la...@trieloff.net>.
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
>