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 21:54:46 GMT

Thank you for the tips.

the thing that i don't understand is that the line of code:

NodeTypeManagerImpl ntmgr =(NodeTypeManagerImpl)ws.getNodeTypeManager();
 doesn't work if i dont have a transient repository, so i have a repository
object obtained with rmi.
(otherwise it works)

it gives me a ClassCastException   and it is normal because
ws.getNodeTypeManager() returns a ClientNodeTypeManager  and it cannot be
casted to NodeTypeManagerImpl  even if they have the same superinterface.
The 2 classes are not related in order to be casted...i think.

i found a post in this forum with:

      LocalAdapterFactory aFactory = new JackrabbitClientAdapterFactory();
      ClientRepositoryFactory rFactory = new
      Repository repo = rFactory.getRepository(rmiJack);

but it is the same situation when i try to cast....to NodeTypeManagerImpl
or JackrabbitNodeTypeManager


Alexander Klimetschek wrote:
> 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).
> Regards,
> Alex
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com

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

View raw message