directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r798550 [1/5] - in /directory: apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-jndi/src/main/java/org/apache...
Date Tue, 28 Jul 2009 14:54:05 GMT
Author: elecharny
Date: Tue Jul 28 14:54:01 2009
New Revision: 798550

URL: http://svn.apache.org/viewvc?rev=798550&view=rev
Log:
o Added the getString() and getBytes() methods in the Value classes.
o Changed the Normalizer to take either a Value<?> or a String parameter
o Fixed the Filter evaluators and the tests accordingly
o Renamed the normalizing visitor for filters in the Normalizer interceptor
o Addition of some missing Javadoc

Added:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
      - copied, changed from r798033, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
    directory/apacheds/trunk/server-integ/src/test/java/MultiThreadedTest.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
Removed:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
Modified:
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.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/ServerBinaryValueTest.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/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.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/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java
    directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java
    directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
    directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
    directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java
    directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnNormalizer.java
    directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDNormalizer.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
    directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultEntryDsml.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyRequestDsml.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/addRequest/AddRequestTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/modifyRequest/ModifyRequestTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchRequest/SearchRequestTest.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
    directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestCodec.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestCodec.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryCodec.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.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/ExtensibleNode.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/filter/SubstringNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.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/AtavSerializer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DefaultStringNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastLdapDnParser.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.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/Normalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/NormalizingComparator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/BooleanNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/CachingNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/DeepTrimNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/DeepTrimToLowerNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/GeneralizedTimeNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NoOpNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/NumericNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ObjectIdentifierNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/RegexNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/TelephoneNumberNormalizer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
    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/client/ClientStringValueTest.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/filter/FilterCloneTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/BooleanNormalizerTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/AttributeUtilsTest.java

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java Tue Jul 28 14:54:01 2009
@@ -129,13 +129,13 @@
                 {
                     if ( isHR )
                     {
-                        serverValue = new ServerStringValue( attributeType, (String)clientValue.get() );
+                        serverValue = new ServerStringValue( attributeType, clientValue.getString() );
                     }
                     else
                     {
                         // We have to convert the value to a binary value first
                         serverValue = new ServerBinaryValue( attributeType, 
-                            StringTools.getBytesUtf8( (String)clientValue.get() ) );
+                            clientValue.getBytes() );
                     }
                 }
                 else if ( clientValue instanceof ClientBinaryValue )
@@ -144,11 +144,11 @@
                     {
                         // We have to convert the value to a String value first
                         serverValue = new ServerStringValue( attributeType, 
-                            StringTools.utf8ToString( (byte[])clientValue.get() ) );
+                            clientValue.getString() );
                     }
                     else
                     {
-                        serverValue = new ServerBinaryValue( attributeType, (byte[])clientValue.get() );
+                        serverValue = new ServerBinaryValue( attributeType, clientValue.getBytes() );
                     }
                 }
 
