org.apache.directory.server.ldap.handlers
Class SearchHandler

java.lang.Object
  extended by org.apache.directory.server.ldap.handlers.LdapRequestHandler<T>
      extended by org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler<org.apache.directory.shared.ldap.message.SearchRequest>
          extended by org.apache.directory.server.ldap.handlers.SearchHandler
All Implemented Interfaces:
org.apache.mina.handler.demux.MessageHandler<org.apache.directory.shared.ldap.message.SearchRequest>

public class SearchHandler
extends ReferralAwareRequestHandler<org.apache.directory.shared.ldap.message.SearchRequest>

A handler for processing search requests.

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

Field Summary
 
Fields inherited from class org.apache.directory.server.ldap.handlers.LdapRequestHandler
ldapService
 
Fields inherited from interface org.apache.mina.handler.demux.MessageHandler
NOOP
 
Constructor Summary
SearchHandler()
           
 
Method Summary
 void handleIgnoringReferrals(LdapSession session, org.apache.directory.shared.ldap.name.LdapDN reqTargetDn, ClonedServerEntry entry, org.apache.directory.shared.ldap.message.SearchRequest req)
          Main message handing method for search requests.
 void modifyFilter(LdapSession session, org.apache.directory.shared.ldap.message.SearchRequest req)
          Alters the filter expression based on the presence of the ManageDsaIT control.
 
Methods inherited from class org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler
getFarthestReferralAncestor, getReferralOnAncestor, getReferralOnAncestorForSearch, handle, handleException, isEntryReferral
 
Methods inherited from class org.apache.directory.server.ldap.handlers.LdapRequestHandler
getLdapServer, isConfidentialityRequirementSatisfied, messageReceived, rejectWithoutConfidentiality, setLdapServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchHandler

public SearchHandler()
Method Detail

modifyFilter

public void modifyFilter(LdapSession session,
                         org.apache.directory.shared.ldap.message.SearchRequest req)
                  throws java.lang.Exception
Alters the filter expression based on the presence of the ManageDsaIT control. If the control is not present, the search filter will be altered to become a disjunction with two terms. The first term is the original filter. The second term is a (objectClass=referral) assertion. When OR'd together these will make sure we get all referrals so we can process continuations properly without having the filter remove them from the result set. NOTE: original filter is first since most entries are not referrals so it has a higher probability on average of accepting and shorting evaluation before having to waste cycles trying to evaluate if the entry is a referral.

Parameters:
session - the session to use to construct the filter (schema access)
req - the request to get the original filter from
Throws:
java.lang.Exception - if there are schema access problems

handleIgnoringReferrals

public void handleIgnoringReferrals(LdapSession session,
                                    org.apache.directory.shared.ldap.name.LdapDN reqTargetDn,
                                    ClonedServerEntry entry,
                                    org.apache.directory.shared.ldap.message.SearchRequest req)
Main message handing method for search requests. This will be called even if the ManageDsaIT control is present because the super class does not know that the search operation has more to do after finding the base. The call to this means that finding the base can ignore referrals.

Specified by:
handleIgnoringReferrals in class ReferralAwareRequestHandler<org.apache.directory.shared.ldap.message.SearchRequest>
Parameters:
session - the associated session
req - the received SearchRequest
reqTargetDn - the target entry DN associated with the request
entry - the target entry if it exists and has been looked up, may be null even if the entry exists, offered in case the entry is looked up to avoid repeat lookups. Implementations should check if the entry is null and attempt a lookup instead of presuming the entry does not exist.


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