Class SubtreeSpecificationParser

java.lang.Object
org.apache.directory.api.ldap.model.subtree.SubtreeSpecificationParser

public class SubtreeSpecificationParser extends Object
A LDAP subtree parser base on the specification as defined by RFC 3672. The parsed grammar is:
subtreeSpecification = OPEN_CURLY ( SP )*
                         ( subtreeSpecificationComponent ( SP )*
                           ( SEP ( SP )* subtreeSpecificationComponent ( SP )* )* 
                         )?
                       CLOSE_CURLY
subtreeSpecificationComponent = ss_base | ss_specificExclusions | ss_minimum | ss_maximum | ss_specificationFilter
ss_base = ID_base ( SP )+ distinguishedName
ss_specificExclusions = ID_specificExclusions ( SP )+ specificExclusions
specificExclusions = OPEN_CURLY ( SP )*
                       ( specificExclusion ( SP )*
                         ( SEP ( SP )* specificExclusion ( SP )* )*
                       )?
                     CLOSE_CURLY
specificExclusion = chopBefore | chopAfter
chopBefore = ID_chopBefore ( SP )* COLON ( SP )* distinguishedName
chopAfter = ID_chopAfter ( SP )* COLON ( SP )* distinguishedName
ss_minimum = ID_minimum ( SP )+ INTEGER
ss_maximum = ID_maximum ( SP )+ INTEGER
ss_specificationFilter = ID_specificationFilter ( SP )+ ( refinement [| FILTER] )
refinements = OPEN_CURLY ( SP )*
                (
                  refinement ( SP )* ( SEP ( SP )* refinement ( SP )* )*
                )? 
              CLOSE_CURLY
refinement = item | and | or | not
item = ID_item ( SP )* COLON ( SP )* oid
and = ID_and ( SP )* COLON ( SP )* refinements
or = ID_or ( SP )* COLON ( SP )* refinements
not = ID_not ( SP )* COLON ( SP )* refinement
[FILTER = '(' ( '&' (SP)* FILTER+ | '|' (SP)* FILTER+ | '!' (SP)* FILTER | FILTER_VALUE ) ')' (SP)*
FILTER_VALUE = every char but '(', ')', '&', '|', '!']
Note: the 'filter' part is not present in RFC 3672
Author:
Apache Directory Project
See Also:
  • Constructor Details

    • SubtreeSpecificationParser

      public SubtreeSpecificationParser(SchemaManager schemaManager)
      Creates a subtree specification parser.
      Parameters:
      schemaManager - The SchemaManager
    • SubtreeSpecificationParser

      public SubtreeSpecificationParser(NormalizerMappingResolver resolver, SchemaManager schemaManager)
      Creates a normalizing subtree specification parser.
      Parameters:
      resolver - The resolver to use
      schemaManager - The SchemaManager
  • Method Details

    • parse

      public SubtreeSpecification parse(String spec) throws ParseException
      Parses a subtree specification
      Parameters:
      spec - the specification to be parsed
      Returns:
      the specification bean
      Throws:
      ParseException - if there are any recognition errors (bad syntax)
    • check

      public boolean check(String spec)
      Check a subtree specification
      Parameters:
      spec - the specification to be checked
      Returns:
      true if the subtree specification is valid, false otherwise
    • isNormilizing

      public boolean isNormilizing()
      Tests to see if this parser is normalizing.
      Returns:
      true if it normalizes false otherwise