hi patrick

On Fri, Feb 13, 2009 at 8:27 AM, Patrick Plaatje <[email protected]> wrote:
> Hi all,
>
> i'm very new to Jackrabbit, and working myslef through the posiiblities of
> it. I came across the part on nodetypes and learned that nodetypes can be
> created by making a XML file of a CND file, and feed that to
> nodeTypeManager. All fine, but i didn't come across any class that could
> create this nodetpye programmatically. Is there an class which does this
> or is there a reason for it that it doesn't exist?

node type creation is not covered by jcr 1.0. jcr 2.0 (jsr 283) will however
include an api for programmatic node type creation. the node type management
api is not finalized yet but there's already an experimental implementation
available in jackrabbit.

for more information please see

http://issues.apache.org/jira/browse/JCR-1586
http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/api/jsr283/nodetype/package-summary.html
http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.html

sample code:

NodeTypeManagerImpl ntMgr =
        (NodeTypeManagerImpl) session.getWorkspace().getNodeTypeManager();
NodeTypeTemplate t = ntMgr.createNodeTypeTemplate();
[...]
NodeType newNodeType = ntMgr.registerNodeType(t, false);

cheers
stefan

>
> Best,
>
> Patrick
>
>

Reply via email to