You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/03/27 23:50:34 UTC

svn commit: r928296 [1/3] - in /directory: apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/ apacheds/trunk/core-entry/...

Author: elecharny
Date: Sat Mar 27 22:50:33 2010
New Revision: 928296

URL: http://svn.apache.org/viewvc?rev=928296&view=rev
Log:
o Merged ClientBinaryValue and ServerBinaryValue
o Started to merge ClientStringValue and ServerStringValue

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java
      - copied, changed from r928092, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java
      - copied, changed from r928092, directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueTest.java
      - copied, changed from r927043, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/EntryUtils.java
Removed:
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerBinaryValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValueTest.java
Modified:
    directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlIndex.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
    directory/apacheds/trunk/core-mock/src/main/java/org/apache/directory/server/core/MockCoreSession.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
    directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SchemaSearchIT.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerStringValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/FilterParser.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVA.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVASerializer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/SimpleNameComponentNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ConcreteNameComponentNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntryTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/normalizers/BooleanNormalizerTest.java

Modified: directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlIndex.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlIndex.java (original)
+++ directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlIndex.java Sat Mar 27 22:50:33 2010
@@ -29,7 +29,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.server.xdbm.Tuple;
 import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
@@ -300,7 +300,7 @@ public class AvlIndex<K, O> implements I
         }
         else
         {
-            return ( K ) normalizer.normalize( new ClientBinaryValue( ( byte[] ) attrVal ) ).get();
+            return ( K ) normalizer.normalize( new BinaryValue( ( byte[] ) attrVal ) ).get();
         }
     }
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java Sat Mar 27 22:50:33 2010
@@ -23,8 +23,8 @@ package org.apache.directory.server.core
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -181,7 +181,7 @@ public class CompareOperationContext ext
                     ( ( !value.isBinary() ) ?
                             value.getString() :
                             ( ( value.isBinary() ) ?
-                                    StringTools.dumpBytes( ((ClientBinaryValue)value).getReference() ) : 
+                                    StringTools.dumpBytes( ((BinaryValue)value).getReference() ) : 
                                         "unknown value type" ) )
                         + "'"
                     : "" );

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java Sat Mar 27 22:50:33 2010
@@ -19,8 +19,8 @@
  */
 package org.apache.directory.server.core.entry;
 import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -270,7 +270,7 @@ public class TestServerEntryUtils
                         newVal[i++] = (byte)(b & 0x007F); 
                     }
                     
-                    return new ClientBinaryValue( StringTools.trim( newVal ) );
+                    return new BinaryValue( StringTools.trim( newVal ) );
                 }
 
                 throw new IllegalStateException( I18n.err( I18n.ERR_474 ) );

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Sat Mar 27 22:50:33 2010
@@ -43,12 +43,11 @@ import java.util.Set;
 import javax.naming.directory.InvalidAttributeValueException;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -85,7 +84,7 @@ public class DefaultServerAttributeTest
     private static AttributeType atPwd;
 
     private static final Value<String> NULL_STRING_VALUE = new ClientStringValue( null );
-    private static final Value<byte[]> NULL_BINARY_VALUE = new ClientBinaryValue( null );
+    private static final Value<byte[]> NULL_BINARY_VALUE = new BinaryValue( (byte[])null );
     private static final byte[] BYTES1 = new byte[]{ 'a', 'b' };
     private static final byte[] BYTES2 = new byte[]{ 'b' };
     private static final byte[] BYTES3 = new byte[]{ 'c' };
@@ -96,10 +95,10 @@ public class DefaultServerAttributeTest
     private static final ClientStringValue STR_VALUE3 = new ClientStringValue( "c" );
     private static final ClientStringValue STR_VALUE4 = new ClientStringValue( "d" );
 