@@ -433,7 +433,7 @@
             {
                 if ( attributeType.getSyntax().isHumanReadable() )
                 {
-                    if ( val == null )
+                    if ( ( val == null ) || val.isNull() )
                     {
                         Value<String> nullSV = new ServerStringValue( attributeType, (String)null );
                         
@@ -456,7 +456,7 @@
                     else if ( val instanceof ClientStringValue )
                     {
                         // If we get a Client value, convert it to a Server value first 
-                        Value<String> serverStringValue = new ServerStringValue( attributeType, (String)val.get() ); 
+                        Value<String> serverStringValue = new ServerStringValue( attributeType, val.getString() ); 
                         
                         if ( !values.contains( serverStringValue ) )
                         {
@@ -486,7 +486,7 @@
                     }
                     else if ( ( val instanceof ClientBinaryValue ) )
                     {
-                        Value<byte[]> serverBinaryValue = new ServerBinaryValue( attributeType, (byte[])val.get() ); 
+                        Value<byte[]> serverBinaryValue = new ServerBinaryValue( attributeType, val.getBytes() ); 
                         
                         if ( !values.contains( serverBinaryValue ) )
                         {
@@ -649,7 +649,7 @@
                 }
                 else if ( val instanceof ClientStringValue )
                 {
-                    ServerStringValue serverValue = new ServerStringValue( attributeType, (String)val.get() );
+                    ServerStringValue serverValue = new ServerStringValue( attributeType, val.isNull() ? (String)null : val.getString() );
                     
                     if ( !values.contains( serverValue ) )
                     {
@@ -1161,11 +1161,11 @@
             
             if ( value instanceof ServerStringValue )
             {
-                clientValue = new ClientStringValue( (String)value.get() );
+                clientValue = new ClientStringValue( value.getString() );
             }
             else
             {
-                clientValue = new ClientBinaryValue( (byte[])value.get() );
+                clientValue = new ClientBinaryValue( value.getBytes() );
             }
             
             clientAttribute.add( clientValue );

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java Tue Jul 28 14:54:01 2009
@@ -1230,7 +1230,7 @@
         }
         
         // We have to check that we are checking the ObjectClass attributeType
-        if ( ((ServerAttribute)objectClass).getAttributeType() != OBJECT_CLASS_AT )
+        if ( !((ServerAttribute)objectClass).getAttributeType().equals( OBJECT_CLASS_AT ) )
         {
             return false;
         }
@@ -1246,7 +1246,7 @@
         for ( Value<?> value:objectClass )
         {
             // Loop on all the values, and check if they are present
-            if ( !attribute.contains( value ) )
+            if ( !attribute.contains( value.getString() ) )
             {
                 return false;
             }

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java Tue Jul 28 14:54:01 2009
@@ -202,7 +202,7 @@
             }
             else
             {
-                normalizedValue = ( byte[] ) normalizer.normalize( getCopy() );
+                normalizedValue = normalizer.normalize( this ).getBytes();
                 setNormalized( true );
             }
             

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -24,6 +24,9 @@
 import javax.naming.NamingException;
 import javax.naming.directory.InvalidAttributeValueException;
 
+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.schema.AbstractAttributeType;
 import org.apache.directory.shared.ldap.schema.AbstractMatchingRule;
 import org.apache.directory.shared.ldap.schema.AbstractSyntax;
@@ -266,17 +269,24 @@
         
         mr.normalizer = new Normalizer()
         {
+            // The serial UID
             private static final long serialVersionUID = 1L;
 
-            public Object normalize( Object value ) throws NamingException
+            public Value<?> normalize( Value<?> value ) throws NamingException
             {
-                if ( value instanceof String )
+                if ( !value.isBinary() )
                 {
-                    return ( ( String ) value ).toLowerCase();
+                    return new ClientStringValue( value.getString().toLowerCase() );
                 }
 
                 throw new IllegalStateException( "expected string to normalize" );
             }
+            
+            
+            public String normalize( String value ) throws NamingException
+            {
+                return value.toLowerCase();
+            }
         };
         
         AT at = new AT( "1.1.3.1" );
@@ -372,15 +382,18 @@
         
         mr.normalizer = new Normalizer()
         {
+            // The serial UID
             private static final long serialVersionUID = 1L;
             
-            public Object normalize( Object value ) throws NamingException
+            public Value<?> normalize( Value<?> value ) throws NamingException
             {
-                if ( value instanceof byte[] )
+                if ( value.isBinary() )
                 {
-                    byte[] val = (byte[])value;
+                    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 )
@@ -388,11 +401,16 @@
                         newVal[i++] = (byte)(b & 0x007F); 
                     }
                     
-                    return StringTools.trim( newVal );
+                    return new ClientBinaryValue( StringTools.trim( newVal ) );
                 }
 
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
+
+            public String normalize( String value ) throws NamingException
+            {
+                throw new IllegalStateException( "expected byte[] to normalize" );
+            }
         };
         
         at.setEquality( mr );

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -222,7 +222,7 @@
         Value<?> value = attr.get();
         
         assertTrue( value instanceof ServerStringValue );
-        assertEquals( "test", ((ServerStringValue)value).get() );
+        assertEquals( "test", ((ServerStringValue)value).getString() );
         
         // Add a binary value
         assertEquals( 0, attr.add( new byte[]{0x01} ) );
@@ -407,7 +407,7 @@
         ServerAttribute attr1 = new DefaultServerAttribute( atCN );
         
         attr1.add( (String)null );
-        assertNull( attr1.getString() );
+        assertEquals( "", attr1.getString() );
 
         ServerAttribute attr2 = new DefaultServerAttribute( atCN );
         
@@ -768,7 +768,7 @@
         int nbAdded = attr1.add( (byte[])null );
         assertEquals( 1, nbAdded );
         assertFalse( attr1.isHR() );
-        assertTrue( Arrays.equals( NULL_BINARY_VALUE.get(), attr1.getBytes() ) );
+        assertTrue( Arrays.equals( NULL_BINARY_VALUE.getBytes(), attr1.getBytes() ) );
         
         ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
         
@@ -1020,13 +1020,13 @@
         ServerAttribute attr2 = new DefaultServerAttribute( "cn", atCN );
         
         attr2.add( "a", "b", "c" );
-        assertEquals( "a", attr2.get().get() );
+        assertEquals( "a", attr2.get().getString() );
         
         attr2.remove( "a" );
-        assertEquals( "b", attr2.get().get() );
+        assertEquals( "b", attr2.get().getString() );
 
         attr2.remove( "b" );
-        assertEquals( "c", attr2.get().get() );
+        assertEquals( "c", attr2.get().getString() );
 
         attr2.remove( "c" );
         assertNull( attr2.get() );
@@ -1034,13 +1034,13 @@
         ServerAttribute attr3 = new DefaultServerAttribute( "userPassword", atPwd );
         
         attr3.add( BYTES1, BYTES2, BYTES3 );
-        assertTrue( Arrays.equals( BYTES1, (byte[])attr3.get().get() ) );
+        assertTrue( Arrays.equals( BYTES1, attr3.get().getBytes() ) );
         
         attr3.remove( BYTES1 );
-        assertTrue( Arrays.equals( BYTES2, (byte[])attr3.get().get() ) );
+        assertTrue( Arrays.equals( BYTES2, attr3.get().getBytes() ) );
 
         attr3.remove( BYTES2 );
-        assertTrue( Arrays.equals( BYTES3, (byte[])attr3.get().get() ) );
+        assertTrue( Arrays.equals( BYTES3, attr3.get().getBytes() ) );
 
         attr3.remove( BYTES3 );
         assertNull( attr2.get() );
@@ -1072,9 +1072,9 @@
         attr.add(  "a", "b", "c" );
         iterator = attr.getAll(); 
         assertTrue( iterator.hasNext() );
-        assertEquals( "a", iterator.next().get() );
-        assertEquals( "b", iterator.next().get() );
-        assertEquals( "c", iterator.next().get() );
+        assertEquals( "a", iterator.next().getString() );
+        assertEquals( "b", iterator.next().getString() );
+        assertEquals( "c", iterator.next().getString() );
         assertFalse( iterator.hasNext() );
     }
 
@@ -1122,7 +1122,7 @@
         int nbAdded = attr1.put( (byte[])null );
         assertEquals( 1, nbAdded );
         assertFalse( attr1.isHR() );
-        assertTrue( Arrays.equals( NULL_BINARY_VALUE.get(), attr1.getBytes() ) );
+        assertTrue( Arrays.equals( NULL_BINARY_VALUE.getBytes(), attr1.getBytes() ) );
         
         ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
         
@@ -1536,7 +1536,7 @@
         for ( Value<?> val:attr1 )
         {
             assertTrue( val instanceof ServerStringValue );
-            assertEquals( values[pos++], val.get() );
+            assertEquals( values[pos++], val.getString() );
         }
     }
 
@@ -2116,7 +2116,7 @@
         assertEquals( dsa.toString(), dsaSer.toString() );
         assertEquals( "commonname", dsaSer.getId() );
         assertEquals( "CommonName", dsaSer.getUpId() );
-        assertNull( dsaSer.getString() );
+        assertEquals( "", dsaSer.getString() );
         assertEquals( 1, dsaSer.size() );
         assertTrue( dsaSer.contains( (String)null ) );
         assertTrue( dsaSer.isHR() );

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -648,7 +648,7 @@
         entry.add( atCN, "test1" );
         assertNotNull( entry.get( atCN ) );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test1", entry.get( atCN ).get().get() );
+        assertEquals( "test1", entry.get( atCN ).get().getString() );
         
         // Test some more addition
         entry.add( atCN, "test2", "test3" );
@@ -703,7 +703,7 @@
         entry.add( atPassword, test1 );
         assertNotNull( entry.get( atPassword ) );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( test1, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( test1, entry.get( atPassword ).get().getBytes() ) );
         
         // Test some more addition
         entry.add( atPassword, test2, test3 );
@@ -768,7 +768,7 @@
         entry.add( atCN, test1 );
         assertNotNull( entry.get( atCN ) );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test1", entry.get( atCN ).get().get() );
+        assertEquals( "test1", entry.get( atCN ).get().getString() );
         
         // Test some more addition
         entry.add( atCN, test2, test3 );
@@ -808,7 +808,7 @@
         entry.add( atPassword, testB1 );
         assertNotNull( entry.get( atPassword ) );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( b1, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( b1, entry.get( atPassword ).get().getBytes() ) );
         
         // Test some more addition
         entry.add( atPassword, testB2, testB3 );
@@ -862,7 +862,7 @@
         assertEquals( "cn", entry.get( atCN ).getId() );
         assertEquals( "CN", entry.get( atCN ).getUpId() );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test1", entry.get( atCN ).get().get() );
+        assertEquals( "test1", entry.get( atCN ).get().getString() );
         
         // Test some more addition
         entry.add( "CN", "test2", "test3" );
@@ -917,7 +917,7 @@
         entry.add( "userPassword", test1 );
         assertNotNull( entry.get( atPassword ) );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( test1, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( test1, entry.get( atPassword ).get().getBytes() ) );
         
         // Test some more addition
         entry.add( "userPassword", test2, test3 );
@@ -982,7 +982,7 @@
         entry.add( "cN", test1 );
         assertNotNull( entry.get( atCN ) );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test1", entry.get( atCN ).get().get() );
+        assertEquals( "test1", entry.get( atCN ).get().getString() );
         assertTrue( entry.containsAttribute( atCN ) );
         assertEquals( "cN", entry.get( atCN ).getUpId() );
         
@@ -1026,7 +1026,7 @@
         entry.add( "userPASSWORD", testB1 );
         assertNotNull( entry.get( atPassword ) );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( b1, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( b1, entry.get( atPassword ).get().getBytes() ) );
         assertTrue( entry.containsAttribute( atPassword ) );
         assertEquals( "userPASSWORD", entry.get( atPassword ).getUpId() );
         
@@ -1079,7 +1079,7 @@
         entry.add( "cn", atCN, "test1" );
         assertNotNull( entry.get( atCN ) );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test1", entry.get( atCN ).get().get() );
+        assertEquals( "test1", entry.get( atCN ).get().getString() );
         
         // Test some more addition
         entry.add( "CN", atCN, "test2", "test3" );
@@ -1134,7 +1134,7 @@
         entry.add( "userPassword", atPassword, test1 );
         assertNotNull( entry.get( atPassword ) );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( test1, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( test1, entry.get( atPassword ).get().getBytes() ) );
         
         // Test some more addition
         entry.add( "userPassword", atPassword, test2, test3 );
@@ -1199,7 +1199,7 @@
         entry.add( "cN", atCN, test1 );
         assertNotNull( entry.get( atCN ) );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test1", entry.get( atCN ).get().get() );
+        assertEquals( "test1", entry.get( atCN ).get().getString() );
         assertTrue( entry.containsAttribute( atCN ) );
         assertEquals( "cN", entry.get( atCN ).getUpId() );
         
@@ -1243,7 +1243,7 @@
         entry.add( "userPASSWORD", atPassword, testB1 );
         assertNotNull( entry.get( atPassword ) );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( b1, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( b1, entry.get( atPassword ).get().getBytes() ) );
         assertTrue( entry.containsAttribute( atPassword ) );
         assertEquals( "userPASSWORD", entry.get( atPassword ).getUpId() );
         
@@ -2441,7 +2441,7 @@
         
         replaced = entry.put(  "cN", "test1", "test2", "test1" );
         assertNotNull( replaced );
-        assertEquals( "test", replaced.get().get() );
+        assertEquals( "test", replaced.get().getString() );
         
         assertEquals( 2, entry.size() );
         assertNotNull( entry.get( "cn" ) );
@@ -2565,7 +2565,7 @@
         
         assertEquals( 1, entry.size() );
         assertNotNull( entry.get( "l" ) );
-        assertEquals( "france", entry.get( "l" ).get().get() );
+        assertEquals( "france", entry.get( "l" ).get().getString() );
         
         ServerAttribute sb = new DefaultServerAttribute( atC, "countryTest" );
         ServerAttribute sc = new DefaultServerAttribute( atGN, "test" );
@@ -2574,11 +2574,11 @@
 
         assertEquals( 4, entry.size() );
         assertNotNull( entry.get( atC ) );
-        assertEquals( "countryTest", entry.get( atC ).get().get() );
+        assertEquals( "countryTest", entry.get( atC ).get().getString() );
         assertNotNull( entry.get( atGN ) );
-        assertEquals( "test", entry.get( atGN ).get().get() );
+        assertEquals( "test", entry.get( atGN ).get().getString() );
         assertNotNull( entry.get( atStreet) );
-        assertEquals( "testStreet", entry.get( atStreet ).get().get() );
+        assertEquals( "testStreet", entry.get( atStreet ).get().getString() );
         
         // Test a replacement
         EntryAttribute sbb = new DefaultServerAttribute( atC, "countryTestTest" );
@@ -2586,15 +2586,15 @@
         List<EntryAttribute> result = entry.put( sbb, scc );
         
         assertEquals( 2, result.size() );
-        assertEquals( "countryTest", result.get(0).get().get() );
-        assertEquals( "test", result.get(1).get().get() );
+        assertEquals( "countryTest", result.get(0).get().getString() );
+        assertEquals( "test", result.get(1).get().getString() );
         assertEquals( 4, entry.size() );
         assertNotNull( entry.get( atC ) );
-        assertEquals( "countryTestTest", entry.get( atC ).get().get() );
+        assertEquals( "countryTestTest", entry.get( atC ).get().getString() );
         assertNotNull( entry.get( atGN ) );
-        assertEquals( "testtest", entry.get( atGN ).get().get() );
+        assertEquals( "testtest", entry.get( atGN ).get().getString() );
         assertNotNull( entry.get( atStreet) );
-        assertEquals( "testStreet", entry.get( atStreet ).get().get() );
+        assertEquals( "testStreet", entry.get( atStreet ).get().getString() );
         
         // test an ObjectClass replacement
         AttributeType OBJECT_CLASS_AT = registries.getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASS_AT );
@@ -2648,7 +2648,7 @@
         assertEquals( 1, entry.size() );
         assertEquals( "cn", entry.get( atCN ).getUpId() );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test", entry.get( atCN ).get().get() );
+        assertEquals( "test", entry.get( atCN ).get().getString() );
         
         // Add more than one value
         entry.put( atCN, "test1", "test2", "test3" );
@@ -2710,7 +2710,7 @@
         assertEquals( 1, entry.size() );
         assertEquals( "userPassword", entry.get( atPwd ).getUpId() );
         assertEquals( 1, entry.get( atPwd ).size() );
-        assertTrue( Arrays.equals( password, (byte[])entry.get( atPwd ).get().get() ) );
+        assertTrue( Arrays.equals( password, entry.get( atPwd ).get().getBytes() ) );
         
         // Add more than one value
         entry.put( atPwd, test1, test2, test3 );
@@ -2768,7 +2768,7 @@
         assertEquals( 1, entry.size() );
         assertEquals( "cn", entry.get( atCN ).getUpId() );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test", entry.get( atCN ).get().get() );
+        assertEquals( "test", entry.get( atCN ).get().getString() );
         
         // Add more than one value
         entry.put( atCN, new ServerStringValue( atCN, "test1" ),
@@ -2830,7 +2830,7 @@
         assertEquals( 1, entry.size() );
         assertEquals( "cn", entry.get( atCN ).getUpId() );
         assertEquals( 1, entry.get( atCN ).size() );
-        assertEquals( "test", entry.get( atCN ).get().get() );
+        assertEquals( "test", entry.get( atCN ).get().getString() );
         
         // Add more than one value
         entry.put( "cn", "test1", "test2", "test3" );
@@ -2897,7 +2897,7 @@
         assertEquals( 1, entry.size() );
         assertEquals( "userPassword", entry.get( atPassword ).getUpId() );
         assertEquals( 1, entry.get( atPassword ).size() );
-        assertTrue( Arrays.equals( test, (byte[])entry.get( atPassword ).get().get() ) );
+        assertTrue( Arrays.equals( test, entry.get( atPassword ).get().getBytes() ) );
         
         // Add more than one value
         entry.put( "userPassword", test1, test2, test3 );
@@ -3594,12 +3594,12 @@
         sa.add( "test" );
         
         // Check that the value has been added to the entry
-        assertEquals( "test", entry.get( "sn" ).get().get() ); 
+        assertEquals( "test", entry.get( "sn" ).get().getString() ); 
         
         // Now add a new SN empty AT : it should replace the existing one.
         AttributeType atSNEmpty = registries.getAttributeTypeRegistry().lookup( "sn" );
         sa = entry.set( atSNEmpty ).get( 0 );
-        assertEquals( "test", sa.get().get() ); 
+        assertEquals( "test", sa.get().getString() ); 
         assertNotNull( entry.get(  "sn" ) );
         assertNull( entry.get(  "sn" ).get() );
         
@@ -3685,12 +3685,12 @@
         sa.add( "test" );
         
         // Check that the value has been added to the entry
-        assertEquals( "test", entry.get( "sn" ).get().get() ); 
+        assertEquals( "test", entry.get( "sn" ).get().getString() ); 
         
         // Now add a new SN empty AT : it should replace the existing one.
         AttributeType atSNEmpty = registries.getAttributeTypeRegistry().lookup( "sn" );
         sa = entry.set( atSNEmpty ).get( 0 );
-        assertEquals( "test", sa.get().get() ); 
+        assertEquals( "test", sa.get().getString() ); 
         assertNotNull( entry.get(  "sn" ) );
         assertNull( entry.get(  "sn" ).get() );
     }

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java Tue Jul 28 14:54:01 2009
@@ -29,6 +29,8 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.comparators.ByteArrayComparator;
@@ -83,11 +85,11 @@
         {
             private static final long serialVersionUID = 1L;
             
-            public Object normalize( Object value ) throws NamingException
+            public Value<?> normalize( Value<?> value ) throws NamingException
             {
-                if ( value instanceof byte[] )
+                if ( value.isBinary() )
                 {
-                    byte[] val = (byte[])value;
+                    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;
@@ -97,11 +99,17 @@
                         newVal[i++] = (byte)(b & 0x007F); 
                     }
                     
-                    return StringTools.trim( newVal );
+                    return new ClientBinaryValue( StringTools.trim( newVal ) );
                 }
 
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
+
+        
+            public String normalize( String value ) throws NamingException
+            {
+                throw new IllegalStateException( "expected byte[] to normalize" );
+            }
         };
         at = new TestServerEntryUtils.AT( "1.1.3.1" );
         at.setEquality( mr );
@@ -291,7 +299,7 @@
         sbv.set( StringTools.EMPTY_BYTES );
         
         assertNotSame( sbv, sbv1 );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.get() ) );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.getBytes() ) );
         
         sbv.set(  BYTES2 );
         sbv1 = sbv.clone();
