Thank you.

I found out you can override nt:folder to allow sns's, but i will do what you 
suggest as this seems like the right thing to do.

-----Original Message-----
From: Tobias Bocanegra <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2008 1:25pm
To: [email protected], [EMAIL PROTECTED]
Subject: Re: nt:folder allowSameNameSiblings and node names

On 3/27/08, Dave Brosius <[EMAIL PROTECTED]> wrote:
> I read JCR-854, and see that nt:folder does not allow same name sibling 
> (children), which i guess makes sense from a directory point of view. 
> Originally this was fine as i used the name of the 'real' document as the 
> name of the node, and avoided name collisions.
>
>  Then i continued to run into a myriad of problems because there are 
> restrictions on node names, that make it tedious (at least to me) to do. So i 
> decide switching to a constant node name 'File', and storing the 'real' name 
> as a property. But i soon found out nt:folder doesn't allow same name 
> siblings.
>
>  So the question is, how does one generally do this? Is there some provided 
> JCREncoder/Decoder class that will mangle any name into a node name 
> exceptable name?
hi,
yes, there is a org.apache.jackrabbit.util.Text class that has:

    public static String escapeIllegalJcrChars(String)
    public static String unescapeIllegalJcrChars(String)

exact for this kind of problems.

> Or can you override nt:folder to allow same name siblings?
i'm not 100% sure if you can extend nt:folder to allow SNS, since this
is a collision in the nodetype definition. but you can try. although i
would not do it. using the filename as node name is much more natural
and causes less problems than dealing with SNS. IMO the only valid use
case where SNS can be used is when mapping a XML document to a node
tree (since XML allows sibling elements with same names).

regards,
-- 
Toby


Reply via email to