-    private static final ClientBinaryValue BIN_VALUE1 = new ClientBinaryValue( BYTES1 );
-    private static final ClientBinaryValue BIN_VALUE2 = new ClientBinaryValue( BYTES2 );
-    private static final ClientBinaryValue BIN_VALUE3 = new ClientBinaryValue( BYTES3 );
-    private static final ClientBinaryValue BIN_VALUE4 = new ClientBinaryValue( BYTES4 );
+    private static final BinaryValue BIN_VALUE1 = new BinaryValue( BYTES1 );
+    private static final BinaryValue BIN_VALUE2 = new BinaryValue( BYTES2 );
+    private static final BinaryValue BIN_VALUE3 = new BinaryValue( BYTES3 );
+    private static final BinaryValue BIN_VALUE4 = new BinaryValue( BYTES4 );
 
         
     /**
@@ -620,7 +619,7 @@ public class DefaultServerAttributeTest
         
         EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
         
-        nbAdded = attr2.add( new ServerBinaryValue( atPwd, null ) );
+        nbAdded = attr2.add( new BinaryValue( atPwd, null ) );
         assertEquals( 1, nbAdded );
         assertFalse( attr2.isHR() );
         assertEquals( NULL_BINARY_VALUE, attr2.get() );
@@ -635,7 +634,7 @@ public class DefaultServerAttributeTest
         
         EntryAttribute attr4 = new DefaultServerAttribute( atCN );
         
-        nbAdded = attr4.add( new ServerBinaryValue( atPwd, BYTES1 ), new ServerBinaryValue( atPwd, BYTES2 ) );
+        nbAdded = attr4.add( new BinaryValue( atPwd, BYTES1 ), new BinaryValue( atPwd, BYTES2 ) );
         assertEquals( 0, nbAdded );
         assertTrue( attr4.isHR() );
         assertFalse( attr4.contains( BYTES1 ) );
@@ -643,7 +642,7 @@ public class DefaultServerAttributeTest
         
         EntryAttribute attr5 = new DefaultServerAttribute( atCN );
         
-        nbAdded = attr5.add( new ServerStringValue( atCN, "c" ), new ServerBinaryValue( atPwd, BYTES1 ) );
+        nbAdded = attr5.add( new ServerStringValue( atCN, "c" ), new BinaryValue( atPwd, BYTES1 ) );
         assertEquals( 1, nbAdded );
         assertTrue( attr5.isHR() );
         assertFalse( attr5.contains( "ab" ) );
@@ -651,7 +650,7 @@ public class DefaultServerAttributeTest
 
         EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
         
-        nbAdded = attr6.add( new ServerBinaryValue( atPwd, BYTES1 ), new ServerStringValue( atCN, "c" ) );
+        nbAdded = attr6.add( new BinaryValue( atPwd, BYTES1 ), new ServerStringValue( atCN, "c" ) );
         assertEquals( 1, nbAdded );
         assertFalse( attr6.isHR() );
         assertTrue( attr6.contains( BYTES1 ) );
@@ -659,7 +658,7 @@ public class DefaultServerAttributeTest
 
         EntryAttribute attr7 = new DefaultServerAttribute( atPwd );
         
-        nbAdded = attr7.add( new ServerBinaryValue( atPwd, null ), new ServerStringValue( atCN, "c" ) );
+        nbAdded = attr7.add( new BinaryValue( atPwd, null ), new ServerStringValue( atCN, "c" ) );
         assertEquals( 1, nbAdded );
         assertFalse( attr7.isHR() );
         assertTrue( attr7.contains( NULL_BINARY_VALUE ) );
@@ -667,7 +666,7 @@ public class DefaultServerAttributeTest
 
         EntryAttribute attr8 = new DefaultServerAttribute( atCN );
         
-        nbAdded = attr8.add( new ServerStringValue( atCN, null ), new ServerBinaryValue( atPwd, BYTES1 ) );
+        nbAdded = attr8.add( new ServerStringValue( atCN, null ), new BinaryValue( atPwd, BYTES1 ) );
         assertEquals( 1, nbAdded );
         assertTrue( attr8.isHR() );
         assertTrue( attr8.contains( NULL_STRING_VALUE ) );
@@ -684,7 +683,7 @@ public class DefaultServerAttributeTest
 
         EntryAttribute attr10 = new DefaultServerAttribute( atPwd );
         
-        nbAdded = attr10.add( new ClientBinaryValue( null ), new ClientBinaryValue( BYTES1 ) );
+        nbAdded = attr10.add( new BinaryValue( (byte[])null ), new BinaryValue( BYTES1 ) );
         assertEquals( 2, nbAdded );
         assertFalse( attr10.isHR() );
         assertTrue( attr10.contains( NULL_BINARY_VALUE ) );

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java Sat Mar 27 22:50:33 2010
@@ -41,15 +41,14 @@ import javax.naming.directory.Attributes
 import javax.naming.directory.BasicAttributes;
 
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -389,7 +388,7 @@ public class DefaultServerEntryTest
         assertTrue( attributeSN.contains( value1 ) );
         assertTrue( attributeSN.contains( value2 ) );
          
-        Value<byte[]> value4 = new ServerBinaryValue( atPwd, BYTES1 );
+        Value<byte[]> value4 = new BinaryValue( atPwd, BYTES1 );
         entry.add( "l", value1, value4 );
         assertEquals( 3, entry.size() );
         EntryAttribute attributeL = entry.get( "l" );
@@ -478,9 +477,9 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
-        Value<byte[]> binValue2 = new ServerBinaryValue( atPwd, BYTES2 );
-        Value<byte[]> binValue3 = new ServerBinaryValue( atPwd, BYTES3 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
+        Value<byte[]> binValue3 = new BinaryValue( atPwd, BYTES3 );
         
         try
         {
@@ -596,9 +595,9 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
-        Value<byte[]> binValue2 = new ServerBinaryValue( atPwd, BYTES2 );
-        Value<byte[]> binValue3 = new ServerBinaryValue( atPwd, BYTES3 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
+        Value<byte[]> binValue3 = new BinaryValue( atPwd, BYTES3 );
         
         try
         {
@@ -765,9 +764,9 @@ public class DefaultServerEntryTest
         Value<String> test2 = new ServerStringValue( atCN, "test2" );
         Value<String> test3 = new ServerStringValue( atCN, "test3" );
         
-        Value<byte[]> testB1 = new ServerBinaryValue( atPassword, b1 );
-        Value<byte[]> testB2 = new ServerBinaryValue( atPassword, b2 );
-        Value<byte[]> testB3 = new ServerBinaryValue( atPassword, b3 );
+        Value<byte[]> testB1 = new BinaryValue( atPassword, b1 );
+        Value<byte[]> testB2 = new BinaryValue( atPassword, b2 );
+        Value<byte[]> testB3 = new BinaryValue( atPassword, b3 );
         
         // Test a simple addition in atCN
         entry.add( atCN, test1 );
@@ -979,9 +978,9 @@ public class DefaultServerEntryTest
         Value<String> test2 = new ServerStringValue( atCN, "test2" );
         Value<String> test3 = new ServerStringValue( atCN, "test3" );
         
-        Value<byte[]> testB1 = new ServerBinaryValue( atPassword, b1 );
-        Value<byte[]> testB2 = new ServerBinaryValue( atPassword, b2 );
-        Value<byte[]> testB3 = new ServerBinaryValue( atPassword, b3 );
+        Value<byte[]> testB1 = new BinaryValue( atPassword, b1 );
+        Value<byte[]> testB2 = new BinaryValue( atPassword, b2 );
+        Value<byte[]> testB3 = new BinaryValue( atPassword, b3 );
         
         // Test a simple addition in atCN
         entry.add( "cN", test1 );
@@ -1196,9 +1195,9 @@ public class DefaultServerEntryTest
         Value<String> test2 = new ServerStringValue( atCN, "test2" );
         Value<String> test3 = new ServerStringValue( atCN, "test3" );
         
-        Value<byte[]> testB1 = new ServerBinaryValue( atPassword, b1 );
-        Value<byte[]> testB2 = new ServerBinaryValue( atPassword, b2 );
-        Value<byte[]> testB3 = new ServerBinaryValue( atPassword, b3 );
+        Value<byte[]> testB1 = new BinaryValue( atPassword, b1 );
+        Value<byte[]> testB2 = new BinaryValue( atPassword, b2 );
+        Value<byte[]> testB3 = new BinaryValue( atPassword, b3 );
         
         // Test a simple addition in atCN
         entry.add( "cN", atCN, test1 );
@@ -1409,10 +1408,10 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
-        Value<byte[]> binValue2 = new ServerBinaryValue( atPwd, BYTES2 );
-        Value<byte[]> binValue3 = new ServerBinaryValue( atPwd, BYTES3 );
-        Value<byte[]> binNullValue = new ServerBinaryValue( atPwd, null );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
+        Value<byte[]> binValue3 = new BinaryValue( atPwd, BYTES3 );
+        Value<byte[]> binNullValue = new BinaryValue( atPwd, null );
 
         assertFalse( entry.contains( (String)null, strValue1 ) );
         assertFalse( entry.contains( atCN, binValue1 ) );
@@ -1530,10 +1529,10 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
-        Value<byte[]> binValue2 = new ServerBinaryValue( atPwd, BYTES2 );
-        Value<byte[]> binValue3 = new ServerBinaryValue( atPwd, BYTES3 );
-        Value<byte[]> binNullValue = new ServerBinaryValue( atPwd, null );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
+        Value<byte[]> binValue3 = new BinaryValue( atPwd, BYTES3 );
+        Value<byte[]> binNullValue = new BinaryValue( atPwd, null );
 
         assertTrue( entry.contains( "CN", strValue1, strValue2 ) );
         assertTrue( entry.contains( "userpassword", binValue1, binValue2, binNullValue ) );
@@ -2007,7 +2006,7 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
 
         try
         {
@@ -2254,7 +2253,7 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
 
         try
         {
@@ -2473,7 +2472,7 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
 
         try
         {
@@ -3268,7 +3267,7 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
 
         EntryAttribute attrPWD = new DefaultServerAttribute( atCN, "test1", (String)null, "test2" );
 
@@ -3461,7 +3460,7 @@ public class DefaultServerEntryTest
         Value<String> strValue3 = new ServerStringValue( atCN, "test3" );
         Value<String> strNullValue = new ServerStringValue( atCN, null);
 
-        Value<byte[]> binValue1 = new ServerBinaryValue( atPwd, BYTES1 );
+        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
 
         EntryAttribute attrPWD = new DefaultServerAttribute( atCN, "test1", (String)null, "test2" );
 
@@ -3500,8 +3499,8 @@ public class DefaultServerEntryTest
         Value<String> test1 = new ServerStringValue( atCN, "test1" );
         Value<String> test2 = new ServerStringValue( atCN, "test2" );
         
-        Value<byte[]> testB1 = new ServerBinaryValue( atPassword, b1 );
-        Value<byte[]> testB2 = new ServerBinaryValue( atPassword, b2 );
+        Value<byte[]> testB1 = new BinaryValue( atPassword, b1 );
+        Value<byte[]> testB2 = new BinaryValue( atPassword, b2 );
         
         // test a removal of an non existing attribute
         List<EntryAttribute> removed = entry.removeAttributes( atCN );
@@ -3846,9 +3845,9 @@ public class DefaultServerEntryTest
         Value<String> strValuePerson = new ClientStringValue( "person" );
         Value<String> strNullValue = new ClientStringValue( null);
 
-        Value<byte[]> binValue1 = new ClientBinaryValue( BYTES1 );
-        Value<byte[]> binValue2 = new ClientBinaryValue( BYTES2 );
-        Value<byte[]> binNullValue = new ClientBinaryValue( null );
+        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
+        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
+        Value<byte[]> binNullValue = new BinaryValue( (byte[])null );
         
         entry.put( "ObjectClass", atOC, strValueTop, strValuePerson, strNullValue );
         entry.put( "UserPassword", atPwd, binValue1, binValue2, binNullValue );

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java Sat Mar 27 22:50:33 2010
@@ -38,7 +38,7 @@ import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -296,7 +296,7 @@ public class ServerStringValueTest
         ServerStringValue value3 = new ServerStringValue( at1, "TEST" );
         ServerStringValue value4 = new ServerStringValue( at1, "tes" );
         ServerStringValue value5 = new ServerStringValue( at1, null );
-        ServerBinaryValue valueBytes = new ServerBinaryValue( at2, new byte[]{0x01} );
+        BinaryValue valueBytes = new BinaryValue( at2, new byte[]{0x01} );
         ServerStringValue valueString = new ServerStringValue( at, "test" );
         
         assertTrue( value1.equals( value1 ) );

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Sat Mar 27 22:50:33 2010
@@ -58,10 +58,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeTypeException;
@@ -758,7 +758,7 @@ public abstract class ServerDirContext e
 
                 if ( value instanceof byte[] )
                 {
-                    node = new EqualityNode<byte[]>( attr.getID(), new ClientBinaryValue( ( byte[] ) value ) );
+                    node = new EqualityNode<byte[]>( attr.getID(), new BinaryValue( ( byte[] ) value ) );
                 }
                 else
                 {

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Sat Mar 27 22:50:33 2010
@@ -38,7 +38,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.NotImplementedException;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -220,11 +220,11 @@ public class ServerLdapContext extends S
         {
             if ( value instanceof String )
             {
-                val = new ServerBinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
             }
             else if ( value instanceof byte[] )
             {
-                val = new ServerBinaryValue( attributeType, (byte[])value );
+                val = new BinaryValue( attributeType, (byte[])value );
             }
             else
             {

Modified: directory/apacheds/trunk/core-mock/src/main/java/org/apache/directory/server/core/MockCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-mock/src/main/java/org/apache/directory/server/core/MockCoreSession.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core-mock/src/main/java/org/apache/directory/server/core/MockCoreSession.java (original)
+++ directory/apacheds/trunk/core-mock/src/main/java/org/apache/directory/server/core/MockCoreSession.java Sat Mar 27 22:50:33 2010
@@ -45,8 +45,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
@@ -210,11 +210,11 @@ public class MockCoreSession implements 
         {
             if ( value instanceof String )
             {
-                val = new ServerBinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
             }
             else if ( value instanceof byte[] )
             {
-                val = new ServerBinaryValue( attributeType, (byte[])value );
+                val = new BinaryValue( attributeType, (byte[])value );
             }
             else
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java Sat Mar 27 22:50:33 2010
@@ -45,8 +45,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
@@ -210,11 +210,11 @@ public class DefaultCoreSession implemen
         {
             if ( value instanceof String )
             {
-                val = new ServerBinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
             }
             else if ( value instanceof byte[] )
             {
-                val = new ServerBinaryValue( attributeType, (byte[])value );
+                val = new BinaryValue( attributeType, (byte[])value );
             }
             else
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sat Mar 27 22:50:33 2010
@@ -54,17 +54,16 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.cursor.EmptyCursor;
 import org.apache.directory.shared.ldap.cursor.SingletonCursor;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapAttributeInUseException;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -545,7 +544,7 @@ public class SchemaInterceptor extends B
             {
                 try
                 {
-                    return new ClientBinaryValue( ( ( String ) value ).getBytes( "UTF-8" ) );
+                    return new BinaryValue( ( ( String ) value ).getBytes( "UTF-8" ) );
                 }
                 catch ( UnsupportedEncodingException uee )
                 {
@@ -1498,7 +1497,7 @@ public class SchemaInterceptor extends B
 
                 for ( Value<?> value : attribute )
                 {
-                    binaries.add( new ServerBinaryValue( attribute.getAttributeType(),
+                    binaries.add( new BinaryValue( attribute.getAttributeType(),
                         value.getBytes() ) );
                 }
 
@@ -1973,7 +1972,7 @@ public class SchemaInterceptor extends B
             {
                 continue;
             }
-            else if ( value instanceof ServerBinaryValue )
+            else if ( value instanceof BinaryValue )
             {
                 // we have a byte[] value. It should be a String UTF-8 encoded
                 // Let's transform it
@@ -2011,7 +2010,7 @@ public class SchemaInterceptor extends B
         // Loop on each values
         for ( Value<?> value : attribute )
         {
-            if ( value instanceof ServerBinaryValue )
+            if ( value instanceof BinaryValue )
             {
                 continue;
             }

Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Sat Mar 27 22:50:33 2010
@@ -60,11 +60,11 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
@@ -136,7 +136,7 @@ public class KeyDerivationInterceptor ex
         {
             log.debug( "Adding the entry '{}' for DN '{}'.", entry, normName.getName() );
 
-            ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+            BinaryValue userPassword = (BinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
             String strUserPassword = userPassword.getString();
 
             if ( log.isDebugEnabled() )
@@ -248,15 +248,15 @@ public class KeyDerivationInterceptor ex
                     password = ((ServerStringValue)firstValue).getString();
                     log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, password );
                 }
-                else if ( firstValue instanceof ServerBinaryValue )
+                else if ( firstValue instanceof BinaryValue )
                 {
-                    password = ((ServerBinaryValue)firstValue).getString();
+                    password = ((BinaryValue)firstValue).getString();
 
                     if ( log.isDebugEnabled() )
                     {
                         StringBuffer sb = new StringBuffer();
                         sb.append( "'" + password + "' ( " );
-                        sb.append( StringTools.dumpBytes( ((ServerBinaryValue)firstValue).getBytes() ).trim() );
+                        sb.append( StringTools.dumpBytes( ((BinaryValue)firstValue).getBytes() ).trim() );
                         sb.append( " )" );
                         log.debug( "{} Attribute id : 'userPassword',  Values : [ {} ]", operation, sb.toString() );
                     }

Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java Sat Mar 27 22:50:33 2010
@@ -26,9 +26,9 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
@@ -77,7 +77,7 @@ public class PasswordPolicyInterceptor e
         {
             String username = null;
 
-            ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+            BinaryValue userPassword = (BinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
 
             // The password is stored in a non H/R attribute, but it's a String
             String strUserPassword = userPassword.getString();
@@ -151,9 +151,9 @@ public class PasswordPolicyInterceptor e
                         log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, attr );
                         pwd = ((ServerStringValue)userPassword).getString();
                     }
-                    else if ( userPassword instanceof ServerBinaryValue )
+                    else if ( userPassword instanceof BinaryValue )
                     {
-                        ServerBinaryValue password = (ServerBinaryValue)userPassword;
+                        BinaryValue password = (BinaryValue)userPassword;
                         
                         String string = password.getString();
 

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Sat Mar 27 22:50:33 2010
@@ -37,7 +37,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.server.xdbm.Tuple;
 import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -687,7 +687,7 @@ public class JdbmIndex<K, O> implements 
             else
             {
                 normalized = ( K ) attribute.getEquality().getNormalizer().normalize(
-                    new ClientBinaryValue( ( byte[] ) attrVal ) ).get();
+                    new BinaryValue( ( byte[] ) attrVal ) ).get();
             }
 
             // Double map it so if we use an already normalized

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SchemaSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SchemaSearchIT.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SchemaSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SchemaSearchIT.java Sat Mar 27 22:50:33 2010
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
@@ -323,4 +324,34 @@ public class SchemaSearchIT extends Abst
 
         result.close();
     }
+
+    
+    /**
+     * Test a search done on cn=schema 
+     */
+    @Test
+    public void testSubSchemaSubEntrySearch() throws Exception
+    {
+        DirContext ctx = getWiredContext( ldapServer );
+        
+        SearchControls searchControls = new SearchControls();
+        searchControls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        searchControls.setReturningAttributes( new String[]{ "objectClasses" } );
+        NamingEnumeration<SearchResult> results = ctx.search( "cn=schema", "(ObjectClass=*)", searchControls );
+
+        assertTrue( results.hasMore() );
+        SearchResult result = results.next();
+        Attributes entry = result.getAttributes();
+
+        Attribute objectClasses = entry.get( "objectClasses" ); 
+        NamingEnumeration<?> ocs = objectClasses.getAll();
+
+        while ( ocs.hasMore() )
+        {
+            String oc = (String)ocs.nextElement();
+            System.out.println( oc );
+        }
+
+        results.close();
+    }
 }

Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java Sat Mar 27 22:50:33 2010
@@ -23,8 +23,8 @@ package org.apache.directory.server.xdbm
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.filter.AndNode;
@@ -147,7 +147,7 @@ public class FilterNormalizingVisitor im
             }
             else
             {
-                normalized = new ClientBinaryValue( ( byte[] ) ncn.normalizeByName( attribute, value.getBytes() ) );
+                normalized = new BinaryValue( ( byte[] ) ncn.normalizeByName( attribute, value.getBytes() ) );
             }
 
             return normalized;

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java (original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java Sat Mar 27 22:50:33 2010
@@ -61,8 +61,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.search.PresentFilter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
@@ -2480,7 +2480,7 @@ public class Dsmlv2Grammar extends Abstr
                 {
                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
                     {
-                        Value<byte[]> value = new ClientBinaryValue( Base64.decode( nextText.trim().toCharArray() ) );
+                        Value<byte[]> value = new BinaryValue( Base64.decode( nextText.trim().toCharArray() ) );
                         assertion.setAssertionValue( value );
                     }
                     else
@@ -2618,7 +2618,7 @@ public class Dsmlv2Grammar extends Abstr
                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
                     {
                         filter.setMatchValue( 
-                            new ClientBinaryValue( 
+                            new BinaryValue( 
                                 Base64.decode( nextText.trim().toCharArray() ) ) );
                     }
                     else

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Sat Mar 27 22:50:33 2010
@@ -615,6 +615,9 @@ public class I18n
     public static final String ERR_04470 = "ERR_04470";
     public static final String ERR_04471 = "ERR_04471";
     public static final String ERR_04472 = "ERR_04472";
+    public static final String ERR_04473 = "ERR_04473";
+    public static final String ERR_04474 = "ERR_04474";
+    public static final String ERR_04475 = "ERR_04475";
 
 	// ldap-constants
 	public static final String ERR_05001 = "ERR_05001";

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties (original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties Sat Mar 27 22:50:33 2010
@@ -574,9 +574,9 @@ ERR_04469=Cannot use standard serializat
 ERR_04470=Cannot read the attribute as it's OID ('{0}') does not exist
 ERR_04471=Cannot serialize a Modification with no attribute
 ERR_04472=The attribute '{0}' is incorrect
-
-
-
+ERR_04473=Not a valid value
+ERR_04474=Expected string to normalize
+ERR_04475=Expected byte[] to normalize
 
 # ldap-constants
 ERR_05001=Unknown AuthenticationLevel {0}

Modified: directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g Sat Mar 27 22:50:33 2010
@@ -29,7 +29,7 @@ import java.util.Map;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import javax.naming.NameParser;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.schema.parsers.ParserMonitor;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -315,8 +315,8 @@ attributeTypeAndValue [RDN rdn] returns 
                     ava = new AVA(
                         type,
                         type,
-                        new ClientBinaryValue( (byte[])value.value ), 
-                        new ClientBinaryValue( (byte[])value.value ),
+                        new BinaryValue( (byte[])value.value ), 
+                        new BinaryValue( (byte[])value.value ),
                         upName
                     );
                 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java Sat Mar 27 22:50:33 2010
@@ -28,8 +28,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -70,11 +70,11 @@ public class InitAssertionValueFilterAct
 
         if ( tlv.getLength() != 0 )
         {
-            assertionValue = new ClientBinaryValue( tlv.getValue().getData() );
+            assertionValue = new BinaryValue( tlv.getValue().getData() );
         }
         else
         {
-            assertionValue = new ClientBinaryValue( StringTools.EMPTY_BYTES );
+            assertionValue = new BinaryValue( StringTools.EMPTY_BYTES );
         }
 
         AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) searchRequest
@@ -85,11 +85,11 @@ public class InitAssertionValueFilterAct
         {
             if ( tlv.getLength() != 0 )
             {
-                assertionValue = new ClientBinaryValue( tlv.getValue().getData() );
+                assertionValue = new BinaryValue( tlv.getValue().getData() );
             }
             else
             {
-                assertionValue = new ClientBinaryValue( StringTools.EMPTY_BYTES );
+                assertionValue = new BinaryValue( StringTools.EMPTY_BYTES );
             }
             
             assertion.setAssertionValue( assertionValue );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java?rev=928296&r1=928295&r2=928296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java Sat Mar 27 22:50:33 2010
@@ -27,7 +27,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,7 +66,7 @@ public class StoreMatchValueAction exten
             .getTerminalFilter();
         
         byte[] value = tlv.getValue().getData();
-        extensibleMatchFilter.setMatchValue( new ClientBinaryValue( value ) );
+        extensibleMatchFilter.setMatchValue( new BinaryValue( value ) );
 
         // unstack the filters if needed
         searchRequest.unstackFilters( container );

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java (from r928092, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.java&r1=928092&r2=928296&rev=928296&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java Sat Mar 27 22:50:33 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.directory.shared.ldap.entry.client;
+package org.apache.directory.shared.ldap.entry;
 
 
 import java.io.Externalizable;
@@ -24,14 +24,14 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Arrays;
+import java.util.Comparator;
 
 import org.apache.directory.shared.ldap.exception.LdapException;
 
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.NotImplementedException;
-import org.apache.directory.shared.ldap.entry.AbstractValue;
-import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapComparator;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -48,38 +48,64 @@ import org.slf4j.LoggerFactory;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ClientBinaryValue extends AbstractValue<byte[]>
+public class BinaryValue extends AbstractValue<byte[]>
 {
     /** Used for serialization */
     protected static final long serialVersionUID = 2L;
     
     /** logger for reporting errors that might not be handled properly upstream */
-    protected static final Logger LOG = LoggerFactory.getLogger( ClientBinaryValue.class );
+    protected static final Logger LOG = LoggerFactory.getLogger( BinaryValue.class );
     
     /** reference to the attributeType which is not serialized */
     protected transient AttributeType attributeType;
 
     /**
-     * Creates a ServerBinaryValue without an initial wrapped value.
+     * Creates a BinaryValue without an initial wrapped value.
      *
-     * @param attributeType the schema type associated with this ServerBinaryValue
+     * @param attributeType the schema type associated with this BinaryValue
      */
-    public ClientBinaryValue()
+    public BinaryValue()
     {
         wrapped = null;
         normalized = false;
         valid = null;
         normalizedValue = null;
     }
+    
+    
+    /**
+     * Creates a BinaryValue without an initial wrapped value.
+     *
+     * @param attributeType the schema type associated with this BinaryValue
+     */
+    public BinaryValue( AttributeType attributeType )
+    {
+        if ( attributeType == null )
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) );
+        }
+
+        if ( attributeType.getSyntax() == null )
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) );
+        }
+
+        if ( attributeType.getSyntax().isHumanReadable() )
+        {
+            LOG.warn( "Treating a value of a human readible attribute {} as binary: ", attributeType.getName() );
+        }
+
+        this.attributeType = attributeType;
+    }
 
 
     /**
-     * Creates a ServerBinaryValue with an initial wrapped binary value.
+     * Creates a BinaryValue with an initial wrapped binary value.
      *
-     * @param attributeType the schema type associated with this ServerBinaryValue
+     * @param attributeType the schema type associated with this BinaryValue
      * @param wrapped the binary value to wrap which may be null, or a zero length byte array
      */
