JOSE FELIX HERNANDEZ BARRIO
Wed, 17 Mar 2010 09:24:17 -0700
This solution works in jackrabbit 2.0.0 and it's not deprecated
CndImporter.registerNodeTypes("cndfile", session);
2010/3/17 Stefan Guggisberg <stefan.guggisb...@gmail.com> > On Wed, Mar 17, 2010 at 4:11 PM, Rodrigo Meza > <rodrigo.meza.fo...@gmail.com> wrote: > > On Mon, Mar 8, 2010 at 7:06 AM, Stefan Guggisberg > > <stefan.guggisb...@gmail.com> wrote: > >> On Fri, Mar 5, 2010 at 9:20 PM, Birmingham, Steven > >> <steven.birming...@itt.com> wrote: > >>> Thanks Stefan, > >>> > >>> Yeah, I just looked through the message archives and saw the > CndImporter example and gave it a try. I tried using the > CompactNodeTypeDefReader as you suggested. It worked as far reading the cnd > file, but the NodeTypeManager.registerNodeTypes() is expecting an array of > NodeTypeDefinition not QNodeTypeDefinition[]. I saw a method to create > QNodeTypeDefinitions out of NodeTypeDefinitions but have not found a way to > do vice versa. > >> > >> sorry, i didn't notice it. > >> > >> o.a.jackrabbit.spi.commons.nodetyp.NodeTypeDefinitionFactory should do > >> the trick. > >> > http://jackrabbit.apache.org/api/2.0/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionFactory.html > >> > >> here's a sample i put together and which should help get you started: > > > > > > > > Im just wondering why the "old" way to import nodetype definitions is > > becoming deprecated, while now it's necessary to perform many > > workarounds to get the same results we used to have calling > > > org.apache.jackrabbit.api.JackrabbitNodeTypeManager.registerNodeTypes(...). > > > > I looked at the new jackrabbit 2.0 api and I dont see what's the new > > proposed solution to import nodetype definitions from a cnd file. > > > > registrering custom node types programmatically from NodeTypeDefinition > objects > has been standardized in JCR 2.0 (note that JCR 1.0 didn't support node > type > registration). that's why the jackrabbit specific api methods in > JackrabbitNodeTypeManager > have been deprecated in favor of the now standardized JCR 2.0 methods. > > however, registering custom node types from a cnd-file definitions is > not supported by JCR 2.0. > i agree that those methods probably shouldn't have been deprecated in > the jackrabbit api > as there's no direct replacement in JCR 2.0. > > feel free to report a jira issue. > > cheers > stefan > -- Jose Hernandez 675599600 Isthari http://www.isthari.com