@@ -593,7 +601,7 @@
         byte[] normalized = sbv.getNormalizedValueReference();
         
         assertTrue( Arrays.equals( v1Norm, normalized ) );
-        assertTrue( Arrays.equals( v1, sbv.get() ) );
+        assertTrue( Arrays.equals( v1, sbv.getBytes() ) );
         
         ServerBinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
         
@@ -633,7 +641,7 @@
         byte[] normalized = sbv.getNormalizedValueReference();
         
         assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, normalized ) );
-        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.get() ) );
+        assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.getBytes() ) );
         
         ServerBinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
         
@@ -656,7 +664,7 @@
         byte[] normalized = sbv.getNormalizedValueReference();
         
         assertTrue( Arrays.equals( v1Norm, normalized ) );
-        assertTrue( Arrays.equals( v1, sbv.get() ) );
+        assertTrue( Arrays.equals( v1, sbv.getBytes() ) );
         
         ServerBinaryValue sbvSer = deserializeValue( serializeValue( sbv ), at );
         

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -421,7 +421,7 @@
         ssv.set( "" );
         
         assertNotSame( ssv, ssv1 );
-        assertEquals( "", ssv.get() );
+        assertEquals( "", ssv.getString() );
         
         ssv.set(  "  This is    a   TEST  " );
         ssv1 = ssv.clone();