-    public ClientBinaryValue( byte[] wrapped )
+    public BinaryValue( byte[] wrapped )
     {
         if ( wrapped != null )
         {
@@ -95,6 +121,19 @@ public class ClientBinaryValue extends A
         valid = null;
         normalizedValue = null;
     }
+    
+    
+    /**
+     * Creates a BinaryValue with an initial wrapped binary value.
+     *
+     * @param attributeType the schema type associated with this BinaryValue
+     * @param wrapped the binary value to wrap which may be null, or a zero length byte array
+     */
+    public BinaryValue( AttributeType attributeType, byte[] wrapped )
+    {
+        this( attributeType );
+        this.wrapped = wrapped;
+    }
 
 
     // -----------------------------------------------------------------------
@@ -152,6 +191,38 @@ public class ClientBinaryValue extends A
     }
 
 
+    /**
+     * Get the associated AttributeType
+     * @return The AttributeType
+     */
+    public AttributeType getAttributeType()
+    {
+        return attributeType;
+    }
+
+
+    /**
+     * Check if the value is stored into an instance of the given 
+     * AttributeType, or one of its ascendant.
+     * 
+     * For instance, if the Value is associated with a CommonName,
+     * checking for Name will match.
+     * 
+     * @param attributeType The AttributeType we are looking at
+     * @return <code>true</code> if the value is associated with the given
+     * attributeType or one of its ascendant
+     */
+    public boolean instanceOf( AttributeType attributeType ) throws LdapException
+    {
+        if ( this.attributeType.equals( attributeType ) )
+        {
+            return true;
+        }
+
+        return this.attributeType.isDescendantOf( attributeType );
+    }
+
+
     // -----------------------------------------------------------------------
     // ServerValue<String> Methods
     // -----------------------------------------------------------------------
