You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by dan z <da...@hotmail.com> on 2006/07/05 22:10:48 UTC

question on CompactNodeTypeDefReader: parsing "long" value constraints

Hi,

I got a ParseException when loading a CND file with 
CompactNodeTypeDefReader. The part of my CND file is listed below:

[cm:aclEntryNode] > nt:base
-cm:uid (string) mandatory copy
-cm:permission (long) mandatory multiple copy
<1,2,4,8,16

The parsing code complained about the line of value constraints for property 
"cm:permission" with message "'?' is not a valid constraint expression for a 
value of type 3".

I've been debugging through the source and it seems that the getNextToken() 
method is not handling TT_Number as expected.

Did I miss anything? or is this a bug?

Thanks,
Dan

Lexer.getNextToken() as below:

public String getNextToken() throws ParseException {
        try {
            int tokenType = st.nextToken();
            if (tokenType == StreamTokenizer.TT_EOF){
                return EOF;
            } else if(tokenType == StreamTokenizer.TT_WORD || tokenType == 
SINGLE_QUOTE || tokenType == DOUBLE_QUOTE){
                return st.sval;
            } else {
                return new String(new char[]{(char)tokenType});
            }
        } catch (IOException e){
            fail("IOException while attempting to read input stream", e);
            return null;
        }
    }

_________________________________________________________________
Watch music videos on Sympatico / MSN Video! 
http://video.msn.com/v/en-ca/v.htm?t=c317&f=38/81&p=ENCAmusic_ENCAvideos


Re: another question on CompactNodeTypeDefReader

Posted by dan z <da...@hotmail.com>.
Hi Torgeir,

First, thanks for responding. It reminds me of the error of using "cm:*" 
insteand of "*". This fixes my problem.

Second, I understand that your model would work well if you are to implement 
access control on multiple node types since they "mix-in" :)

My scenario is a bit different: I'd like to have a Workspace-wide acl which 
is evaluated against any attempt to access the workspace. As for node level 
access control, I intend to use special properties like "editors", "readers" 
to support low level access control.

Any suggestions?

Regards,
Dan




>From: Torgeir Veimo <to...@pobox.com>
>Reply-To: users@jackrabbit.apache.org
>To: users@jackrabbit.apache.org
>Subject: Re: another question on CompactNodeTypeDefReader
>Date: Wed, 05 Jul 2006 22:17:21 +0100
>
>dan z wrote:
>>Hi Tobias,
>>
>>just another question on the CompactNodeTypeDefReader, please see my CND 
>>file components below:
>>
>>[cm:aclEntryNode] > nt:base
>>-cm:uid (string) mandatory copy
>>-cm:permission (string) mandatory multiple copy
>><'1','2','4','8','16'
>>
>>/* the node names of aclNode's children are the common name of the 
>>aclEntry Nodetype's id property */
>>[cm:aclNode] > nt:base
>>+cm:* (cm:aclEntryNode) = cm:aclEntryNode
>>  copy
>>
>>What I'd like to have is a node hierarchy that reflects an ACL object. But 
>>the parser throws an ParserException saying "Error while parsing 'cm:'".
>>It seems that the parser doesn't like expression "cm:*", which I expect to 
>>tell the system "the subnode can have any name, as long as it is of 
>>NodeType cm:aclEntryNode".
>
>What about having a mixin nodetype that denotes a protected node? The mixin 
>node would 0..N ace children, eg:
>
>[nen:protected] mixin orderable
>- nen:owner (string) mandatory multiple
>+ nen:ace(nen:ace)=nen:ace multiple
>
>[nen:ace] > nt:base
>- nen:principal (string) mandatory
>- nen:action (string) mandatory multiple
>- nen:negative (boolean) mandatory
>
>These are the nodeTypes I'm working with at the moment.
>
>--
>-Torgeir

_________________________________________________________________
Search your PC with MSN Desktop Search  http://desktop.sympatico.msn.ca/


Re: another question on CompactNodeTypeDefReader

