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

java.lang.Object
  extended by org.apache.directory.server.ldap.handlers.LdapRequestHandler<org.apache.directory.shared.ldap.model.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.model.message.SearchRequest>

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

A handler for processing search requests.

Author:
Apache Directory Project

Field Summary
protected  ReplicationRequestHandler replicationReqHandler
          The replication handler
 
Fields inherited from class org.apache.directory.server.ldap.handlers.LdapRequestHandler
ldapServer
 
Fields inherited from interface org.apache.mina.handler.demux.MessageHandler
NOOP
 
Constructor Summary
SearchHandler()
           
 
Method Summary
static org.apache.directory.shared.ldap.model.entry.Entry getFarthestReferralAncestor(LdapSession session, org.apache.directory.shared.ldap.model.name.Dn target)
          Searches up the ancestry of a Dn searching for the farthest referral ancestor.
 org.apache.directory.shared.ldap.model.message.Referral getReferralOnAncestor(LdapSession session, org.apache.directory.shared.ldap.model.name.Dn reqTargetDn, org.apache.directory.shared.ldap.model.message.SearchRequest req, org.apache.directory.shared.ldap.model.entry.Entry referralAncestor)
          Handles processing with referrals without ManageDsaIT decorator and with an ancestor that is a referral.
 org.apache.directory.shared.ldap.model.message.Referral getReferralOnAncestorForSearch(LdapSession session, org.apache.directory.shared.ldap.model.message.SearchRequest req, org.apache.directory.shared.ldap.model.entry.Entry referralAncestor)
          Handles processing with referrals without ManageDsaIT decorator and with an ancestor that is a referral.
 void handle(LdapSession session, org.apache.directory.shared.ldap.model.message.SearchRequest req)
          Handle a Ldap message associated with a session
 void handleException(LdapSession session, org.apache.directory.shared.ldap.model.message.ResultResponseRequest req, Exception e)
          Handles processing with referrals without ManageDsaIT decorator.
 void setReplicationReqHandler(ReplicationRequestHandler replicationReqHandler)
          Install the replication handler when it's allowed by this server
 
Methods inherited from class org.apache.directory.server.ldap.handlers.LdapRequestHandler
getLdapServer, handleMessage, isConfidentialityRequirementSatisfied, rejectWithoutConfidentiality, setLdapServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

replicationReqHandler

protected ReplicationRequestHandler replicationReqHandler
The replication handler

Constructor Detail

SearchHandler

public SearchHandler()
Method Detail

handle

public final void handle(LdapSession session,
                         org.apache.directory.shared.ldap.model.message.SearchRequest req)
                  throws Exception
Handle a Ldap message associated with a session

Specified by:
handle in class LdapRequestHandler<org.apache.directory.shared.ldap.model.message.SearchRequest>
Parameters:
session - The associated session
req - The message we have to handle
Throws:
Exception - If there is an error during the processing of this message

getReferralOnAncestorForSearch

public org.apache.directory.shared.ldap.model.message.Referral getReferralOnAncestorForSearch(LdapSession session,
                                                                                              org.apache.directory.shared.ldap.model.message.SearchRequest req,
                                                                                              org.apache.directory.shared.ldap.model.entry.Entry referralAncestor)
                                                                                       throws Exception
Handles processing with referrals without ManageDsaIT decorator and with an ancestor that is a referral. The original entry was not found and the walk of the ancestry returned a referral.

Parameters:
referralAncestor - the farthest referral ancestor of the missing entry
Throws:
Exception

getReferralOnAncestor

public org.apache.directory.shared.ldap.model.message.Referral getReferralOnAncestor(LdapSession session,
                                                                                     org.apache.directory.shared.ldap.model.name.Dn reqTargetDn,
                                                                                     org.apache.directory.shared.ldap.model.message.SearchRequest req,
                                                                                     org.apache.directory.shared.ldap.model.entry.Entry referralAncestor)
                                                                              throws Exception
Handles processing with referrals without ManageDsaIT decorator and with an ancestor that is a referral. The original entry was not found and the walk of the ancestry returned a referral.

Parameters:
referralAncestor - the farthest referral ancestor of the missing entry
Throws:
Exception

handleException

public void handleException(LdapSession session,
                            org.apache.directory.shared.ldap.model.message.ResultResponseRequest req,
                            Exception e)
Handles processing with referrals without ManageDsaIT decorator.

Overrides:
handleException in class LdapRequestHandler<org.apache.directory.shared.ldap.model.message.SearchRequest>

getFarthestReferralAncestor

public static final org.apache.directory.shared.ldap.model.entry.Entry getFarthestReferralAncestor(LdapSession session,
                                                                                                   org.apache.directory.shared.ldap.model.name.Dn target)
                                                                                            throws Exception
Searches up the ancestry of a Dn searching for the farthest referral ancestor. This is required to properly handle referrals. Note that this function is quite costly since it attempts to lookup all the ancestors up the hierarchy just to see if they represent referrals. Techniques can be employed later to improve this performance hit by having an intelligent referral cache.

Returns:
the farthest referral ancestor or null
Throws:
Exception - if there are problems during this search

setReplicationReqHandler

public void setReplicationReqHandler(ReplicationRequestHandler replicationReqHandler)
Install the replication handler when it's allowed by this server

Parameters:
replicationReqHandler - The replication handler provider


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.