jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Singer <jackrab...@it-specialist.at>
Subject Behavior of CompactNodeTypeDefReader in contribution nt-ns-util
Date Wed, 01 Feb 2006 10:44:02 GMT
Hi list,

I wrote a simple program which uses the nt-ns-util contribution to
register custom node types written in CND language.

I defined the following (very simple) custom node types:

<test = 'http://foo.bar/test'>
[test:firstnodetype]
+ test:secondnodetype mandatory

<test = 'http://foo.bar/test'>
[test:secondnodetype] > test:firstnodetype
+ test:thirdnodetype

<test = 'http://foo.bar/test'>
[test:thirdnodetype] > test:secondnodetype
- test:catalog (string)  < 'URI', 'URN', 'DOI', 'ISBN', 'ISSN'
- test:entry (string) m


In the resulting custom_nodetypes.xml each of the custom nodes has a
supertype of "nt:base" but I didn't explicitely define a supertype of
"nt:base" for [test:secondnodetype] and [test:thirdnodetype].

I think this behavior is wrong since the method getDeclaredSupertypes()
of class NodeType always returns "nt:base" plus the explicitely declared
Supertype (which it e.g. does not for "nt:folder").

I changed the code to avoid the creation of "nt:base" supertypes if not
explicitely declared (if no supertype is declared "nt:base" still gets
created). This patch will do the change:

Index:
Z:/_DATA/workspace/nt-ns-util/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
===================================================================
---
Z:/_DATA/workspace/nt-ns-util/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
(revision 374032)
+++
Z:/_DATA/workspace/nt-ns-util/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
(working copy)
@@ -206,7 +206,7 @@
             // add nt:base to superclasses if not mixin
             if (!ntd.isMixin()) {
                 HashSet superTypes = new
HashSet(Arrays.asList(ntd.getSupertypes()));
-                if (!superTypes.contains(QName.NT_BASE)) {
+                if (superTypes.size() == 0) {
                     superTypes.add(QName.NT_BASE);
                     ntd.setSupertypes((QName[]) superTypes.toArray(new
QName[superTypes.size()]));
                 }

Can someone tell me if I am missing something?

-- 
kind regards

Michael

Mime
View raw message