You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Steeg Werkmans <we...@gmail.com> on 2012/04/16 15:56:37 UTC

JCR application design

All,

I've made my first steps with jackrabbit for the proof of concept part of
our project. Fine. Now comes the real stuff... And the question I ask
myself is how to best design my application when the backend is no longer
JDBC, but JCR (well we may use JDBC, but it will be under the hood)...

So I've been googling a bit and browsing trough the documentation and I'm
still confused.. There is the OCM part of jackrabbit, my initial thoughts
were, nice this is what I need! But then I continue my search and encounter
articles that explain how content should come first, structure is perhaps
not needed and should come later. And other articles go down the same route
and explain that OCM is actually just overhead, because unstructured is the
way to go. So I wonder what's the deal. I guess there is no right answer
and it all depends. I'm also not looking for a right answers. Just perhaps
some pointers and ideas about how to design applications that are persisted
in a JCR backend. Our application is a to explain things easily a web
application that has functionality similar to a "file explorer". So JCR is
a natural match for the business domain.

However.. even then. If you have unstructured information, where do those
"OCM is overhead" and "learn to love unstructured" people put their
business logic? Do they all just expose their javax.jcr.Node in their
front-end logic? Or is business logic a good use case to introduce an OCM
intermediate layer? Or is JCR aimed at content-only applications and do we
forget about N-tier best practices when it comes to JCR?

Another interesting question is, if I am given some kind of reassurance
that OCM is perhaps not so evil after all, would I make a generic mapping
(to be quite rude: store the Nodes in a Hashtable-like structure).. or is
it okay to map JCR unstructured content to a structured java OO model?


Best regards,

S Werkmans

Re: JCR application design

Posted by Lukas Kahwe Smith <ml...@pooteeweet.org>.
On Apr 16, 2012, at 15:56 , Steeg Werkmans wrote:

> All,
> 
> I've made my first steps with jackrabbit for the proof of concept part of
> our project. Fine. Now comes the real stuff... And the question I ask
> myself is how to best design my application when the backend is no longer
> JDBC, but JCR (well we may use JDBC, but it will be under the hood)...
> 
> So I've been googling a bit and browsing trough the documentation and I'm
> still confused.. There is the OCM part of jackrabbit, my initial thoughts
> were, nice this is what I need! But then I continue my search and encounter
> articles that explain how content should come first, structure is perhaps
> not needed and should come later. And other articles go down the same route
> and explain that OCM is actually just overhead, because unstructured is the
> way to go. So I wonder what's the deal. I guess there is no right answer
> and it all depends. I'm also not looking for a right answers. Just perhaps
> some pointers and ideas about how to design applications that are persisted
> in a JCR backend. Our application is a to explain things easily a web
> application that has functionality similar to a "file explorer". So JCR is
> a natural match for the business domain.
> 
> However.. even then. If you have unstructured information, where do those
> "OCM is overhead" and "learn to love unstructured" people put their
> business logic? Do they all just expose their javax.jcr.Node in their
> front-end logic? Or is business logic a good use case to introduce an OCM
> intermediate layer? Or is JCR aimed at content-only applications and do we
> forget about N-tier best practices when it comes to JCR?
> 
> Another interesting question is, if I am given some kind of reassurance
> that OCM is perhaps not so evil after all, would I make a generic mapping
> (to be quite rude: store the Nodes in a Hashtable-like structure).. or is
> it okay to map JCR unstructured content to a structured java OO model?


Honestly I think it really requires a lot of playing around. There isnt a "rule set" like with normalization for RDBMS.
I do not know OCM, but I assume it also gives you the option of using explicit node types or just unstructured.
Note I am using Jackrabbit via PHP using Jackalope, but actually most of the type I am using PHPCR ODM, which is similar in spirit than Java Hibernate contrary to OCM which seems to be quite ActiveRecord inspired.

Personally in this setup I am mostly using unstructured nodes (though I usually disable same name siblings).

regards,
Lukas Kahwe Smith
mls@pooteeweet.org




Re: JCR application design