@@ -638,12 +638,12 @@
                 
                 if ( o1 != null )
                 {
-                    n1 = o1.get();
+                    n1 = o1.getString();
                 }
 
                 if ( o2 != null )
                 {
-                    n2 = o2.get();
+                    n2 = o2.getString();
                 }
 
                 if ( n1 == null )
@@ -697,7 +697,7 @@
         String normalized = ssv.getNormalizedValue();
         
         assertEquals( "test test", normalized );
-        assertEquals( "  Test   Test  ", ssv.get() );
+        assertEquals( "  Test   Test  ", ssv.getString() );
         
         ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
@@ -717,7 +717,7 @@
         String normalized = ssv.getNormalizedValue();
         
         assertEquals( "test", normalized );
-        assertEquals( "test", ssv.get() );
+        assertEquals( "test", ssv.getString() );
         
         ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
@@ -736,8 +736,8 @@
         ssv.normalize();
         String normalized = ssv.getNormalizedValue();
         
-        assertEquals( null, normalized );
-        assertEquals( null, ssv.get() );
+        assertNull( normalized );
+        assertNull( ssv.get() );
         
         ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
@@ -757,7 +757,7 @@
         String normalized = ssv.getNormalizedValue();
         
         assertEquals( "", normalized );
-        assertEquals( "", ssv.get() );
+        assertEquals( "", ssv.getString() );
         
         ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         