@@ -166,14 +237,93 @@ public class ClientBinaryValue extends A
      */
     public byte[] getNormalizedValueCopy()
     {
-        if ( normalizedValue == null )
+        if ( isNull() )
         {
             return null;
         }
 
-        byte[] copy = new byte[ normalizedValue.length ];
-        System.arraycopy( normalizedValue, 0, copy, 0, normalizedValue.length );
-        return copy;
+        if ( !normalized )
+        {      
+            try
+            {
+                normalize();
+            }
+            catch ( LdapException ne )
+            {
+                String message = "Cannot normalize the value :" + ne.getLocalizedMessage();
+                LOG.warn( message );
+                normalized = false;
+            }
+        }
+
+        if ( normalizedValue != null )
+        {
+            byte[] copy = new byte[ normalizedValue.length ];
+            System.arraycopy( normalizedValue, 0, copy, 0, normalizedValue.length );
+            return copy;
+        }
+        else
+        {
+            return StringTools.EMPTY_BYTES;
+        }
+    }
+    
+    
+    /**
+     * Gets the normalized (canonical) representation for the wrapped string.
+     * If the wrapped String is null, null is returned, otherwise the normalized
+     * form is returned.  If no the normalizedValue is null, then this method
+     * will attempt to generate it from the wrapped value: repeated calls to
+     * this method do not unnecessarily normalize the wrapped value.  Only changes
+     * to the wrapped value result in attempts to normalize the wrapped value.
+     *
+     * @return a reference to the normalized version of the wrapped value
+     */
+    public byte[] getNormalizedValueReference()
+    {
+        if ( isNull() )
+        {
+            return null;
+        }
+
+        if ( !isNormalized() )
+        {
+            try
+            {
+                normalize();
+            }
+            catch ( LdapException ne )
+            {
+                String message = "Cannot normalize the value :" + ne.getLocalizedMessage();
+                LOG.warn( message );
+                normalized = false;
+            }
+        }
+
+        if ( normalizedValue != null )
+        {
+            return normalizedValue;
+        }
+        else
+        {
+            return wrapped;
+        }
+    }
+
+    
+    /**
+     * Gets the normalized (canonical) representation for the wrapped byte[].
+     * If the wrapped byte[] is null, null is returned, otherwise the normalized
+     * form is returned.  If the normalizedValue is null, then this method
+     * will attempt to generate it from the wrapped value: repeated calls to
+     * this method do not unnecessarily normalize the wrapped value.  Only changes
+     * to the wrapped value result in attempts to normalize the wrapped value.
+     *
+     * @return gets the normalized value
+     */
+    public byte[] getNormalizedValue()
+    {
+        return getNormalizedValueCopy();
     }
 
 
