directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r798550 [2/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
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Tue Jul 28 14:54:01 2009
@@ -579,31 +579,15 @@
          * through all values looking for a match.
          */
         Normalizer normalizer = attrType.getEquality().getNormalizer();
-        Object reqVal = normalizer.normalize( ((Value<?>)compareContext.getValue()).get() );
+        Value<?> reqVal = normalizer.normalize( compareContext.getValue() );
 
         for ( Value<?> value:attr )
         {
-            Object attrValObj = normalizer.normalize( value.get() );
+            Value<?> attrValObj = normalizer.normalize( value );
             
-            if ( attrValObj instanceof String )
+            if ( attrValObj.equals( reqVal ) )
             {
-                String attrVal = ( String ) attrValObj;
-                if ( ( reqVal instanceof String ) && attrVal.equals( reqVal ) )
-                {
-                    return true;
-                }
-            }
-            else
-            {
-                byte[] attrVal = ( byte[] ) attrValObj;
-                if ( reqVal instanceof byte[] )
-                {
-                    return Arrays.equals( attrVal, ( byte[] ) reqVal );
-                }
-                else if ( reqVal instanceof String )
-                {
-                    return Arrays.equals( attrVal, StringTools.getBytesUtf8( ( String ) reqVal ) );
-                }
+                return true;
             }
         }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Tue Jul 28 14:54:01 2009
@@ -89,7 +89,7 @@
     {
         ServerStringValue ref = ( ServerStringValue ) value;
 
-        String refVal = ref.get();
+        String refVal = ref.getString();
 
         LdapURL ldapUrl = new LdapURL( refVal );
 
@@ -217,7 +217,7 @@
         directoryService.setReferralManager( referralManager );
 
         Value<?> subschemaSubentry = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        LdapDN subschemaSubentryDn = new LdapDN( ( String ) ( subschemaSubentry.get() ) );
+        LdapDN subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() );
         subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() );
         subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java Tue Jul 28 14:54:01 2009
@@ -26,7 +26,6 @@
 import javax.naming.directory.InvalidAttributeValueException;
 
 import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerBinaryValue;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 
@@ -65,9 +64,9 @@
         
         Value<?> value = attribute.get();
         
-        if ( value instanceof ServerBinaryValue )
+        if ( value.isBinary() )
         {
-            classBytes = ((ServerBinaryValue)value).get();
+            classBytes = value.getBytes();
 
             return defineClass( name, classBytes, 0, classBytes.length );
         }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Tue Jul 28 14:54:01 2009