@@ -773,8 +773,7 @@
         // First check with a value which will be normalized
         ServerStringValue ssv = new ServerStringValue( at, "  " );
         
-        //assertEquals( "", normalized );
-        assertEquals( "  ", ssv.get() );
+        assertEquals( "  ", ssv.getString() );
         
         ServerStringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
         

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Tue Jul 28 14:54:01 2009
@@ -813,7 +813,7 @@
         {
             for ( AttributeTypeAndValue atav : rdn )
             {
-                serverEntry.put( atav.getUpType(), ( String ) atav.getNormValue() );
+                serverEntry.put( atav.getUpType(), atav.getNormValue().getString() );
             }
         }
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Tue Jul 28 14:54:01 2009
@@ -102,7 +102,7 @@
         for ( Value<?> url:refs )
         {
             // we have to replace the parent by the referral
-            LdapURL ldapUrl = new LdapURL( (String)url.get() );
+            LdapURL ldapUrl = new LdapURL( url.getString() );
             
             // We have a problem with the DN : we can't use the UpName,
             // as we may have some spaces around the ',' and '+'.
@@ -140,7 +140,7 @@
             // we have to replace the parent by the referral
             try
             {
-                LdapURL ldapUrl = new LdapURL( (String)url.get() );
+                LdapURL ldapUrl = new LdapURL( url.getString() );
                 
                 StringBuilder urlString = new StringBuilder();
     
@@ -182,7 +182,7 @@
             catch ( LdapURLEncodingException luee )
             {
                 // The URL is not correct, returns it as is
-                urls.add( (String)url.get() );
+                urls.add( url.getString() );
             }
         }
         

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Tue Jul 28 14:54:01 2009
@@ -38,7 +38,6 @@
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
@@ -623,14 +622,7 @@
         {
             userPassword = userPasswordAttr.get();
 
-            if ( userPassword instanceof ServerStringValue )
-            {
-                return StringTools.getBytesUtf8( (String)userPassword.get() );
-            }
-            else
-            {
-                return (byte[])userPassword.get();
-            }
+            return userPassword.getBytes();
         }
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Tue Jul 28 14:54:01 2009
@@ -231,7 +231,7 @@
         Value<?> subschemaSubentry = 
             directoryService.getPartitionNexus().getRootDSE( null ).
                 get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        LdapDN subschemaSubentryDnName = new LdapDN( (String)(subschemaSubentry.get()) );
+        LdapDN subschemaSubentryDnName = new LdapDN( subschemaSubentry.getString() );
         subschemaSubentryDnName.normalize( atRegistry.getNormalizerMapping() );
         subschemaSubentryDn = subschemaSubentryDnName.toNormName();
     }
@@ -313,7 +313,7 @@
         
         for ( Value<?> value:subentries )
         {
-            String subentryDn = ( String ) value.get();
+            String subentryDn = value.getString();
             tuples.addAll( tupleCache.getACITuples( subentryDn ) );
         }
     }
