ScopeNode scope = new ScopeNode( DerefAliasesEnum.NEVERDEREFALIASES, normalizedBaseDn.toNormName(),
ScopeNode scope = new ScopeNode( DerefAliasesEnum.NEVER_DEREF_ALIASES, normalizedBaseDn.toNormName(),
    public void addNamingListener( EventContext ctx, Name name, ExprNode filter, SearchControls searchControls,        NamingListener namingListener ) throws NamingException    {        LdapDN normalizedBaseDn = new LdapDN( name );        normalizedBaseDn.normalize( attributeRegistry.getNormalizerMapping() );                // -------------------------------------------------------------------        // must normalize the filter here: need to handle special cases        // -------------------------------------------------------------------        if ( filter.isLeaf() )        {            LeafNode ln = ( LeafNode ) filter;            if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) )            {                StringBuffer buf = new StringBuffer();                buf.append( "undefined filter based on undefined attributeType '" );                buf.append( ln.getAttribute() );                buf.append( "' not evaluted at all.  Only using scope node." );                log.warn( buf.toString() );                filter = null;            }            else            {                filter.accept( visitor );            }        }        else         {            filter.accept( visitor );                // Check that after pruning/normalization we have a valid branch node at the top            BranchNode child = ( BranchNode ) filter;            // If the remaining filter branch node has no children set filter to null            if ( child.getChildren().size() == 0 )            {                log.warn( "Undefined branchnode filter without child nodes not evaluted at all. " +                        "Only using scope node." );                filter = null;            }            // Now for AND & OR nodes with a single child left replace them with their child            if ( child.getChildren().size() == 1 && child.getOperator() != BranchNode.NOT )            {                filter = child.getChild();            }        }                        ScopeNode scope = new ScopeNode( DerefAliasesEnum.NEVERDEREFALIASES, normalizedBaseDn.toNormName(),             searchControls.getSearchScope() );                if ( filter != null )        {            BranchNode and = new BranchNode( BranchNode.AND );            and.addNode( scope );            and.addNode( filter );            filter = and;        }        else        {            filter = scope;        }                EventSourceRecord rec = new EventSourceRecord( name, filter, ctx, searchControls, namingListener );        Object obj = sources.get( namingListener );        if ( obj == null )        {            sources.put( namingListener, rec );        }        else if ( obj instanceof EventSourceRecord )        {            List list = new ArrayList();            list.add( obj );            list.add( rec );            sources.put( namingListener, list );        }        else if ( obj instanceof List )        {            List list = ( List ) obj;            list.add( rec );        }    }