@@ -203,6 +353,37 @@ public class ClientBinaryValue extends A
                 same = Arrays.equals( wrapped, normalizedValue );
             }
         }
+        else
+        {
+            normalizedValue = wrapped;
+            normalized = false;
+            same = true;
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void normalize() throws LdapException
+    {
+        if ( isNormalized() )
+        {
+            // Bypass the normalization if it has already been done. 
+            return;
+        }
+
+        if ( attributeType != null )
+        {
+            Normalizer normalizer = getNormalizer();
+            normalize( normalizer );
+        }
+        else
+        {
+            normalizedValue = wrapped;
+            normalized = true;
+            same = true;
+        }
     }
 
     
@@ -233,16 +414,36 @@ public class ClientBinaryValue extends A
             }
         }
 
-        if ( value instanceof ClientBinaryValue )
+        BinaryValue binaryValue = ( BinaryValue ) value;
+        
+        if ( attributeType != null )
         {
-            ClientBinaryValue binaryValue = ( ClientBinaryValue ) value;
+            try
+            {
+                Comparator<byte[]> comparator = (Comparator<byte[]>)getLdapComparator();
 
+                if ( comparator != null )
+                {
+                    return comparator
+                        .compare( getNormalizedValueReference(), binaryValue.getNormalizedValueReference() );
+                }
+                else
+                {
+                    return new ByteArrayComparator( null ).compare( getNormalizedValueReference(), binaryValue
+                        .getNormalizedValueReference() );
+                }
+            }
+            catch ( LdapException e )
+            {
+                String msg = I18n.err( I18n.ERR_04443, Arrays.toString( getReference() ), value );
+                LOG.error( msg, e );
+                throw new IllegalStateException( msg, e );
+            }
+        }
+        else
+        {
             return new ByteArrayComparator( null ).compare( getNormalizedValue(), binaryValue.getNormalizedValue() );
         }