@@ -338,7 +338,7 @@
 
         for ( Value<?> value:entryAci )
         {
-            String aciString = ( String ) value.get();
+            String aciString = value.getString();
             ACIItem item;
 
             try
@@ -391,7 +391,7 @@
 
         for ( Value<?> value:subentryAci )
         {
-            String aciString = ( String ) value.get();
+            String aciString = value.getString();
             ACIItem item;
 
             try

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Tue Jul 28 14:54:01 2009
@@ -114,6 +114,7 @@
      */
     public DefaultAuthorizationInterceptor()
     {
+        // Nothing to do
     }
 
 
@@ -162,7 +163,7 @@
         
         for ( Value<?> value:uniqueMember )
         {
-            LdapDN memberDn = new LdapDN( ( String ) value.get() );
+            LdapDN memberDn = new LdapDN( value.getString() );
             memberDn.normalize( normalizerMapping );
             newAdministrators.add( memberDn.getNormName() );
         }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java Tue Jul 28 14:54:01 2009
@@ -232,7 +232,7 @@
         {
 
             // get and normalize the DN of the member
-            String memberDn = ( String ) value.get();
+            String memberDn = value.getString();
 
             try
             {
@@ -260,7 +260,7 @@
         for ( Value<?> value : members )
         {
             // get and normalize the DN of the member
-            String memberDn = ( String ) value.get();
+            String memberDn = value.getString();
 
             try
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Tue Jul 28 14:54:01 2009
@@ -197,7 +197,7 @@
 
         for ( Value<?> value : aciAttr )
         {
-            String aci = ( String ) value.get();
+            String aci = value.getString();
             ACIItem item = null;
 
             try

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java Tue Jul 28 14:54:01 2009
@@ -191,7 +191,7 @@
                     String attrOid = oidRegistry.getOid( attr.getID() );
                     AttributeType attrType = attrRegistry.lookup( attrOid );
                     
-                    if ( oid.equals( attrOid ) && AttributeUtils.containsValue( attr, attrValue.get(), attrType ) )
+                    if ( oid.equals( attrOid ) && AttributeUtils.containsValue( attr, attrValue, attrType ) )
                     {
                         return true;
                     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Tue Jul 28 14:54:01 2009
@@ -154,7 +154,7 @@
             
             for ( Value<?> value:collectiveExclusions )
             {
-                AttributeType attrType = atRegistry.lookup( ( String ) value.get() );
+                AttributeType attrType = atRegistry.lookup( value.getString() );
                 exclusions.add( attrType.getOid() );
             }
         }
@@ -194,7 +194,7 @@
          */
         for ( Value<?> value:collectiveAttributeSubentries )
         {
-            String subentryDnStr = ( String ) value.get();
+            String subentryDnStr = value.getString();
             LdapDN subentryDn = new LdapDN( subentryDnStr );
             
             /*
@@ -270,7 +270,7 @@
                  */
                 for ( Value<?> subentryColVal:subentryColAttr )
                 {
-                    entryColAttr.add( (String)subentryColVal.get() );
+                    entryColAttr.add( subentryColVal.getString() );
                 }
             }
         }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Tue Jul 28 14:54:01 2009
@@ -41,7 +41,7 @@
 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.normalization.NormalizingVisitor;
+import org.apache.directory.server.core.normalization.FilterNormalizingVisitor;
 import org.apache.directory.server.core.partition.ByPassConstants;
 import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -70,7 +70,7 @@
     
     private List<RegistrationEntry> registrations = new CopyOnWriteArrayList<RegistrationEntry>();
     private DirectoryService ds;
-    private NormalizingVisitor filterNormalizer;
+    private FilterNormalizingVisitor filterNormalizer;
     private Evaluator evaluator;
     private ExecutorService executor;
     
@@ -85,7 +85,7 @@
         OidRegistry oidRegistry = ds.getRegistries().getOidRegistry();
         AttributeTypeRegistry attributeRegistry = ds.getRegistries().getAttributeTypeRegistry();
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
-        filterNormalizer = new NormalizingVisitor( ncn, ds.getRegistries() );
+        filterNormalizer = new FilterNormalizingVisitor( ncn, ds.getRegistries() );
         evaluator = new ExpressionEvaluator( oidRegistry, attributeRegistry );
         executor = new ThreadPoolExecutor( 1, 10, 1000, TimeUnit.MILLISECONDS, 
             new ArrayBlockingQueue<Runnable>( 100 ) );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java Tue Jul 28 14:54:01 2009
@@ -119,7 +119,9 @@
         {
             for ( ExprNode child: bnode.getChildren() )
             {
-                if ( !evaluate( child, dn, entry ) )
+                boolean res = evaluate( child, dn, entry );
+                
+                if ( !res )
                 {
                     return false;
                 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java Tue Jul 28 14:54:01 2009
@@ -30,7 +30,6 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 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.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -45,7 +44,6 @@
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -266,9 +264,9 @@
         
         if ( at.getSyntax().isHumanReadable() )
         {
-            if ( node.getValue() instanceof ClientBinaryValue )
+            if ( node.getValue().isBinary() )
             {
-                value = new ClientStringValue( StringTools.utf8ToString( (byte[])node.getValue().get() ) );
+                value = new ClientStringValue( node.getValue().getString() );
             }
             else
             {
@@ -286,17 +284,10 @@
         }
 
         // get the normalized AVA filter value
-        Object filterValue = normalizer.normalize( value.get() );
+        Value<?> filterValue = normalizer.normalize( value );
 
         // check if the normalized value is present
-        if ( filterValue instanceof String )
-        {
-            if ( attr.contains( ( String ) filterValue ) )
-            {
-                return true;
-            }
-        }
-        else if ( attr.contains( ( byte[] ) filterValue ) )
+        if ( attr.contains( filterValue ) )
         {
             return true;
         }
@@ -308,9 +299,9 @@
          */
         for ( Value<?> val : attr )
         {
-            Object normValue = normalizer.normalize( val.get() );
+            Value<?> normValue = normalizer.normalize( val );
 
-            if ( 0 == comparator.compare( normValue, filterValue ) )
+            if ( 0 == comparator.compare( normValue.get(), filterValue.get() ) )
             {
                 return true;
             }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java Tue Jul 28 14:54:01 2009
@@ -113,7 +113,7 @@
 
         for ( Value<?> value: attr )
         {
-            String normValue = ( String ) normalizer.normalize( value );
+            String normValue = normalizer.normalize( value.getString() );
 
             // Once match is found cleanup and return true
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Tue Jul 28 14:54:01 2009
@@ -126,7 +126,7 @@
         nexus = directoryService.getPartitionNexus();
         normalizerMap = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
         Value<?> attr = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        subschemSubentryDn = new LdapDN( ( String ) attr.get() );
+        subschemSubentryDn = new LdapDN( attr.getString() );
         subschemSubentryDn.normalize( normalizerMap );
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Tue Jul 28 14:54:01 2009
@@ -1072,6 +1072,7 @@
                     }
                     catch ( Exception ne )
                     {
+                        ne.printStackTrace();
                         throw ne;
                     }
                     catch ( Throwable e )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java Tue Jul 28 14:54:01 2009
@@ -23,7 +23,6 @@
 import org.apache.directory.server.core.CoreSession;
 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.message.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
@@ -146,7 +145,7 @@
     /**
      * @return The value to compare
      */
-    public Object getValue() 
+    public Value<?> getValue() 
     {
         return value;
     }
@@ -179,9 +178,9 @@
         return "CompareContext for DN '" + getDn().getUpName() + "'" + 
             ( ( oid != null ) ? ", oid : <" + oid + ">" : "" ) +
             ( ( value != null ) ? ", value :'" +
-                    ( ( value instanceof ClientStringValue ) ?
-                            ((ClientStringValue)value).get() :
-                            ( ( value instanceof ClientBinaryValue ) ?
+                    ( ( !value.isBinary() ) ?
+                            value.getString() :
+                            ( ( value.isBinary() ) ?
                                     StringTools.dumpBytes( ((ClientBinaryValue)value).getReference() ) : 
                                         "unknown value type" ) )
                         + "'"

Copied: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java (from r798033, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java?p2=directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java&p1=directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java&r1=798033&r2=798550&rev=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java Tue Jul 28 14:54:01 2009
@@ -41,7 +41,6 @@
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,10 +62,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class NormalizingVisitor implements FilterVisitor
+public class FilterNormalizingVisitor implements FilterVisitor
 {
     /** logger used by this class */
-    private static final Logger log = LoggerFactory.getLogger( NormalizingVisitor.class );
+    private static final Logger log = LoggerFactory.getLogger( FilterNormalizingVisitor.class );
 
     /** the name component normalizer used by this visitor */
     private final NameComponentNormalizer ncn;
@@ -119,7 +118,7 @@
      * @param ncn The name component normalizer to use
      * @param registries The global registries
      */
-    public NormalizingVisitor( NameComponentNormalizer ncn, Registries registries )
+    public FilterNormalizingVisitor( NameComponentNormalizer ncn, Registries registries )
     {
         this.ncn = ncn;
         this.registries = registries;
@@ -127,7 +126,10 @@
 
 
     /**
-     * A private method used to normalize a value
+     * A private method used to normalize a value. At this point, the value
+     * is a Value<byte[]>, we have to translate it to a Value<String> if its
+     * AttributeType is H-R. Then we have to normalize the value accordingly
+     * to the AttributeType Normalizer.
      * 
      * @param attribute The attribute's ID
      * @param value The value to normalize
@@ -143,30 +145,12 @@
 
             if ( attributeType.getSyntax().isHumanReadable() )
             {
-                if ( value.isBinary() )
-                {
-                    normalized = new ClientStringValue( ( String ) ncn.normalizeByName( attribute, StringTools
-                        .utf8ToString( ( byte[] ) value.get() ) ) );
-                }
-                else
-                {
-                    normalized = new ClientStringValue( ( String ) ncn.normalizeByName( attribute, ( String ) value
-                        .get() ) );
-                }
+                normalized = new ClientStringValue( 
+                    (String) ncn.normalizeByName( attribute, value.getString() ) );
             }
             else
             {
-                if ( value.isBinary() )
-                {
-                    normalized = new ClientBinaryValue( ( byte[] ) ncn.normalizeByName( attribute, ( byte[] ) value
-                        .get() ) );
-                }
-                else
-                {
-                    normalized = new ClientBinaryValue( ( byte[] ) ncn.normalizeByName( attribute, ( String ) value
-                        .get() ) );
-
-                }
+                normalized = (Value<?>)ncn.normalizeByName( attribute, value.getBytes() );
             }
 
             return normalized;
@@ -176,7 +160,6 @@
             log.warn( "Failed to normalize filter value: {}", ne.getMessage(), ne );
             return null;
         }
-
     }
 
 
@@ -285,7 +268,7 @@
 
                 if ( normAny != null )
                 {
-                    normAnys.add( ( String ) normAny.get() );
+                    normAnys.add( normAny.getString() );
                 }
             }
 
@@ -313,7 +296,7 @@
 
             if ( normInitial != null )
             {
-                node.setInitial( ( String ) normInitial.get() );
+                node.setInitial( normInitial.getString() );
             }
             else
             {
@@ -324,7 +307,7 @@
 
             if ( normFinal != null )
             {
-                node.setFinal( ( String ) normFinal.get() );
+                node.setFinal( normFinal.getString() );
             }
             else
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Tue Jul 28 14:54:01 2009
@@ -48,8 +48,6 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.cursor.EmptyCursor;
-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.filter.ExprNode;
 import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
@@ -58,7 +56,6 @@
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -69,6 +66,11 @@
  * A name normalization service.  This service makes sure all relative and distinuished
  * names are normalized before calls are made against the respective interface methods
  * on {@link PartitionNexus}.
+ * 
+ * The Filters are also normalized.
+ * 
+ * If the RDN AttributeTypes are not present in the entry for an Add request,
+ * they will be added.
  *
  * @org.apache.xbean.XBean
  *
@@ -81,7 +83,7 @@
     private static final Logger LOG = LoggerFactory.getLogger( NormalizationInterceptor.class );
 
     /** a filter node value normalizer and undefined node remover */
-    private NormalizingVisitor normVisitor;
+    private FilterNormalizingVisitor normVisitor;
 
     /** The association between attributeTypes and their normalizers */
     private Map<String, OidNormalizer> attrNormalizers; 
@@ -94,11 +96,12 @@
      */
     public void init( DirectoryService directoryService ) throws Exception
     {
+        LOG.debug( "Initialiazing the NormalizationInterceptor" );
+        
         OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
         attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
-        normVisitor = new NormalizingVisitor( ncn, directoryService.getRegistries() );
-        //expVisitor = new ExpandingVisitor( attributeRegistry );
+        normVisitor = new FilterNormalizingVisitor( ncn, directoryService.getRegistries() );
         attrNormalizers = attributeRegistry.getNormalizerMapping();
     }
 
@@ -112,7 +115,9 @@
     // ------------------------------------------------------------------------
     // Normalize all Name based arguments for ContextPartition interface operations
     // ------------------------------------------------------------------------
-
+    /**
+     * {@inheritDoc}
+     */
     public void add( NextInterceptor nextInterceptor, AddOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -122,6 +127,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void delete( NextInterceptor nextInterceptor, DeleteOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -129,6 +137,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void modify( NextInterceptor nextInterceptor, ModifyOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -136,6 +147,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void rename( NextInterceptor nextInterceptor, RenameOperationContext opContext ) throws Exception
     {
         LdapDN rdn = new LdapDN();
@@ -148,6 +162,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void move( NextInterceptor nextInterceptor, MoveOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -156,6 +173,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext opContext )
         throws Exception
     {
@@ -170,11 +190,16 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
 
         ExprNode filter = opContext.getFilter();
+        
+        // Normalize the filter
         ExprNode result = ( ExprNode ) filter.accept( normVisitor );
 
         if ( result == null )
@@ -192,6 +217,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasEntry( NextInterceptor nextInterceptor, EntryOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -199,6 +227,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -206,6 +237,9 @@
     }
 
     
+    /**
+     * {@inheritDoc}
+     */
     private String[] normalizeAttrsId( String[] attrIds ) throws Exception
     {
         if ( attrIds == null )
@@ -226,6 +260,9 @@
     }
 
     
+    /**
+     * {@inheritDoc}
+     */
     public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -243,8 +280,9 @@
     // ------------------------------------------------------------------------
     // Normalize all Name based arguments for other interface operations
     // ------------------------------------------------------------------------
-
-    
+    /**
+     * {@inheritDoc}
+     */
     public LdapDN getMatchedName ( NextInterceptor nextInterceptor, GetMatchedNameOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -252,6 +290,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public LdapDN getSuffix ( NextInterceptor nextInterceptor, GetSuffixOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -259,15 +300,18 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
         
         AttributeType at = opContext.getSession().getDirectoryService().getRegistries().getAttributeTypeRegistry().lookup( opContext.getOid() );
         
-        if ( at.getSyntax().isHumanReadable() && ( opContext.getValue() instanceof ClientBinaryValue ) )
+        if ( at.getSyntax().isHumanReadable() && ( opContext.getValue().isBinary() ) )
         {
-            String value = StringTools.utf8ToString( ((Value<byte[]>)opContext.getValue()).get() );
+            String value = opContext.getValue().getString();
             opContext.setValue( new ClientStringValue( value ) );
         }
         
@@ -275,6 +319,9 @@
     }
     
     
+    /**
+     * {@inheritDoc}
+     */
     public void bind( NextInterceptor next, BindOperationContext opContext )  throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -282,6 +329,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -289,6 +339,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception
     {
         opContext.getDn().normalize( attrNormalizers );
@@ -314,8 +367,8 @@
         // Loop on all the AVAs
         for ( AttributeTypeAndValue ava : rdn )
         {
-            String value = ( String ) ava.getNormValue();
-            String upValue = ( String ) ava.getUpValue();
+            String value = ava.getNormValue().getString();
+            String upValue = ava.getUpValue().getString();
             String upId = ava.getUpType();
 
             // Check that the entry contains this AVA
@@ -365,6 +418,7 @@
     private void addUnescapedUpValue( ServerEntry entry, String upId, String upValue ) throws Exception
     {
         Object unescapedUpValue = Rdn.unescapeValue( upValue );
+
         if ( unescapedUpValue instanceof String )
         {
             entry.add( upId, ( String ) unescapedUpValue );
@@ -374,5 +428,4 @@
             entry.add( upId, ( byte[] ) unescapedUpValue );
         }
     }
-
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Tue Jul 28 14:54:01 2009
@@ -143,7 +143,7 @@
         // stuff for dealing with subentries (garbage for now)
         Value<?> subschemaSubentry = service.getPartitionNexus()
                 .getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        subschemaSubentryDn = new LdapDN( (String)subschemaSubentry.get() );
+        subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() );
         subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() );
         
         CREATE_TIMESTAMP_ATTRIBUTE_TYPE = atRegistry.lookup( SchemaConstants.CREATE_TIMESTAMP_AT );
@@ -485,7 +485,7 @@
             else if ( rdn.size() == 1 )
             {
                 String name = atRegistry.lookup( rdn.getNormType() ).getName();
-                String value = (String)rdn.getAtav().getNormValue(); 
+                String value = rdn.getAtav().getNormValue().getString(); 
                 newDn.add( new Rdn( name, name, value, value ) );
                 continue;
             }



Mime
View raw message