You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Matt Fulford <ma...@pfiks.com> on 2009/03/20 09:27:06 UTC
How to modify CND in live repository
Is the only way to make a change to the repository CND file:
1. export data
2. clear/initialize repository
3. register modified CND
4. re-import data
Or can I update some file 'on the fly'?
Thanks,
Matt
Re: How to modify CND in live repository
Posted by Sébastien Launay <se...@anyware-tech.com>.
Hi Matt,
See the following thread:
http://markmail.org/message/4ui7en5d6myygngm
Best regards,
Matt Fulford a écrit :
> Is the only way to make a change to the repository CND file:
> 1. export data
> 2. clear/initialize repository
> 3. register modified CND
> 4. re-import data
>
> Or can I update some file 'on the fly'?
>
> Thanks,
>
>
> Matt
--
Sébastien Launay
Re: How to modify CND in live repository
Posted by Charles Brooking <pu...@charlie.brooking.id.au>.
Matt Fulford wrote:
> Is the only way to make a change to the repository CND file:
> 1. export data
> 2. clear/initialize repository
> 3. register modified CND
> 4. re-import data
>
> Or can I update some file 'on the fly'?
>
See registerNodeTypes in NodeTypeManagerImpl:
NodeTypeManagerImpl manager = (NodeTypeManagerImpl)
session.getWorkspace().getNodeTypeManager();
NodeType[] nodeTypes = manager.registerNodeTypes(
in, // input stream for new CND file
NodeTypeManagerImpl.TEXT_X_JCR_CND,
true // reregister existing node types
);
<http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.html#registerNodeTypes(java.io.InputStream,%20java.lang.String,%20boolean)>
I have found this to work even when existing nodes have types being
replaced. You can write "migration" code that does the nodetype
reregistration (above) and then makes the relevant changes to content.
When you call save, nodes are validated against the new node types.
Later
Charlie