* @throws NamingException if any system indices fail
* @see org.apache.ldap.server.db.Enumerator#enumerate(ExprNode)
*/
public NamingEnumeration enumerate( ExprNode node ) throws NamingException
{
final ScopeNode snode = ( ScopeNode ) node;
final BigInteger id = db.getEntryId( snode.getBaseDn() );
switch( snode.getScope() )
{
case( SearchControls.OBJECT_SCOPE ):
final IndexRecord record = new IndexRecord();
record.setEntryId( id );
record.setIndexKey( snode.getBaseDn() );
return new SingletonEnumeration( record );
case( SearchControls.ONELEVEL_SCOPE ):
return enumerateChildren( snode.getBaseDn(),
snode.getDerefAliases().derefInSearching() );
case( SearchControls.SUBTREE_SCOPE ):
return enumerateDescendants( snode );
default:
throw new NamingException( "Unrecognized search scope!" );
}