You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Kristian Rink <ka...@zimmer428.net> on 2009/05/26 08:46:11 UTC
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//
Re: declarative custom node type configuration?
Posted by Kristian Rink <ka...@zimmer428.net>.
Hi Ariel;
and first off, thanks a bunch for your response on that...
ASTI Araza, Ariel D. schrieb:
[...]
> 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.
Nice, that seems pretty much what I want, gonna give it a try. Thanks very
much for pointing me there! :)
Cheers,
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//
RE: declarative custom node type configuration?
Posted by "ASTI Araza, Ariel D." <AD...@ayalasystems.com>.
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//
Re: declarative custom node type configuration?
Posted by Kristian Rink <ka...@zimmer428.net>.
Hi Alex;
Alexander Klimetschek schrieb:
> Apart from copying the custom_nodetypes.xml to new repository
> instances for simpler setup, what is different about the two code
> samples?
The samples indeed are the same, the interesting piece indeed is the fact
that copying the custom_nodetypes.xml practically allows for doing so
without running the registration code against a new repository. :)
Cheers,
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//
Re: declarative custom node type configuration?
Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, May 26, 2009 at 4:02 PM, Kristian Rink <ka...@zimmer428.net> wrote:
> Yes, I already read through this page, but yet failed to see how to "just"
> introduce the CND text files to a running Jackrabbit server without
> requiring custom code to make the NodeTypeManager know about them
> programmatically. The way outlined earlier seems a good approach it seems,
> however. :)
Apart from copying the custom_nodetypes.xml to new repository
instances for simpler setup, what is different about the two code
samples? I don't see any... but if there is something you think is
missing from the website, we could add it.
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: declarative custom node type configuration?
Posted by Kristian Rink <ka...@zimmer428.net>.
Hi Alex;
and first off, thanks a bunch for your comment, much appreciated.
Alexander Klimetschek schrieb:
> It's right on the Jackrabbit homepage, "Node Types" link on the right:
> http://jackrabbit.apache.org/node-types.html The code for registering
> is at the bottom, and it points to subpages explaining the CND format.
Yes, I already read through this page, but yet failed to see how to "just"
introduce the CND text files to a running Jackrabbit server without
requiring custom code to make the NodeTypeManager know about them
programmatically. The way outlined earlier seems a good approach it seems,
however. :)
Cheers,
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//
Re: declarative custom node type configuration?
Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, May 26, 2009 at 8:46 AM, Kristian Rink <ka...@zimmer428.net> wrote:
> 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? :)
It's right on the Jackrabbit homepage, "Node Types" link on the right:
http://jackrabbit.apache.org/node-types.html The code for registering
is at the bottom, and it points to subpages explaining the CND format.
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com