org.apache.directory.server.core.normalization
Class NormalizingVisitor

java.lang.Object
  extended by org.apache.directory.server.core.normalization.NormalizingVisitor
All Implemented Interfaces:
org.apache.directory.shared.ldap.filter.FilterVisitor

public class NormalizingVisitor
extends java.lang.Object
implements org.apache.directory.shared.ldap.filter.FilterVisitor

A filter visitor which normalizes leaf node values as it visits them. It also removes leaf nodes from branches whose attributeType is undefined. It obviously cannot remove a leaf node from a filter which is only a leaf node. Checks to see if a filter is a leaf node with undefined attributeTypes should be done outside this visitor. Since this visitor may remove filter nodes it may produce negative results on filters, like NOT branch nodes without a child or AND and OR nodes with one or less children. This might make some partition implementations choke. To avoid this problem we clean up branch nodes that don't make sense. For example all BranchNodes without children are just removed. An AND and OR BranchNode with a single child is replaced with it's child for all but the topmost branchnode which we cannot replace. So again the top most branch node must be inspected by code outside of this visitor.

Version:
$Rev: 437314 $
Author:
Apache Directory Project

Constructor Summary
NormalizingVisitor(org.apache.directory.shared.ldap.name.NameComponentNormalizer ncn, OidRegistry registry)
           
 
Method Summary
 boolean canVisit(org.apache.directory.shared.ldap.filter.ExprNode node)
           
 java.util.ArrayList getOrder(org.apache.directory.shared.ldap.filter.BranchNode node, java.util.ArrayList children)
           
 boolean isPrefix()
           
 void visit(org.apache.directory.shared.ldap.filter.ExprNode node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NormalizingVisitor

public NormalizingVisitor(org.apache.directory.shared.ldap.name.NameComponentNormalizer ncn,
                          OidRegistry registry)
Method Detail

visit

public void visit(org.apache.directory.shared.ldap.filter.ExprNode node)
Specified by:
visit in interface org.apache.directory.shared.ldap.filter.FilterVisitor

canVisit

public boolean canVisit(org.apache.directory.shared.ldap.filter.ExprNode node)
Specified by:
canVisit in interface org.apache.directory.shared.ldap.filter.FilterVisitor

isPrefix

public boolean isPrefix()
Specified by:
isPrefix in interface org.apache.directory.shared.ldap.filter.FilterVisitor

getOrder

public java.util.ArrayList getOrder(org.apache.directory.shared.ldap.filter.BranchNode node,
                                    java.util.ArrayList children)
Specified by:
getOrder in interface org.apache.directory.shared.ldap.filter.FilterVisitor


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.