jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torgeir Veimo <torg...@pobox.com>
Subject Re: Custom nodetypes, any simple example?
Date Sat, 11 Mar 2006 15:33:34 GMT
On Fri, 2006-03-10 at 10:46 -0300, hsp wrote:
> orgeir, thanks by your help.
> What is the difference between declare a xml file or a cnd file for
> nodetype definition?
> Is the file (xml or cnd) imported automatically or I have to place the
> file in a specific place and call some special method?

There's some code in jackrabbit contrib. Basically you can do it with;

Reader fileReader = new InputStreamReader(new FileReader(new
File("filename")));
String systemId = registerForm.getFile().getFileName();

CompactNodeTypeDefReader cndReader = new
CompactNodeTypeDefReader(fileReader, systemId);

List ntdList = cndReader.getNodeTypeDefs();

NodeTypeManagerImpl ntmgr =
(NodeTypeManagerImpl)ws.getNodeTypeManager();
NodeTypeRegistry ntreg = ntmgr.getNodeTypeRegistry();

for (Iterator i = ntdList.iterator(); i.hasNext();) {
  NodeTypeDef ntd = (NodeTypeDef)i.next();
  ntreg.registerNodeType(ntd);
}

-- 
Torgeir Veimo <torgeir@pobox.com>


Mime
View raw message