-        
-        String message = I18n.err( I18n.ERR_04127 ); 
-        LOG.error( message );
-        throw new NotImplementedException( message );
     }
 
 
@@ -263,13 +464,83 @@ public class ClientBinaryValue extends A
         {
             return 0;
         }
+        
+        byte[] normalizedValue = getNormalizedValueReference();
+        int h = Arrays.hashCode( normalizedValue );
 
-        return Arrays.hashCode( getNormalizedValueReference() );
+        return h;
     }
 
 
     /**
-     * Checks to see if this ServerBinaryValue equals the supplied object.
+     * Find a matchingRule to use for normalization and comparison.  If an equality
+     * matchingRule cannot be found it checks to see if other matchingRules are
+     * available: SUBSTR, and ORDERING.  If a matchingRule cannot be found null is
+     * returned.
+     *
+     * @return a matchingRule or null if one cannot be found for the attributeType
+     * @throws LdapException if resolution of schema entities fail
+     */
+    private MatchingRule getMatchingRule() throws LdapException
+    {
+        MatchingRule mr = attributeType.getEquality();
+
+        if ( mr == null )
+        {
+            mr = attributeType.getOrdering();
+        }
+
+        if ( mr == null )
+        {
+            mr = attributeType.getSubstring();
+        }
+
+        return mr;
+    }
+
+
+    /**
+     * Gets a comparator using getMatchingRule() to resolve the matching
+     * that the comparator is extracted from.
+     *
+     * @return a comparator associated with the attributeType or null if one cannot be found
+     * @throws LdapException if resolution of schema entities fail
+     */
+    private LdapComparator<?> getLdapComparator() throws LdapException
+    {
+        MatchingRule mr = getMatchingRule();
+
+        if ( mr == null )
+        {
+            return null;
+        }
+
+        return mr.getLdapComparator();
+    }
+    
+    
+    /**
+     * Gets a normalizer using getMatchingRule() to resolve the matchingRule
+     * that the normalizer is extracted from.
+     *
+     * @return a normalizer associated with the attributeType or null if one cannot be found
+     * @throws LdapException if resolution of schema entities fail
+     */
+    private Normalizer getNormalizer() throws LdapException
+    {
+        MatchingRule mr = getMatchingRule();
+
+        if ( mr == null )
+        {
+            return null;
+        }
+
+        return mr.getNormalizer();
+    }
+
+
+    /**
+     * Checks to see if this BinaryValue equals the supplied object.
      *
      * This equals implementation overrides the BinaryValue implementation which
      * is not schema aware.
@@ -283,20 +554,74 @@ public class ClientBinaryValue extends A
             return true;
         }
         
-        if ( ! ( obj instanceof ClientBinaryValue ) )
+        if ( ! ( obj instanceof BinaryValue ) )
         {
             return false;
         }
 
-        ClientBinaryValue other = ( ClientBinaryValue ) obj;
+        BinaryValue other = ( BinaryValue ) obj;
         
         if ( isNull() )
         {
             return other.isNull();
         }
+        
+        // If we have an attributeType, it must be equal
+        // We should also use the comparator if we have an AT
+        if ( attributeType != null )
+        {
+            if ( other.attributeType != null )
+            {
+                if ( !attributeType.equals( other.attributeType ) )
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                other.attributeType = attributeType;
+            }
+        }
+        else if ( other.attributeType != null )
+        {
+            attributeType = other.attributeType;
+        }
+
+        // Shortcut : if the values are equals, no need to compare
+        // the normalized values
+        if ( Arrays.equals( wrapped, other.get() ) )
+        {
+            return true;
+        }
+
+        if ( attributeType != null )
+        {
+            // We have an AttributeType, we eed to use the comparator
+            try
+            {
+                Comparator<byte[]> comparator = (Comparator<byte[]>)getLdapComparator();
+
+                // Compare normalized values
+                if ( comparator == null )
+                {
+                    return Arrays.equals( getNormalizedValueReference(), other.getNormalizedValueReference() );
+                }
+                else
+                {
+                    return comparator.compare( getNormalizedValueReference(), other.getNormalizedValueReference() ) == 0;
+                }
+            }
+            catch ( LdapException ne )
+            {
+                return false;
+            }
 
-        // now unlike regular values we have to compare the normalized values
-        return Arrays.equals( getNormalizedValueReference(), other.getNormalizedValueReference() );
+        }
+        else
+        {
+            // now unlike regular values we have to compare the normalized values
+            return Arrays.equals( getNormalizedValueReference(), other.getNormalizedValueReference() );
+        }
     }
 
 
@@ -306,9 +631,9 @@ public class ClientBinaryValue extends A
     /**
      * @return a copy of the current value
      */
