directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1516802 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/ apacheds/trunk/mavibot-partition/src/mai...
Date Fri, 23 Aug 2013 10:10:26 GMT
Author: elecharny
Date: Fri Aug 23 10:10:25 2013
New Revision: 1516802

URL: http://svn.apache.org/r1516802
Log:
o Added a shallowClone() method in the Entry interface, implemented it n the various classes
o Augmented the cache in JDBM search perf tests
o Closed the ByteArrayOutputStream in MavibotParentIdAndRdnSerializer
o Changed the default cacheSize for the RDN index in the config
o Added the registering of AttributeType in the LdapNetworkConnection.addSchema() method,
as it was missing (DIRAPI-156)
o Storing the attributeType as a byte[] in the AddAttributeTyp.action() method

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntrySearch.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
    directory/apacheds/trunk/server-config/src/main/resources/config.ldif
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/searchResultEntry/AddAttributeType.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchResultEntryDecorator.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
Fri Aug 23 10:10:25 2013
@@ -443,6 +443,12 @@ public class ClonedServerEntry implement
     }
 
 
+    public Entry shallowClone()
+    {
+        return clonedEntry.shallowClone();
+    }
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntrySearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntrySearch.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntrySearch.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntrySearch.java
Fri Aug 23 10:10:25 2013
@@ -48,6 +48,6 @@ public class ClonedServerEntrySearch ext
     {
         super();
         this.originalEntry = originalEntry;
-        this.clonedEntry = ( Entry ) originalEntry.clone();
+        this.clonedEntry = originalEntry.clone();
     }
 }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
Fri Aug 23 10:10:25 2013
@@ -57,6 +57,7 @@ import org.junit.runner.RunWith;
     partitions =
         {
             @CreatePartition(
+                cacheSize = 10000,
                 name = "example",
                 suffix = "dc=example,dc=com",
                 contextEntry = @ContextEntry(
@@ -67,10 +68,10 @@ import org.junit.runner.RunWith;
                         "objectClass: domain\n\n"),
                 indexes =
                     {
-                        @CreateIndex(attribute = "objectClass"),
-                        @CreateIndex(attribute = "sn"),
-                        @CreateIndex(attribute = "cn"),
-                        @CreateIndex(attribute = "displayName")
+                        @CreateIndex(attribute = "objectClass", cacheSize = 1000),
+                        @CreateIndex(attribute = "sn", cacheSize = 1000),
+                        @CreateIndex(attribute = "cn", cacheSize = 10000),
+                        @CreateIndex(attribute = "displayName", cacheSize = 1000)
                 })
 
     },
@@ -315,7 +316,7 @@ public class SearchPerfIT extends Abstra
             "ou: People" );
 
         connection.add( rootPeople );
-        int nbUsers = 10000;
+        int nbUsers = 100000;
 
         long tadd0 = System.currentTimeMillis();
         for ( int i = 0; i < nbUsers; i++ )
@@ -351,6 +352,7 @@ public class SearchPerfIT extends Abstra
                 System.out.println( "Injected " + i );
             }
         }
+
         long tadd1 = System.currentTimeMillis();
 
         System.out.println( "Time to inject " + nbUsers + " entries : " + ( ( tadd1 - tadd0
) / 1000 ) + "s" );

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
Fri Aug 23 10:10:25 2013
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.partition.impl.btree.mavibot;
 
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -30,10 +31,10 @@ import java.util.Comparator;
 
 import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.server.xdbm.ParentIdAndRdn;
 import org.apache.directory.mavibot.btree.serializer.BufferHandler;
 import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
+import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.xdbm.ParentIdAndRdn;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -69,9 +70,10 @@ public class MavibotParentIdAndRdnSerial
         {
             return rdn1.compareTo( rdn2 );
         }
-        
+
     };
 
