I was wondering if there is anything written about modelling in a JCR.
I'm currently designing and documenting the model we are going to use in the repository for our application and being somewhat new to this have no idea what are good design patterns to follow and what are bad.
e.g. I have a document object that has 0 or more states attached to it. The state of a document is represented as a set of key/value pairs (probably the simple context from an apache SCXML state engine). I could model this in a few different ways.
- a node property with an array of STRING attribute one per document state machine being represented. The string value contains the identity of the state machine and the serialised context from the state machine representing the current document state
- 0 or more child nodes that contain two attributes, one is the identity of the state machine and the other is an array of STRING attributes, one per context variable, content something like "name=value".
- as in 2 but without the array and having 0 or more child nodes, one per context key/value, containing attribute name and value.
There are questions about what I need at runtime that can help select which of the above I need (ie: what do I need to search on) but I have no idea of the impact on storage or speed of access which are equally valid concerns when desiging the runtime model.
Another modelling question is: How detailed and type specific should I go?
Ie: I don't actually need a (CND) model at all. nt:unstructured is a fine node type and I could just have an implicit model realised by the usage in the code. Maybe that is more efficient at runtime?
I like type safety and explict models so I tend to avoid the unstructured approach, particularly for product development where the code has to live for a long time (the system I'm re-architecting is about 11 years old). What I don't know are the tradeoffs and costs associated with this in a JCR model.
Any help, pointers to previously written posts and articles or other suggestions would be most welcome.