jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek" <aklim...@day.com>
Subject Re: node types
Date Tue, 21 Oct 2008 20:06:33 GMT
On Tue, Oct 21, 2008 at 9:40 PM, vlad_v <numaplictisesc@yahoo.com> wrote:
>    <nodeType name="nt:owner" isMixin="false" hasOrderableChildNodes="false"
> primaryItemName="jcr:content">
>        <supertypes>
>            <supertype>nt:folder</supertype>
>            <supertype>nt:file</supertype>
>        </supertypes>

You should not extend from both nt:folder and nt:file at the same time
(multiple inheritance).

>        <propertyDefinition name="nt:owner" requiredType="String"
> autoCreated="false" mandatory="false"
>                                             onParentVersion="COPY"
> protected="false" multiple="false"/>
>    </nodeType>
> </nodeTypes>
> I put the file in the repository/nodetypes  and it is called
> custom_nodetypes.xml.

You should register the node type via the NodeTypeManager as described
on http://jackrabbit.apache.org/node-types.html

> It seems to be correct the  sintax because tomcat
> doesn't produce any exceptions at startup.
> but, when i do this :
> node.addNode(login, "nt:owner");
> i get:
> javax.jcr.nodetype.ConstraintViolationException: /new_folder/vlad1:
> mandatory child node {http://www.jcp.org/jcr/1.0}content does not exist

Did you add a subnode jcr:content before you called saved? nt:file
requires the mandatory child node jcr:content (and your nt:owner type
extends from nt:file).

> I thought it is not good to use the namespace "nt"  and i put in
> ns_reg.properties
> a new line: owner=http://www.jcp.org/jcr/1.0  but tomcat complains with
> Unknown namespace prefix owner.

You have to define the new namespace "owner" in the node type xml root
element (just as the others already present) and, as mentioned above,
register the new node types through the java api. Namespaces will be
registered automatically. Directly modifying ns_reg.properties is not
recommended (for example, you have to change the ns_idx.properties
accordingly, which can be tricky).


Alexander Klimetschek

View raw message