+
     /**
      * Creates a new instance of ParentIdAndRdnSerializer.
      * The schemaManager MUST be set explicitly using the static {@link #setSchemaManager(SchemaManager)}
@@ -92,20 +94,19 @@ public class MavibotParentIdAndRdnSerial
         try
         {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            
+
             int totalBytes = 0;
             // write dummy length for preserving the space for 'length' to be filled later
             baos.write( 0 );
             baos.write( 0 );
             baos.write( 0 );
             baos.write( 0 );
-            
+
             ObjectOutput out = new ObjectOutputStream( baos );
-            
-            
+
             // First, the Dn
             Rdn[] rdns = parentIdAndRdn.getRdns();
-            
+
             // Write the Rdn of the Dn
             if ( ( rdns == null ) || ( rdns.length == 0 ) )
             {
@@ -114,43 +115,44 @@ public class MavibotParentIdAndRdnSerial
             else
             {
                 out.writeByte( rdns.length );
-                
+
                 for ( Rdn rdn : rdns )
                 {
                     rdn.writeExternal( out );
                 }
             }
-            
+
             // Then the parentId.
             out.writeUTF( parentIdAndRdn.getParentId() );
-            
+
             // The number of children
             out.writeInt( parentIdAndRdn.getNbChildren() );
-            
+
             // The number of descendants
             out.writeInt( parentIdAndRdn.getNbDescendants() );
-            
+
             out.flush();
-            
+
             if ( IS_DEBUG )
             {
                 LOG.debug( ">------------------------------------------------" );
                 LOG.debug( "Serialize " + parentIdAndRdn );
             }
-            
+
             byte[] bytes = baos.toByteArray();
-            
+            baos.close();
+
             totalBytes = bytes.length - 4; //subtract the first 4 dummy bytes
-            
+
             // replace the dummy length with the actual length
             bytes[0] = ( byte ) ( totalBytes >>> 24 );
             bytes[1] = ( byte ) ( totalBytes >>> 16 );
             bytes[2] = ( byte ) ( totalBytes >>> 8 );
             bytes[3] = ( byte ) ( totalBytes );
-            
+
             return bytes;
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             throw new RuntimeException( e );
         }
@@ -215,14 +217,14 @@ public class MavibotParentIdAndRdnSerial
             parentIdAndRdn.setNbDescendants( nbDescendants );
 
             buffer.position( buffer.position() + len );
-            
+
             return parentIdAndRdn;
         }
         catch ( ClassNotFoundException cnfe )
         {
             LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
             throw new IOException( cnfe.getLocalizedMessage() );
-        }        
+        }
     }
 
 
@@ -239,6 +241,7 @@ public class MavibotParentIdAndRdnSerial
         return comparator;
     }
 
+
     public static void setSchemaManager( SchemaManager schemaManager )
     {
         MavibotParentIdAndRdnSerializer.schemaManager = schemaManager;

Modified: directory/apacheds/trunk/server-config/src/main/resources/config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/resources/config.ldif?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/resources/config.ldif (original)
+++ directory/apacheds/trunk/server-config/src/main/resources/config.ldif Fri Aug 23 10:10:25
2013
@@ -280,7 +280,7 @@ objectclass: top
 dn: ads-indexAttributeId=apacheRdn,ou=indexes,ads-partitionId=system,ou=partitions,ads-directoryServiceId=default,ou=config
 ads-indexattributeid: apacheRdn
 ads-indexHasReverse: TRUE
-ads-indexcachesize: 100
+ads-indexcachesize: 1000
 objectclass: ads-index
 objectclass: ads-jdbmIndex
 objectclass: ads-base

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Fri Aug 23 10:10:25 2013
@@ -3424,6 +3424,7 @@ public class LdapNetworkConnection exten
             for ( AttributeType atType : atList )
             {
                 atRegistry.addMappingFor( atType );
+                atRegistry.register( atType );
             }
 
             List<ObjectClass> ocList = olsp.getObjectClassTypes();

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/searchResultEntry/AddAttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/searchResultEntry/AddAttributeType.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/searchResultEntry/AddAttributeType.java
(original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/searchResultEntry/AddAttributeType.java
Fri Aug 23 10:10:25 2013
@@ -72,8 +72,6 @@ public class AddAttributeType extends Gr
 
         TLV tlv = container.getCurrentTLV();
 
-        String type = "";
-
         // Store the type
         if ( tlv.getLength() == 0 )
         {
@@ -84,14 +82,13 @@ public class AddAttributeType extends Gr
         }
         else
         {
-            type = Strings.utf8ToString( tlv.getValue().getData() );
-
             try
             {
-                searchResultEntry.addAttribute( type );
+                searchResultEntry.addAttribute( tlv.getValue().getData() );
             }
             catch ( LdapException ine )
             {
+                String type = Strings.utf8ToString( tlv.getValue().getData() );
                 // This is for the client side. We will never decode LdapResult on the server
                 String msg = "The Attribute type " + type + "is invalid : " + ine.getMessage();
                 LOG.error( "{} : {}", msg, ine.getMessage() );
@@ -101,6 +98,7 @@ public class AddAttributeType extends Gr
 
         if ( IS_DEBUG )
         {
+            String type = Strings.utf8ToString( tlv.getValue().getData() );
             LOG.debug( "Attribute type : {}", type );
         }
     }

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchResultEntryDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchResultEntryDecorator.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchResultEntryDecorator.java
(original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchResultEntryDecorator.java
Fri Aug 23 10:10:25 2013
@@ -200,6 +200,19 @@ public class SearchResultEntryDecorator 
 
 
     /**
+     * Create a new attribute
+     * 
+     * @param type The attribute's type
+     */
+    public void addAttribute( byte[] type ) throws LdapException
+    {
+        currentAttribute = new DefaultAttribute( type );
+
+        getDecorated().getEntry().put( currentAttribute );
+    }
+
+
+    /**
      * Add a new value to the current attribute
      * 
      * @param value The added value

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
Fri Aug 23 10:10:25 2013
@@ -974,6 +974,40 @@ public final class DefaultEntry implemen
     @SuppressWarnings("unchecked")
     public Entry clone()
     {
+        // First, clone the structure
+        DefaultEntry clone = ( DefaultEntry ) shallowClone();
+
+        // now clone all the attributes
+        clone.attributes.clear();
+
+        if ( schemaManager != null )
+        {
+            for ( Attribute attribute : attributes.values() )
+            {
+                String oid = attribute.getAttributeType().getOid();
+                clone.attributes.put( oid, attribute.clone() );
+            }
+        }
+        else
+        {
+            for ( Attribute attribute : attributes.values() )
+            {
+                clone.attributes.put( attribute.getId(), attribute.clone() );
+            }
+
+        }
+
+        // We are done !
+        return clone;
+    }
+
+
+    /**
+     * Shallow clone an entry. We don't clone the Attributes
+     */
+    @SuppressWarnings("unchecked")
+    public Entry shallowClone()
+    {
         try
         {
             // First, clone the structure
@@ -992,26 +1026,6 @@ public final class DefaultEntry implemen
             clone.attributes = ( Map<String, Attribute> ) ( ( ( HashMap<String,
Attribute> ) attributes )
                 .clone() );
 
-            // now clone all the attributes
-            //            clone.attributes.clear();
-            //
-            //            if ( schemaManager != null )
-            //            {
-            //                for ( Attribute attribute : attributes.values() )
-            //                {
-            //                    String oid = attribute.getAttributeType().getOid();
-            //                    clone.attributes.put( oid, attribute.clone() );
-            //                }
-            //            }
-            //            else
-            //            {
-            //                for ( Attribute attribute : attributes.values() )
-            //                {
-            //                    clone.attributes.put( attribute.getId(), attribute.clone()
);
-            //                }
-            //
-            //            }
-
             // We are done !
             return clone;
         }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
