directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1743342 - in /directory/shared/branches/shared-value: integ/src/test/java/org/apache/directory/api/ldap/entry/ integ/src/test/java/org/apache/directory/api/ldap/model/name/ ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/...
Date Wed, 11 May 2016 12:00:28 GMT
Author: elecharny
Date: Wed May 11 12:00:27 2016
New Revision: 1743342

URL: http://svn.apache.org/viewvc?rev=1743342&view=rev
Log:
o Fixed the Normalizer, to take a parameter for substrings normalizations
o Fixed a bug in the DnComparator
o Added an (incomplete) implementation to the Rdn.compareTo() method
o Fixed a bug in the FilterParser 
o Used a NoOpNormalizer instance when computing the normalized value if we don'(t have a MatchingRule for a value
o Ignorihg a performance test in DnTest

Modified:
    directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java
    directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java
    directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java
    directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyDnRequestDecorator.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/Normalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PrepareString.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ObjectIdentifierComparator.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ConcreteNameComponentNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NoOpNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizerTest.java
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/DummyNormalizer.java

Modified: directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java (original)
+++ directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java Wed May 11 12:00:27 2016
@@ -20,7 +20,6 @@
 package org.apache.directory.api.ldap.entry;
 
 
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.LdapComparator;
@@ -29,6 +28,8 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
 import org.apache.directory.api.ldap.model.schema.MutableMatchingRule;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.PrepareString.AssertionType;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator;
 import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
@@ -157,18 +158,13 @@ public final class TestEntryUtils
             public static final long serialVersionUID = 1L;
 
 
-            public Value normalize( Value value ) throws LdapException
+            public String normalize( String value ) throws LdapException
             {
-                if ( value.isHumanReadable() )
-                {
-                    return new Value( Strings.toLowerCaseAscii( value.getValue() ) );
-                }
-
-                throw new IllegalStateException();
+                return normalize( value, AssertionType.ATTRIBUTE_VALUE );
             }
 
 
-            public String normalize( String value ) throws LdapException
+            public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
             {
                 return Strings.toLowerCaseAscii( value );
             }
@@ -255,32 +251,27 @@ public final class TestEntryUtils
             public static final long serialVersionUID = 1L;
 
 
-            public Value normalize( Value value ) throws LdapException
+            public String normalize( String value ) throws LdapException
             {
-                if ( !value.isHumanReadable() )
-                {
-                    byte[] val = value.getBytes();
-
-                    // each byte will be changed to be > 0, and spaces will be trimmed
-                    byte[] newVal = new byte[val.length];
+                return normalize( value, AssertionType.ATTRIBUTE_VALUE );
+            }
 
-                    int i = 0;
 
-                    for ( byte b : val )
-                    {
-                        newVal[i++] = ( byte ) ( b & 0x007F );
-                    }
-
-                    return new Value( Strings.trim( newVal ) );
-                }
+            public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
+            {
+                byte[] val = Strings.getBytesUtf8( value );
 
-                throw new IllegalStateException();
-            }
+                // each byte will be changed to be > 0, and spaces will be trimmed
+                byte[] newVal = new byte[val.length];
 
+                int i = 0;
 
-            public String normalize( String value ) throws LdapException
-            {
-                throw new IllegalStateException();
+                for ( byte b : val )
+                {
+                    newVal[i++] = ( byte ) ( b & 0x007F );
+                }
+                
+                return Strings.utf8ToString( Strings.trim( newVal ) );
             }
         } );
 

Modified: directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java (original)
+++ directory/shared/branches/shared-value/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java Wed May 11 12:00:27 2016
@@ -2983,7 +2983,7 @@ public class DnTest
     
     
     @Test
