directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1736388 [3/6] - in /directory/shared/branches/shared-value: dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/ dsml/parser/src/main/java/org/apache/directory/api/ds...
Date Wed, 23 Mar 2016 23:28:29 GMT
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java Wed Mar 23 23:28:28 2016
@@ -90,7 +90,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Entry add( AttributeType attributeType, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn() + " is immutable." );
@@ -110,7 +110,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public Entry add( String upId, AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Entry add( String upId, AttributeType attributeType, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn() + " is immutable." );
@@ -160,7 +160,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public Entry add( String upId, Value<?>... values ) throws LdapException
+    public Entry add( String upId, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn() + " is immutable." );
@@ -235,7 +235,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public boolean contains( AttributeType attributeType, Value<?>... values )
+    public boolean contains( AttributeType attributeType, Value... values )
     {
         return entry.contains( attributeType, values );
     }
@@ -262,7 +262,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public boolean contains( String upId, Value<?>... values )
+    public boolean contains( String upId, Value... values )
     {
         return entry.contains( upId, values );
     }
@@ -318,7 +318,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public Attribute put( String upId, Value<?>... values )
+    public Attribute put( String upId, Value... values )
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot put a value : the entry " + entry.getDn() + " is immutable." );
@@ -358,7 +358,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public Attribute put( AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Attribute put( AttributeType attributeType, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot put a value : the entry " + entry.getDn() + " is immutable." );
@@ -388,7 +388,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public Attribute put( String upId, AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Attribute put( String upId, AttributeType attributeType, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot put a value : the entry " + entry.getDn() + " is immutable." );
@@ -428,7 +428,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public boolean remove( AttributeType attributeType, Value<?>... values ) throws LdapException
+    public boolean remove( AttributeType attributeType, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot remove a value : the entry " + entry.getDn() + " is immutable." );
@@ -544,7 +544,7 @@ public class ImmutableEntry implements E
      * @return <code>true</code> if at least a value is removed, <code>false</code>
      * if not all the values have been removed or if the attribute does not exist. 
      */
-    public boolean remove( String upId, Value<?>... values ) throws LdapException
+    public boolean remove( String upId, Value... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot remove a value : the entry " + entry.getDn() + " is immutable." );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java Wed Mar 23 23:28:28 2016
@@ -21,10 +21,27 @@ package org.apache.directory.api.ldap.mo
 
 
 import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.Comparator;
 
+import org.apache.directory.api.i18n.I18n;
+import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
+import org.apache.directory.api.ldap.model.schema.LdapComparator;
+import org.apache.directory.api.ldap.model.schema.LdapSyntax;
+import org.apache.directory.api.ldap.model.schema.MatchingRule;
+import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
+import org.apache.directory.api.util.Serialize;
+import org.apache.directory.api.util.Strings;
+import org.apache.directory.api.util.exception.NotImplementedException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -33,19 +50,309 @@ import org.apache.directory.api.ldap.mod
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface Value<T> extends Cloneable, Externalizable, Comparable<Value<T>>
+public class Value implements Cloneable, Externalizable, Comparable<Value>
 {
+    /** Used for serialization */
+    private static final long serialVersionUID = 2L;
+
+    /** logger for reporting errors that might not be handled properly upstream */
+    private static final Logger LOG = LoggerFactory.getLogger( Value.class );
+
+    /** reference to the attributeType zssociated with the value */
+    private transient AttributeType attributeType;
+
+    /** the User Provided value if it's a String */
+    private String upValue;
+
+    /** the canonical representation of the user provided value if it's a String */
+    private String normValue;
+
+    /** The computed hashcode. We don't want to compute it each time the hashcode() method is called */
+    private volatile int h;
+
+    /** The UTF-8 bytes for this value (we use the UP value) */
+    private byte[] upBytes;
+
+    /** The UTF-8 bytes for this value (we use the NORM value) */
+    private byte[] normBytes;
+
     /** Two flags used to tell if the value is HR or not in serialization */
-    boolean STRING = true;
-    boolean BINARY = false;
+    private boolean isHR = true;
+    
+    // -----------------------------------------------------------------------
+    // Constructors
+    // -----------------------------------------------------------------------
+    /**
+     * Creates a Value with an initial user provided String value.
+     *
+     * @param value the value to wrap which can be null
+     */
+    public Value( String value )
+    {
+        upValue = value;
+        normValue = value;
+        
+        if ( value != null )
+        {
+            upBytes = Strings.getBytesUtf8( value );
+        }
+        
+        normBytes = upBytes;
+        isHR = true;
+        h = hashCode();
+    }
+    
+    
+    /**
+     * Creates a Value with an initial user provided binary value.
+     *
+     * @param value the binary value to wrap which may be null, or a zero length byte array
+     */
+    public Value( byte[] value )
+    {
+        isHR = false;
+        
+        if ( value != null )
+        {
+            upBytes = new byte[value.length];
+            System.arraycopy( value, 0, upBytes, 0, value.length );
+            
+            normBytes = upBytes;
+            h = hashCode();
+        }
+        else
+        {
+            upBytes = null;
+            normBytes = null;
+        }
+    }
+
+
+    
+    /**
+     * Creates a Value with an initial user provided String value and a normalized value.
+     *
+     * @param upValue the user provided value to wrap which can be null
+     * @param normValue the normalized value to wrap which can be null
+     */
+    public Value( String upValue, String normalizedValue )
+    {
+        this.upValue = upValue;
+        this.normValue = normalizedValue;
+        
+        if ( upValue != null )
+        {
+            upBytes = Strings.getBytesUtf8( upValue );
+        }
+        else
+        {
+            upBytes = null;
+        }
+
+        if ( normalizedValue != null )
+        {
+            normBytes = Strings.getBytesUtf8( normalizedValue );
+        }
+        else
+        {
+            normBytes = null;
+        }
+
+        isHR = true;
+        h = hashCode();
+    }
+
+
+    /**
+     * Creates a schema aware binary Value with an initial value.
+     *
+     * @param attributeType the schema type associated with this Value
+     * @param value the value to wrap
+     * @throws LdapInvalidAttributeValueException If the added value is invalid accordingly
+     * to the schema
+     */
+    public Value( AttributeType attributeType, byte[] value ) throws LdapInvalidAttributeValueException
+    {
+        isHR = false;
+        
+        if ( value != null )
+        {
+            upBytes = new byte[value.length];
+            System.arraycopy( value, 0, upBytes, 0, value.length );
+        }
+        else
+        {
+            upBytes = null;
+        }
+
+        apply( attributeType );
+    }
+
+
+    /**
+     * Creates a schema aware binary Value with an initial value.
+     *
+     * @param attributeType the schema type associated with this Value
+     * @param value the value to wrap
+     */
+    /* Package protected*/ Value( AttributeType attributeType )
+    {
+        // The AttributeType must have a Syntax
+        // We must have a Syntax
+        if ( attributeType != null )
+        {
+            if ( attributeType.getSyntax() == null )
+            {
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) );
+            }
+            else
+            {
+                isHR = attributeType.getSyntax().isHumanReadable();
+            }
+        }
+
+        this.attributeType = attributeType;
+    }
+    
+    
+    /**
+     * Creates a schema aware StringValue with an initial user provided String value.
+     *
+     * @param attributeType the schema type associated with this StringValue
+     * @param value the value to wrap
+     * @throws LdapInvalidAttributeValueException If the added value is invalid accordingly
+     * to the schema
+     */
+    public Value( AttributeType attributeType, String value ) throws LdapInvalidAttributeValueException
+    {
+        upValue = value;
+        normValue = value;
+        
+        if ( value != null )
+        {
+            upBytes = Strings.getBytesUtf8( value );
+        }
+        else
+        {
+            upBytes = null;
+        }
+        
+        apply( attributeType );
+    }
+
+
+    /**
+     * Creates a schema aware Value with an initial user provided String value.
+     *
+     * @param attributeType the schema type associated with this StringValue
+     * @param upValue the value to wrap
+     * @throws LdapInvalidAttributeValueException If the added value is invalid accordingly
+     * to the schema
+     */
+    public Value( AttributeType attributeType, String upValue, String normValue ) throws LdapInvalidAttributeValueException
+    {
+        this.upValue = upValue;
+        this.normValue = normValue;
+
+        if ( upValue != null )
+        {
+            upBytes = Strings.getBytesUtf8( upValue );
+        }
+        else
+        {
+            upBytes = null;
+        }
+        
+        apply( attributeType );
+    }
+
+
+    
+    /**
+     * Creates a StringValue without an initial user provided value.
+     *
+     * @param attributeType the schema attribute type associated with this StringValue
+     * @param value the original Value
+     */
+    public Value( AttributeType attributeType, Value value ) throws LdapInvalidAttributeValueException
+    {
+        if ( attributeType != null )
+        {
+            // We must have a Syntax
+            if ( attributeType.getSyntax() == null )
+            {
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) );
+            }
+
+            isHR = attributeType.getSyntax().isHumanReadable();
+            
+            if ( isHR )
+            {
+                upValue = value.upValue;
+            }
+            
+            // We have to copy the byte[], they are just referenced by suoer.clone()
+            if ( value.upBytes != null )
+            {
+                upBytes = new byte[value.upBytes.length];
+                System.arraycopy( value.upBytes, 0, upBytes, 0, value.upBytes.length );
+            }
+
+            apply( attributeType );
+        }
+    }
 
+    
+    /**
+     * Create a Value with an AttributeType. It will not contain anything and will only be used by
+     * the deserializer.
+     * 
+     * @param attributeType The ATttributeType to use
+     * @return An instance of value.
+     */
+    public static Value createValue( AttributeType attributeType )
+    {
+        Value value = new Value( attributeType );
+        
+        return value;
+    }
 
     /**
      * Clone a Value
      * 
      * @return A cloned value
      */
-    Value<T> clone();
+    public Value clone()
+    {
+        try
+        {
+            Value clone = ( Value ) super.clone();
+            
+            if ( isHR )
+            {
+                return clone;
+            }
+            else
+            {
+                // We have to copy the byte[], they are just referenced by suoer.clone()
+                if ( upBytes != null )
+                {
+                    clone.upBytes = new byte[upBytes.length];
+                    System.arraycopy( upBytes, 0, clone.upBytes, 0, upBytes.length );
+    
+                    clone.normBytes = new byte[normBytes.length];
+                    System.arraycopy( normBytes, 0, clone.normBytes, 0, normBytes.length );
+                }
+            }
+            
+            return clone;
+        }
+        catch ( CloneNotSupportedException cnse )
+        {
+            // Do nothing
+            return null;
+        }
+    }
 
 
     /**
@@ -53,7 +360,17 @@ public interface Value<T> extends Clonea
      * 
      * @return <code>true</code> if the inner value is null.
      */
-    boolean isNull();
+    public boolean isNull()
+    {
+        if ( isHR )
+        {
+            return normValue == null;
+        }
+        else
+        {
+            return normBytes == null;
+        }
+    }
 
 
     /**
@@ -61,7 +378,10 @@ public interface Value<T> extends Clonea
      * 
      * @return The AttributeType
      */
-    AttributeType getAttributeType();
+    public AttributeType getAttributeType()
+    {
+        return attributeType;
+    }
 
 
     /**
@@ -75,7 +395,11 @@ public interface Value<T> extends Clonea
      * @return <code>true</code> if the value is associated with the given
      * attributeType or one of its ascendant
      */
-    boolean isInstanceOf( AttributeType attributeType );
+    public boolean isInstanceOf( AttributeType attributeType )
+    {
+        return ( attributeType != null )
+            && ( this.attributeType.equals( attributeType ) || this.attributeType.isDescendantOf( attributeType ) );
+    }
 
 
     /**
@@ -83,7 +407,17 @@ public interface Value<T> extends Clonea
      *
      * @return a copy of the wrapped value
      */
-    T getValue();
+    public String getValue()
+    {
+        if ( isHR )
+        {
+            return upValue;
+        }
+        else
+        {
+            return null;
+        }
+    }
 
 
     /**
@@ -92,7 +426,18 @@ public interface Value<T> extends Clonea
      *
      * @return the wrapped value as a byte[]
      */
-    byte[] getBytes();
+    public byte[] getBytes()
+    {
+        if ( Strings.isEmpty( upBytes ) )
+        {
+            return upBytes;
+        }
+        
+        byte[] copy = new byte[upBytes.length];
+        System.arraycopy( upBytes, 0, copy, 0, upBytes.length );
+        
+        return copy;
+    }
 
 
     /**
@@ -102,17 +447,17 @@ public interface Value<T> extends Clonea
      *
      * @return the wrapped value as a String
      */
-    String getString();
-
-
-    /**
-     * Gets a reference to the wrapped value.
-     * 
-     * Warning ! The value is not copied !!!
-     *
-     * @return a direct handle on the value that is wrapped
-     */
-    T getReference();
+    public String getString()
+    {
+        if ( isHR )
+        {
+            return upValue != null ? upValue : "";
+        }
+        else
+        {
+            return Strings.utf8ToString( upBytes );
+        }
+    }
 
 
     /**
@@ -120,7 +465,10 @@ public interface Value<T> extends Clonea
      *
      * @return <code>true</code> if the value is sxhema aware
      */
-    boolean isSchemaAware();
+    public boolean isSchemaAware()
+    {
+        return attributeType != null;
+    }
 
 
     /**
@@ -131,7 +479,31 @@ public interface Value<T> extends Clonea
      * @return <code>true</code> if the value is valid
      * @exception LdapInvalidAttributeValueException if the value cannot be validated
      */
-    boolean isValid( SyntaxChecker checker ) throws LdapInvalidAttributeValueException;
+    public final boolean isValid( SyntaxChecker syntaxChecker ) throws LdapInvalidAttributeValueException
+    {
+        if ( syntaxChecker == null )
+        {
+            String message = I18n.err( I18n.ERR_04139, toString() );
+            LOG.error( message );
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );
+        }
+
+        if ( ( attributeType != null ) && attributeType.isRelaxed() ) 
+        {
+            return true;
+        }
+        else
+        { 
+            if ( isHR )
+            {
+                return syntaxChecker.isValidSyntax( normValue );
+            }
+            else
+            {
+                return syntaxChecker.isValidSyntax( normBytes );
+            }
+        }
+    }
 
 
     /**
@@ -142,16 +514,24 @@ public interface Value<T> extends Clonea
      *
      * @return gets the normalized value
      */
-    T getNormValue();
-
-
-    /**
-     * Gets a reference to the the normalized (canonical) representation
-     * for the wrapped value.
-     *
-     * @return gets a reference to the normalized value
-     */
-    T getNormReference();
+    public String getNormValue()
+    {
+        if ( isHR )
+        {
+            return normValue;
+        }
+        else
+        {
+            if ( normBytes != null )
+            {
+                return Strings.utf8ToString( normBytes );
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
 
 
     /**
@@ -159,13 +539,27 @@ public interface Value<T> extends Clonea
      * 
      * @return <code>true</code> if the value is a String, <code>false</code> otherwise
      */
-    boolean isHumanReadable();
+    public boolean isHumanReadable()
+    {
+        return isHR;
+    }
 
 
     /**
      * @return The length of the interned value
      */
-    int length();
+    public int length()
+    {
+        if ( isHR )
+        {
+            return upValue != null ? upValue.length() : 0;
+        }
+        else
+        {
+            return upBytes != null ? upBytes.length : 0;
+
+        }
+    }
     
     
     /**
@@ -173,5 +567,712 @@ public interface Value<T> extends Clonea
      *
      * @param attributeType The AttributeType to apply
      */
-    void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException;
+    /* Package protected */ void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException
+    {
+        if ( attributeType == null )
+        {
+            // No attributeType : the normalized value and the user provided value are the same
+            normValue = upValue;
+            normBytes = upBytes;
+            
+            return;
+        }
+
+        this.attributeType = attributeType;
+
+        // We first have to normalize the value before we can check its syntax
+        // Get the equality matchingRule, if we have one
+        MatchingRule equality = attributeType.getEquality();
+
+        if ( equality != null )
+        {
+            // If we have an Equality MR, we *must* have a normalizer
+            Normalizer normalizer = equality.getNormalizer();
+            isHR = attributeType.getSyntax().isHumanReadable();
+            
+            if ( !isHR )
+            {
+                // No normalization for binary values
+                normValue = upValue;
+                normBytes = upBytes;
+            }
+            else
+            {
+                if ( normalizer != null )
+                {
+                    if ( upValue != null )
+                    {
+                        try
+                        {
+                            normValue = normalizer.normalize( upValue );
+                            normBytes = Strings.getBytesUtf8( normValue );
+                        }
+                        catch ( LdapException ne )
+                        {
+                            String message = I18n.err( I18n.ERR_04447_CANNOT_NORMALIZE_VALUE, ne.getLocalizedMessage() );
+                            LOG.info( message );
+                        }
+                    }
+                    else
+                    {
+                        normBytes = upBytes;
+                    }
+                }
+                else
+                {
+                    normValue = upValue;
+                    normBytes = upBytes;
+        
+                    String message = "The '" + attributeType.getName() + "' AttributeType does not have" + " a normalizer";
+                    LOG.error( message );
+                    throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );
+                }
+            }
+        }
+        else
+        {
+            // No MatchingRule, there is nothing we can do but make the normalized value
+            // to be a reference on the user provided value
+            normValue = upValue;
+            normBytes = upBytes;
+        }
+
+        // and checks that the value syntax is valid
+        if ( !attributeType.isRelaxed() )
+        {
+            try
+            {
+                LdapSyntax syntax = attributeType.getSyntax();
+    
+                // Check the syntax if not in relaxed mode
+                if ( ( syntax != null ) && ( !isValid( syntax.getSyntaxChecker() ) ) )
+                {
+                    String message = I18n.err( I18n.ERR_04473_NOT_VALID_VALUE, upValue, attributeType );
+                    LOG.info( message );
+                    throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );
+                }
+            }
+            catch ( LdapException le )
+            {
+                String message = I18n.err( I18n.ERR_04447_CANNOT_NORMALIZE_VALUE, le.getLocalizedMessage() );
+                LOG.info( message );
+                throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message, le );
+            }
+        }
+
+        // Rehash the Value now
+        h = 0;
+        hashCode();
+    }
+    
+    
+    /**
+     * Gets a comparator using getMatchingRule() to resolve the matching
+     * that the comparator is extracted from.
+     *
+     * @return a comparator associated with the attributeType or null if one cannot be found
+     * @throws LdapException if resolution of schema entities fail
+     */
+    private LdapComparator<?> getLdapComparator() throws LdapException
+    {
+        if ( attributeType != null )
+        {
+            MatchingRule mr = attributeType.getEquality();
+
+            if ( mr != null )
+            {
+                return ( LdapComparator<?> ) mr.getLdapComparator();
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Serialize the Value into a buffer at the given position.
+     * 
+     * @param buffer The buffer which will contain the serialized StringValue
+     * @param pos The position in the buffer for the serialized value
+     * @return The new position in the buffer
+     */
+    public int serialize( byte[] buffer, int pos )
+    {
+        // Compute the length : the isHR flag first, the up and norm value presence flags
+        int length = 1 + 1 + 1;
+
+        if ( upValue != null )
+        {
+            // The presence flag, the length and the value
+            length += 4 + upBytes.length;
+        }
+
+        if ( normValue != null )
+        {
+            // The presence flag, the length and the value
+            length += 4 + normBytes.length;
+        }
+
+        // Check that we will be able to store the data in the buffer
+        if ( buffer.length - pos < length )
+        {
+            throw new ArrayIndexOutOfBoundsException();
+        }
+
+        // The STRING flag
+        if ( isHR )
+        {
+            buffer[pos] = Serialize.TRUE;
+        }
+        else
+        {
+            buffer[pos] = Serialize.FALSE;
+        }
+        
+        pos++;
+
+        // Write the user provided value, if not null
+        if ( upBytes != null )
+        {
+            buffer[pos++] = Serialize.TRUE;
+            pos = Serialize.serialize( upBytes, buffer, pos );
+        }
+        else
+        {
+            buffer[pos++] = Serialize.FALSE;
+        }
+
+        // Write the normalized value, if not null
+        if ( normValue != null )
+        {
+            buffer[pos++] = Serialize.TRUE;
+            pos = Serialize.serialize( normBytes, buffer, pos );
+        }
+        else
+        {
+            buffer[pos++] = Serialize.FALSE;
+        }
+
+        return pos;
+    }
+    
+    
+    /**
+     * Deserialize a Value. It will return a new Value instance.
+     * 
+     * @param in The input stream
+     * @return A new Value instance
+     * @throws IOException If the stream can't be read
+     * @throws ClassNotFoundException If we can't instanciate a Value
+     * @throws LdapInvalidAttributeValueException 
+     */
+    public static Value deserialize( ObjectInput in ) throws IOException, ClassNotFoundException, LdapInvalidAttributeValueException
+    {
+        Value value = new Value( ( AttributeType ) null );
+        value.readExternal( in );
+
+        return value;
+    }
+
+    
+    /**
+     * Deserialize a Value. It will return a new Value instance.
+     * 
+     * @param attributeType The AttributeType associated with the Value. Can be null
+     * @param in The input stream
+     * @return A new Value instance
+     * @throws IOException If the stream can't be read
+     * @throws ClassNotFoundException If we can't instanciate a Value
+     * @throws LdapInvalidAttributeValueException 
+     */
+    public static Value deserialize( AttributeType attributeType, ObjectInput in ) throws IOException, ClassNotFoundException
+    {
+        Value value = new Value( attributeType );
+        value.readExternal( in );
+
+        return value;
+    }
+
+
+    /**
+     * Deserialize a StringValue from a byte[], starting at a given position
+     * 
+     * @param buffer The buffer containing the StringValue
+     * @param pos The position in the buffer
+     * @return The new position
+     * @throws IOException If the serialized value is not a StringValue
+     * @throws LdapInvalidAttributeValueException 
+     */
+    public int deserialize( byte[] buffer, int pos ) throws IOException, LdapInvalidAttributeValueException
+    {
+        if ( ( pos < 0 ) || ( pos >= buffer.length ) )
+        {
+            throw new ArrayIndexOutOfBoundsException();
+        }
+
+        // Read the isHR flag
+        isHR = Serialize.deserializeBoolean( buffer, pos );
+        pos++;
+
+        // Read the user provided value, if it's not null
+        boolean hasUpValue = Serialize.deserializeBoolean( buffer, pos );
+        pos++;
+
+        if ( hasUpValue )
+        {
+            upBytes = Serialize.deserializeBytes( buffer, pos );
+            pos += 4 + upBytes.length;
+            upValue = Strings.utf8ToString( upBytes );
+        }
+
+        // Read the normalized value, if not null
+        boolean hasNormalizedValue = Serialize.deserializeBoolean( buffer, pos );
+        pos++;
+
+        if ( hasNormalizedValue )
+        {
+            normBytes = Serialize.deserializeBytes( buffer, pos );
+            pos += 4 + normBytes.length;
+            normValue = Strings.utf8ToString( normBytes );
+        }
+
+        apply( attributeType );
+
+        return pos;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
+    {
+        // Read the isHR flag
+        isHR = in.readBoolean();
+
+        if ( isHR )
+        {
+            // This is a String value 
+            // Read the upValue if any
+            if ( in.readBoolean() )
+            {
+                upValue = in.readUTF();
+                upBytes = Strings.getBytesUtf8( upValue );
+            }
+
+            // Check if we have a normalized value
+            if ( in.readBoolean() )
+            {
+                // Read it if not null
+                if ( in.readBoolean() )
+                {
+                    normValue = in.readUTF();
+                    normBytes = Strings.getBytesUtf8( normValue );
+                }
+            }
+        }
+        else
+        {
+            // This is a binary value
+            // Read the upvalue length
+            int upLength = in.readInt();
+
+            if ( upLength >= 0 )
+            {
+                upBytes = new byte[upLength];
+
+                in.readFully( upBytes );
+            }
+        }
+        
+        // Apply the AttributeType now
+        try
+        {
+            apply( attributeType );
+        }
+        catch ( LdapInvalidAttributeValueException e )
+        {
+            // Make the nomValue equals to the upValue
+            normValue = upValue;
+            normBytes = upBytes;
+        }
+        
+        // And rehash if needed
+        if ( h == 0 )
+        {
+            h = hashCode();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void writeExternal( ObjectOutput out ) throws IOException
+    {
+        // Write a boolean for the HR flag
+        out.writeBoolean( isHR );
+
+        if ( isHR )
+        {
+            // We first write the upValue, if we have one
+            if ( upValue != null )
+            {
+                out.writeBoolean( true );
+                out.writeUTF( upValue );
+            }
+            else
+            {
+                out.writeBoolean( false );
+            }
+            
+            // Write the isNormalized flag
+            if ( attributeType != null )
+            {
+                // This flag is present to tell that we have a normalized value different
+                // from the upValue
+                out.writeBoolean( true );
+
+                // Write the normalized value, if not null
+                if ( normValue != null )
+                {
+                    out.writeBoolean( true );
+                    out.writeUTF( normValue );
+                }
+                else
+                {
+                    out.writeBoolean( false );
+                }
+            }
+            else
+            {
+                // No normalized value
+                out.writeBoolean( false );
+            }
+        }
+        else
+        {
+            // This is a binary value, we just have to write the upBytes
+            if ( upBytes != null )
+            {
+                out.writeInt( upBytes.length );
+
+                if ( upBytes.length > 0 )
+                {
+                    out.write( upBytes, 0, upBytes.length );
+                }
+            }
+            else
+            {
+                // Null value will be marked with a negative value
+                out.writeInt( -1 );
+            }
+            
+        }
+
+        // and flush the data
+        out.flush();
+    }
+
+    
+    /**
+     * Compare two values.
+     * 
+     * @throws IllegalStateException on failures to extract the comparator, or the
+     * normalizers needed to perform the required comparisons based on the schema
+     */
+    public int compareTo( Value value )
+    {
+        // The two values must have the same type
+        if ( isHR != value.isHR )
+        {
+            String msg = I18n.err( I18n.ERR_04443, this, value );
+            LOG.error( msg );
+            throw new IllegalStateException( msg );
+        }
+        
+        if ( isNull() )
+        {
+            if ( ( value == null ) || value.isNull() )
+            {
+                return 0;
+            }
+            else
+            {
+                return -1;
+            }
+        }
+        else if ( ( value == null ) || value.isNull() )
+        {
+            return 1;
+        }
+        
+        if ( !isHR )
+        {
+            return Strings.compare( normBytes, value.normBytes );
+        }
+
+        if ( attributeType != null )
+        {
+            if ( value.getAttributeType() == null )
+            {
+                return normValue.compareTo( value.normValue );
+            }
+            else
+            {
+                if ( !attributeType.equals( value.attributeType ) )
+                {
+                    String message = I18n.err( I18n.ERR_04128, toString(), value.getClass() );
+                    LOG.error( message );
+                    throw new NotImplementedException( message );
+                }
+            }
+        }
+        else
+        {
+            return normValue.compareTo( value.normValue );
+        }
+
+        try
+        {
+            return ( ( LdapComparator<String> ) getLdapComparator() ).compare( normValue, value.getNormValue() );
+        }
+        catch ( LdapException e )
+        {
+            String msg = I18n.err( I18n.ERR_04443, this, value );
+            LOG.error( msg, e );
+            throw new IllegalStateException( msg, e );
+        }
+    }
+    
+    
+    /**
+     * @see Object#hashCode()
+     * @return the instance's hashcode
+     */
+    public int hashCode()
+    {
+        if ( h == 0 )
+        {
+            // return zero if the value is null so only one null value can be
+            // stored in an attribute - the binary version does the same
+            h = Arrays.hashCode( normBytes );
+        }
+
+        return h;
+    }
+    
+    
+    /**
+     * Two StringValue are equals if their normalized values are equal
+     * 
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+
+        if ( !( obj instanceof Value ) )
+        {
+            return false;
+        }
+
+        Value other = ( Value ) obj;
+
+        // Check if the values aren't of the same type
+        if ( isHR != other.isHR )
+        {
+            // Both values must be HR or not HR
+            return false;
+        }
+
+        // Ok, now, let's see if we have an AttributeType at all
+        if ( attributeType == null )
+        {
+            if ( other.attributeType != null )
+            {
+                // Use the comparator
+                // We have an AttributeType, we use the associated comparator
+                try
+                {
+                    Comparator comparator = other.getLdapComparator();
+                    
+                    if ( other.attributeType.getEquality() == null )
+                    {
+                        return false;
+                    }
+                    
+                    Normalizer normalizer = other.attributeType.getEquality().getNormalizer();
+
+                    if ( normalizer == null )
+                    {
+                        if ( comparator == null )
+                        {
+                            return normValue.equals( other.normValue );
+                        }
+                        else
+                        {
+                            return comparator.compare( normValue, other.normValue ) == 0;
+                        }
+                    }
+                    
+                    String thisNormValue = normalizer.normalize( normValue );
+                        
+                    // Compare normalized values
+                    if ( comparator == null )
+                    {
+                        return thisNormValue.equals( other.normValue );
+                    }
+                    else
+                    {
+                        return comparator.compare( thisNormValue, other.normValue ) == 0;
+                    }
+                }
+                catch ( LdapException ne )
+                {
+                    return false;
+                }
+            }
+            
+            // No attributeType
+            if ( isHR )
+            {
+                if ( normValue == null )
+                {
+                    return other.normValue == null;
+                }
+                else
+                {
+                    return normValue.equals( other.normValue );
+                }
+            }
+            else
+            {
+                return Arrays.equals( normBytes, other.normBytes );
+            }
+        }
+        else
+        {
+            if ( other.attributeType == null )
+            {
+                if ( isHR )
+                {
+                    // Use the comparator
+                    // We have an AttributeType, we use the associated comparator
+                    try
+                    {
+                        Comparator comparator = getLdapComparator();
+                        
+                        if ( attributeType.getEquality() == null )
+                        {
+                            return false;
+                        }
+                        
+                        Normalizer normalizer = attributeType.getEquality().getNormalizer();
+
+                        if ( normalizer == null )
+                        {
+                            if ( comparator == null )
+                            {
+                                return normValue.equals( other.normValue );
+                            }
+                            else
+                            {
+                                return comparator.compare( normValue, other.normValue ) == 0;
+                            }
+                        }
+                        
+                        String otherNormValue = normalizer.normalize( other.normValue );
+                            
+                        // Compare normalized values
+                        if ( comparator == null )
+                        {
+                            return normValue.equals( otherNormValue );
+                        }
+                        else
+                        {
+                            return comparator.compare( normValue, otherNormValue ) == 0;
+                        }
+                    }
+                    catch ( LdapException ne )
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    return Arrays.equals( normBytes, other.normBytes );
+                }
+            }
+
+            if ( !attributeType.equals( other.attributeType ) )
+            {
+                return false;
+            }
+            
+            if ( isHR )
+            {
+                // Use the comparator
+                // We have an AttributeType, we use the associated comparator
+                try
+                {
+                    Comparator comparator = getLdapComparator();
+
+                    // Compare normalized values
+                    if ( comparator == null )
+                    {
+                        return normValue.equals( other.normValue );
+                    }
+                    else
+                    {
+                        return comparator.compare( normValue, other.normValue ) == 0;
+                    }
+                }
+                catch ( LdapException ne )
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                return Arrays.equals( normBytes, other.normBytes );
+            }
+        }
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        if ( isHR )
+        {
+            return upValue == null ? "null" : upValue;
+        }
+        else
+        {
+             // Dumps binary in hex with label.
+            if ( normBytes == null )
+            {
+                return "null";
+            }
+            else if ( normBytes.length > 16 )
+            {
+                // Just dump the first 16 bytes...
+                byte[] copy = new byte[16];
+
+                System.arraycopy( normBytes, 0, copy, 0, 16 );
+
+                return Strings.dumpBytes( copy ) + "...";
+            }
+            else
+            {
+                return Strings.dumpBytes( normBytes );
+            }
+        }
+    }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java Wed Mar 23 23:28:28 2016
@@ -24,8 +24,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.directory.api.i18n.I18n;
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.util.Strings;
 
@@ -146,7 +144,7 @@ public abstract class AbstractExprNode i
      * @param value Right hand side of "attrId=value" assertion occurring in an LDAP search filter.
      * @return Escaped version of <code>value</code>
      */
-    protected static Value<?> escapeFilterValue( Value<?> value )
+    protected static Value escapeFilterValue( Value value )
     {
         if ( value.isNull() )
         {
@@ -158,9 +156,10 @@ public abstract class AbstractExprNode i
 
         if ( !value.isHumanReadable() )
         {
-            sb = new StringBuilder( ( ( BinaryValue ) value ).getReference().length * 3 );
+            byte[] bytes = value.getBytes();
+            sb = new StringBuilder( bytes.length * 3 );
 
-            for ( byte b : ( ( BinaryValue ) value ).getReference() )
+            for ( byte b : bytes )
             {
                 if ( ( b < 0x7F ) && ( b >= 0 ) )
                 {
@@ -204,10 +203,10 @@ public abstract class AbstractExprNode i
                 }
             }
 
-            return new StringValue( sb.toString() );
+            return new Value( sb.toString() );
         }
 
-        val = ( ( StringValue ) value ).getString();
+        val = value.getString();
         String encodedVal = FilterEncoder.encodeFilterValue( val );
         if ( val.equals( encodedVal ) )
         {
@@ -215,7 +214,7 @@ public abstract class AbstractExprNode i
         }
         else
         {
-            return new StringValue( encodedVal );
+            return new Value( encodedVal );
         }
     }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ApproximateNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ApproximateNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ApproximateNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ApproximateNode.java Wed Mar 23 23:28:28 2016
@@ -37,7 +37,7 @@ public class ApproximateNode<T> extends
      * @param attributeType the attribute type
      * @param value the value to test for
      */
-    public ApproximateNode( AttributeType attributeType, Value<T> value )
+    public ApproximateNode( AttributeType attributeType, Value value )
     {
         super( attributeType, value, AssertionType.APPROXIMATE );
     }
@@ -49,7 +49,7 @@ public class ApproximateNode<T> extends
      * @param attribute the attribute name
      * @param value the value to test for
      */
-    public ApproximateNode( String attribute, Value<T> value )
+    public ApproximateNode( String attribute, Value value )
     {
         super( attribute, value, AssertionType.APPROXIMATE );
     }
@@ -76,7 +76,7 @@ public class ApproximateNode<T> extends
 
         buf.append( "~=" );
 
-        Value<?> escapedValue = getEscapedValue();
+        Value escapedValue = getEscapedValue();
         if ( !escapedValue.isNull() )
         {
             buf.append( escapedValue );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/EqualityNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/EqualityNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/EqualityNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/EqualityNode.java Wed Mar 23 23:28:28 2016
@@ -37,7 +37,7 @@ public class EqualityNode<T> extends Sim
      * @param attributeType the attributeType
      * @param value the value to test for
      */
-    public EqualityNode( AttributeType attributeType, Value<T> value )
+    public EqualityNode( AttributeType attributeType, Value value )
     {
         super( attributeType, value, AssertionType.EQUALITY );
     }
@@ -49,7 +49,7 @@ public class EqualityNode<T> extends Sim
      * @param attribute the attribute name
      * @param value the value to test for
      */
-    public EqualityNode( String attribute, Value<T> value )
+    public EqualityNode( String attribute, Value value )
     {
         super( attribute, value, AssertionType.EQUALITY );
     }
@@ -76,7 +76,8 @@ public class EqualityNode<T> extends Sim
 
         buf.append( "=" );
 
-        Value<?> escapedValue = getEscapedValue();
+        Value escapedValue = getEscapedValue();
+        
         if ( !escapedValue.isNull() )
         {
             buf.append( escapedValue );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ExtensibleNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ExtensibleNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ExtensibleNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/ExtensibleNode.java Wed Mar 23 23:28:28 2016
@@ -32,7 +32,7 @@ import org.apache.directory.api.ldap.mod
 public class ExtensibleNode extends LeafNode
 {
     /** The value of the attribute to match for */
-    private Value<?> value;
+    private Value value;
 
     /** The matching rules id */
     private String matchingRuleId;
@@ -75,7 +75,7 @@ public class ExtensibleNode extends Leaf
      * @param matchingRuleId the OID of the matching rule
      * @param dnAttributes the dn attributes
      */
-    public ExtensibleNode( AttributeType attributeType, Value<?> value, String matchingRuleId, boolean dnAttributes )
+    public ExtensibleNode( AttributeType attributeType, Value value, String matchingRuleId, boolean dnAttributes )
     {
         super( attributeType, AssertionType.EXTENSIBLE );
 
@@ -93,7 +93,7 @@ public class ExtensibleNode extends Leaf
      * @param matchingRuleId the OID of the matching rule
      * @param dnAttributes the dn attributes
      */
-    public ExtensibleNode( String attribute, Value<?> value, String matchingRuleId, boolean dnAttributes )
+    public ExtensibleNode( String attribute, Value value, String matchingRuleId, boolean dnAttributes )
     {
         super( attribute, AssertionType.EXTENSIBLE );
 
@@ -172,7 +172,7 @@ public class ExtensibleNode extends Leaf
      * 
      * @return the value
      */
-    public final Value<?> getValue()
+    public final Value getValue()
     {
         return value;
     }
@@ -181,7 +181,7 @@ public class ExtensibleNode extends Leaf
     /** 
      * @return representation of value, escaped for use in a filter if required 
      */
-    public Value<?> getEscapedValue()
+    public Value getEscapedValue()
     {
         if ( value.isHumanReadable() )
         {
@@ -197,7 +197,7 @@ public class ExtensibleNode extends Leaf
      * 
      * @param value the value
      */
-    public final void setValue( Value<?> value )
+    public final void setValue( Value value )
     {
         this.value = value;
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java Wed Mar 23 23:28:28 2016
@@ -24,8 +24,6 @@ import java.text.ParseException;
 
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.entry.AttributeUtils;
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -232,7 +230,7 @@ public final class FilterParser
      * unicodeSubset     = %x01-27 / %x2B-5B / %x5D-FFFF
      * @throws LdapInvalidAttributeValueException 
      */
-    private static Value<?> parseAssertionValue( SchemaManager schemaManager, String attribute, byte[] filter,
+    private static Value parseAssertionValue( SchemaManager schemaManager, String attribute, byte[] filter,
         Position pos ) throws ParseException
     {
         byte b = Strings.byteAt( filter, pos.start );
@@ -295,21 +293,21 @@ public final class FilterParser
 
                 if ( attributeType == null )
                 {
-                    return new BinaryValue( result );
+                    return new Value( result );
                 }
 
                 if ( attributeType.getSyntax().isHumanReadable() )
                 {
-                    return new StringValue( Strings.utf8ToString( result ) );
+                    return new Value( Strings.utf8ToString( result ) );
                 }
                 else
                 {
-                    return new BinaryValue( result );
+                    return new Value( result );
                 }
             }
             else
             {
-                return new BinaryValue( result );
+                return new Value( result );
             }
         }
         else
@@ -320,16 +318,16 @@ public final class FilterParser
 
                 if ( attributeType.getEquality().getSyntax().isHumanReadable() )
                 {
-                    return new StringValue( ( String ) null );
+                    return new Value( ( String ) null );
                 }
                 else
                 {
-                    return new BinaryValue( null );
+                    return new Value( ( byte[] ) null );
                 }
             }
             else
             {
-                return new BinaryValue( ( byte[] ) null );
+                return new Value( ( byte[] ) null );
             }
         }
     }
@@ -367,7 +365,7 @@ public final class FilterParser
      * HEX            = '0'-'9' / 'A'-'F' / 'a'-'f'
      * unicodeSubset     = %x01-27 / %x2B-5B / %x5D-FFFF
      */
-    private static Value<?> parseAssertionValue( SchemaManager schemaManager, byte[] filter, Position pos )
+    private static Value parseAssertionValue( SchemaManager schemaManager, byte[] filter, Position pos )
         throws ParseException
     {
         byte b = Strings.byteAt( filter, pos.start );
@@ -424,11 +422,11 @@ public final class FilterParser
             byte[] result = new byte[current];
             System.arraycopy( value, 0, result, 0, current );
 
-            return new BinaryValue( result );
+            return new Value( result );
         }
         else
         {
-            return new BinaryValue( null );
+            return new Value( ( byte[] ) null );
         }
     }
 
@@ -436,7 +434,7 @@ public final class FilterParser
     /**
      * Parse a substring
      */
-    private static ExprNode parseSubstring( SchemaManager schemaManager, String attribute, Value<?> initial,
+    private static ExprNode parseSubstring( SchemaManager schemaManager, String attribute, Value initial,
         byte[] filter, Position pos )
         throws ParseException, LdapException
     {
@@ -476,7 +474,7 @@ public final class FilterParser
             //
             while ( true )
             {
-                Value<?> assertionValue = parseAssertionValue( schemaManager, attribute, filter, pos );
+                Value assertionValue = parseAssertionValue( schemaManager, attribute, filter, pos );
 
                 // Is there anything else but a ')' after the value ?
                 if ( Strings.isCharASCII( filter, pos.start, ')' ) )
@@ -592,7 +590,7 @@ public final class FilterParser
 
                 if ( attributeType != null )
                 {
-                    return new EqualityNode( attributeType, new BinaryValue( ( byte[] ) null ) );
+                    return new EqualityNode( attributeType, new Value( ( byte[] ) null ) );
                 }
 
                 else
@@ -602,13 +600,13 @@ public final class FilterParser
             }
             else
             {
-                return new EqualityNode( attribute, new BinaryValue( ( byte[] ) null ) );
+                return new EqualityNode( attribute, new Value( ( byte[] ) null ) );
             }
         }
         else
         {
             // A substring or an equality node
-            Value<?> value = parseAssertionValue( schemaManager, attribute, filter, pos );
+            Value value = parseAssertionValue( schemaManager, attribute, filter, pos );
 
             // Is there anything else but a ')' after the value ?
             if ( Strings.isCharASCII( filter, pos.start, ')' ) )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/GreaterEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/GreaterEqNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/GreaterEqNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/GreaterEqNode.java Wed Mar 23 23:28:28 2016
@@ -37,7 +37,7 @@ public class GreaterEqNode<T> extends Si
      * @param attributeType the attributeType
      * @param value the value to test for
      */
-    public GreaterEqNode( AttributeType attributeType, Value<T> value )
+    public GreaterEqNode( AttributeType attributeType, Value value )
     {
         super( attributeType, value, AssertionType.GREATEREQ );
     }
@@ -49,7 +49,7 @@ public class GreaterEqNode<T> extends Si
      * @param attribute the attribute name
      * @param value the value to test for
      */
-    public GreaterEqNode( String attribute, Value<T> value )
+    public GreaterEqNode( String attribute, Value value )
     {
         super( attribute, value, AssertionType.GREATEREQ );
     }
@@ -76,7 +76,7 @@ public class GreaterEqNode<T> extends Si
 
         buf.append( ">=" );
 
-        Value<?> escapedValue = getEscapedValue();
+        Value escapedValue = getEscapedValue();
         if ( !escapedValue.isNull() )
         {
             buf.append( escapedValue );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/LessEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/LessEqNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/LessEqNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/LessEqNode.java Wed Mar 23 23:28:28 2016
@@ -37,7 +37,7 @@ public class LessEqNode<T> extends Simpl
      * @param attributeType the attributeType
      * @param value the value to test for
      */
-    public LessEqNode( AttributeType attributeType, Value<T> value )
+    public LessEqNode( AttributeType attributeType, Value value )
     {
         super( attributeType, value, AssertionType.LESSEQ );
     }
@@ -49,7 +49,7 @@ public class LessEqNode<T> extends Simpl
      * @param attribute the attribute name
      * @param value the value to test for
      */
-    public LessEqNode( String attribute, Value<T> value )
+    public LessEqNode( String attribute, Value value )
     {
         super( attribute, value, AssertionType.LESSEQ );
     }
@@ -76,7 +76,7 @@ public class LessEqNode<T> extends Simpl
 
         buf.append( "<=" );
 
-        Value<?> escapedValue = getEscapedValue();
+        Value escapedValue = getEscapedValue();
         if ( !escapedValue.isNull() )
         {
             buf.append( escapedValue );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SimpleNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SimpleNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SimpleNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SimpleNode.java Wed Mar 23 23:28:28 2016
@@ -34,7 +34,7 @@ import org.apache.directory.api.ldap.mod
 public abstract class SimpleNode<T> extends LeafNode
 {
     /** the value */
-    protected Value<T> value;
+    protected Value value;
 
     /** Constants for comparisons : > */
     public static final boolean EVAL_GREATER = true;
@@ -50,7 +50,7 @@ public abstract class SimpleNode<T> exte
      * @param value the value to test for
      * @param assertionType the type of assertion represented by this ExprNode
      */
-    protected SimpleNode( String attribute, Value<T> value, AssertionType assertionType )
+    protected SimpleNode( String attribute, Value value, AssertionType assertionType )
     {
         super( attribute, assertionType );
         this.value = value;
@@ -64,7 +64,7 @@ public abstract class SimpleNode<T> exte
      * @param value the value to test for
      * @param assertionType the type of assertion represented by this ExprNode
      */
-    protected SimpleNode( AttributeType attributeType, Value<T> value, AssertionType assertionType )
+    protected SimpleNode( AttributeType attributeType, Value value, AssertionType assertionType )
     {
         super( attributeType, assertionType );
         this.value = value;
@@ -92,7 +92,7 @@ public abstract class SimpleNode<T> exte
      * 
      * @return the value
      */
-    public final Value<T> getValue()
+    public final Value getValue()
     {
         return value;
     }
@@ -101,7 +101,7 @@ public abstract class SimpleNode<T> exte
     /** 
      * @return representation of value, escaped for use in a filter if required 
      */
-    public Value<?> getEscapedValue()
+    public Value getEscapedValue()
     {
         return escapeFilterValue( value );
     }
@@ -112,7 +112,7 @@ public abstract class SimpleNode<T> exte
      * 
      * @param value the value for this node
      */
-    public void setValue( Value<T> value )
+    public void setValue( Value value )
     {
         this.value = value;
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SubstringNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SubstringNode.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SubstringNode.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/SubstringNode.java Wed Mar 23 23:28:28 2016
@@ -25,7 +25,7 @@ import java.util.List;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
-import org.apache.directory.api.ldap.model.entry.StringValue;
+import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
@@ -452,7 +452,7 @@ public class SubstringNode extends LeafN
 
         if ( null != initialPattern )
         {
-            buf.append( escapeFilterValue( new StringValue( initialPattern ) ) ).append( '*' );
+            buf.append( escapeFilterValue( new Value( initialPattern ) ) ).append( '*' );
         }
         else
         {
@@ -463,14 +463,14 @@ public class SubstringNode extends LeafN
         {
             for ( String any : anyPattern )
             {
-                buf.append( escapeFilterValue( new StringValue( any ) ) );
+                buf.append( escapeFilterValue( new Value( any ) ) );
                 buf.append( '*' );
             }
         }
 
         if ( null != finalPattern )
         {
-            buf.append( escapeFilterValue( new StringValue( finalPattern ) ) );
+            buf.append( escapeFilterValue( new Value( finalPattern ) ) );
         }
 
         buf.append( super.toString() );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java Wed Mar 23 23:28:28 2016
@@ -39,7 +39,6 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.entry.Modification;
 import org.apache.directory.api.ldap.model.entry.ModificationOperation;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
@@ -465,8 +464,8 @@ public class LdifEntry implements Clonea
 
             if ( value == null )
             {
-                value = new StringValue( ( String ) null );
-                attr = new DefaultAttribute( id, ( Value<?> ) value );
+                value = new Value( ( String ) null );
+                attr = new DefaultAttribute( id, ( Value ) value );
             }
             else
             {
@@ -554,7 +553,7 @@ public class LdifEntry implements Clonea
         }
         else
         {
-            entry.add( id, ( Value<?> ) null );
+            entry.add( id, ( Value ) null );
         }
     }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java Wed Mar 23 23:28:28 2016
@@ -581,7 +581,7 @@ public final class LdifUtils
             return "";
         }
 
-        for ( Value<?> value : attr )
+        for ( Value value : attr )
         {
             StringBuilder lineBuffer = new StringBuilder();
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/Anonymizer.java Wed Mar 23 23:28:28 2016
@@ -44,7 +44,7 @@ public interface Anonymizer<K>
      * @param attribute The attribute to anonymize
      * @return The anonymized attribute
      */
-    Attribute anonymize( Map<Value<K>, Value<K>> valueMap, Set<Value<K>> valueSet, Attribute attribute );
+    Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute );
     
     
     /**

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/BinaryAnonymizer.java Wed Mar 23 23:28:28 2016
@@ -26,7 +26,6 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
@@ -71,20 +70,20 @@ public class BinaryAnonymizer extends Ab
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<byte[]>, Value<byte[]>> valueMap, Set<Value<byte[]>> valueSet, Attribute attribute )
+    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
 
-        for ( Value<?> value : attribute )
+        for ( Value value : attribute )
         {
-            byte[] bytesValue = ( byte[] ) value.getNormValue();
+            byte[] bytesValue = value.getBytes();
             byte[] newValue = computeNewValue( bytesValue );
             
             try
             {
                 result.add( newValue );
-                Value<byte[]> anonValue = new BinaryValue( attribute.getAttributeType(), newValue );
-                valueMap.put( ( Value<byte[]> ) value, anonValue );
+                Value anonValue = new Value( attribute.getAttributeType(), newValue );
+                valueMap.put( ( Value ) value, anonValue );
                 valueSet.add( anonValue );
             }
             catch ( LdapInvalidAttributeValueException e )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/CaseSensitiveStringAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/CaseSensitiveStringAnonymizer.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/CaseSensitiveStringAnonymizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/CaseSensitiveStringAnonymizer.java Wed Mar 23 23:28:28 2016
@@ -27,7 +27,6 @@ import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -76,16 +75,16 @@ public class CaseSensitiveStringAnonymiz
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap, Set<Value<String>> valueSet, Attribute attribute )
+    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
     {
         AttributeType attributeType = attribute.getAttributeType();
         Attribute result = new DefaultAttribute( attributeType );
 
-        for ( Value<?> value : attribute )
+        for ( Value value : attribute )
         {
-            if ( value instanceof StringValue )
+            if ( value.isHumanReadable() )
             {
-                Value<String> anonymized =  valueMap.get( value );
+                Value anonymized =  valueMap.get( value );
                 
                 if ( anonymized != null )
                 {
@@ -100,14 +99,14 @@ public class CaseSensitiveStringAnonymiz
                 }
                 else
                 {
-                    String strValue = value.getNormValue().toString();
+                    String strValue = value.getNormValue();
                     String newValue = computeNewValue( strValue );
                     
                     try
                     {
                         result.add( newValue );
-                        Value<String> anonValue = new StringValue( attribute.getAttributeType(), newValue );
-                        valueMap.put( ( Value<String> ) value, anonValue );
+                        Value anonValue = new Value( attribute.getAttributeType(), newValue );
+                        valueMap.put( ( Value ) value, anonValue );
                         valueSet.add( anonValue );
                     }
                     catch ( LdapInvalidAttributeValueException e )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/IntegerAnonymizer.java Wed Mar 23 23:28:28 2016
@@ -28,7 +28,6 @@ import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 
@@ -72,15 +71,15 @@ public class IntegerAnonymizer extends A
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap, Set<Value<String>> valueSet, Attribute attribute )
+    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
 
-        for ( Value<?> value : attribute )
+        for ( Value value : attribute )
         {
-            if ( value instanceof StringValue )
+            if ( value.isHumanReadable() )
             {
-                Value<String> anonymized =  valueMap.get( value );
+                Value anonymized =  valueMap.get( value );
                 
                 if ( anonymized != null )
                 {
@@ -101,8 +100,8 @@ public class IntegerAnonymizer extends A
                     try
                     {
                         result.add( newValue );
-                        Value<String> anonValue = new StringValue( attribute.getAttributeType(), newValue );
-                        valueMap.put( ( Value<String> ) value, anonValue );
+                        Value anonValue = new Value( attribute.getAttributeType(), newValue );
+                        valueMap.put( ( Value ) value, anonValue );
                         valueSet.add( anonValue );
                     }
                     catch ( LdapInvalidAttributeValueException e )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java Wed Mar 23 23:28:28 2016
@@ -27,7 +27,6 @@ import java.util.Set;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -76,16 +75,16 @@ public class StringAnonymizer extends Ab
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending on the Attribute type)
      */
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap, Set<Value<String>> valueSet, Attribute attribute )
+    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
     {
         AttributeType attributeType = attribute.getAttributeType();
         Attribute result = new DefaultAttribute( attributeType );
 
-        for ( Value<?> value : attribute )
+        for ( Value value : attribute )
         {
-            if ( value instanceof StringValue )
+            if ( value.isHumanReadable() )
             {
-                Value<String> anonymized =  valueMap.get( value );
+                Value anonymized =  valueMap.get( value );
                 
                 if ( anonymized != null )
                 {
@@ -106,8 +105,8 @@ public class StringAnonymizer extends Ab
                     try
                     {
                         result.add( newValue );
-                        Value<String> anonValue = new StringValue( attribute.getAttributeType(), newValue );
-                        valueMap.put( ( Value<String> ) value, anonValue );
+                        Value anonValue = new Value( attribute.getAttributeType(), newValue );
+                        valueMap.put( ( Value ) value, anonValue );
                         valueSet.add( anonValue );
                     }
                     catch ( LdapInvalidAttributeValueException e )

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/TelephoneNumberAnonymizer.java Wed Mar 23 23:28:28 2016
@@ -54,13 +54,13 @@ public class TelephoneNumberAnonymizer e
     /**
      * Anonymize an attribute using pure random values (either chars of bytes, depending on the Attribute type)
      *
-    public Attribute anonymize( Map<Value<String>, Value<String>> valueMap, Set<Value<String>> valueSet, Attribute attribute )
+    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
     {
         Attribute result = new DefaultAttribute( attribute.getAttributeType() );
 
-        for ( Value<?> value : attribute )
+        for ( Value value : attribute )
         {
-            Value<String> anonymized =  valueMap.get( value );
+            Value anonymized =  valueMap.get( value );
             
             if ( anonymized != null )
             {
@@ -102,8 +102,8 @@ public class TelephoneNumberAnonymizer e
                         String newValueStr = new String( newValue );
                         result.add( newValueStr );
                         
-                        Value<String> anonValue = new StringValue( attribute.getAttributeType(), newValueStr );
-                        valueMap.put( ( Value<String> ) value, anonValue );
+                        Value anonValue = new Value( attribute.getAttributeType(), newValueStr );
+                        valueMap.put( ( Value ) value, anonValue );
                     }
                     catch ( LdapInvalidAttributeValueException e )
                     {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AddRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AddRequestImpl.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AddRequestImpl.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AddRequestImpl.java Wed Mar 23 23:28:28 2016
@@ -106,7 +106,7 @@ public class AddRequestImpl extends Abst
      * 
      * @param value The value to add
      */
-    public void addAttributeValue( Value<?> value ) throws LdapException
+    public void addAttributeValue( Value value ) throws LdapException
     {
         currentAttribute.add( value );
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequest.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequest.java Wed Mar 23 23:28:28 2016
@@ -56,7 +56,7 @@ public interface CompareRequest extends
      * 
      * @return the attribute value to used in comparison.
      */
-    Value<?> getAssertionValue();
+    Value getAssertionValue();
 
 
     /**

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequestImpl.java?rev=1736388&r1=1736387&r2=1736388&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequestImpl.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/CompareRequestImpl.java Wed Mar 23 23:28:28 2016
@@ -20,8 +20,6 @@
 package org.apache.directory.api.ldap.model.message;
 
 
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.util.Strings;
@@ -43,7 +41,7 @@ public class CompareRequestImpl extends
     private String attrId;
 
     /** The value of the attribute used in the comparison */
-    private Value<?> attrVal;
+    private Value attrVal;
 
     /** The associated response */
     private CompareResponse response;
@@ -94,7 +92,7 @@ public class CompareRequestImpl extends
      * 
      * @return the attribute value to used in comparison.
      */
-    public Value<?> getAssertionValue()
+    public Value getAssertionValue()
     {
         return attrVal;
     }
@@ -105,7 +103,7 @@ public class CompareRequestImpl extends
      */
     public CompareRequest setAssertionValue( String value )
     {
-        this.attrVal = new StringValue( value );
+        this.attrVal = new Value( value );
 
         return this;
     }
@@ -118,7 +116,7 @@ public class CompareRequestImpl extends
     {
         if ( value != null )
         {
-            this.attrVal = new BinaryValue( value );
+            this.attrVal = new Value( value );
         }
         else
         {
@@ -240,7 +238,7 @@ public class CompareRequestImpl extends
         {
             hash = hash * 17 + attrVal.hashCode();
         }
-        Value<?> reqVal = getAssertionValue();
+        Value reqVal = getAssertionValue();
         if ( reqVal != null )
         {
             hash = hash * 17 + reqVal.hashCode();
@@ -304,7 +302,7 @@ public class CompareRequestImpl extends
             return false;
         }
 
-        Value<?> reqVal = req.getAssertionValue();
+        Value reqVal = req.getAssertionValue();
 
         if ( attrVal != null )
         {




Mime
View raw message