-    public ClientBinaryValue clone()
+    public BinaryValue clone()
     {
-        ClientBinaryValue clone = (ClientBinaryValue)super.clone();
+        BinaryValue clone = (BinaryValue)super.clone();
         
         if ( normalizedValue != null )
         {
@@ -357,6 +682,35 @@ public class ClientBinaryValue extends A
     
     
     /**
+     * Uses the syntaxChecker associated with the attributeType to check if the
+     * value is valid.  Repeated calls to this method do not attempt to re-check
+     * the syntax of the wrapped value every time if the wrapped value does not
+     * change. Syntax checks only result on the first check, and when the wrapped
+     * value changes.
+     *
+     * @see Value#isValid()
+     */
+    public final boolean isValid()
+    {
+        if ( valid != null )
+        {
+            return valid;
+        }
+
+        if ( attributeType != null )
+        {
+            valid = attributeType.getSyntax().getSyntaxChecker().isValidSyntax( getReference() );
+            return valid;
+        }
+        else
+        {
+            // Always false if we don't have an AttributeType
+            return false;
+        }
+    }
+
+
+    /**
      * @return The length of the interned value
      */
     public int length()
@@ -474,6 +828,159 @@ public class ClientBinaryValue extends A
     
     
     /**
+     * We will write the value and the normalized value, only
+     * if the normalized value is different.
+     * 
+     * If the value is empty, a flag is written at the beginning with 
+     * the value true, otherwise, a false is written.
+     * 
+     * The data will be stored following this structure :
+     *  [length] the wrapped length. Can be -1, if wrapped is null
+     *  [value length]
+     *  [UP value] if not empty
+     *  [normalized] (will be false if the value can't be normalized)
+     *  [same] (a flag set to true if the normalized value equals the UP value)
+     *  [Norm value] (the normalized value if different from the UP value, and not empty)
+     *  
+     *  @param out the buffer in which we will stored the serialized form of the value
+     *  @throws IOException if we can't write into the buffer
+     */
+    public void serialize( ObjectOutput out ) throws IOException
+    {
+        if ( wrapped != null )
+        {
+            // write a the wrapped length
+            out.writeInt( wrapped.length );
+
+            // Write the data if not empty
+            if ( wrapped.length > 0 )
+            {
+                // The data
+                out.write( wrapped );
+
+                // Normalize the data
+                try
+                {
+                    normalize();
+
+                    if ( !normalized )
+                    {
+                        // We may not have a normalizer. Just get out
+                        // after having writen the flag
+                        out.writeBoolean( false );
+                    }
+                    else
+                    {
+                        // Write a flag indicating that the data has been normalized
+                        out.writeBoolean( true );
+
+                        if ( Arrays.equals( getReference(), normalizedValue ) )
+                        {
+                            // Write the 'same = true' flag
+                            out.writeBoolean( true );
+                        }
+                        else
+                        {
+                            // Write the 'same = false' flag
+                            out.writeBoolean( false );
+
+                            // Write the normalized value length
+                            out.writeInt( normalizedValue.length );
+
+                            if ( normalizedValue.length > 0 )
+                            {
+                                // Write the normalized value if not empty
+                                out.write( normalizedValue );
+                            }
+                        }
+                    }
+                }
+                catch ( LdapException ne )
+                {
+                    // The value can't be normalized, we don't write the 
+                    // normalized value.
+                    normalizedValue = null;
+                    out.writeBoolean( false );
+                }
+            }
+        }
+        else
+        {
+            // Write -1 indicating that the value is null
+            out.writeInt( -1 );
+        }
+    }
+
+
+    /**
+     * 
+     * Deserialize a BinaryValue. 
+     *
+     * @param in the buffer containing the bytes with the serialized value
+     * @throws IOException 
+     * @throws ClassNotFoundException
+     */
+    public void deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
+    {
+        // The UP value length
+        int wrappedLength = in.readInt();
+
+        if ( wrappedLength == -1 )
+        {
+            // If the value is null, the length will be set to -1
+            same = true;
+            wrapped = null;
+        }
+        else if ( wrappedLength == 0 )
+        {
+            wrapped = StringTools.EMPTY_BYTES;
+            same = true;
+            normalized = true;
+            normalizedValue = wrapped;
+        }
+        else
+        {
+            wrapped = new byte[wrappedLength];
+
+            // Read the data
+            in.readFully( wrapped );
+
+            // Check if we have a normalized value
+            normalized = in.readBoolean();
+
+            if ( normalized )
+            {
+                // Read the 'same' flag
+                same = in.readBoolean();
+
+                if ( !same )
+                {
+                    // Read the normalizedvalue length
+                    int normalizedLength = in.readInt();
+
+                    if ( normalizedLength > 0 )
+                    {
+                        normalizedValue = new byte[normalizedLength];
+
+                        // Read the normalized value
+                        in.read( normalizedValue, 0, normalizedLength );
+                    }
+                    else
+                    {
+                        normalizedValue = StringTools.EMPTY_BYTES;
+                    }
+                }
+                else
+                {
+                    normalizedValue = new byte[wrappedLength];
+                    System.arraycopy( wrapped, 0, normalizedValue, 0, wrappedLength );
+                }
+            }
+        }
+    }
+    
+    
+    /**
      * Dumps binary in hex with label.
      *
      * @see Object#toString()