directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1513752 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java
Date Wed, 14 Aug 2013 07:35:02 GMT
Author: elecharny
Date: Wed Aug 14 07:35:02 2013
New Revision: 1513752

URL: http://svn.apache.org/r1513752
Log:
Added a performance improvement when the normalizer is used on the server

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java?rev=1513752&r1=1513751&r2=1513752&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java
Wed Aug 14 07:35:02 2013
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/* no qualifier*/class NormalizingComparator extends LdapComparator<String>
+public class NormalizingComparator extends LdapComparator<String>
 {
     /** The serial version UID */
     private static final long serialVersionUID = 2L;
@@ -47,6 +47,8 @@ import org.slf4j.LoggerFactory;
     /** the underlying comparator to use for comparisons */
     private LdapComparator<String> comparator;
 
+    private boolean onServer = false;
+
 
     /**
      * A comparator which normalizes a value first before comparing them.
@@ -68,6 +70,11 @@ import org.slf4j.LoggerFactory;
      */
     public int compare( String o1, String o2 )
     {
+        if ( onServer )
+        {
+            return comparator.compare( o1, o2 );
+        }
+
         String n1;
         String n2;
 
@@ -108,4 +115,14 @@ import org.slf4j.LoggerFactory;
         normalizer.setOid( oid );
         comparator.setOid( oid );
     }
+
+
+    /**
+     * tells that the normalizingComparator should not normalize values which are
+     * already normalized on the server 
+     */
+    public void setOnServer()
+    {
+        this.onServer = true;
+    }
 }



Mime
View raw message