org.safehaus.penrose.filter
Class FilterParser

java.lang.Object
  extended byorg.safehaus.penrose.filter.FilterParser
All Implemented Interfaces:
FilterParserConstants

public class FilterParser
extends java.lang.Object
implements FilterParserConstants

LDAP Filter Parser.


    See: http://www.faqs.org/rfcs/rfc2254.html

         filter     = "(" filtercomp ")"
         filtercomp = and / or / not / item
         and        = "&" filterlist
         or         = "|" filterlist
         not        = "!" filter
         filterlist = 1*filter
         item       = simple / present / substring / extensible
         simple     = attr filtertype value
         filtertype = equal / approx / greater / less
         equal      = "="
         approx     = "~="
         greater    = ">="
         less       = "<="
         extensible = attr [":dn"] [":" matchingrule] ":=" value
                      / [":dn"] ":" matchingrule ":=" value
         present    = attr "=*"
         substring  = attr "=" [initial] any [final]
         initial    = value
         any        = "*" *(value "*")
         final      = value
         attr       = AttributeDescription from Section 4.1.5 of [1]
         matchingrule = MatchingRuleId from Section 4.1.9 of [1]
         value      = AttributeValue from Section 4.1.6 of [1]

    If a value should contain any of the following characters

            Character       ASCII value
            ---------------------------
            *               0x2a
            (               0x28
            )               0x29
            \               0x5c
            NUL             0x00

    the character must be encoded as the backslash '\' character (ASCII
    0x5c) followed by the two hexadecimal digits representing the ASCII
    value of the encoded character. The case of the two hexadecimal
    digits is not significant.

    Example usage:

    Reader in = ...;
    FilterParser parser = new FilterParser(in);
    try {
      Filter filter = parser.parse();
    } catch (ParseException ex) {
      System.out.println(ex.getMessage());
    }

 


Field Summary
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 FilterParserTokenManager token_source
           
 
Fields inherited from interface org.safehaus.penrose.filter.FilterParserConstants
AND, ANY, COLON, DEFAULT, EOF, ITEM, LPAREN, NOT, OR, RPAREN, SPACE, tokenImage
 
Constructor Summary
FilterParser(FilterParserTokenManager tm)
           
FilterParser(java.io.InputStream stream)
           
FilterParser(java.io.Reader stream)
           
 
Method Summary
 Filter And()
           
 void disable_tracing()
           
 void enable_tracing()
           
 Filter Filter()
           
 ParseException generateParseException()
           
 Filter getFilter()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 Filter Item()
           
 Filter Not()
           
 Filter Or()
           
 Filter parse()
           
 void ReInit(FilterParserTokenManager tm)
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(java.io.Reader stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public FilterParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

FilterParser

public FilterParser(java.io.InputStream stream)

FilterParser

public FilterParser(java.io.Reader stream)

FilterParser

public FilterParser(FilterParserTokenManager tm)
Method Detail

getFilter

public Filter getFilter()

parse

public Filter parse()
             throws ParseException
Throws:
ParseException

Filter

public final Filter Filter()
                    throws ParseException
Throws:
ParseException

And

public final Filter And()
                 throws ParseException
Throws:
ParseException

Or

public final Filter Or()
                throws ParseException
Throws:
ParseException

Not

public final Filter Not()
                 throws ParseException
Throws:
ParseException

Item

public final Filter Item()
                  throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(FilterParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()