jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASTI Araza, Ariel D." <ADAr...@ayalasystems.com>
Subject RE: declarative custom node type configuration?
Date Tue, 26 May 2009 07:32:11 GMT

Hi Kristian,

This thread helped me yesterday when I got stumped on the same problem: 

http://markmail.org/message/264gzqhqha4nfrxc

What I did, as stated in the thread was programmatically added the custom nodetypes using
CND. This will create the file <repository-home>/nodetypes/custom_nodetypes.xml, then
I just copy this XML to the right directory whenever I need to create new repositories that
should support my custom nodetypes. 

Here's the code snippet the registers the custom nodetypes

=======================
		Workspace ws = session.getWorkspace();
		Node rn = session.getRootNode();
		System.out.println("ROOT node: " + rn.getName());
		
		
    	JackrabbitNodeTypeManager ntManager =  (JackrabbitNodeTypeManager) ws.getNodeTypeManager();
    	try {
			ntManager.registerNodeTypes (ClassLoader.getSystemResourceAsStream("mynew_nodetype.cnd"),
JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		session.save();
		
		NodeTypeIterator ntIterator = ntManager.getAllNodeTypes();
		while (ntIterator.hasNext()) {
			System.out.println("Nodetype " + ntIterator.nextNodeType().getName());
		}
		
=======================

here's the content of mynew_nodetype.cnd

[blah:file] > nt:file
- blah:author
- blah:section

==========================

I hope this helps.

Ariel


-----Original Message-----
From: Kristian Rink [mailto:kawazu@zimmer428.net]
Sent: Tue 5/26/2009 2:46 PM
To: users@jackrabbit.apache.org
Subject: declarative custom node type configuration?
 
Folks;

not sure whether this is an FAQ or not, please apologize and feel free to
quietly point me there if so: Browsing the Jackrabbit documentation, I found
quite a bunch of information on CND as well as how to register custom node
types programmatically. But what about doing so declaratively? Somehow I was
expecting, say, to have a conf/nodetypes/ folder (or something like that)
where to place CND files to make Jackrabbit know about them. But at least in
the "Jackrabbit Configuration" I didn't so far find what I was looking for.

Can some kind soul enlighten me about this? :)

Many thanks in advance, all the best.
Kristian


-- 
Kristian Rink
cell    :  +49 176 2447 2771
business: http://www.planconnect.de
personal: http://pictorial.zimmer428.net
"Past midnight. Never knew such silence.
The earth might be uninhabited..."
//beckett / krapp's last tape//


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message