Question

Starting out with JCR and Jackrabbit I do not understand what a workspace is and how it is intended to be used. And why is it named workspace in the firstplace? Are repositories like databases, workspaces like tables and items like rows (or pretty much)?

Was it helpful?

Solution

Each JCR workspace is like a different root in your content tree, so you can have a node at /foo in workspace A and a different node /foo in workspace B.

A node can have corresponding nodes in other workspaces: the /foo node of workspace A can be cloned to /foo in workspace B, creating a corresponding node. Both nodes can then live their own life for a while, while being kept corresponding which allows for updating one with the content of the other with one JCR call later.

That could be used for content staging, for example, where one workspace holds the live content of a website while another holds staged content.

I'm not sure what the comparison with a database would be, maybe distinct schemas with some functions that allow for updating one set of tables with another set's data.

In my team (Apache Sling, Adobe CQ/AEM) we always use a single workspace, from my experience multiple workspaces would make things more complicated and less transparent that I like them to be.

http://wiki.apache.org/jackrabbit/DavidsModel Rule #3 recommends using workspaces only if you need clone(), merge() and update(), that's good advice in my opinion, and I would seriously check if those methods meet my need before using workspaces.

OTHER TIPS

Workspaces are working copies of the JCR that you make local updates to before committing the updates to the master copy of the JCR.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top