Hi, On 3/11/06, Torgeir Veimo <[EMAIL PROTECTED]> wrote: > There's some code in jackrabbit contrib. Basically you can do it with; > [reading and registering nodetypes]
There's a recently added and not yet much documented public API for registering node types in Jackrabbit. Instead of casting a NodeTypeManager instance to the internal NodeTypeManagerImpl class, you should cast it to the JackrabbitNodeTypeManager API interface. This interface extends the standard NodeTypeManager interface and is guaranteed to remain backwards compatible at least through the Jackrabbit 1.x cycle. No similar backwards compatibility claims are made for the NodeTypeManagerImpl or the other classes in org.ajache.jackrabbit.core. The JackrabbitNodeTypeManager interface contains two registerNodeTypes methods; one that takes an XML InputSource, and another that takes a generic InputStream and a MIME content type string specifying the node type syntax. The currently supported content types are "text/xml" for the XML syntax and "text/x-jcr-cnd" for the CND syntax. The interface has public string constants for the supported content types. To register node types from a CND file called "nodetypes.cnd", you could do this: Session session = ...; JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager) session.getWorkspace().getNodeTypeManager(); manager.registerNodeTypes( new FileInputStream("nodetypes.cnd"), JackrabbitNodeTypeManager.TEXT_X_JCR_CND); See the org.apache.api.JackrabbitNodeTypeManager interface and the JCR-309 issue for more details. BR, Jukka Zitting -- Yukatan - http://yukatan.fi/ - [EMAIL PROTECTED] Software craftsmanship, JCR consulting, and Java development