You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Hammond, Steve" <st...@Polycom.com> on 2009/02/19 17:54:57 UTC
[APacheDS] do I need to write a way to clone a filter?
I am getting a filter in on the wire.
I want to use a visitor method and remove some pieces (a memberof)
But I need to use the original filter also.
I was hoping for a ExprNode.clone function so that I can have a copy of
the filter that I can send the visitor to do the alterations to the
copy, leaving the original filter pristine.
I tried to hack it together with (FilterParser.parse(filter.toString())
but this fails when my memberOf groupDN has parenthesis in it.
Just thought I would ask before I got very far on adding a clone to the
ExprNode Interface
Re: [APacheDS] do I need to write a way to clone a filter?
Posted by Emmanuel Lecharny <el...@apache.org>.
>> I tried to hack it together with
> (FilterParser.parse(filter.toString()) but
>> this fails when my memberOf groupDN has parenthesis in it.
>
> Well, the parser might not be perfect :/ Worth a JIRA, IMO.
>
>
> Actually I like it how it is. The problem is that filter.toString() can
> produce things like (cn=bobs group(not jims)) which is the correct way
> to look at it as to string I think. But it cannot be parsed, because
> the parens would have to be escaped. I don't think they should be
> escaped in the toString function, that is why I did not enter a Jira
> ticket.
RFC 4515 says that string representations of a filter should escape
some chars. Your sample should be :
(cn=bobs group\28not jims\29)
filter = LPAREN filtercomp RPAREN
filtercomp = and / or / not / item
item = simple / present / substring / extensible
simple = attr filtertype assertionvalue
assertionvalue = valueencoding
valueencoding = 0*(normal / escaped)
normal = UTF1SUBSET / UTFMB
escaped = ESC HEX HEX
UTF1SUBSET = %x01-27 / %x2B-5B / %x5D-7F
; UTF1SUBSET excludes 0x00 (NUL), LPAREN,
; RPAREN, ASTERISK, and ESC.
So the filter might work well, but I think that a asString() method
should produce such a String with escaped parentheses. JIRA ?
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
RE: [APacheDS] do I need to write a way to clone a filter?
Posted by "Hammond, Steve" <st...@Polycom.com>.
Ok, 2 out of 3 have patch submissions now.
-----Original Message-----
From: elecharny@gmail.com [mailto:elecharny@gmail.com] On Behalf Of Emmanuel Lecharny
Sent: Thursday, February 19, 2009 10:25 AM
To: Apache Directory Developers List
Subject: Re: [APacheDS] do I need to write a way to clone a filter?
i,
On Thu, Feb 19, 2009 at 5:54 PM, Hammond, Steve
<st...@polycom.com> wrote:
> I am getting a filter in on the wire.
>
> I want to use a visitor method and remove some pieces (a memberof)
>
> But I need to use the original filter also.
>
>
>
> I was hoping for a ExprNode.clone function so that I can have a copy of the
> filter that I can send the visitor to do the alterations to the copy,
> leaving the original filter pristine.
We don't have a clone() method for filters. Sigh :/
> I tried to hack it together with (FilterParser.parse(filter.toString()) but
> this fails when my memberOf groupDN has parenthesis in it.
Well, the parser might not be perfect :/ Worth a JIRA, IMO.
>
> Just thought I would ask before I got very far on adding a clone to the
> ExprNode Interface
There are three things we would like to add :
- a clone() method which works
- a decent equals method, comparing two filters and accept filters
which are not ordered the same way (ie, (|(a=*)(b=*)) should be equal
to (|(b=*)(a=*))
- a decent toString() method - I would call it asString() - returning
a String representation of the current filter, not a String decorating
the filter with some few infos, like the number of nodes, etc.
Well, we also need a volunteer to jump into the mud too :)
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
RE: [APacheDS] do I need to write a way to clone a filter?
Posted by "Hammond, Steve" <st...@Polycom.com>.
-----Original Message-----
From: elecharny@gmail.com [mailto:elecharny@gmail.com] On Behalf Of
Emmanuel Lecharny
Sent: Thursday, February 19, 2009 10:25 AM
To: Apache Directory Developers List
Subject: Re: [APacheDS] do I need to write a way to clone a filter?
> I tried to hack it together with
(FilterParser.parse(filter.toString()) but
> this fails when my memberOf groupDN has parenthesis in it.
Well, the parser might not be perfect :/ Worth a JIRA, IMO.
Actually I like it how it is. The problem is that filter.toString() can
produce things like (cn=bobs group(not jims)) which is the correct way
to look at it as to string I think. But it cannot be parsed, because
the parens would have to be escaped. I don't think they should be
escaped in the toString function, that is why I did not enter a Jira
ticket.
Re: [APacheDS] do I need to write a way to clone a filter?
Posted by Emmanuel Lecharny <el...@apache.org>.
i,
On Thu, Feb 19, 2009 at 5:54 PM, Hammond, Steve
<st...@polycom.com> wrote:
> I am getting a filter in on the wire.
>
> I want to use a visitor method and remove some pieces (a memberof)
>
> But I need to use the original filter also.
>
>
>
> I was hoping for a ExprNode.clone function so that I can have a copy of the
> filter that I can send the visitor to do the alterations to the copy,
> leaving the original filter pristine.
We don't have a clone() method for filters. Sigh :/
> I tried to hack it together with (FilterParser.parse(filter.toString()) but
> this fails when my memberOf groupDN has parenthesis in it.
Well, the parser might not be perfect :/ Worth a JIRA, IMO.
>
> Just thought I would ask before I got very far on adding a clone to the
> ExprNode Interface
There are three things we would like to add :
- a clone() method which works
- a decent equals method, comparing two filters and accept filters
which are not ordered the same way (ie, (|(a=*)(b=*)) should be equal
to (|(b=*)(a=*))
- a decent toString() method - I would call it asString() - returning
a String representation of the current filter, not a String decorating
the filter with some few infos, like the number of nodes, etc.
Well, we also need a volunteer to jump into the mud too :)
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com