atom feed4 messages in org.apache.jackrabbit.oak-devOn virtual content
FromSent OnAttachments
Jukka ZittingSep 18, 2012 8:56 am 
Michael DürigSep 19, 2012 5:11 am 
Jukka ZittingSep 19, 2012 5:56 am 
Ard SchrijversSep 19, 2012 12:46 pm 
Subject:On virtual content
From:Jukka Zitting (
Date:Sep 18, 2012 8:56:53 am


We have a good reasons for adding support for "virtual content", i.e. content that's accessible through the Oak API, but that's not actually stored in the underlying MicroKernel. The main reasons that come to my mind are:

1) As we implement workspace support, we need some way to make the shared /jcr:system subtree visible to all workspaces. 2) The JCR spec mandates some auto-created content to be available already before transient changes are persisted. That should be fairly straightforward to implement with virtual content. 3) We could "mount" parts of external repositories to a single content tree. 4) We could implement "views" like in Hippo's facet feature.

The same feature could probably also be easily used to hide existing content for access control or other reasons.

So how could we best implement something like this?

The implementation should probably go to somewhere between the Oak API and the MicroKernel, ideally either as an extension point in the Tree or NodeState implementations. Additionally, to make sure that the implementation won't interfere with the performance of normal content access, this mechanism should probably only be invoked _after_ an attempt to access normal content has been made. Apart from these general ideas I don't yet have a good picture of what the detailed implementation could or should look like.

Like with custom indexes, the configuration settings for such virtual content should in my mind go into the repository as normal content. For example, the following hypothetical repository tree would define a workspace subtree with a view to a shared /jcr:system subtree and a custom view for the latest 100 nodes in /latest:

/ /jcr:system {the global jcr:system tree} /... {namespace & node type registries, version store, etc.} /my-workspace [jcr:mixinTypes = oak:virtual] /oak:virtual /system [jcr:mixinType = oak:mount, globalPath = /jcr:system, mountName = jcr:system] /latest [jcr:mixinTypes = oak:virtual] /oak:virtual /view [jcr:mixinType = oak:view, query = "SELECT * FROM [nt:base] ... ORDER BY [jcr:created] DESC LIMIT 100"]

As before, please share your critiques, improvements and/or alternatives.