@@ -149,7 +149,7 @@
             try
             {
                 syntaxCheckerDescriptions[pos++] = 
-                    syntaxCheckerParser.parseSyntaxCheckerDescription( (String)value.get() );
+                    syntaxCheckerParser.parseSyntaxCheckerDescription( value.getString() );
             }
             catch ( ParseException e )
             {
@@ -180,12 +180,12 @@
         {
             try
             {
-                normalizerDescriptions[pos++] = normalizerParser.parseNormalizerDescription( (String)value.get() );
+                normalizerDescriptions[pos++] = normalizerParser.parseNormalizerDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the normalizerDescription syntax: " + value.get(), 
+                    "The following does not conform to the normalizerDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -211,12 +211,12 @@
         {
             try
             {
-                comparatorDescriptions[pos++] = comparatorParser.parseComparatorDescription( ( String ) value.get() );
+                comparatorDescriptions[pos++] = comparatorParser.parseComparatorDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the comparatorDescription syntax: " + value.get(), 
+                    "The following does not conform to the comparatorDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -252,12 +252,12 @@
             
             try
             {
-                desc = attributeTypeParser.parseAttributeTypeDescription( ( String ) value.get() );
+                desc = attributeTypeParser.parseAttributeTypeDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the attributeTypeDescription syntax: " + value.get(), 
+                    "The following does not conform to the attributeTypeDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -387,12 +387,12 @@
             
             try
             {
-                desc = objectClassParser.parseObjectClassDescription( ( String ) value.get() );
+                desc = objectClassParser.parseObjectClassDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the objectClassDescription syntax: " + value.get(), 
+                    "The following does not conform to the objectClassDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -488,12 +488,12 @@
             
             try
             {
-                desc = matchingRuleUseParser.parseMatchingRuleUseDescription( ( String ) value.get() );
+                desc = matchingRuleUseParser.parseMatchingRuleUseDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the matchingRuleUseDescription syntax: " + value.get(), 
+                    "The following does not conform to the matchingRuleUseDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -535,12 +535,12 @@
             
             try
             {
-                desc = syntaxParser.parseLdapSyntaxDescription( ( String ) value.get() );
+                desc = syntaxParser.parseLdapSyntaxDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the ldapSyntaxDescription syntax: " + value.get(), 
+                    "The following does not conform to the ldapSyntaxDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -589,12 +589,12 @@
 
             try
             {
-                desc = matchingRuleParser.parseMatchingRuleDescription( ( String ) value.get() );
+                desc = matchingRuleParser.parseMatchingRuleDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the matchingRuleDescription syntax: " + value.get(), 
+                    "The following does not conform to the matchingRuleDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -642,12 +642,12 @@
      
             try
             {
-                desc = ditStructureRuleParser.parseDITStructureRuleDescription( ( String ) value.get() );
+                desc = ditStructureRuleParser.parseDITStructureRuleDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the ditStructureRuleDescription syntax: " + value.get(), 
+                    "The following does not conform to the ditStructureRuleDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -691,12 +691,12 @@
      
             try
             {
-                desc = ditContentRuleParser.parseDITContentRuleDescription( ( String ) value.get() );
+                desc = ditContentRuleParser.parseDITContentRuleDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the ditContentRuleDescription syntax: " + value.get(), 
+                    "The following does not conform to the ditContentRuleDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;
@@ -742,12 +742,12 @@
             
             try
             {
-                desc = nameFormParser.parseNameFormDescription( ( String  ) value.get() );
+                desc = nameFormParser.parseNameFormDescription( value.getString() );
             }
             catch ( ParseException e )
             {
                 LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( 
-                    "The following does not conform to the nameFormDescription syntax: " + value.get(), 
+                    "The following does not conform to the nameFormDescription syntax: " + value.getString(), 
                     ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
                 iave.setRootCause( e );
                 throw iave;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Tue Jul 28 14:54:01 2009
@@ -543,7 +543,7 @@
             
             for ( Value<?> value:dependencies )
             {
-                String dependency = ( String ) value.get();
+                String dependency = value.getString();
                 
                 if ( ! loaded.containsKey( dependency ) )
                 {
@@ -559,7 +559,7 @@
             
             for ( Value<?> value:dependencies )
             {
-                String dependency = ( String ) value.get();
+                String dependency = value.getString();
                 
                 if ( ! allSchemas.contains( dependency ) )
                 {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Tue Jul 28 14:54:01 2009
@@ -206,7 +206,7 @@
             
             for ( Value<?> value:names )
             {
-                targetRegistries.getOidRegistry().register( ( String ) value.get(), oid );
+                targetRegistries.getOidRegistry().register( value.getString(), oid );
             }
         }
         

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Tue Jul 28 14:54:01 2009
@@ -103,7 +103,7 @@
         // check that there is at least one structural objectClass in the replacement set
         for ( Value<?> value:attribute )
         {
-            ObjectClass ocType = registry.lookup( ( String ) value.get() );
+            ObjectClass ocType = registry.lookup( value.getString() );
 
             if ( ocType.getType() == ObjectClassTypeEnum.STRUCTURAL )
             {
@@ -165,7 +165,7 @@
         // check that there is at least one structural objectClass in the replacement set
         for ( Value<?> value:objectClass )
         {
-            ObjectClass ocType = registry.lookup( ( String ) value.get() );
+            ObjectClass ocType = registry.lookup( value.getString() );
             
             if ( ocType.getType() == ObjectClassTypeEnum.STRUCTURAL )
             {
@@ -218,7 +218,7 @@
         // Fist gather the value to remove
         for ( Value<?> value:attribute )
         {
-            if ( ((String)value.get()).length() == 0 )
+            if ( value.getString().length() == 0 )
             {
                 removed.add( value );
             }
@@ -258,7 +258,7 @@
         // check resultant set of objectClass values for a structural objectClass
         for ( Value<?> objectClass:cloned )
         {
-            ObjectClass oc = registry.lookup( (String)objectClass.get() );
+            ObjectClass oc = registry.lookup( objectClass.getString() );
             
             if ( oc.getType() == ObjectClassTypeEnum.STRUCTURAL )
             {
@@ -572,7 +572,7 @@
         
         for ( Value<?> value:attribute )
         {
-            if ( rdnValue.equals( (String)value.get() ) )
+            if ( rdnValue.equals( value.getString() ) )
             {
                 String msg = "Modify operation attempts to delete RDN attribute values in use for ";
                 msg += id + " on entry " + name + " and violates schema constraints";
@@ -647,7 +647,7 @@
                 
                 for ( Value<?> value:rdnAttr )
                 {
-                    if ( rdnValue.equals( (String)value.get() ) )
+                    if ( rdnValue.equals( value.getString() ) )
                     {
                         String msg = "Modify operation attempts to delete RDN attribute values in use for ";
                         msg += id + " on entry " + name + " and violates schema constraints";

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java Tue Jul 28 14:54:01 2009
@@ -129,7 +129,7 @@
             
             for ( Value<?> value:depsAttr )
             {
-                depsSet.add( (String)value.get() );
+                depsSet.add( value.getString() );
             }
 
             dependencies = depsSet.toArray( EMPTY );
@@ -212,8 +212,8 @@
                 + MetaSchemaConstants.M_FQCN_AT + " attribute" );
         }
 
-        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get().get();
-        String syntaxOid = ( String ) entry.get( oidAT ).get().get();
+        String className = entry.get( MetaSchemaConstants.M_FQCN_AT ).get().getString();
+        String syntaxOid = entry.get( oidAT ).get().getString();
         return getSyntaxChecker( syntaxOid, className, entry.get( byteCodeAT ), 
             targetRegistries );
     }
@@ -333,7 +333,7 @@
                 + MetaSchemaConstants.M_FQCN_AT + " attribute" );
         }
         
-        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get().get();
+        String className = entry.get( MetaSchemaConstants.M_FQCN_AT ).get().getString();
         return getComparator( className, entry.get( MetaSchemaConstants.M_BYTECODE_AT ), targetRegistries );
     }
     
@@ -426,7 +426,7 @@
                 + MetaSchemaConstants.M_FQCN_AT + " attribute" );
         }
         
-        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get().get();
+        String className = entry.get( MetaSchemaConstants.M_FQCN_AT ).get().getString();
         return getNormalizer( className, entry.get( MetaSchemaConstants.M_BYTECODE_AT ), targetRegistries );
     }
     
@@ -592,7 +592,7 @@
         
         for ( Value<?> value:attr )
         {
-            strings[pos++] = (String)value.get();
+            strings[pos++] = value.getString();
         }
         
         return strings;
@@ -716,7 +716,7 @@
             
             for ( Value<?> name:names )
             {
-                values.add( (String)name.get() );
+                values.add( name.getString() );
             }
             
             mso.setNames( values.toArray( EMPTY ) );

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -107,7 +107,6 @@
 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.shared.ldap.schema.syntaxes.AcceptAllSyntaxChecker;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -216,7 +215,7 @@
 
         // stuff for dealing with subentries (garbage for now)
         Value<?> subschemaSubentry = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        LdapDN subschemaSubentryDn = new LdapDN( ( String ) ( subschemaSubentry.get() ) );
+        LdapDN subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() );
         subschemaSubentryDn.normalize( atRegistry.getNormalizerMapping() );
         subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
 
@@ -725,14 +724,7 @@
                 SimpleNode node = ( SimpleNode ) filter;
                 String objectClass;
 
-                if ( node.getValue() instanceof ClientStringValue )
-                {
-                    objectClass = ( String ) node.getValue().get();
-                }
-                else
-                {
-                    objectClass = node.getValue().get().toString();
-                }
+                objectClass = node.getValue().getString();
 
                 String objectClassOid = null;
 
@@ -849,7 +841,7 @@
 
         for ( Value<?> objectClass : objectClasses )
         {
-            ObjectClass ocSpec = registry.lookup( ( String ) objectClass.get() );
+            ObjectClass ocSpec = registry.lookup( objectClass.getString() );
 
             for ( AttributeType must : ocSpec.getMustList() )
             {
@@ -987,7 +979,7 @@
 
         for ( Value<?> objectClass : objectClasses )
         {
-            String objectClassName = ( String ) objectClass.get();
+            String objectClassName = objectClass.getString();
 
             if ( SchemaConstants.TOP_OC.equals( objectClassName ) )
             {
@@ -1023,7 +1015,7 @@
         // Loop on all objectclasses
         for ( Value<?> value : objectClasses )
         {
-            String ocName = ( String ) value.get();
+            String ocName = value.getString();
             ObjectClass oc = registries.getObjectClassRegistry().lookup( ocName );
 
             AttributeType[] types = oc.getMustList();
@@ -1052,7 +1044,7 @@
         // Loop on all objectclasses
         for ( Value<?> objectClass : objectClasses )
         {
-            String ocName = ( String ) objectClass.get();
+            String ocName = objectClass.getString();
             ObjectClass oc = registries.getObjectClassRegistry().lookup( ocName );
 
             AttributeType[] types = oc.getMayList();
@@ -1094,7 +1086,7 @@
         // Construct the new list of ObjectClasses
         for ( Value<?> ocValue : objectClassAttr )
         {
-            String ocName = ( String ) ocValue.get();
+            String ocName = ocValue.getString();
 
             if ( !ocName.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
             {
@@ -1188,13 +1180,13 @@
             for ( AttributeTypeAndValue atav : oldRDN )
             {
                 AttributeType type = atRegistry.lookup( atav.getUpType() );
-                String value = ( String ) atav.getNormValue();
+                String value = ( String ) atav.getNormValue().getString();
                 tmpEntry.remove( type, value );
             }
             for ( AttributeTypeAndValue atav : newRdn )
             {
                 AttributeType type = atRegistry.lookup( atav.getUpType() );
-                String value = ( String ) atav.getNormValue();
+                String value = ( String ) atav.getNormValue().getString();
                 if ( !tmpEntry.contains( type, value ) )
                 {
                     tmpEntry.add( new DefaultServerAttribute( type, value ) );
@@ -1293,7 +1285,7 @@
 
             for ( Value<?> value : ( ServerAttribute ) mod.getAttribute() )
             {
-                keybuf.append( value.get() );
+                keybuf.append( value.getString() );
             }
 
             if ( !modset.add( keybuf.toString() ) && ( mod.getOperation() == ModificationOperation.ADD_ATTRIBUTE ) )
@@ -1627,18 +1619,8 @@
 
                 for ( Value<?> value : attribute )
                 {
-                    Object attrValue = value.get();
-
-                    if ( attrValue instanceof String )
-                    {
-                        binaries.add( new ServerBinaryValue( ( ( ServerAttribute ) attribute ).getAttributeType(),
-                            StringTools.getBytesUtf8( ( String ) attrValue ) ) );
-                    }
-                    else
-                    {
-                        binaries.add( new ServerBinaryValue( ( ( ServerAttribute ) attribute ).getAttributeType(),
-                            ( byte[] ) attrValue ) );
-                    }
+                    binaries.add( new ServerBinaryValue( ( ( ServerAttribute ) attribute ).getAttributeType(),
+                        value.getBytes() ) );
                 }
 
                 attribute.clear();
@@ -1768,7 +1750,7 @@
             {
                 try
                 {
-                    String supName = (String)sup.get();
+                    String supName = sup.getString();
                     
                     ObjectClass superior = ocRegistry.lookup( supName );
 
@@ -2070,9 +2052,8 @@
                 }
                 catch ( Exception ne )
                 {
-                    String message = "Attribute value '"
-                        + ( value instanceof ServerStringValue ? value.get() : StringTools.dumpBytes( ( byte[] ) value
-                            .get() ) ) + "' for attribute '" + attribute.getUpId() + "' is syntactically incorrect";
+                    String message = "Attribute value '" + value.getString()
+                         + "' for attribute '" + attribute.getUpId() + "' is syntactically incorrect";
                     LOG.info( message );
 
                     throw new LdapInvalidAttributeValueException( message, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
@@ -2104,7 +2085,7 @@
                 // Let's transform it
                 try
                 {
-                    String valStr = new String( ( byte[] ) value.get(), "UTF-8" );
+                    String valStr = new String( value.getBytes(), "UTF-8" );
                     attribute.remove( value );
                     attribute.add( valStr );
                     isModified = true;
@@ -2146,7 +2127,7 @@
                 // Let's transform it
                 try
                 {
-                    byte[] valBytes = ( ( String ) value.get() ).getBytes( "UTF-8" );
+                    byte[] valBytes = value.getString().getBytes( "UTF-8" );
 
                     attribute.remove( value );
                     attribute.add( valBytes );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Tue Jul 28 14:54:01 2009
@@ -296,7 +296,7 @@
         for ( Value<?> value:oc )
         {
 
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -345,7 +345,7 @@
         
         for ( Value<?> value:oc )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -394,7 +394,7 @@
         
         for ( Value<?> value:oc )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -423,7 +423,7 @@
         
         for ( Value<?> value:oc )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -459,7 +459,7 @@
         
         for ( Value<?> value:oc )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -487,7 +487,7 @@
         
         for ( Value<?> value:oc )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -515,7 +515,7 @@
         
         for ( Value<?> value:oc )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            String oid = registries.getOidRegistry().getOid( value.getString() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java Tue Jul 28 14:54:01 2009
@@ -160,7 +160,7 @@
                 
                 for ( Value<?> val : attr )
                 {
-                    LdapDN dn = new LdapDN( ( String ) val.get() );
+                    LdapDN dn = new LdapDN( val.getString() );
                     dn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
                     searchContexts.add( dn );
                 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Tue Jul 28 14:54:01 2009
@@ -98,29 +98,11 @@
 
         // check if AVA value exists in attribute
         // If the filter value for the objectClass is an OID we need to resolve a name
-        String value = null;
-        
-        if ( node.getValue() instanceof ClientStringValue )
-        {
-            value = ( String ) node.getValue().get();
+        String value = node.getValue().getString();
 
-            if ( objectClasses.contains( value ) )
-            {
-                return true;
-            }
-        }
-        else if ( node.getValue() instanceof ClientBinaryValue )
-        {
-            value = StringTools.utf8ToString(  ( byte[] ) node.getValue().get() );
-            
-            if ( objectClasses.contains( value ) )
-            {
-                return true;
-            }
-        }
-        else
+        if ( objectClasses.contains( value ) )
         {
-            value = node.getValue().toString();
+            return true;
         }
         
         if ( Character.isDigit( value.charAt( 0 ) ) )
@@ -129,7 +111,7 @@
             
             while ( list.hasNext() )
             {
-                String objectClass = ( String ) list.next();
+                String objectClass = list.next();
                 
                 if ( objectClasses.contains( objectClass ) )
                 {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Tue Jul 28 14:54:01 2009
@@ -986,7 +986,7 @@
                     case ADD_ATTRIBUTE:
                         for ( Value<?> value : ( ServerAttribute ) mod.getAttribute() )
                         {
-                            ocFinalState.add( ( String ) value.get() );
+                            ocFinalState.add( value.getString() );
                         }
 
                         break;
@@ -994,7 +994,7 @@
                     case REMOVE_ATTRIBUTE:
                         for ( Value<?> value : ( ServerAttribute ) mod.getAttribute() )
                         {
-                            ocFinalState.remove( ( String ) value.get() );
+                            ocFinalState.remove( value.getString() );
                         }
 
                         break;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Tue Jul 28 14:54:01 2009
@@ -143,7 +143,7 @@
         
         for ( Value<?> value:subentries )
         {
-            String subentryDn = ( String ) value.get();
+            String subentryDn = value.getString();
             triggerSpecs.addAll( triggerSpecCache.getSubentryTriggerSpecs( subentryDn ) );
         }
     }
@@ -168,7 +168,7 @@
 
         for ( Value<?> value:entryTrigger )
         {
-            String triggerString = ( String ) value.get();
+            String triggerString = value.getString();
             TriggerSpecification item;
 
             try

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Tue Jul 28 14:54:01 2009
@@ -176,7 +176,7 @@
 
             try
             {
-                item = triggerSpecParser.parse( ( String ) value.get() );
+                item = triggerSpecParser.parse( value.getString() );
                 subentryTriggerSpecs.add( item );
             }
             catch ( ParseException e )

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java Tue Jul 28 14:54:01 2009
@@ -30,6 +30,8 @@
 
 import org.apache.directory.server.core.authz.support.ACITupleFilter;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
@@ -131,9 +133,14 @@
                             {
                                 private static final long serialVersionUID = 1L;
 
-                                public Object normalize( Object value ) throws NamingException
+                                public Value<?> normalize( Value<?> value ) throws NamingException
                                 {
-                                    return StringTools.deepTrimToLower( value.toString() );
+                                    return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
+                                }
+                                
+                                public String normalize( String value ) throws NamingException
+                                {
+                                    return StringTools.deepTrimToLower( value );
                                 }
                             };
                         }
@@ -407,9 +414,14 @@
                             {
                                 private static final long serialVersionUID = 1L;
 
-                                public Object normalize( Object value ) throws NamingException
+                                public Value<?> normalize( Value<?> value ) throws NamingException
+                                {
+                                    return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
+                                }
+
+                                public String normalize( String value ) throws NamingException
                                 {
-                                    return StringTools.deepTrimToLower( value.toString() );
+                                    return StringTools.deepTrimToLower( value );
                                 }
                             };
                         }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java Tue Jul 28 14:54:01 2009
@@ -47,7 +47,7 @@
 public class NormalizationVisitorTest
 {
     /** a filter node value normalizer and undefined node remover */
-    private static NormalizingVisitor normVisitor;
+    private static FilterNormalizingVisitor normVisitor;
     
     /** A reference to the directory service */
     private static DirectoryService service;
@@ -60,7 +60,7 @@
         OidRegistry oidRegistry = service.getRegistries().getOidRegistry();
         AttributeTypeRegistry attributeRegistry = service.getRegistries().getAttributeTypeRegistry();
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
-        normVisitor = new NormalizingVisitor( ncn, service.getRegistries() );
+        normVisitor = new FilterNormalizingVisitor( ncn, service.getRegistries() );
     }
 
     @Test

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java Tue Jul 28 14:54:01 2009
@@ -27,19 +27,27 @@
 
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.normalization.FilterNormalizingVisitor;
+import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.bootstrap.SystemSchema;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
+import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 
 /**
@@ -52,21 +60,28 @@
 {
     private Registries registries;
     private SubtreeEvaluator evaluator;
+    FilterNormalizingVisitor visitor;
+    AttributeTypeRegistry attributeRegistry;
 
 
     private void init() throws Exception
     {
         BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        DefaultRegistries bsRegistries = new DefaultRegistries( "bootstrap", loader, new DefaultOidRegistry() );
+        OidRegistry oidRegistry = new DefaultOidRegistry();
+        DefaultRegistries bsRegistries = new DefaultRegistries( "bootstrap", loader, oidRegistry );
         registries = bsRegistries;
         Set<Schema> schemas = new HashSet<Schema>();
         schemas.add( new SystemSchema() );
         schemas.add( new ApacheSchema() );
         schemas.add( new CoreSchema() );
         loader.loadWithDependencies( schemas, bsRegistries );
+        attributeRegistry = registries.getAttributeTypeRegistry();
+        
+        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
+        visitor = new FilterNormalizingVisitor( ncn, registries );
     }
 
-
+    @BeforeClass
     protected void setUp() throws Exception
     {
         init();
@@ -74,6 +89,7 @@
     }
 
 
+    @AfterClass
     protected void tearDown() throws Exception
     {
         evaluator = null;
@@ -81,6 +97,7 @@
     }
 
 
+    @Test
     public void testDefaults() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
@@ -99,6 +116,7 @@
     }
 
 
+    @Test
     public void testWithBase() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
@@ -118,6 +136,7 @@
     }
 
 
+    @Test
     public void testWithMinMax() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
@@ -148,6 +167,7 @@
     }
 
 
+    @Test
     public void testWithMinMaxAndChopAfter() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
@@ -182,6 +202,7 @@
     }
 
 
+    @Test
     public void testWithMinMaxAndChopBefore() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
@@ -216,9 +237,11 @@
     }
 
 
+    @Test
     public void testWithMinMaxAndSimpleRefinement() throws Exception
     {
         ExprNode refinement = FilterParser.parse( "(objectClass=person)" );
+        refinement.accept( visitor );
 
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         modifier.setRefinement( refinement );
@@ -273,9 +296,11 @@
     }
     
     
+    @Test
     public void testWithFilter() throws Exception
     {
         ExprNode filter = FilterParser.parse( "(&(cn=Ersin)(objectClass=person))" );
+        filter.accept( visitor );
 
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         modifier.setRefinement( filter );

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -136,7 +136,7 @@
             log.debug( "Adding the entry '{}' for DN '{}'.", entry, normName.getUpName() );
 
             ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
-            String strUserPassword = StringTools.utf8ToString( userPassword.get() );
+            String strUserPassword = userPassword.getString();
 
             if ( log.isDebugEnabled() )
             {
@@ -149,7 +149,7 @@
 
             Value<?> principalNameValue = entry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
             
-            String principalName = (String)principalNameValue.get();
+            String principalName = principalNameValue.getString();
 
             log.debug( "Got principal '{}' with userPassword '{}'.", principalName, strUserPassword );
 
@@ -244,18 +244,18 @@
 
                 if ( firstValue instanceof ServerStringValue )
                 {
-                    password = ((ServerStringValue)firstValue).get();
+                    password = ((ServerStringValue)firstValue).getString();
                     log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, password );
                 }
                 else if ( firstValue instanceof ServerBinaryValue )
                 {
-                    password = StringTools.utf8ToString( ((ServerBinaryValue)firstValue).get() );
+                    password = ((ServerBinaryValue)firstValue).getString();
 
                     if ( log.isDebugEnabled() )
                     {
                         StringBuffer sb = new StringBuffer();
                         sb.append( "'" + password + "' ( " );
-                        sb.append( StringTools.dumpBytes( ((ServerBinaryValue)firstValue).get() ).trim() );
+                        sb.append( StringTools.dumpBytes( ((ServerBinaryValue)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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -80,7 +80,7 @@
             ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
 
             // The password is stored in a non H/R attribute, but it's a String
-            String strUserPassword = StringTools.utf8ToString( userPassword.get() );
+            String strUserPassword = userPassword.getString();
 
             if ( log.isDebugEnabled() )
             {
@@ -94,7 +94,7 @@
             if ( entry.get( SchemaConstants.CN_AT ) != null )
             {
                 ServerStringValue attr = (ServerStringValue)entry.get( SchemaConstants.CN_AT ).get();
-                username = attr.get();
+                username = attr.getString();
             }
 
             // If userPassword fails checks, throw new NamingException.
@@ -149,24 +149,19 @@
                     if ( userPassword instanceof ServerStringValue )
                     {
                         log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, attr );
-                        pwd = ((ServerStringValue)userPassword).get();
+                        pwd = ((ServerStringValue)userPassword).getString();
                     }
                     else if ( userPassword instanceof ServerBinaryValue )
                     {
                         ServerBinaryValue password = (ServerBinaryValue)userPassword;
                         
-                        String string = "";
-                        
-                        if ( password != null )
-                        {
-                            string = StringTools.utf8ToString( password.get() );
-                        }
+                        String string = password.getString();
 
                         if ( log.isDebugEnabled() )
                         {
                             StringBuffer sb = new StringBuffer();
                             sb.append( "'" + string + "' ( " );
-                            sb.append( StringTools.dumpBytes( password.get() ).trim() );
+                            sb.append( StringTools.dumpBytes( password.getBytes() ).trim() );
                             sb.append( " )" );
                             log.debug( "{} Attribute id : 'userPassword',  Values : [ {} ]", operation, sb.toString() );
                         }

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=798550&r1=798549&r2=798550&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 Tue Jul 28 14:54:01 2009
@@ -32,6 +32,7 @@
 import org.apache.directory.server.xdbm.Tuple;
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.util.SynchronizedLRUMap;
@@ -691,7 +692,14 @@
 
         if ( null == normalized )
         {
-            normalized = ( K ) attribute.getEquality().getNormalizer().normalize( attrVal );
+            if ( attrVal instanceof String )
+            {
+               normalized = ( K ) attribute.getEquality().getNormalizer().normalize( (String)attrVal );
+            }
+            else
+            {
+                normalized = ( K ) attribute.getEquality().getNormalizer().normalize( new ClientBinaryValue( (byte[])attrVal ) ).get();
+            }
 
             // Double map it so if we use an already normalized
             // value we can get back the same normalized value.

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Tue Jul 28 14:54:01 2009
@@ -1216,7 +1216,7 @@
         // First, the ObjectClass index
         for ( Value<?> value : objectClass )
         {
-            objectClassIdx.add( (String)value.get(), id );
+            objectClassIdx.add( value.getString(), id );
         }
         
         
@@ -1322,7 +1322,7 @@
         
         for ( Value<?> value : objectClass )
         {
-            objectClassIdx.drop( (String)value.get(), id );
+            objectClassIdx.drop( value.getString(), id );
         }
 
         ndnIdx.drop( id );
@@ -1440,7 +1440,7 @@
         {
             for ( Value<?> value : mods )
             {
-                objectClassIdx.drop( (String)value.get(), id );
+                objectClassIdx.drop( value.getString(), id );
             }
         }
         else if ( hasUserIndexOn( modsOid ) )
@@ -1503,7 +1503,7 @@
         {
             for ( Value<?> value : mods )
             {
-                objectClassIdx.drop( (String)value.get(), id );
+                objectClassIdx.drop( value.getString(), id );
             }
         }
         else if ( hasUserIndexOn( modsOid ) )
@@ -1542,14 +1542,17 @@
 
             for ( Value<?> value : mods )
             {
+                entryAttr.remove( value );
+                /*
                 if ( value instanceof ServerStringValue )
                 {
-                    entryAttr.remove( ( String ) value.get() );
+                    entryAttr.remove( value.getString() );
                 }
                 else
                 {
-                    entryAttr.remove( ( byte[] ) value.get() );
+                    entryAttr.remove( value.getBytes() );
                 }
+                */
             }
 
             // if nothing is left just remove empty attribute
@@ -1601,7 +1604,7 @@
             
             for ( Value<?> value : mods )
             {
-                objectClassIdx.add( (String)value.get(), id );
+                objectClassIdx.add( value.getString(), id );
             }
         }
         else if ( hasUserIndexOn( modsOid ) )
@@ -1771,10 +1774,10 @@
         for ( AttributeTypeAndValue newAtav : newRdn )
         {
             String newNormType = newAtav.getNormType();
-            String newNormValue = ( String ) newAtav.getNormValue();
+            String newNormValue = newAtav.getNormValue().getString();
             AttributeType newRdnAttrType = attributeTypeRegistry.lookup( newNormType );
             
-            Object unEscapedRdn = Rdn.unescapeValue( (String)newAtav.getUpValue() );
+            Object unEscapedRdn = Rdn.unescapeValue( newAtav.getUpValue().getString() );
             
             Value<?> value = null;
             
@@ -1841,7 +1844,7 @@
                 if ( mustRemove )
                 {
                     String oldNormType = oldAtav.getNormType();
-                    String oldNormValue = ( String ) oldAtav.getNormValue();
+                    String oldNormValue = oldAtav.getNormValue().getString();
                     AttributeType oldRdnAttrType = attributeTypeRegistry.lookup( oldNormType );
                     entry.remove( oldRdnAttrType, oldNormValue );
 

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Tue Jul 28 14:54:01 2009
@@ -825,10 +825,10 @@
         
         ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
         
-        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().get() ); // before replacing
+        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing
         
         store.modify( dn, mods );
-        assertEquals( attribVal, lookedup.get( "sn" ).get().get() );
+        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );
         
         // testing the store.modify( dn, mod, entry ) API
         ServerEntry entry = new DefaultServerEntry( registries, dn );
@@ -836,7 +836,7 @@
         entry.add( "sn", attribVal );
         
         store.modify( dn, ModificationOperation.REPLACE_ATTRIBUTE, entry );
-        assertEquals( attribVal, lookedup.get( "sn" ).get().get() );
+        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );
     }
     
     
@@ -901,6 +901,6 @@
         assertNull( lookedup.get( "ou" ) ); // before replacing
         
         store.modify( dn, mods );
-        assertEquals( attribVal, lookedup.get( "ou" ).get().get() );
+        assertEquals( attribVal, lookedup.get( "ou" ).get().getString() );
     }
 }

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java Tue Jul 28 14:54:01 2009
@@ -290,7 +290,7 @@
                 throw new IllegalStateException( "Kerberos key should not be a String." );
             }
 
-            byte[] encryptionKeyBytes = ( byte[] ) val.get();
+            byte[] encryptionKeyBytes = val.getBytes();
             EncryptionKey encryptionKey = EncryptionKeyDecoder.decode( encryptionKeyBytes );
             map.put( encryptionKey.getKeyType(), encryptionKey );
         }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java Tue Jul 28 14:54:01 2009
@@ -199,7 +199,7 @@
 
         for ( Value<?> value : refAttr )
         {
-            String ref = ( String ) value.get();
+            String ref = value.getString();
 
             LOG.debug( "Calculating LdapURL for referrence value {}", ref );
 
@@ -298,7 +298,7 @@
 
         for ( Value<?> value : refAttr )
         {
-            String ref = ( String ) value.get();
+            String ref = value.getString();
 
             LOG.debug( "Calculating LdapURL for referrence value {}", ref );
 

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Tue Jul 28 14:54:01 2009
@@ -778,7 +778,7 @@
             
             for ( Value<?> val : ref )
             {
-                String url = ( String ) val.get();
+                String url = val.getString();
                 
                 if ( ! url.startsWith( "ldap" ) )
                 {
@@ -1158,7 +1158,7 @@
         
         for ( Value<?> refval : refAttr )
         {
-            String refstr = ( String ) refval.get();
+            String refstr = refval.getString();
             
             // need to add non-ldap URLs as-is
             if ( ! refstr.startsWith( "ldap" ) )
@@ -1250,7 +1250,7 @@
         DirectoryService ds = session.getCoreSession().getDirectoryService();
         PartitionNexus nexus = ds.getPartitionNexus();
         Value<?> subschemaSubentry = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        LdapDN subschemaSubentryDn = new LdapDN( ( String ) ( subschemaSubentry.get() ) );
+        LdapDN subschemaSubentryDn = new LdapDN( subschemaSubentry.getString() );
         subschemaSubentryDn.normalize( ds.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
         String subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
         

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java Tue Jul 28 14:54:01 2009
@@ -182,7 +182,7 @@
                 if ( userPassword != null )
                 {
                     // We assume that we have only one password available
-                    byte[] password = (byte[])userPassword.get().get();
+                    byte[] password = userPassword.get().getBytes();
                     
                     String strPassword = StringTools.utf8ToString( password );
                     passwordCB.setPassword( strPassword.toCharArray() );

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdNormalizer.java Tue Jul 28 14:54:01 2009
@@ -24,11 +24,12 @@
 
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.syntaxes.NumericOidSyntaxChecker;
-import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -42,62 +43,93 @@
  */
 public class NameOrNumericIdNormalizer implements Normalizer
 {
+    // The serial UID
     private static final long serialVersionUID = 1L;
+    
     private NumericOidSyntaxChecker checker = new NumericOidSyntaxChecker();
+    
     private transient OidRegistry registry;
     
     
+    /** A static instance of this normalizer */
+    public static final NameOrNumericIdNormalizer INSTANCE = new NameOrNumericIdNormalizer();
+    
+    
     public NameOrNumericIdNormalizer( OidRegistry registry )
     {
         this.registry = registry;
     }
     
     
+    /**
+     * 
+     */
     public NameOrNumericIdNormalizer()
     {
+        // Nothing to do
     }
     
     
-    /* (non-Javadoc)
-     * @see org.apache.directory.shared.ldap.schema.Normalizer#normalize(java.lang.Object)
+    /**
+     * {@inheritDoc} 
      */
-    public Object normalize( Object value ) throws NamingException
+    public Value<?> normalize( Value<?> value ) throws NamingException
     {
-        String strValue;
-
         if ( value == null )
         {
             return null;
         }
         
-        if ( value instanceof String )
+        String strValue = value.getString();
+
+        if ( strValue.length() == 0 )
         {
-            strValue = ( String ) value;
+            return new ClientStringValue( "" );
         }
-        else if ( value instanceof byte[] )
+        
+        // if value is a numeric id then return it as is
+        if ( checker.isValidSyntax( strValue ) )
         {
-            strValue = StringTools.utf8ToString( ( byte[] ) value ); 
+            return value;
         }
-        else
+        
+        // if it is a name we need to do a lookup
+        if ( registry.hasOid( strValue ) )
         {
-            strValue = value.toString();
+            return new ClientStringValue( registry.getOid( strValue ) );
         }
-
-        if ( strValue.length() == 0 )
+        
+        // if all else fails
+        throw new LdapNamingException( "Encountered name based id of " + value 
+            + " which was not found in the OID registry" , ResultCodeEnum.OTHER );
+    }
+    
+    
+    /**
+     * {@inheritDoc} 
+     */
+    public String normalize( String value ) throws NamingException
+    {
+        if ( value == null )
+        {
+            return null;
+        }
+        
+        if ( value.length() == 0 )
         {
-            return "";
+            return value;
         }
         
         // if value is a numeric id then return it as is
-        if ( checker.isValidSyntax( strValue ) )
+        if ( checker.isValidSyntax( value ) )
         {
             return value;
         }
         
         // if it is a name we need to do a lookup
-        if ( registry.hasOid( strValue ) )
+        if ( registry.hasOid( value ) )
         {
-            return registry.getOid( strValue );
+            return registry.getOid( value );
         }
         
         // if all else fails

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java Tue Jul 28 14:54:01 2009
@@ -82,7 +82,7 @@
     {
         public NameAndOptionalUIDCachingNormalizingComparator()        
         {
-            super( new CachingNormalizer( new NameAndOptionalUIDNormalizer() ), new NameAndOptionalUIDComparator() );
+            super( new CachingNormalizer( NameAndOptionalUIDNormalizer.INSTANCE ), new NameAndOptionalUIDComparator() );
         }
     }
     

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemNormalizerProducer.java Tue Jul 28 14:54:01 2009
@@ -85,7 +85,7 @@
         
         public CachingDnNormalizer()
         {
-            super( new DnNormalizer() );
+            super( DnNormalizer.INSTANCE );
         }
 
         
@@ -322,7 +322,7 @@
          * ( 2.5.13.23 NAME 'uniqueMemberMatch'
          * SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )
          */
-        normalizer = new NameAndOptionalUIDNormalizer();
+        normalizer = NameAndOptionalUIDNormalizer.INSTANCE;
         cb.schemaObjectProduced( this, SchemaConstants.UNIQUE_MEMBER_MATCH_MATCH_MR_OID, normalizer );
 
         /*

Modified: directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java (original)
+++ directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java Tue Jul 28 14:54:01 2009
@@ -26,6 +26,7 @@
 
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
@@ -128,7 +129,7 @@
                 String unescaped = unescape( value );
                 byte[] valBytes = unescaped.getBytes( "UTF-8" );
                 
-                return lookup( name ).normalize( valBytes ); 
+                return lookup( name ).normalize( new ClientBinaryValue( valBytes ) ); 
             }
             catch ( UnsupportedEncodingException uee )
             {
@@ -150,7 +151,7 @@
         
         if ( !attributeType.getSyntax().isHumanReadable() )
         {
-            return lookup( name ).normalize( value );
+            return lookup( name ).normalize( new ClientBinaryValue( value ) );
         }
         else
         {
@@ -183,7 +184,7 @@
      */
     public Object normalizeByOid( String oid, byte[] value ) throws NamingException
     {
-        return lookup( oid ).normalize( value );
+        return lookup( oid ).normalize( new ClientBinaryValue( value ) );
     }
 
 

Modified: directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnNormalizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnNormalizer.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnNormalizer.java (original)
+++ directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnNormalizer.java Tue Jul 28 14:54:01 2009
@@ -20,26 +20,31 @@
 package org.apache.directory.server.schema;
 
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 
 
 /**
- * 
+ * Normalizer a DN
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class DnNormalizer implements Normalizer
 {
+    // The serial UID
     private static final long serialVersionUID = 1L;
+    
+    /** A static instance of this normalizer */
+    public static final DnNormalizer INSTANCE = new DnNormalizer();
 
-    // @TODO use this later for seting up normalization
+    // @TODO use this later for setting up normalization
     private AttributeTypeRegistry attrRegistry;
     
     
@@ -48,39 +53,63 @@
         this.attrRegistry = attrRegistry;
     }
     
-    
+
+    /**
+     * Empty constructor
+     */
     public DnNormalizer()
     {
+        // Nothing to do
     }
- 
-    
+
+
     public void setRegistries( Registries registries )
     {
         this.attrRegistry = registries.getAttributeTypeRegistry();
     }
     
 
-    public Object normalize( Object value ) throws NamingException
+    /**
+     * {@inheritDoc}
+     */
+    public Value<?> normalize( Value<?> value ) throws NamingException
+    {
+        LdapDN dn = null;
+        
+        String dnStr = value.getString();
+        
+        dn = new LdapDN( dnStr );
+        
+        dn.normalize( attrRegistry.getNormalizerMapping() );
+        return new ClientStringValue( dn.getNormName() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String normalize( String value ) throws NamingException
+    {
+        LdapDN dn = null;
+        
+        dn = new LdapDN( value );
+        
+        dn.normalize( attrRegistry.getNormalizerMapping() );
+        return dn.getNormName();
+    }
+
+
+    /**
+     * Normalize a DN
+     * @param value The DN to normalize
+     * @return A normalized DN
+     * @throws NamingException
+     */
+    public String normalize( LdapDN value ) throws NamingException
     {
         LdapDN dn = null;
         
-        if ( value instanceof LdapDN )
-        {
-            dn = ( LdapDN ) ( ( LdapDN ) value ).clone();
-        }
-        else if ( value instanceof Name )
-        {
-            dn = new LdapDN( ( Name ) value );
-        }
-        else if ( value instanceof String )
-        {
-            dn = new LdapDN( ( String ) value );
-        }
-        else
-        {
-            throw new IllegalStateException( "I do not know how to handle dn normalization with objects of class: " 
-                + (value == null ? null : value.getClass() ) );
-        }
+        dn = new LdapDN( value );
         
         dn.normalize( attrRegistry.getNormalizerMapping() );
         return dn.getNormName();

Modified: directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDNormalizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDNormalizer.java?rev=798550&r1=798549&r2=798550&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDNormalizer.java (original)
+++ directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDNormalizer.java Tue Jul 28 14:54:01 2009
@@ -22,6 +22,8 @@
 
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -37,21 +39,23 @@
  */
 public class NameAndOptionalUIDNormalizer implements Normalizer
 {
+    // The serial UID
     private static final long serialVersionUID = 1L;
 
     private AttributeTypeRegistry attrRegistry;
     
+    public final static NameAndOptionalUIDNormalizer INSTANCE = new NameAndOptionalUIDNormalizer();
     
-    public NameAndOptionalUIDNormalizer( AttributeTypeRegistry attrRegistry )
+    public NameAndOptionalUIDNormalizer()
     {
-        this.attrRegistry = attrRegistry;
+        // Do nothing
     }
     
-    
-    public NameAndOptionalUIDNormalizer()
+    public NameAndOptionalUIDNormalizer( AttributeTypeRegistry attrRegistry )
     {
+        this.attrRegistry = attrRegistry;
     }
- 
+    
     
     public void setRegistries( Registries registries )
     {
@@ -59,65 +63,100 @@
     }
     
 
-    public Object normalize( Object value ) throws NamingException
+    public Value<?> normalize( Value<?> value ) throws NamingException
     {
-        if ( value instanceof byte[] )
+        String nameAndUid = value.getString();
+            
+        if ( nameAndUid.length() == 0 )
         {
-            value = StringTools.utf8ToString( ( byte[] ) value );
+            return null;
         }
-
-        if ( value instanceof String )
+        
+        // Let's see if we have an UID part
+        int sharpPos = nameAndUid.lastIndexOf( '#' );
+        
+        if ( sharpPos != -1 )
         {
-            String nameAndUid = (String)value;
+            // Now, check that we don't have another '#'
+            if ( nameAndUid.indexOf( '#' ) != sharpPos )
+            {
+                // Yes, we have one : this is not allowed, it should have been
+                // escaped.
+                return null;
+            }
             
-            if ( nameAndUid.length() == 0 )
+            // This is an UID if the '#' is immediately
+            // followed by a BitString, except if the '#' is
+            // on the last position
+            String uid = nameAndUid.substring( sharpPos + 1 );
+            
+            if ( sharpPos > 0 )
+            {
+                LdapDN dn = new LdapDN( nameAndUid.substring( 0, sharpPos ) );
+                
+                dn.normalize( attrRegistry.getNormalizerMapping() );
+                
+                return new ClientStringValue( dn.getNormName() + '#' + uid );
+            }
+            else
+            {
+                throw new IllegalStateException( "I do not know how to handle NameAndOptionalUID normalization with objects of class: " 
+                    + value.getClass() );
+            }
+        }
+        else
+        {
+            // No UID, the strValue is a DN
+            // Return the normalized DN
+            return new ClientStringValue( new LdapDN( nameAndUid ).getNormName() );
+        }
+    }
+
+
+    public String normalize( String value ) throws NamingException
+    {
+        if ( StringTools.isEmpty( value ) )
+        {
+            return null;
+        }
+        
+        // Let's see if we have an UID part
+        int sharpPos = value.lastIndexOf( '#' );
+        
+        if ( sharpPos != -1 )
+        {
+            // Now, check that we don't have another '#'
+            if ( value.indexOf( '#' ) != sharpPos )
             {
-                return false;
+                // Yes, we have one : this is not allowed, it should have been
+                // escaped.
+                return null;
             }
             
-            // Let's see if we have an UID part
-            int sharpPos = nameAndUid.lastIndexOf( '#' );
+            // This is an UID if the '#' is immediatly
+            // followed by a BitString, except if the '#' is
+            // on the last position
+            String uid = value.substring( sharpPos + 1 );
             
-            if ( sharpPos != -1 )
+            if ( sharpPos > 0 )
             {
-                // Now, check that we don't have another '#'
-                if ( nameAndUid.indexOf( '#' ) != sharpPos )
-                {
-                    // Yes, we have one : this is not allowed, it should have been
-                    // escaped.
-                    return false;
-                }
+                LdapDN dn = new LdapDN( value.substring( 0, sharpPos ) );
                 
-                // This is an UID if the '#' is immediatly
-                // followed by a BitString, except if the '#' is
-                // on the last position
-                String uid = nameAndUid.substring( sharpPos + 1 );
+                dn.normalize( attrRegistry.getNormalizerMapping() );
                 
-                if ( sharpPos > 0 )
-                {
-                    LdapDN dn = new LdapDN( nameAndUid.substring( 0, sharpPos ) );
-                    
-                    dn.normalize( attrRegistry.getNormalizerMapping() );
-                    
-                    return dn.getNormName() + '#' + uid;
-                }
-                else
-                {
-                    throw new IllegalStateException( "I do not know how to handle NameAndOptionalUID normalization with objects of class: " 
-                        + (value == null ? null : value.getClass() ) );
-                }
+                return dn.getNormName() + '#' + uid;
             }
             else
             {
-                // No UID, the strValue is a DN
-                // Return the normalized DN
-                return new LdapDN( nameAndUid ).getNormName();
+                throw new IllegalStateException( "I do not know how to handle NameAndOptionalUID normalization with objects of class: " 
+                    + value.getClass() );
             }
         }
         else
         {
-            throw new IllegalStateException( "I do not know how to handle NameAndOptionalUID normalization with objects of class: " 
-                + (value == null ? null : value.getClass() ) );
+            // No UID, the strValue is a DN
+            // Return the normalized DN
+            return new LdapDN( value ).getNormName();
         }
     }
 }



Mime
View raw message