Fri Aug 23 10:10:25 2013
@@ -59,6 +59,12 @@ public interface Entry extends Cloneable
 
 
     /**
+     * Shallow Clone the current entry. We don't deep clone the attributes
+     */
+    Entry shallowClone();
+
+
+    /**
      * Get this entry's Dn.
      *
      * @return The entry's Dn

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
Fri Aug 23 10:10:25 2013
@@ -181,6 +181,15 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
+    public Entry shallowClone()
+    {
+        return entry.shallowClone();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean contains( Attribute... attributes )
     {
         return entry.contains( attributes );

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java?rev=1516802&r1=1516801&r2=1516802&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java Fri
Aug 23 10:10:25 2013
@@ -222,6 +222,266 @@ public final class Strings
             0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
     };
 
+    public static final byte[] TO_LOWER_CASE_BYTE =
+        {
+            0x00,
+            0x01,
+            0x02,
+            0x03,
+            0x04,
+            0x05,
+            0x06,
+            0x07,
+            0x08,
+            0x09,
+            0x0A,
+            0x0B,
+            0x0C,
+            0x0D,
+            0x0E,
+            0x0F,
+            0x10,
+            0x11,
+            0x12,
+            0x13,
+            0x14,
+            0x15,
+            0x16,
+            0x17,
+            0x18,
+            0x19,
+            0x1A,
+            0x1B,
+            0x1C,
+            0x1D,
+            0x1E,
+            0x1F,
+            ' ',
+            0x21,
+            0x22,
+            0x23,
+            0x24,
+            0x25,
+            0x26,
+            '\'',
+            '(',
+            ')',
+            0x2A,
+            '+',
+            ',',
+            '-',
+            '.',
+            '/',
+            '0',
+            '1',
+            '2',
+            '3',
+            '4',
+            '5',
+            '6',
+            '7',
+            '8',
+            '9',
+            ':',
+            0x3B,
+            0x3C,
+            '=',
+            0x3E,
+            '?',
+            0x40,
+            'a',
+            'b',
+            'c',
+            'd',
+            'e',
+            'f',
+            'g',
+            'h',
+            'i',
+            'j',
+            'k',
+            'l',
+            'm',
+            'n',
+            'o',
+            'p',
+            'q',
+            'r',
+            's',
+            't',
+            'u',
+            'v',
+            'w',
+            'x',
+            'y',
+            'z',
+            0x5B,
+            0x5C,
+            0x5D,
+            0x5E,
+            0x5F,
+            0x60,
+            'a',
+            'b',
+            'c',
+            'd',
+            'e',
+            'f',
+            'g',
+            'h',
+            'i',
+            'j',
+            'k',
+            'l',
+            'm',
+            'n',
+            'o',
+            'p',
+            'q',
+            'r',
+            's',
+            't',
+            'u',
+            'v',
+            'w',
+            'x',
+            'y',
+            'z',
+            0x7B,
+            0x7C,
+            0x7D,
+            0x7E,
+            0x7F,
+            ( byte ) 0x80,
+            ( byte ) 0x81,
+            ( byte ) 0x82,
+            ( byte ) 0x83,
+            ( byte ) 0x84,
+            ( byte ) 0x85,
+            ( byte ) 0x86,
+            ( byte ) 0x87,
+            ( byte ) 0x88,
+            ( byte ) 0x89,
+            ( byte ) 0x8A,
+            ( byte ) 0x8B,
+            ( byte ) 0x8C,
+            ( byte ) 0x8D,
+            ( byte ) 0x8E,
+            ( byte ) 0x8F,
+            ( byte ) 0x90,
+            ( byte ) 0x91,
+            ( byte ) 0x92,
+            ( byte ) 0x93,
+            ( byte ) 0x94,
+            ( byte ) 0x95,
+            ( byte ) 0x96,
+            ( byte ) 0x97,
+            ( byte ) 0x98,
+            ( byte ) 0x99,
+            ( byte ) 0x9A,
+            ( byte ) 0x9B,
+            ( byte ) 0x9C,
+            ( byte ) 0x9D,
+            ( byte ) 0x9E,
+            ( byte ) 0x9F,
+            ( byte ) 0xA0,
+            ( byte ) 0xA1,
+            ( byte ) 0xA2,
+            ( byte ) 0xA3,
+            ( byte ) 0xA4,
+            ( byte ) 0xA5,
+            ( byte ) 0xA6,
+            ( byte ) 0xA7,
+            ( byte ) 0xA8,
+            ( byte ) 0xA9,
+            ( byte ) 0xAA,
+            ( byte ) 0xAB,
+            ( byte ) 0xAC,
+            ( byte ) 0xAD,
+            ( byte ) 0xAE,
+            ( byte ) 0xAF,
+            ( byte ) 0xB0,
+            ( byte ) 0xB1,
+            ( byte ) 0xB2,
+            ( byte ) 0xB3,
+            ( byte ) 0xB4,
+            ( byte ) 0xB5,
+            ( byte ) 0xB6,
+            ( byte ) 0xB7,
+            ( byte ) 0xB8,
+            ( byte ) 0xB9,
+            ( byte ) 0xBA,
+            ( byte ) 0xBB,
+            ( byte ) 0xBC,
+            ( byte ) 0xBD,
+            ( byte ) 0xBE,
+            ( byte ) 0xBF,
+            ( byte ) 0xC0,
+            ( byte ) 0xC1,
+            ( byte ) 0xC2,
+            ( byte ) 0xC3,
+            ( byte ) 0xC4,
+            ( byte ) 0xC5,
+            ( byte ) 0xC6,
+            ( byte ) 0xC7,
+            ( byte ) 0xC8,
+            ( byte ) 0xC9,
+            ( byte ) 0xCA,
+            ( byte ) 0xCB,
+            ( byte ) 0xCC,
+            ( byte ) 0xCD,
+            ( byte ) 0xCE,
+            ( byte ) 0xCF,
+            ( byte ) 0xD0,
+            ( byte ) 0xD1,
+            ( byte ) 0xD2,
+            ( byte ) 0xD3,
+            ( byte ) 0xD4,
+            ( byte ) 0xD5,
+            ( byte ) 0xD6,
+            ( byte ) 0xD7,
+            ( byte ) 0xD8,
+            ( byte ) 0xD9,
+            ( byte ) 0xDA,
+            ( byte ) 0xDB,
+            ( byte ) 0xDC,
+            ( byte ) 0xDD,
+            ( byte ) 0xDE,
+            ( byte ) 0xDF,
+            ( byte ) 0xE0,
+            ( byte ) 0xE1,
+            ( byte ) 0xE2,
+            ( byte ) 0xE3,
+            ( byte ) 0xE4,
+            ( byte ) 0xE5,
+            ( byte ) 0xE6,
+            ( byte ) 0xE7,
+            ( byte ) 0xE8,
+            ( byte ) 0xE9,
+            ( byte ) 0xEA,
+            ( byte ) 0xEB,
+            ( byte ) 0xEC,
+            ( byte ) 0xED,
+            ( byte ) 0xEE,
+            ( byte ) 0xEF,
+            ( byte ) 0xF0,
+            ( byte ) 0xF1,
+            ( byte ) 0xF2,
+            ( byte ) 0xF3,
+            ( byte ) 0xF4,
+            ( byte ) 0xF5,
+            ( byte ) 0xF6,
+            ( byte ) 0xF7,
+            ( byte ) 0xF8,
+            ( byte ) 0xF9,
+            ( byte ) 0xFA,
+            ( byte ) 0xFB,
+            ( byte ) 0xFC,
+            ( byte ) 0xFD,
+            ( byte ) 0xFE,
+            ( byte ) 0xFF,
+    };
+
     /** upperCase = 'A' .. 'Z', '0'..'9', '-' */
     public static final char[] UPPER_CASE =
         {
@@ -1958,6 +2218,30 @@ public final class Strings
      * In Ldap, attributesType are supposed to use ASCII chars :
      * 'a'-'z', 'A'-'Z', '0'-'9', '.' and '-' only.
      *
+     * @param value The byte[] to lowercase
+     * @return The lowercase string
+     */
+    public static String toLowerCase( byte[] value )
+    {
+        if ( ( null == value ) || ( value.length == 0 ) )
+        {
+            return "";
+        }
+
+        for ( int i = 0; i < value.length; i++ )
+        {
+            value[i] = TO_LOWER_CASE_BYTE[value[i]];
+        }
+
+        return new String( value );
+    }
+
+
+    /**
+     * Rewrote the toLowercase method to improve performances.
+     * In Ldap, attributesType are supposed to use ASCII chars :
+     * 'a'-'z', 'A'-'Z', '0'-'9', '.' and '-' only.
+     *
      * @param value The String to uppercase
      * @return The uppercase string
      */



Mime
View raw message