jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eder, Johann" <j...@manz.at>
Subject AW: Recursive Node Typs
Date Thu, 04 Aug 2011 12:41:56 GMT
Hi Stefan,

thanks for the snippet.
I guess it works fine with Jackrabbit 2.x.

We still use Jackrabbit 1.4.5. Is there a way to import the cnd file successfully?

Cheers
Johann



-----Ursprüngliche Nachricht-----
Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] 
Gesendet: Mittwoch, 3. August 2011 18:38
An: users@jackrabbit.apache.org
Betreff: Re: Recursive Node Typs

On Tue, Aug 2, 2011 at 10:06 AM, Eder, Johann <joed@manz.at> wrote:
> Hi Stefan,
>
> Thanks for the hints.
>
> I guess I have not made myself clear.
>
> I have a method which imports the NodeTypDef via cnd file perfectly.
> But when I try to import and register Nodes like
>
> ----------
> <mix = 'http://www.jcp.org/jcr/mix/1.0'>
> <nt = 'http://www.jcp.org/jcr/nt/1.0'>
> <jcr = 'http://www.jcp.org/jcr/1.0'>
> <sys = 'http://onlaw.at/sys'>
> <default =''>
>
> [sys:base] >  nt:base, mix:referenceable
>
> [default:li] > sys:base
> orderable mixin
> + default:ul (default:ul)=default:ul multiple
> + * (nt:unstructured)=nt:unstructured multiple
>
> [default:ul] > sys:base
> orderable
> - *
> + default:li (default:li)=default:li multiple
>
> [default:ol] > sys:base
> orderable
> - *
> + default:li (default:li)=default:li multiple
>
> [sys:Text] > sys:base
> - *
> + default:ol (default:ol)=default:ol multiple
> + default:ul (default:ul)=default:ul multiple
> ---------
>
> I get an error:
> ...
> INFO NodeTypeImporter:63 - DEBUG [registerCustomNodeTypes:L3] to register...li
> ERROR NodeTypeImporter:68 - org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException:
[{}li#{}ul] invalid default
>  primary type '{}ul'
> ...
>
> This is clear to me, because ul is unknown.
>
> So my question is how to change the cnd file in a way that
> ul can be a child of li and li can be a child of ul ?

i was able to successfully register your cnd node type definitions
using the following
snippet:

            Reader cnd = new FileReader("/path/to/file.cnd");
            CndImporter.registerNodeTypes(cnd, "cnd input stream",
wsp.getNodeTypeManager(), wsp.getNamespaceRegistry(),
                    session.getValueFactory(), true);

cheers
stefan

>
> Thanks.
>
> Cheers
> Johann
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Gesendet: Montag, 1. August 2011 17:22
> An: users@jackrabbit.apache.org
> Betreff: Re: Recursive Node Typs
>
> On Mon, Aug 1, 2011 at 4:24 PM, Eder, Johann <joed@manz.at> wrote:
>> Hi,
>>
>> Is it expected to be possible to create circular node type dependencies?
>
> yes (except if the circular dependencies are declared as 'autocreate'...).
>
>>
>> Example:
>> Node type A has B nodes, and node type B has A nodes.
>>
>> In the NodeTypDef I have ul and li elements. ul can be a child of li and li can be
a child of ul.
>>
>> ...
>> <jcr = 'http://www.jcp.org/jcr/1.0'>
>> <sys = 'http://onlaw.at/sys'>
>> <default =''>
>>
>> [sys:base] >  nt:base, mix:referenceable
>>
>> [default:li] > sys:base
>> orderable mixin
>> + * (nt:unstructured)=nt:unstructured multiple
>>
>> [default:ul] > sys:base
>> orderable
>> - *
>> + default:li (default:li)=default:li multiple
>>
>> [default:ol] > sys:base
>> orderable
>> - *
>> + default:li (default:li)=default:li multiple
>>
>> [sys:Text] > sys:base
>> - *
>> + default:ol (default:ol)=default:ol multiple
>> + default:ul (default:ul)=default:ul multiple
>> + default:table (default:table)=default:table multiple
>> + * (default:p)=default:p multiple
>>
>> ...
>>
>> If yes, how to do it?
>
> declare all related/required node tyes in the same cnd file
> and register them (see [1]).
>
> cheers
> stefan
>
> [1] http://wiki.apache.org/jackrabbit/ExamplesPage#Register_a_Node_Type_.5BCND.5D
>
>
>>
>> Thanks for any hints.
>>
>> Johann
>>
>>
>

Mime
View raw message