jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Bocanegra <tobias.bocane...@day.com>
Subject Re: Behavior of CompactNodeTypeDefReader in contribution nt-ns-util
Date Wed, 01 Feb 2006 13:34:48 GMT
hi michael,
you are right. this extra declaration is not needed (but does not do
any harm neither). i will fix this. thanks for reporting this.

regads, toby

On 2/1/06, Michael Singer <jackrabbit@it-specialist.at> wrote:
> 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
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Mime
View raw message