-    //@Ignore
+    @Ignore
     public void testDnParsing() throws LdapInvalidDnException
     {
         long[] deltas = new long[10];

Modified: directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java (original)
+++ directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java Wed May 11 12:00:27 2016
@@ -80,7 +80,7 @@ public class StoreModifyDnRequestNewRdn
 
         // We have to handle the special case of a 0 length matched
         // newDN
-        Rdn newRdn = null;
+        Rdn newRdn;
 
         if ( tlv.getLength() == 0 )
         {

Modified: directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyDnRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyDnRequestDecorator.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyDnRequestDecorator.java (original)
+++ directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ModifyDnRequestDecorator.java Wed May 11 12:00:27 2016
@@ -222,6 +222,7 @@ public class ModifyDnRequestDecorator ex
      * 
      * @return The PDU's length of a ModifyDN Request
      */
+    @Override
     public int computeLength()
     {
         int newRdnlength = Strings.getBytesUtf8( getNewRdn().getName() ).length;
@@ -264,7 +265,6 @@ public class ModifyDnRequestDecorator ex
             buffer.put( TLV.getBytes( modifyDnRequestLength ) );
 
             // The entry
-
             BerValue.encode( buffer, dnBytes );
 
             // The newRDN

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java Wed May 11 12:00:27 2016
@@ -50,6 +50,7 @@ public final class SchemaConstants
     public static final String OBJECT_CLASS = "ObjectCLass";
     public static final String SYNTAX = "Syntax";
     public static final String SYNTAX_CHECKER = "SyntaxChecker";
+    public static final String SYNTAXES = "Syntaxes";
 
     // SchemaEntity paths
     public static final String ATTRIBUTE_TYPES_PATH = "ou=attributetypes";

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java Wed May 11 12:00:27 2016
@@ -35,6 +35,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.MatchingRule;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
+import org.apache.directory.api.ldap.model.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.api.util.Serialize;
 import org.apache.directory.api.util.Strings;
 import org.slf4j.Logger;
@@ -484,7 +485,7 @@ public class Value implements Cloneable,
             return;
         }
         
-        Normalizer normalizer = null;
+        Normalizer normalizer;
         
         // We should have a Equality MatchingRule
         MatchingRule equality = attributeType.getEquality();
@@ -501,7 +502,8 @@ public class Value implements Cloneable,
                 
                 if ( ordering == null )
                 {
-                    throw new IllegalArgumentException( I18n.err( I18n.ERR_04148_MATCHING_RULE_EXPECTED ) );
+                    // Ok, no luck. Use a NoOp normalizer
+                    normalizer = new NoOpNormalizer();
                 }
                 else
                 {
@@ -526,6 +528,15 @@ public class Value implements Cloneable,
         // Now, normalize the upValue
         normValue = normalizer.normalize( upValue );
     }
+    
+    
+    /**
+     * @return The normalized value
+     */
+    public String getNormalized()
+    {
+        return normValue;
+    }
 
 
     /**

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java Wed May 11 12:00:27 2016
@@ -549,6 +549,12 @@ public final class FilterParser
 
             pos.start++;
 
+            if ( Strings.isCharASCII( filterBytes, pos.start, ')' ) )
+            {
+                // No any or final, we are done
+                return node;
+            }
+
             //
             while ( true )
             {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java Wed May 11 12:00:27 2016
@@ -1004,6 +1004,7 @@ public class Rdn implements Cloneable, E
      * @param rdn Rdn to be compared for equality with this Rdn
      * @return true if the specified object is equal to this Rdn
      */
+    @Override
     public boolean equals( Object that )
     {
         if ( this == that )
@@ -1011,7 +1012,7 @@ public class Rdn implements Cloneable, E
             return true;
         }
         
-        Rdn rdn = null;
+        Rdn rdn;
 
         if ( that instanceof String )
         {
@@ -1830,7 +1831,74 @@ public class Rdn implements Cloneable, E
      */
     public int compareTo( Rdn otherRdn )
     {
-        return 0;
+        if ( otherRdn == null )
+        {
+            return 1;
+        }
+        
+        if ( nbAvas < otherRdn.nbAvas )
+        {
+            return -1;
+        }
+        else if ( nbAvas > otherRdn.nbAvas )
+        {
+            return 1;
+        }
+        
+        switch ( nbAvas )
+        {
+            case 0 :
+                return 0;
+                
+            case 1 :
+                int comp = ava.compareTo( otherRdn.ava );
+                
+                if ( comp < 0 )
+                {
+                    return -1;
+                }
+                else if ( comp > 0 )
+                {
+                    return 1;
+                }
+                else
+                {
+                    return 0;
+                }
+                
+            default :
+                // Loop on all the Avas. As we have more than one,
+                // we have to order them by their AttributeType.
+                /*if ( isSchemaAware() )
+                {
+                    
+                }*/
+                
+                int pos = 0;
+                
+                for ( Ava ava : avas )
+                {
+                    Ava otherAva = otherRdn.avas.get( pos );
+                    
+                    comp = ava.compareTo( otherAva );
+                    
+                    if ( comp != 0 )
+                    {
+                        if ( comp < 0 )
+                        {
+                            return -1;
+                        }
+                        else
+                        {
+                            return 1;
+                        }
+                    }
+                    
+                    pos++;
+                }
+                
+                return 0;
+        }
     }
 
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/Normalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/Normalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/Normalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/Normalizer.java Wed May 11 12:00:27 2016
@@ -20,7 +20,6 @@
 package org.apache.directory.api.ldap.model.schema;
 
 
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 
 
@@ -58,23 +57,24 @@ public abstract class Normalizer extends
 
 
     /**
-     * Gets the normalized value.
+     * Gets the normalized value of AssertionValues.
      * 
      * @param value the value to normalize. It must *not* be null !
-     * @param assertionType The PrepareString.AssertionType
      * @return the normalized form for a value
      * @throws LdapException if an error results during normalization
      */
-    public abstract Value normalize( Value value ) throws LdapException;
+    public abstract String normalize( String value ) throws LdapException;
+
 
     /**
-     * Gets the normalized value of AssertionValues.
+     * Gets the normalized value of a substring assertion.
      * 
-     * @param value the value to normalize. It must *not* be null !
+     * @param value the substring value to normalize. It must *not* be null !
+     * @param assertionType The type of assertion
      * @return the normalized form for a value
      * @throws LdapException if an error results during normalization
      */
-    public abstract String normalize( String value ) throws LdapException;
+    public abstract String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException;
 
 
     /**

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PrepareString.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PrepareString.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PrepareString.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PrepareString.java Wed May 11 12:00:27 2016
@@ -3285,7 +3285,7 @@ public final class PrepareString
      * 
      * For instance, the following telephone number :
      * "+ (33) 1-123--456  789"
-     * will be trasnformed to :
+     * will be transformed to :
      * "+(33)1123456789"
      *
      * @param str The telephoneNumber String

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java Wed May 11 12:00:27 2016
@@ -84,7 +84,7 @@ public class DnComparator extends LdapCo
             return 1;
         }
 
-        for ( int i = dn0Size; i >= 0; i-- )
+        for ( int i = dn0Size - 1; i >= 0; i-- )
         {
             int comp = dn0.getRdn( i ).compareTo( dn1.getRdn( i ) );
             

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ObjectIdentifierComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ObjectIdentifierComparator.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ObjectIdentifierComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ObjectIdentifierComparator.java Wed May 11 12:00:27 2016
@@ -84,7 +84,7 @@ public class ObjectIdentifierComparator
             return -1;
         }
 
-        // Here, we should leverage the SchemaManager to compare the String and teh OID
+        // Here, we should leverage the SchemaManager to compare the String and the OID
         return ( ( String ) o1 ).compareToIgnoreCase( ( String ) o2 );
     }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java Wed May 11 12:00:27 2016
@@ -21,9 +21,9 @@ package org.apache.directory.api.ldap.mo
 
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.util.Strings;
 
 
@@ -48,23 +48,23 @@ public class BooleanNormalizer extends N
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapInvalidDnException
+    @Override
+    public String normalize( String value ) throws LdapInvalidDnException
     {
         if ( value == null )
         {
             return null;
         }
 
-        String strValue = value.getValue();
-
-        return new Value( Strings.upperCase( strValue.trim() ) );
+        return Strings.upperCase( value.trim() );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapInvalidDnException
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapInvalidDnException
     {
         if ( value == null )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ConcreteNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ConcreteNameComponentNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ConcreteNameComponentNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ConcreteNameComponentNormalizer.java Wed May 11 12:00:27 2016
@@ -20,7 +20,6 @@
 package org.apache.directory.api.ldap.model.schema.normalizers;
 
 
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.MatchingRule;
@@ -61,7 +60,7 @@ public class ConcreteNameComponentNormal
         char[] newVal = new char[value.length()];
         int escaped = 0;
         char high = 0;
-        char low = 0;
+        char low;
         int pos = 0;
 
         for ( int index = 0; index < value.length(); index++  )
@@ -105,20 +104,21 @@ public class ConcreteNameComponentNormal
     /**
      * {@inheritDoc}
      */
+    @Override
     public Object normalizeByName( String name, String value ) throws LdapException
     {
         AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( name );
+        Normalizer normalizer = lookup( name );
 
         if ( attributeType.getSyntax().isHumanReadable() )
         {
-            return lookup( name ).normalize( value );
+            return normalizer.normalize( value );
         }
         else
         {
             String unescaped = unescape( value );
-            byte[] valBytes = Strings.getBytesUtf8( unescaped );
 
-            return lookup( name ).normalize( new Value( valBytes ) );
+            return normalizer.normalize( unescaped );
         }
 
     }
@@ -127,25 +127,19 @@ public class ConcreteNameComponentNormal
     /**
      * {@inheritDoc}
      */
+    @Override
     public Object normalizeByName( String name, byte[] value ) throws LdapException
     {
-        AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( name );
+        String valStr = Strings.utf8ToString( value );
 
-        if ( !attributeType.getSyntax().isHumanReadable() )
-        {
-            return lookup( name ).normalize( new Value( value ) );
-        }
-        else
-        {
-            String valStr = Strings.utf8ToString( value );
-            return lookup( name ).normalize( valStr );
-        }
+        return lookup( name ).normalize( valStr );
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public Object normalizeByOid( String oid, String value ) throws LdapException
     {
         return lookup( oid ).normalize( value );
@@ -155,9 +149,10 @@ public class ConcreteNameComponentNormal
     /**
      * {@inheritDoc}
      */
+    @Override
     public Object normalizeByOid( String oid, byte[] value ) throws LdapException
     {
-        return lookup( oid ).normalize( new Value( value ) );
+        return lookup( oid ).normalize( Strings.utf8ToString( value ) );
     }
 
 
@@ -189,12 +184,17 @@ public class ConcreteNameComponentNormal
     /**
      * @see NameComponentNormalizer#isDefined(String)
      */
+    @Override
     public boolean isDefined( String id )
     {
         return schemaManager.getAttributeTypeRegistry().contains( id );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public String normalizeName( String attributeName ) throws LdapException
     {
         return schemaManager.getAttributeTypeRegistry().getOidByName( attributeName );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java Wed May 11 12:00:27 2016
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.mo
 import java.io.IOException;
 
 import org.apache.directory.api.i18n.I18n;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
@@ -59,12 +58,14 @@ public class DeepTrimNormalizer extends
      */
     public DeepTrimNormalizer()
     {
+        super();
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public String normalize( String value ) throws LdapException
     {
         return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
@@ -74,25 +75,7 @@ public class DeepTrimNormalizer extends
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
-    {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        // Transcoding
-        String transcoded = PrepareString.transcode( value.getBytes() );
-
-        String normValue = normalize( transcoded, PrepareString.AssertionType.ATTRIBUTE_VALUE );
-
-        return new Value( value.getAttributeType(), value.getValue() );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( value == null )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java Wed May 11 12:00:27 2016
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.mo
 import java.io.IOException;
 
 import org.apache.directory.api.i18n.I18n;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
@@ -60,31 +59,14 @@ public class DeepTrimToLowerNormalizer e
      */
     public DeepTrimToLowerNormalizer()
     {
-    }
-    
-    
-    /**
-     * {@inheritDoc}
-     */
-    public Value normalize( Value value ) throws LdapException
-    {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        // Transcoding
-        String transcoded = PrepareString.transcode( value.getBytes() );
-
-        String normValue = normalize( transcoded, PrepareString.AssertionType.ATTRIBUTE_VALUE );
-
-        return new Value( value.getAttributeType(), normValue );
+        super();
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public String normalize( String value ) throws LdapException
     {
         return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
@@ -94,6 +76,7 @@ public class DeepTrimToLowerNormalizer e
     /**
      * {@inheritDoc}
      */
+    @Override
     public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( value == null )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java Wed May 11 12:00:27 2016
@@ -21,10 +21,10 @@ package org.apache.directory.api.ldap.mo
 
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 
 
@@ -37,7 +37,7 @@ import org.apache.directory.api.ldap.mod
 public class DnNormalizer extends Normalizer
 {
     /** A reference to the schema manager used to normalize the Dn */
-    private SchemaManager schemaManager;
+    private transient SchemaManager schemaManager;
 
 
     /**
@@ -52,26 +52,22 @@ public class DnNormalizer extends Normal
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
+    @Override
+    public String normalize( String value ) throws LdapException
     {
-        Dn dn = null;
-
-        String dnStr = value.getValue();
-
-        dn = new Dn( schemaManager, dnStr );
+        Dn dn = new Dn( schemaManager, value );
 
-        return new Value( dn.getName() );
+        return dn.getName();
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapException
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
-        Dn dn = null;
-
-        dn = new Dn( schemaManager, value );
+        Dn dn = new Dn( schemaManager, value );
 
         return dn.getName();
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java Wed May 11 12:00:27 2016
@@ -24,7 +24,6 @@ import java.text.ParseException;
 
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
@@ -45,6 +44,8 @@ import org.apache.directory.api.util.Gen
  * <li>the time is supposed to be expressed in Zulu (GMT), so 
  * increment is applied to hours/days/yeah, and a Z is added at the end</li>
  * </ul>
+ * 
+ * Note : there is no Substring for this type of values.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -63,18 +64,18 @@ public class GeneralizedTimeNormalizer e
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
+    @Override
+    public String normalize( String value ) throws LdapException
     {
-        String normalized = PrepareString.normalize( value.getValue() );
-
-        return new Value( normalized );
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapException
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( value == null )
         {
@@ -86,10 +87,8 @@ public class GeneralizedTimeNormalizer e
         try
         {
             GeneralizedTime time = new GeneralizedTime( value );
-            String normalized = time.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION,
+            return time.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION,
                 FractionDelimiter.DOT, 3, TimeZoneFormat.Z );
-
-            return normalized;
         }
         catch ( ParseException pe )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java Wed May 11 12:00:27 2016
@@ -22,12 +22,13 @@ package org.apache.directory.api.ldap.mo
 
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapOtherException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.ldap.model.schema.syntaxCheckers.NumericOidSyntaxChecker;
+import org.apache.directory.api.util.Strings;
 
 
 /**
@@ -62,50 +63,20 @@ public class NameOrNumericIdNormalizer e
     /**
      * {@inheritDoc} 
      */
-    public Value normalize( Value value ) throws LdapException
+    @Override
+    public String normalize( String value ) throws LdapException
     {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        String strValue = value.getValue();
-
-        if ( strValue.length() == 0 )
-        {
-            return new Value( "" );
-        }
-
-        // if value is a numeric id then return it as is
-        if ( checker.isValidSyntax( strValue ) )
-        {
-            return value;
-        }
-
-        // if it is a name we need to do a lookup
-        String oid = schemaManager.getRegistries().getOid( strValue );
-
-        if ( oid != null )
-        {
-            return new Value( oid );
-        }
-
-        // if all else fails
-        throw new LdapOtherException( I18n.err( I18n.ERR_04225, value ) );
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
     }
 
 
     /**
      * {@inheritDoc} 
      */
-    public String normalize( String value ) throws LdapException
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        if ( value.length() == 0 )
+        if ( Strings.isEmpty( value ) )
         {
             return value;
         }
@@ -132,6 +103,7 @@ public class NameOrNumericIdNormalizer e
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setSchemaManager( SchemaManager schemaManager )
     {
         this.schemaManager = schemaManager;

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NoOpNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NoOpNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NoOpNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NoOpNormalizer.java Wed May 11 12:00:27 2016
@@ -20,8 +20,8 @@
 package org.apache.directory.api.ldap.model.schema.normalizers;
 
 
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 
 
 /**
@@ -49,6 +49,7 @@ public class NoOpNormalizer extends Norm
      */
     public NoOpNormalizer()
     {
+        super();
     }
 
 
@@ -57,22 +58,20 @@ public class NoOpNormalizer extends Norm
      * 
      * @param value any value
      * @return the value argument returned as-is
-     * @see org.apache.directory.api.ldap.model.schema.Normalizer#normalize(Value)
+     * @see org.apache.directory.api.ldap.model.schema.Normalizer#normalize(String)
      */
-    public Value normalize( Value value )
+    @Override
+    public String normalize( String value )
     {
         return value;
     }
 
 
     /**
-     * Returns the value argument as-is without alterations all the time.
-     * 
-     * @param value any value
-     * @return the value argument returned as-is
-     * @see org.apache.directory.api.ldap.model.schema.Normalizer#normalize(String)
+     * {@inheritDoc}
      */
-    public String normalize( String value )
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType )
     {
         return value;
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java Wed May 11 12:00:27 2016
@@ -59,6 +59,7 @@ public class NumericNormalizer extends N
     /**
      * {@inheritDoc}
      */
+    @Override
     public String normalize( String value ) throws LdapException
     {
         return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
@@ -68,6 +69,7 @@ public class NumericNormalizer extends N
     /**
      * {@inheritDoc}
      */
+    @Override
     public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( value == null )
@@ -78,8 +80,6 @@ public class NumericNormalizer extends N
         char[] chars = value.toCharArray();
         
         // Insignificant Characters Handling
-        String normValue = PrepareString.insignificantNumericStringHandling( chars );
-
-        return normValue;
+        return PrepareString.insignificantNumericStringHandling( chars );
     }
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java Wed May 11 12:00:27 2016
@@ -21,9 +21,9 @@ package org.apache.directory.api.ldap.mo
 
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.util.Strings;
 
 
@@ -47,35 +47,18 @@ public class ObjectIdentifierNormalizer
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
+    @Override
+    public String normalize( String value ) throws LdapException
     {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        String str = value.getValue().trim();
-
-        if ( str.length() == 0 )
-        {
-            return new Value( "" );
-        }
-        else if ( Character.isDigit( str.charAt( 0 ) ) )
-        {
-            // We do this test to avoid a lowerCasing which cost time
-            return new Value( str );
-        }
-        else
-        {
-            return new Value( Strings.toLowerCaseAscii( str ) );
-        }
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapException
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( value == null )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java Wed May 11 12:00:27 2016
@@ -23,8 +23,8 @@ package org.apache.directory.api.ldap.mo
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 
 
 /**
@@ -39,7 +39,7 @@ public class RegexNormalizer extends Nor
     private final Pattern[] regexes;
 
     /** the set of regular expressions used to transform values */
-    private final Matcher[] matchers;
+    private final transient Matcher[] matchers;
 
 
     /**
@@ -74,34 +74,18 @@ public class RegexNormalizer extends Nor
     /**
      * {@inheritDoc}
      */
-    public Value normalize( final Value value )
+    @Override
+    public String normalize( String value )
     {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        if ( value.isHumanReadable() )
-        {
-            String str = value.getValue();
-
-            for ( int i = 0; i < matchers.length; i++ )
-            {
-
-                str = matchers[i].replaceAll( str );
-            }
-
-            return new Value( str );
-        }
-
-        return value;
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value )
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType )
     {
         if ( value == null )
         {
@@ -112,7 +96,6 @@ public class RegexNormalizer extends Nor
 
         for ( int i = 0; i < matchers.length; i++ )
         {
-
             str = matchers[i].replaceAll( str );
         }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java Wed May 11 12:00:27 2016
@@ -21,14 +21,14 @@ package org.apache.directory.api.ldap.mo
 
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.PrepareString;
 
 
 /**
- * Normalize Telephone Number Strings
+ * Normalize Telephone Number Strings. We don't process substring differently, as we don't
+ * have any significant space in a Telephone Number.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -47,18 +47,18 @@ public class TelephoneNumberNormalizer e
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
+    @Override
+    public String normalize( String value ) throws LdapException
     {
-        String normalized = normalize( value.getValue() );
-
-        return new Value( normalized );
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
     }
-
+    
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapException
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertiontype ) throws LdapException
     {
         if ( value == null )
         {
@@ -68,8 +68,6 @@ public class TelephoneNumberNormalizer e
         char[] chars = value.toCharArray();
         
         // Insignificant Characters Handling
-        String normValue = PrepareString.insignificantTelephoneNumberStringHandling( chars );
-
-        return normValue;
+        return PrepareString.insignificantTelephoneNumberStringHandling( chars );
     }
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java Wed May 11 12:00:27 2016
@@ -22,10 +22,10 @@ package org.apache.directory.api.ldap.mo
 
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.Strings;
 
@@ -39,7 +39,7 @@ import org.apache.directory.api.util.Str
 public class UniqueMemberNormalizer extends Normalizer
 {
     /** A reference to the schema manager used to normalize the Dn */
-    private SchemaManager schemaManager;
+    private transient SchemaManager schemaManager;
 
 
     public UniqueMemberNormalizer()
@@ -48,54 +48,21 @@ public class UniqueMemberNormalizer exte
     }
 
 
-    public Value normalize( Value value ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String normalize( String value ) throws LdapException
     {
-        String nameAndUid = value.getValue();
-
-        if ( nameAndUid.length() == 0 )
-        {
-            return null;
-        }
-
-        // Let's see if we have an UID part
-        int sharpPos = nameAndUid.lastIndexOf( '#' );
-
-        if ( sharpPos != -1 )
-        {
-            // Now, check that we don't have another '#'
-            if ( nameAndUid.indexOf( '#' ) != sharpPos )
-            {
-                // Yes, we have one : this is not allowed, it should have been
-                // escaped.
-                return null;
-            }
-
-            // This is an UID if the '#' is immediately
-            // followed by a BitString, except if the '#' is
-            // on the last position
-            String uid = nameAndUid.substring( sharpPos + 1 );
-
-            if ( sharpPos > 0 )
-            {
-                Dn dn = new Dn( schemaManager, nameAndUid.substring( 0, sharpPos ) );
-
-                return new Value( dn.getName() + '#' + uid );
-            }
-            else
-            {
-                throw new IllegalStateException( I18n.err( I18n.ERR_04226, value.getClass() ) );
-            }
-        }
-        else
-        {
-            // No UID, the strValue is a Dn
-            // Return the normalized Dn
-            return new Value( new Dn( nameAndUid ).getName() );
-        }
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
     }
 
 
-    public String normalize( String value ) throws LdapException
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( Strings.isEmpty( value ) )
         {
@@ -143,6 +110,7 @@ public class UniqueMemberNormalizer exte
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setSchemaManager( SchemaManager schemaManager )
     {
         this.schemaManager = schemaManager;

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java Wed May 11 12:00:27 2016
@@ -41,6 +41,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
 import org.apache.directory.api.ldap.model.schema.MutableMatchingRule;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator;
 import org.apache.directory.api.ldap.model.schema.syntaxCheckers.OctetStringSyntaxChecker;
 import org.apache.directory.api.util.StringConstants;
@@ -96,31 +97,25 @@ public class BinaryValueAttributeTypeTes
         {
             public static final long serialVersionUID = 1L;
 
+            public String normalize( String value ) throws LdapException
+            {
+                return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
+            }
+            
 
-            public Value normalize( Value value ) throws LdapException
+            public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
             {
-                if ( !value.isHumanReadable() )
-                {
-                    byte[] val = value.getBytes();
-                    // each byte will be changed to be > 0, and spaces will be trimmed
-                    byte[] newVal = new byte[val.length];
-                    int i = 0;
-
-                    for ( byte b : val )
-                    {
-                        newVal[i++] = ( byte ) ( b & 0x007F );
-                    }
+                byte[] val = Strings.getBytesUtf8( value );
+                // each byte will be changed to be > 0, and spaces will be trimmed
+                byte[] newVal = new byte[val.length];
+                int i = 0;
 
-                    return new Value( Strings.trim( newVal ) );
+                for ( byte b : val )
+                {
+                    newVal[i++] = ( byte ) ( b & 0x007F );
                 }
 
-                throw new IllegalStateException( "expected byte[] to normalize" );
-            }
-
-
-            public String normalize( String value ) throws LdapException
-            {
-                throw new IllegalStateException( "expected byte[] to normalize" );
+                return Strings.utf8ToString( Strings.trim( newVal ) );
             }
         } );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java Wed May 11 12:00:27 2016
@@ -39,6 +39,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
 import org.apache.directory.api.ldap.model.schema.MutableMatchingRule;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator;
 import org.apache.directory.api.ldap.model.schema.syntaxCheckers.OctetStringSyntaxChecker;
@@ -93,29 +94,25 @@ public class BinaryValueTest
             public static final long serialVersionUID = 1L;
 
 
-            public Value normalize( Value value ) throws LdapException
+            public String normalize( String value ) throws LdapException
             {
-                if ( !value.isHumanReadable() )
-                {
-                    byte[] val = value.getBytes();
-                    // each byte will be changed to be > 0, and spaces will be trimmed
-                    byte[] newVal = new byte[val.length];
-                    int i = 0;
-
-                    for ( byte b : val )
-                    {
-                        newVal[i++] = ( byte ) ( b & 0x007F );
-                    }
-
-                    return new Value( Strings.trim( newVal ) );
-                }
-
-                throw new IllegalStateException( "expected byte[] to normalize" );
+                return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
             }
 
-            public String normalize( String value ) throws LdapException
+            
+            public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
             {
-                throw new IllegalStateException( "expected byte[] to normalize" );
+                byte[] val = Strings.getBytesUtf8( value );
+                // each byte will be changed to be > 0, and spaces will be trimmed
+                byte[] newVal = new byte[val.length];
+                int i = 0;
+
+                for ( byte b : val )
+                {
+                    newVal[i++] = ( byte ) ( b & 0x007F );
+                }
+
+                return Strings.utf8ToString( Strings.trim( newVal ) );
             }
         } );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java Wed May 11 12:00:27 2016
@@ -28,6 +28,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
 import org.apache.directory.api.ldap.model.schema.MutableMatchingRule;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator;
 import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
@@ -159,18 +160,13 @@ public class EntryUtils
             public static final long serialVersionUID = 1L;
 
 
-            public Value normalize( Value value ) throws LdapException
+            public String normalize( String value ) throws LdapException
             {
-                if ( value.isHumanReadable() )
-                {
-                    return new Value( Strings.toLowerCaseAscii( value.getValue() ) );
-                }
-
-                throw new IllegalStateException( I18n.err( I18n.ERR_04474 ) );
+                return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
             }
 
 
-            public String normalize( String value ) throws LdapException
+            public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
             {
                 return Strings.toLowerCaseAscii( value );
             }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java Wed May 11 12:00:27 2016
@@ -99,30 +99,25 @@ public class ValueSerializationTest
             public static final long serialVersionUID = 1L;
 
 
-            public Value normalize( Value value ) throws LdapException
+            public String normalize( String value ) throws LdapException
             {
-                if ( !value.isHumanReadable() )
-                {
-                    byte[] val = value.getBytes();
-                    // each byte will be changed to be > 0, and spaces will be trimmed
-                    byte[] newVal = new byte[val.length];
-                    int i = 0;
-
-                    for ( byte b : val )
-                    {
-                        newVal[i++] = ( byte ) ( b & 0x007F );
-                    }
-
-                    return new Value( Strings.trim( newVal ) );
-                }
-
-                throw new IllegalStateException( "expected byte[] to normalize" );
+                return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
             }
 
-            
-            public String normalize( String value ) throws LdapException
+
+            public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
             {
-                throw new IllegalStateException( "expected byte[] to normalize" );
+                byte[] val = Strings.getBytesUtf8( value );
+                // each byte will be changed to be > 0, and spaces will be trimmed
+                byte[] newVal = new byte[val.length];
+                int i = 0;
+
+                for ( byte b : val )
+                {
+                    newVal[i++] = ( byte ) ( b & 0x007F );
+                }
+
+                return Strings.utf8ToString( Strings.trim( newVal ) );
             }
         } );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java Wed May 11 12:00:27 2016
@@ -681,7 +681,7 @@ public class DnParserTest
     
     
     @Test
-    //@Ignore
+    @Ignore
     public void testDnParsing() throws LdapInvalidDnException
     {
         long[] deltas = new long[10];

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizerTest.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizerTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizerTest.java Wed May 11 12:00:27 2016
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.mo
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.schema.normalizers.BooleanNormalizer;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -48,7 +47,7 @@ public class BooleanNormalizerTest
     @Test
     public void testNormalizeNullValue() throws Exception
     {
-        assertNull( normalizer.normalize( ( Value ) null ) );
+        assertNull( normalizer.normalize( null ) );
     }
 
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/DummyNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/DummyNormalizer.java?rev=1743342&r1=1743341&r2=1743342&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/DummyNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/DummyNormalizer.java Wed May 11 12:00:27 2016
@@ -21,9 +21,10 @@ package org.apache.directory.api.ldap.mo
 
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.PrepareString.AssertionType;
 import org.apache.directory.api.util.Strings;
 
 
@@ -48,23 +49,16 @@ public class DummyNormalizer extends Nor
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
+    public String normalize( String value ) throws LdapException
     {
-        String str = value.getValue();
-
-        if ( Strings.isEmpty( str ) )
-        {
-            return new Value( str );
-        }
-
-        return new Value( str );
+        return normalize( value, AssertionType.ATTRIBUTE_VALUE );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapException
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
         if ( Strings.isEmpty( value ) )
         {



Mime
View raw message