You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Torgeir Veimo <to...@netenviron.com> on 2009/12/16 16:24:20 UTC
CompactNodeTypeDefReader with JR 2.0
This class now seems to take an additional constructor parameter, from
what it did in JR 1.6.
CompactNodeTypeDefReader(Reader r, String systemId,
DefinitionBuilderFactory<T, N> factory)
Is there any example that shows how to use it, alternatively any other
way to read in my cnd file with JR 2.0?
--
-Tor
Re: CompactNodeTypeDefReader with JR 2.0
Posted by Michael Dürig <mi...@day.com>.
Torgeir Veimo wrote:
> This class now seems to take an additional constructor parameter, from
> what it did in JR 1.6.
>
> CompactNodeTypeDefReader(Reader r, String systemId,
> DefinitionBuilderFactory<T, N> factory)
>
> Is there any example that shows how to use it, alternatively any other
> way to read in my cnd file with JR 2.0?
>
You might want to have a look at
org.apache.jackrabbit.commons.cnd.CndImporter
This utility class takes care about parsing you cnd and registering them.
Michael
Re: CompactNodeTypeDefReader with JR 2.0
Posted by Torgeir Veimo <to...@netenviron.com>.
2009/12/17 Torgeir Veimo <to...@netenviron.com>:
> This class now seems to take an additional constructor parameter, from
> what it did in JR 1.6.
>
> CompactNodeTypeDefReader(Reader r, String systemId,
> DefinitionBuilderFactory<T, N> factory)
>
> Is there any example that shows how to use it, alternatively any other
> way to read in my cnd file with JR 2.0?
Looks like I'm almost there, I've got
CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> cndReader =
new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
fileReader, systemId, new QDefinitionBuilderFactory());
List<QNodeTypeDefinition> ntdList = cndReader.getNodeTypeDefinitions();
for (Iterator<QNodeTypeDefinition> i = ntdList.iterator(); i.hasNext();) {
QNodeTypeDefinition ntd = i.next();
ntmgr.registerNodeType(ntd, true);
}
Except that registerNodeType() takes a NodeTypeDefinition, not a
QNodeTypeDefinition. What am I missing here?
--
-Tor