You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/05/05 16:09:09 UTC
svn commit: r941299 -
/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
Author: elecharny
Date: Wed May 5 14:09:09 2010
New Revision: 941299
URL: http://svn.apache.org/viewvc?rev=941299&view=rev
Log:
o Some method are now private instead of public
o removed the 'static' keywords for some methods too
o slight optimization : we check the filter before normalizing the subschemasubentry DN
Modified:
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=941299&r1=941298&r2=941299&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Wed May 5 14:09:09 2010
@@ -36,6 +36,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.ldap.LdapSession;
import org.apache.directory.server.ldap.handlers.controls.PagedSearchContext;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControl;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
@@ -780,9 +781,9 @@ public class SearchHandler extends Refer
* @return the response for the entry
* @throws Exception if there are problems in generating the response
*/
- private InternalResponse generateResponse( LdapSession session, InternalSearchRequest req, ClonedServerEntry entry ) throws Exception
+ private InternalResponse generateResponse( LdapSession session, InternalSearchRequest req, Entry entry ) throws Exception
{
- EntryAttribute ref = entry.getOriginalEntry().get( SchemaConstants.REF_AT );
+ EntryAttribute ref = ((ClonedServerEntry)entry).getOriginalEntry().get( SchemaConstants.REF_AT );
boolean hasManageDsaItControl = req.getControls().containsKey( ManageDsaITControl.CONTROL_OID );
if ( ( ref != null ) && ! hasManageDsaItControl )
@@ -870,7 +871,7 @@ public class SearchHandler extends Refer
* @param req the request to get the original filter from
* @throws Exception if there are schema access problems
*/
- public void modifyFilter( LdapSession session, InternalSearchRequest req ) throws Exception
+ private void modifyFilter( LdapSession session, InternalSearchRequest req ) throws Exception
{
if ( req.hasControl( ManageDsaITControl.CONTROL_OID ) )
{
@@ -878,16 +879,6 @@ public class SearchHandler extends Refer
}
/*
- * Do not add the OR'd (objectClass=referral) expression if the user
- * searches for the subSchemaSubEntry as the SchemaIntercepter can't
- * handle an OR'd filter.
- */
- if ( isSubSchemaSubEntrySearch( session, req ) )
- {
- return;
- }
-
- /*
* Most of the time the search filter is just (objectClass=*) and if
* this is the case then there's no reason at all to OR this with an
* (objectClass=referral). If we detect this case then we leave it
@@ -901,12 +892,23 @@ public class SearchHandler extends Refer
AttributeType at = session.getCoreSession().getDirectoryService()
.getSchemaManager().lookupAttributeTypeRegistry( presenceNode.getAttribute() );
+
if ( at.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
{
return;
}
}
+ /*
+ * Do not add the OR'd (objectClass=referral) expression if the user
+ * searches for the subSchemaSubEntry as the SchemaIntercepter can't
+ * handle an OR'd filter.
+ */
+ if ( isSubSchemaSubEntrySearch( session, req ) )
+ {
+ return;
+ }
+
// using varags to add two expressions to an OR node
req.setFilter( new OrNode( req.getFilter(), newIsReferralEqualityNode( session ) ) );
}
@@ -976,8 +978,11 @@ public class SearchHandler extends Refer
// Handle regular search requests from here down
// ===============================================================
+ //long t0 = System.nanoTime();
InternalSearchResponseDone done = doSimpleSearch( session, req );
+ //long t1 = System.nanoTime();
session.getIoSession().write( done );
+ //.print( "Handler;" + ((t1-t0)/1000) + ";" );
}
catch ( Exception e )
{
@@ -1219,7 +1224,7 @@ public class SearchHandler extends Refer
* @param req the request issued
* @return true if the search is on the RootDSE false otherwise
*/
- private static boolean isRootDSESearch( InternalSearchRequest req )
+ private boolean isRootDSESearch( InternalSearchRequest req )
{
boolean isBaseIsRoot = req.getBase().isEmpty();
boolean isBaseScope = req.getScope() == SearchScope.OBJECT;
@@ -1259,7 +1264,7 @@ public class SearchHandler extends Refer
*
* @throws Exception the exception
*/
- private static boolean isSubSchemaSubEntrySearch( LdapSession session, InternalSearchRequest req ) throws Exception
+ private boolean isSubSchemaSubEntrySearch( LdapSession session, InternalSearchRequest req ) throws Exception
{
DN base = req.getBase();
String baseNormForm = ( base.isNormalized() ? base.getNormName() : base.getNormName() );