jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vlad_v <numaplictis...@yahoo.com>
Subject Re: node types
Date Tue, 21 Oct 2008 19:40:17 GMT

Hi, Thank you for the ideea

i tried to add a new node type  and i did this

<nodeTypes
    xmlns:rep="internal" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
    xmlns:jcr="http://www.jcp.org/jcr/1.0">
    <nodeType name="nt:owner" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="jcr:content">
        <supertypes>
            <supertype>nt:folder</supertype>
            <supertype>nt:file</supertype>
        </supertypes>
        <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. 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

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.

Thanks a lot,
Regards,
Vlad

Hi,

nt:file does not allow residual properties (ie. arbitrarily named
properties, aka unstructured content) itself, so you could either add
a mixin at runtime that introduces a * property definition (or a
strict "roles" property if you only want that one) or create a new
node type that extends from nt:file and adds the "roles" or *
property. If you want to store a list of strings, a multi-value STRING
property, ie. a String[], is probably exactly what you need.

For more on node types see http://jackrabbit.apache.org/node-types.html

Regards,
Alex

-- 
View this message in context: http://www.nabble.com/node-types-tp20093480p20097843.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message