Posted by Torgeir Veimo <to...@pobox.com>.
dan z wrote:
> Hi Tobias,
> 
> just another question on the CompactNodeTypeDefReader, please see my CND 
> file components below:
> 
> [cm:aclEntryNode] > nt:base
> -cm:uid (string) mandatory copy
> -cm:permission (string) mandatory multiple copy
> <'1','2','4','8','16'
> 
> /* the node names of aclNode's children are the common name of the 
> aclEntry Nodetype's id property */
> [cm:aclNode] > nt:base
> +cm:* (cm:aclEntryNode) = cm:aclEntryNode
>  copy
> 
> What I'd like to have is a node hierarchy that reflects an ACL object. 
> But the parser throws an ParserException saying "Error while parsing 
> 'cm:'".
> It seems that the parser doesn't like expression "cm:*", which I expect 
> to tell the system "the subnode can have any name, as long as it is of 
> NodeType cm:aclEntryNode".

What about having a mixin nodetype that denotes a protected node? The 
mixin node would 0..N ace children, eg:

[nen:protected] mixin orderable
- nen:owner (string) mandatory multiple
+ nen:ace(nen:ace)=nen:ace multiple

[nen:ace] > nt:base
- nen:principal (string) mandatory
- nen:action (string) mandatory multiple
- nen:negative (boolean) mandatory

These are the nodeTypes I'm working with at the moment.

-- 
-Torgeir

another question on CompactNodeTypeDefReader

Posted by dan z <da...@hotmail.com>.
Hi Tobias,

just another question on the CompactNodeTypeDefReader, please see my CND 
file components below:

[cm:aclEntryNode] > nt:base
-cm:uid (string) mandatory copy
-cm:permission (string) mandatory multiple copy
<'1','2','4','8','16'

/* the node names of aclNode's children are the common name of the aclEntry 
Nodetype's id property */
[cm:aclNode] > nt:base
+cm:* (cm:aclEntryNode) = cm:aclEntryNode
  copy

What I'd like to have is a node hierarchy that reflects an ACL object. But 
the parser throws an ParserException saying "Error while parsing 'cm:'".
It seems that the parser doesn't like expression "cm:*", which I expect to 
tell the system "the subnode can have any name, as long as it is of NodeType 
cm:aclEntryNode".

Any advice on this?

Thanks,
Dan

_________________________________________________________________
Auto news & advice – check out Sympatico / MSN Autos 
http://en.autos.sympatico.msn.ca/Default.aspx


Re: question on CompactNodeTypeDefReader: parsing "long" value constraints

Posted by Tobias Bocanegra <to...@day.com>.
hi dan,
this is probably a bug. i opened a jira issue for you:
  http://issues.apache.org/jira/browse/JCR-475

regards, toby


On 7/5/06, dan z <da...@hotmail.com> wrote:
> Hi,
>
> I got a ParseException when loading a CND file with
> CompactNodeTypeDefReader. The part of my CND file is listed below:
>
> [cm:aclEntryNode] > nt:base
> -cm:uid (string) mandatory copy
> -cm:permission (long) mandatory multiple copy
> <1,2,4,8,16
>
> The parsing code complained about the line of value constraints for property
> "cm:permission" with message "'?' is not a valid constraint expression for a
> value of type 3".
>
> I've been debugging through the source and it seems that the getNextToken()
> method is not handling TT_Number as expected.
>
> Did I miss anything? or is this a bug?
>
> Thanks,
> Dan
>
> Lexer.getNextToken() as below:
>
> public String getNextToken() throws ParseException {
>         try {
>             int tokenType = st.nextToken();
>             if (tokenType == StreamTokenizer.TT_EOF){
>                 return EOF;
>             } else if(tokenType == StreamTokenizer.TT_WORD || tokenType ==
> SINGLE_QUOTE || tokenType == DOUBLE_QUOTE){
>                 return st.sval;
>             } else {
>                 return new String(new char[]{(char)tokenType});
>             }
>         } catch (IOException e){
>             fail("IOException while attempting to read input stream", e);
>             return null;
>         }
>     }
>
> _________________________________________________________________
> Watch music videos on Sympatico / MSN Video!
> http://video.msn.com/v/en-ca/v.htm?t=c317&f=38/81&p=ENCAmusic_ENCAvideos
>
>


-- 
-----------------------------------------< 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 >---