On 26/08/10 19:47, Berry van Halderen wrote:
In Jackrabbit, only "trivial" nodetype changes are supported(see
o.a.j.c.nodetype.NodeTypeDefDiff) to reregister node types.  In order to
change nodetypes we're currently using a module that can basically change any
nodetype structure.  However this is based on pure jcr interaction and
therefor requires relative expensive copy actions.

See http://markmail.org/message/hiqvukxc7lftfspm for a previous posting (Re: Re-register Custom Node Types Without Destroying Repository?, Sep 15, 2009) where I describe some steps that I used for changing node types. For example: "to add a mandatory property type, first add it as optional then create properties in nodes having the relevant node type before replacing the property type with its mandatory form." The code that I ended up with was similar to migrations in Rails. It required a patch that removed the if (diff.isTrivial()) condition from code in NodeTypeRegistry.

Alternatively a better support of Node.setPrimaryNodeType would also solve
this.  But that also cannot handle renamed, and blindly drops subnodes and
properties.  Especially for a structure of nodes, where both parent and child
nodes require a setPrimaryNodeType I can't see this to work at the moment.

I submitted https://issues.apache.org/jira/browse/JCR-2011, "Replacing mixin type doesn't preserve properties", last year and the only response was that I should use nt:unstructured because "unstructured-ness is what JCR is optimized for." However, node types were important for the application I developed then because I allowed users write-access via the WebDAV module (in addition to access through a conventional webapp). Users can modify properties etc through WebDAV, so I relied on node types to preserve data integrity.

That was just my use case, but it's interesting to hear of other people interested in node types.

Later
Charlie

Reply via email to