Posted by Decebal Suiu <de...@gmail.com>.
Fabián Mandelbaum wrote
> 
> At first, we did use OCM, it wasn't JackRabbit's though, it was JCROM
> (http://code.google.com/p/jcrom/).
> 
> But then, we went, and stayed with, "plain", done-by-hand, DAO
> objects. We have one DAO for each business object, and those DAOs are
> maintained by us, not by an automated OCM solution.
> 
> The reason is that we needed more control sometimes on the
> (de-)serialization of objects, so we wrote our own DAOs.
> 
> JCROM did prove to be a very nice solution for "regular" business
> applications, but ours has special needs. Maybe things changed now,
> but we didn't look back.
> 
> Hope this helps. Good luck!
> 

We also use jcrom (that seems to be dead) with a StoregeUpdater mechanism
(change jcr nodes structure according to last business objects definitions
on start application) on a medium size application and everything is ok.

Have a nice day,
Decebal



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-application-design-tp4561691p4592355.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: JCR application design

Posted by Fabián Mandelbaum <fm...@gmail.com>.
At first, we did use OCM, it wasn't JackRabbit's though, it was JCROM
(http://code.google.com/p/jcrom/).

But then, we went, and stayed with, "plain", done-by-hand, DAO
objects. We have one DAO for each business object, and those DAOs are
maintained by us, not by an automated OCM solution.

The reason is that we needed more control sometimes on the
(de-)serialization of objects, so we wrote our own DAOs.

JCROM did prove to be a very nice solution for "regular" business
applications, but ours has special needs. Maybe things changed now,
but we didn't look back.

Hope this helps. Good luck!

On Fri, Apr 27, 2012 at 7:20 AM, Decebal Suiu <de...@gmail.com> wrote:
>
> Fabián Mandelbaum wrote
>>
>> In our application we use this last approach, we have a bunch of DAO
>> objects, one for each business object, that know how to
>> (de-)materialize business objects from/to JCR nodes and properties.
>>
>
> Did you use OCM (annotation, ...) or something like a Jcr Handler (write
> your converter for each business objects)?
>
> Best regards,
> Decebal
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-application-design-tp4561691p4592297.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.



-- 
Fabián Mandelbaum
IS Engineer

Re: JCR application design

Posted by Decebal Suiu <de...@gmail.com>.
Fabián Mandelbaum wrote
> 
> In our application we use this last approach, we have a bunch of DAO
> objects, one for each business object, that know how to
> (de-)materialize business objects from/to JCR nodes and properties.
> 

Did you use OCM (annotation, ...) or something like a Jcr Handler (write
your converter for each business objects)?

Best regards,
Decebal



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-application-design-tp4561691p4592297.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: JCR application design

Posted by Fabián Mandelbaum <fm...@gmail.com>.
It's up to you to have your business objects manipulate JCR directly
using nodes and properties, or to make your DAO (Data Access Object)
classes that abstract storage (in this case JCR) and provide methods
that use only business objects.

In our application we use this last approach, we have a bunch of DAO
objects, one for each business object, that know how to
(de-)materialize business objects from/to JCR nodes and properties.

On Thu, Apr 26, 2012 at 7:22 AM, decebal <de...@gmail.com> wrote:
> Hi
>
> I have the same question. It's easy to say that no OCM it's the right
> direction but this it's always true only in theory. In applications you work
> with entity/business objects and services, web presentation that "consume"
> these objects. For example in the User entity you have username, password,
> admin flag, ... If you don't use OCM approach you must have a method (in the
> persistent layer, or a jcrhelper) that materialize User object from JCR. I
> think that you must work with business objects (entity) in your application.
> You can use a generic approach using OCM or write by hand a converter from
> JCR Node to User and reverse.
>
> I want to know how people that don't use OCM works with JCR. How these
> people do business logic and web presentation using only JCR Nodes and
> Properties.
>
> Best regards,
> Decebal
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-application-design-tp4561691p4589402.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.



-- 
Fabián Mandelbaum
IS Engineer

Re: JCR application design

Posted by decebal <de...@gmail.com>.
Hi

I have the same question. It's easy to say that no OCM it's the right
direction but this it's always true only in theory. In applications you work
with entity/business objects and services, web presentation that "consume"
these objects. For example in the User entity you have username, password,
admin flag, ... If you don't use OCM approach you must have a method (in the
persistent layer, or a jcrhelper) that materialize User object from JCR. I
think that you must work with business objects (entity) in your application.
You can use a generic approach using OCM or write by hand a converter from
JCR Node to User and reverse. 

I want to know how people that don't use OCM works with JCR. How these
people do business logic and web presentation using only JCR Nodes and
Properties. 

Best regards,
Decebal

--
View this message in context: http://jackrabbit.510166.n4.nabble.com/JCR-application-design-tp4561691p4589402.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: JCR application design

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Mon, Apr 16, 2012 at 3:56 PM, Steeg Werkmans <we...@gmail.com> wrote:
> ...However.. even then. If you have unstructured information, where do those
> "OCM is overhead" and "learn to love unstructured" people put their
> business logic? Do they all just expose their javax.jcr.Node in their
> front-end logic?...

See http://markmail.org/message/wmqggzrxwxearmyh for a previous
discussion on the same topic.

-Bertrand