We have a content structure that differs from the structure that is assumed in opencmis jcr. I.e. our documents are not of type nt:file, our folders are a sub-type of nt:folder but we have meta-data around in nodes of type nt:folder which we don't want to show and we want to hide the system folders directly under the root.
To get things working with our structure we've had to make customizations in quite a few places. To make it manageable we've introduced a handler that is responsible for tasks related to a certain type. This is similar to what the TODO in JcrNodeFactory describes.
A type handler is responsible for:
- providing a TypeDefinition (see
- testing if it handles a specific javax.jcr.Node
- creating a JcrNode instance for the type (which is now done by JcrNodeFactory)
- providing IdentifierMap for queries (now done by JcrNodeFactory)
- creating a new object of the type, this is now done in JcrFolder addNode and addFolder so if you have many documents you have to add the code for creating all of them there, spreading the handling of your new type around
The type handlers are managed by TypeHandlerManager which keep the list of handlers and have utility methods that loop through the handlers to calls the right handler.
A really nifty thing here is that the TypeHandlerManager can expose a Predicate that loops type handlers to see if a Node is handled or not, this means that things in the jcr repository for which there is no CMIS type are hidden. This predicate needs to take effect in alot of places, both in JcrFolder and in JcrRepository, I've solved this by giving JcrFolder a wrapped Node that applies the predicate to all NodeIterators it returns.
What do you think?