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

svn commit: r927839 [3/3] - in /directory: apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ apacheds/trunk/core-api/src...

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Fri Mar 26 13:25:10 2010
@@ -26,7 +26,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -127,7 +127,7 @@ public class PresenceEvaluator<ID> imple
         }
 
         // get the attribute
-        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
+        EntryAttribute attr = entry.get( type );
 
         // if the attribute exists just return true
         if ( attr != null )
@@ -150,7 +150,7 @@ public class PresenceEvaluator<ID> imple
             {
                 AttributeType descendant = descendants.next();
 
-                attr = ( ServerAttribute ) entry.get( descendant );
+                attr = entry.get( descendant );
 
                 if ( attr != null )
                 {

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Fri Mar 26 13:25:10 2010
@@ -29,7 +29,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
@@ -247,7 +247,7 @@ public class SubstringEvaluator<ID> impl
     private boolean evaluateWithoutIndex( ServerEntry entry ) throws Exception
     {
         // get the attribute
-        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
+        EntryAttribute attr = entry.get( type );
 
         // if the attribute exists and the pattern matches return true
         if ( attr != null )
@@ -288,7 +288,7 @@ public class SubstringEvaluator<ID> impl
             {
                 AttributeType descendant = descendants.next();
 
-                attr = ( ServerAttribute ) entry.get( descendant );
+                attr = entry.get( descendant );
 
                 if ( null != attr )
                 {
@@ -339,7 +339,7 @@ public class SubstringEvaluator<ID> impl
          */
 
         // get the attribute
-        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
+        EntryAttribute attr = entry.get( type );
 
         // if the attribute exists and the pattern matches return true
         if ( attr != null )
@@ -382,7 +382,7 @@ public class SubstringEvaluator<ID> impl
             {
                 AttributeType descendant = descendants.next();
 
-                attr = ( ServerAttribute ) entry.get( descendant );
+                attr = entry.get( descendant );
 
                 if ( null != attr )
                 {

Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java (original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java Fri Mar 26 13:25:10 2010
@@ -34,7 +34,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientEntry;
+import org.apache.directory.shared.ldap.entry.client.ClientEntryFactory;
 import org.apache.directory.shared.ldap.entry.client.ClientModification;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
@@ -85,7 +85,7 @@ public class LdifEntry implements Clonea
     private boolean deleteOldRdn;
 
     /** the entry */
-    private ClientEntry entry;
+    private Entry entry;
 
     
     /** The control */
@@ -553,7 +553,7 @@ public class LdifEntry implements Clonea
 
         if ( entry != null )
         {
-            clone.entry = (ClientEntry)entry.clone();
+            clone.entry = entry.clone();
         }
 
         return clone;
@@ -927,7 +927,7 @@ public class LdifEntry implements Clonea
         // Read the changeType
         int type = in.readInt();
         changeType = ChangeType.getChangeType( type );
-        entry = (ClientEntry)in.readObject();
+        entry = (Entry)in.readObject();
         
         switch ( changeType )
         {

Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java (original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java Fri Mar 26 13:25:10 2010
@@ -478,7 +478,7 @@ public class LdifUtils
         {
             StringBuilder lineBuffer = new StringBuilder();
             
-            lineBuffer.append( attr.getId() );
+            lineBuffer.append( attr.getUpId() );
             
             // First, deal with null value (which is valid)
             if ( value.isNull() )

Modified: directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.7.ldif
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/resources/schema/ou%3Dschema/cn%3Djava/ou%3Dobjectclasses/m-oid%3D1.3.6.1.4.1.42.2.27.4.2.7.ldif?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.7.ldif (original)
+++ directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.7.ldif Fri Mar 26 13:25:10 2010
@@ -10,7 +10,6 @@ m-supObjectClass: javaObject
 m-typeObjectClass: AUXILIARY
 m-may: javaReferenceAddress
 m-may: javaFactory
-entryUUID:: h00TrOdXSSetsPaZmZyjkQ==
 createtimestamp: 20090818022732Z
 entrycsn: 20090818052732.846000Z#000000#000#000000
 creatorsname: uid=admin,ou=system

Modified: directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.8.ldif
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/resources/schema/ou%3Dschema/cn%3Djava/ou%3Dobjectclasses/m-oid%3D1.3.6.1.4.1.42.2.27.4.2.8.ldif?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.8.ldif (original)
+++ directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.8.ldif Fri Mar 26 13:25:10 2010
@@ -9,7 +9,6 @@ m-description: Java marshalled object
 m-supObjectClass: javaObject
 m-typeObjectClass: AUXILIARY
 m-must: javaSerializedData
-entryUUID:: Vp4K6buFT3qm4rxt7RVzCA==
 createtimestamp: 20090818022732Z
 entrycsn: 20090818052732.847000Z#000000#000#000000
 creatorsname: uid=admin,ou=system

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java Fri Mar 26 13:25:10 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.exception.LdapException;
-import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -45,39 +44,13 @@ import org.slf4j.LoggerFactory;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public final class DefaultServerAttribute extends DefaultClientAttribute implements ServerAttribute
+public final class DefaultServerAttribute extends DefaultClientAttribute implements EntryAttribute
 {
     public static final long serialVersionUID = 1L;
     
     /** logger for reporting errors that might not be handled properly upstream */
     private static final Logger LOG = LoggerFactory.getLogger( DefaultServerAttribute.class );
     
-    /** The associated AttributeType */
-    private AttributeType attributeType;
-    
-    
-    //-----------------------------------------------------------------------
-    // utility methods
-    //-----------------------------------------------------------------------
-    /**
-     * Private helper method used to set an UpId from an attributeType
-     * 
-     * @param at The attributeType for which we want the upID
-     * @return the ID of the given attributeType
-     */
-    private String getUpId( AttributeType at )
-    {
-        String atUpId = at.getName();
-        
-        if ( atUpId == null )
-        {
-            atUpId = at.getOid();
-        }
-        
-        return atUpId;
-    }
-    
-    
     //-------------------------------------------------------------------------
     // Constructors
     //-------------------------------------------------------------------------
@@ -97,7 +70,7 @@ public final class DefaultServerAttribut
         this.id = attribute.getId();
         this.upId = attribute.getUpId();
 
-        if ( attribute instanceof ServerAttribute )
+        if ( attributeType == null )
         {
             isHR = attribute.isHR();
 
@@ -185,7 +158,7 @@ public final class DefaultServerAttribut
         }
 
         setAttributeType( attributeType );
-        setUpId( upId );
+        setUpId( upId, attributeType );
     }
 
 
@@ -652,58 +625,10 @@ public final class DefaultServerAttribut
         
         return true;
     }
-
-
-    /**
-     * Get the attribute type associated with this ServerAttribute.
-     *
-     * @return the attributeType associated with this entry attribute
-     */
-    public AttributeType getAttributeType()
-    {
-        return attributeType;
-    }
     
     
     /**
      * <p>
-     * Check if the current attribute type is of the expected attributeType
-     * </p>
-     * <p>
-     * This method won't tell if the current attribute is a descendant of 
-     * the attributeType. For instance, the "CN" serverAttribute will return
-     * false if we ask if it's an instance of "Name". 
-     * </p> 
-     *
-     * @param attributeId The AttributeType ID to check
-     * @return True if the current attribute is of the expected attributeType
-     * @throws LdapInvalidAttributeValueException If there is no AttributeType
-     */
-    public boolean instanceOf( String attributeId ) throws LdapInvalidAttributeValueException
-    {
-        String trimmedId = StringTools.trim( attributeId );
-        
-        if ( StringTools.isEmpty( trimmedId ) )
-        {
-            return false;
-        }
-        
-        String normId = StringTools.lowerCaseAscii( trimmedId );
-        
-        for ( String name:attributeType.getNames() )
-        {
-            if ( normId.equalsIgnoreCase( name ) )
-            {
-                return true;
-            }
-        }
-        
-        return normId.equalsIgnoreCase( attributeType.getOid() );
-    }
-    
-
-    /**
-     * <p>
      * Checks to see if this attribute is valid along with the values it contains.
      * </p>
      * <p>
@@ -847,39 +772,6 @@ public final class DefaultServerAttribut
     
     /**
      * <p>
-     * Set the attribute type associated with this ServerAttribute.
-     * </p>
-     * <p>
-     * The current attributeType will be replaced. It is the responsibility of
-     * the caller to insure that the existing values are compatible with the new
-     * AttributeType
-     * </p>
-     *
-     * @param attributeType the attributeType associated with this entry attribute
-     */
-    public void setAttributeType( AttributeType attributeType )
-    {
-        if ( attributeType == null )
-        {
-            throw new IllegalArgumentException( "The AttributeType parameter should not be null" );
-        }
-
-        this.attributeType = attributeType;
-        setUpId( null, attributeType );
-        
-        if ( attributeType.getSyntax().isHumanReadable() )
-        {
-            isHR = true;
-        }
-        else
-        {
-            isHR = false;
-        }
-    }
-    
-    
-    /**
-     * <p>
      * Overload the ClientAttribte isHR method : we can't change this flag
      * for a ServerAttribute, as the HR is already set using the AttributeType.
      * Set the attribute to Human Readable or to Binary. 
@@ -974,7 +866,7 @@ public final class DefaultServerAttribut
      * </p>
      *
      * @param upId The attribute ID
-     */
+     *
     public void setUpId( String upId )
     {
         if ( !StringTools.isEmpty( StringTools.trim( upId  ) ) )
@@ -987,7 +879,7 @@ public final class DefaultServerAttribut
                     // Everything is fine, store the upId.
                     // This should not happen...
                     super.setUpId( upId );
-                    
+                    return;
                 }
             }
             else
@@ -1012,131 +904,17 @@ public final class DefaultServerAttribut
                 {
                     // We have an OID : stores it
                     super.setUpId( upId );
+                    return;
                 }
-            }
-        }
-    }
-    
-    
-    /**
-     * <p>
-     * Set the user provided ID. If we have none, the upId is assigned
-     * the attributetype's name. If it does not have any name, we will
-     * use the OID.
-     * </p>
-     * <p>
-     * If we have an upId and an AttributeType, they must be compatible. :
-     *  - if the upId is an OID, it must be the AttributeType's OID
-     *  - otherwise, its normalized form must be equals to ones of
-     *  the attributeType's names.
-     * </p>
-     * <p>
-     * In any case, the ATtributeType will be changed. The caller is responsible for
-     * the present values to be compatoble with the new AttributeType.
-     * </p>
-     *
-     * @param upId The attribute ID
-     * @param attributeType The associated attributeType
-     */
-    public void setUpId( String upId, AttributeType attributeType )
-    {
-        if ( StringTools.isEmpty( StringTools.trim( upId  ) ) )
-        {
-            super.setUpId( getUpId( attributeType ) );
-            this.attributeType = attributeType;
-        }
-        else
-        {
-            String name = attributeType.getName();
-            
-            if ( name == null )
-            {
-                // If the name is null, then we may have to store an OID
-                if ( OID.isOID( upId )  && attributeType.getOid().equals( upId ) )
-                {
-                    //  Everything is fine, store the upId. 
-                    super.setUpId( upId );
-                    this.attributeType = attributeType;
-                }
-                else
-                {
-                    // We have a difference or the upId is not a valid OID :
-                    // we will use the attributeTypeOID in this case.
-                    LOG.warn( "The upID ({}) is not an OID or is different from the AttributeType OID({})",
-                        upId, attributeType.getOid() );
-                    super.setUpId( attributeType.getOid() );
-                    this.attributeType = attributeType;
-                }
-            }
-            else
-            {
-                // We have at least one name. Check that the normalized upId
-                // is one of those names. Otherwise, the upId may be an OID too.
-                // In this case, it must be equals to the attributeType OID.
-                String normUpId = StringTools.lowerCaseAscii( StringTools.trim( upId ) );
                 
-                for ( String atId:attributeType.getNames() )
-                {
-                    if ( atId.equalsIgnoreCase( normUpId ) )
-                    {
-                        // Found ! We can store the upId and get out
-                        super.setUpId( upId );
-                        this.attributeType = attributeType;
-                        return;
-                    }
-                }
-    
-                // UpId was not found in names. It should be an OID, or if not, we 
-                // will use the AttributeType name.
-                if ( OID.isOID( normUpId ) && attributeType.getOid().equals( normUpId ) )
-                {
-                    // We have an OID : stores it
-                    super.setUpId( upId );
-                    this.attributeType = attributeType;
-                }
-                else
-                {
-                    String message = I18n.err( I18n.ERR_04453, upId, attributeType.getOid() );
-                    // Not a valid OID : use the AttributeTypes OID name instead
-                    LOG.error( message );
-                    throw new IllegalArgumentException( message );
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Convert the ServerAttribute to a ClientAttribute
-     *
-     * @return An instance of ClientAttribute
-     */
-    public EntryAttribute toClientAttribute()
-    {
-        // Create the new EntryAttribute
-        EntryAttribute clientAttribute = new DefaultClientAttribute( upId );
-        
-        // Copy the values
-        for ( Value<?> value:this )
-        {
-            Value<?> clientValue = null;
-            
-            if ( value instanceof ServerStringValue )
-            {
-                clientValue = new ClientStringValue( value.getString() );
+                return;
             }
-            else
-            {
-                clientValue = new ClientBinaryValue( value.getBytes() );
-            }
-            
-            clientAttribute.add( clientValue );
         }
         
-        return clientAttribute;
+        return;
     }
-
-
+    
+    
     //-------------------------------------------------------------------------
     // Serialization methods
     //-------------------------------------------------------------------------
@@ -1276,10 +1054,10 @@ public final class DefaultServerAttribut
      * 
      * @return a clone of the current attribute
      */
-    public ServerAttribute clone()
+    public EntryAttribute clone()
     {
         // clone the structure by cloner the inherited class
-        ServerAttribute clone = (ServerAttribute)super.clone();
+        EntryAttribute clone = (EntryAttribute)super.clone();
         
         // We are done !
         return clone;
@@ -1298,12 +1076,12 @@ public final class DefaultServerAttribut
             return true;
         }
         
-        if ( ! (obj instanceof ServerAttribute ) )
+        if ( ! (obj instanceof EntryAttribute ) )
         {
             return false;
         }
         
-        ServerAttribute other = (ServerAttribute)obj;
+        EntryAttribute other = (EntryAttribute)obj;
         
         if ( !attributeType.equals( other.getAttributeType() ) )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java Fri Mar 26 13:25:10 2010
@@ -156,7 +156,7 @@ public final class DefaultServerEntry ex
      */
     private void createAttribute( String upId, AttributeType attributeType, byte[]... values ) 
     {
-        ServerAttribute attribute = new DefaultServerAttribute( attributeType, values );
+        EntryAttribute attribute = new DefaultServerAttribute( attributeType, values );
         attribute.setUpId( upId, attributeType );
         attributes.put( attributeType, attribute );
     }
@@ -170,7 +170,7 @@ public final class DefaultServerEntry ex
      */
     private void createAttribute( String upId, AttributeType attributeType, String... values ) 
     {
-        ServerAttribute attribute = new DefaultServerAttribute( attributeType, values );
+        EntryAttribute attribute = new DefaultServerAttribute( attributeType, values );
         attribute.setUpId( upId, attributeType );
         attributes.put( attributeType, attribute );
     }
@@ -184,7 +184,7 @@ public final class DefaultServerEntry ex
      */
     private void createAttribute( String upId, AttributeType attributeType, Value<?>... values ) 
     {
-        ServerAttribute attribute = new DefaultServerAttribute( attributeType, values );
+        EntryAttribute attribute = new DefaultServerAttribute( attributeType, values );
         attribute.setUpId( upId, attributeType );
         attributes.put( attributeType, attribute );
     }
@@ -279,13 +279,9 @@ public final class DefaultServerEntry ex
             try
             {
                 // First get the AttributeType
-                AttributeType attributeType = null;
+                AttributeType attributeType = attribute.getAttributeType();
 
-                if ( attribute instanceof ServerAttribute )
-                {
-                    attributeType = ((ServerAttribute)attribute).getAttributeType();
-                }
-                else
+                if ( attributeType == null )
                 {
                     attributeType = schemaManager.lookupAttributeTypeRegistry( attribute.getId() );
                 }
@@ -468,7 +464,7 @@ public final class DefaultServerEntry ex
      * @param dn The DN for this serverEntry. Can be null
      * @param attributes The list of attributes to create
      */
-    public DefaultServerEntry( SchemaManager schemaManager, DN dn, ServerAttribute... attributes )
+    public DefaultServerEntry( SchemaManager schemaManager, DN dn, EntryAttribute... attributes )
     {
         if ( dn == null )
         {
@@ -483,7 +479,7 @@ public final class DefaultServerEntry ex
 
         initObjectClassAT( schemaManager );
 
-        for ( ServerAttribute attribute:attributes )
+        for ( EntryAttribute attribute:attributes )
         {
             // Store a new ServerAttribute
             try
@@ -654,7 +650,7 @@ public final class DefaultServerEntry ex
     {
         for ( EntryAttribute attribute:attributes )
         {
-            ServerAttribute serverAttribute = (ServerAttribute)attribute;
+            EntryAttribute serverAttribute = (EntryAttribute)attribute;
             AttributeType attributeType = serverAttribute.getAttributeType();
             
             if ( this.attributes.containsKey( attributeType ) )
@@ -709,7 +705,7 @@ public final class DefaultServerEntry ex
             throw new UnsupportedOperationException( message );
         }
 
-        ServerAttribute attribute = (ServerAttribute)attributes.get( attributeType );
+        EntryAttribute attribute = (EntryAttribute)attributes.get( attributeType );
         
         upId = getUpId( upId, attributeType );
         
@@ -759,7 +755,7 @@ public final class DefaultServerEntry ex
         
         upId = getUpId( upId, attributeType );
         
-        ServerAttribute attribute = (ServerAttribute)attributes.get( attributeType );
+        EntryAttribute attribute = (EntryAttribute)attributes.get( attributeType );
     
         if ( attribute != null )
         {
@@ -795,7 +791,7 @@ public final class DefaultServerEntry ex
         
         upId = getUpId( upId, attributeType );
 
-        ServerAttribute attribute = (ServerAttribute)attributes.get( attributeType );
+        EntryAttribute attribute = (EntryAttribute)attributes.get( attributeType );
         
         if ( attribute != null )
         {
@@ -959,7 +955,7 @@ public final class DefaultServerEntry ex
                 return this.attributes.size() == 0;
             }
             
-            if ( !this.attributes.containsKey( ((ServerAttribute)entryAttribute).getAttributeType() ) )
+            if ( !this.attributes.containsKey( ((EntryAttribute)entryAttribute).getAttributeType() ) )
             {
                 return false;
             }
@@ -1225,7 +1221,7 @@ public final class DefaultServerEntry ex
         }
         
         // We have to check that we are checking the ObjectClass attributeType
-        if ( !((ServerAttribute)objectClass).getAttributeType().equals( OBJECT_CLASS_AT ) )
+        if ( !((EntryAttribute)objectClass).getAttributeType().equals( OBJECT_CLASS_AT ) )
         {
             return false;
         }
@@ -1402,7 +1398,7 @@ public final class DefaultServerEntry ex
                 throw new IllegalArgumentException( message );
             }
             
-            EntryAttribute removed = this.attributes.put( ((ServerAttribute)serverAttribute).getAttributeType(), serverAttribute );
+            EntryAttribute removed = this.attributes.put( ((EntryAttribute)serverAttribute).getAttributeType(), serverAttribute );
             
             if ( removed != null )
             {
@@ -1884,9 +1880,9 @@ public final class DefaultServerEntry ex
         
         for ( EntryAttribute serverAttribute:attributes )
         {
-            if ( this.attributes.containsKey( ((ServerAttribute)serverAttribute).getAttributeType() ) )
+            if ( this.attributes.containsKey( ((EntryAttribute)serverAttribute).getAttributeType() ) )
             {
-                this.attributes.remove( ((ServerAttribute)serverAttribute).getAttributeType() );
+                this.attributes.remove( ((EntryAttribute)serverAttribute).getAttributeType() );
                 removedAttributes.add( serverAttribute );
             }
         }
@@ -2240,7 +2236,7 @@ public final class DefaultServerEntry ex
         // Convert each attribute 
         for ( EntryAttribute serverAttribute:this )
         {
-            EntryAttribute clientAttribute = ((ServerAttribute)serverAttribute).toClientAttribute();
+            EntryAttribute clientAttribute = serverAttribute.toClientAttribute();
             clientEntry.add( clientAttribute );
         }
         
@@ -2277,7 +2273,7 @@ public final class DefaultServerEntry ex
         
         for ( EntryAttribute entryAttribute : attributes.values() )
         {
-            ServerAttribute value = (ServerAttribute)entryAttribute.clone();
+            EntryAttribute value = (EntryAttribute)entryAttribute.clone();
             clone.attributes.put( value.getAttributeType(), value );
         }
         
@@ -2458,7 +2454,7 @@ public final class DefaultServerEntry ex
         
         for ( EntryAttribute attribute:other )
         {
-            EntryAttribute attr = attributes.get( ((ServerAttribute)attribute).getAttributeType() );
+            EntryAttribute attr = attributes.get( ((EntryAttribute)attribute).getAttributeType() );
             
             if ( attr == null )
             {
@@ -2509,7 +2505,7 @@ public final class DefaultServerEntry ex
         {
             for ( EntryAttribute attribute:attributes.values() )
             {
-                if ( !((ServerAttribute)attribute).getAttributeType().equals( OBJECT_CLASS_AT ) )
+                if ( !((EntryAttribute)attribute).getAttributeType().equals( OBJECT_CLASS_AT ) )
                 {
                     sb.append( attribute );
                 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java Fri Mar 26 13:25:10 2010
@@ -22,7 +22,10 @@ import java.io.Externalizable;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
 
 /**
  * A generic interface mocking the Attribute JNDI interface. This interface
@@ -198,6 +201,46 @@ public interface EntryAttribute extends 
 
 
     /**
+     * Get the attribute type associated with this ServerAttribute.
+     *
+     * @return the attributeType associated with this entry attribute
+     */
+    AttributeType getAttributeType();
+
+    
+    /**
+     * <p>
+     * Set the attribute type associated with this ServerAttribute.
+     * </p>
+     * <p>
+     * The current attributeType will be replaced. It is the responsibility of
+     * the caller to insure that the existing values are compatible with the new
+     * AttributeType
+     * </p>
+     *
+     * @param attributeType the attributeType associated with this entry attribute
+     */
+    void setAttributeType( AttributeType attributeType );
+
+    
+    /**
+     * <p>
+     * Check if the current attribute type is of the expected attributeType
+     * </p>
+     * <p>
+     * This method won't tell if the current attribute is a descendant of 
+     * the attributeType. For instance, the "CN" serverAttribute will return
+     * false if we ask if it's an instance of "Name". 
+     * </p> 
+     *
+     * @param attributeId The AttributeType ID to check
+     * @return True if the current attribute is of the expected attributeType
+     * @throws LdapInvalidAttributeValueException If there is no AttributeType
+     */
+    boolean instanceOf( String attributeId ) throws LdapInvalidAttributeValueException;
+
+    
+    /**
      * <p>
      * Get the first value of this attribute. If there is none, 
      * null is returned.
@@ -460,6 +503,29 @@ public interface EntryAttribute extends 
      */
     public void setUpId( String upId );
 
+
+    /**
+     * <p>
+     * Set the user provided ID. If we have none, the upId is assigned
+     * the attributetype's name. If it does not have any name, we will
+     * use the OID.
+     * </p>
+     * <p>
+     * If we have an upId and an AttributeType, they must be compatible. :
+     *  - if the upId is an OID, it must be the AttributeType's OID
+     *  - otherwise, its normalized form must be equals to ones of
+     *  the attributeType's names.
+     * </p>
+     * <p>
+     * In any case, the ATtributeType will be changed. The caller is responsible for
+     * the present values to be compatoble with the new AttributeType.
+     * </p>
+     * 
+     * @param upId The attribute ID
+     * @param attributeType The associated attributeType
+     */
+    void setUpId( String upId, AttributeType attributeType );
+
     
     /**
       * Retrieves the number of values in this attribute.
@@ -468,4 +534,37 @@ public interface EntryAttribute extends 
       * wrapping a null value if there is one
       */
     int size();
+    
+    
+    /**
+     * <p>
+     * Checks to see if this attribute is valid along with the values it contains.
+     * </p>
+     * <p>
+     * An attribute is valid if :
+     * <li>All of its values are valid with respect to the attributeType's syntax checker</li>
+     * <li>If the attributeType is SINGLE-VALUE, then no more than a value should be present</li>
+     *</p>
+     * @return true if the attribute and it's values are valid, false otherwise
+     * @throws LdapException  if there is a failure to check syntaxes of values
+     */
+    boolean isValid() throws LdapException;
+
+
+    /**
+     * Checks to see if this attribute is valid along with the values it contains.
+     *
+     * @param checker The syntax checker
+     * @return true if the attribute and it's values are valid, false otherwise
+     * @throws LdapException if there is a failure to check syntaxes of values
+     */
+    boolean isValid( SyntaxChecker checker) throws LdapException;
+    
+    
+    /**
+     * Convert the ServerAttribute to a ClientAttribute
+     *
+     * @return An instance of ClientAttribute
+     */
+    EntryAttribute toClientAttribute();
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerModification.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerModification.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerModification.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerModification.java Fri Mar 26 13:25:10 2010
@@ -86,9 +86,9 @@ public class ServerModification implemen
         {
             AttributeType at = null;
             
-            if ( modAttribute instanceof ServerAttribute )
+            if ( modAttribute instanceof DefaultServerAttribute )
             {
-                at = ((ServerAttribute)modAttribute).getAttributeType();
+                at = ((EntryAttribute)modAttribute).getAttributeType();
             }
             else
             {
@@ -155,7 +155,7 @@ public class ServerModification implemen
      */
     public void setAttribute( EntryAttribute attribute )
     {
-        this.attribute = (ServerAttribute)attribute;
+        this.attribute = (EntryAttribute)attribute;
     }
     
 
@@ -167,7 +167,7 @@ public class ServerModification implemen
     public Modification toClientModification()
     {
         ModificationOperation newOperation = operation;
-        EntryAttribute newAttribute = ((ServerAttribute)attribute).toClientAttribute();
+        EntryAttribute newAttribute = attribute.toClientAttribute();
         Modification newModification = new ClientModification( newOperation, newAttribute );
         
         return newModification;
@@ -232,7 +232,7 @@ public class ServerModification implemen
         {
             ServerModification clone = (ServerModification)super.clone();
             
-            clone.attribute = (ServerAttribute)this.attribute.clone();
+            clone.attribute = (EntryAttribute)this.attribute.clone();
             return clone;
         }
         catch ( CloneNotSupportedException cnse )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientModification.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientModification.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientModification.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientModification.java Fri Mar 26 13:25:10 2010
@@ -142,7 +142,7 @@ public class ClientModification implemen
      */
     public void setAttribute( EntryAttribute attribute )
     {
-        this.attribute = (ClientAttribute)attribute;
+        this.attribute = attribute;
     }
     
     
@@ -208,7 +208,7 @@ public class ClientModification implemen
         operation = ModificationOperation.getOperation( op );
         
         // Read the attribute
-        attribute = (ClientAttribute)in.readObject();
+        attribute = (EntryAttribute)in.readObject();
     }
     
     
@@ -238,7 +238,7 @@ public class ClientModification implemen
         {
             ClientModification clone = (ClientModification)super.clone();
             
-            clone.attribute = (ClientAttribute)this.attribute.clone();
+            clone.attribute = this.attribute.clone();
             return clone;
         }
         catch ( CloneNotSupportedException cnse )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java Fri Mar 26 13:25:10 2010
@@ -30,10 +30,13 @@ import java.util.Set;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 
+import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.ServerStringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -49,11 +52,13 @@ import org.slf4j.LoggerFactory;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DefaultClientAttribute implements ClientAttribute
+public class DefaultClientAttribute implements EntryAttribute
 {
     /** logger for reporting errors that might not be handled properly upstream */
     private static final Logger LOG = LoggerFactory.getLogger( DefaultClientAttribute.class );
-    
+
+    /** The associated AttributeType */
+    protected AttributeType attributeType;
     
     /** The set of contained values */
     protected Set<Value<?>> values = new LinkedHashSet<Value<?>>();
@@ -61,7 +66,7 @@ public class DefaultClientAttribute impl
     /** The User provided ID */
     protected String upId;
 
-    /** The normalized ID */
+    /** The normalized ID (will be the OID if we have a AttributeType) */
     protected String id;
 
     /** Tells if the attribute is Human Readable or not. When not set, 
@@ -270,7 +275,10 @@ public class DefaultClientAttribute impl
 
     /**
      * Set the user provided ID. It will also set the ID, normalizing
-     * the upId (removing spaces before and after, and lowercasing it)
+     * the upId (removing spaces before and after, and lowercasing it)<br>
+     * <br>
+     * If the Attribute already has an AttributeType, then the upId must
+     * be either the AttributeType name, or OID
      *
      * @param upId The attribute ID
      * @throws IllegalArgumentException If the ID is empty or null or
@@ -278,15 +286,114 @@ public class DefaultClientAttribute impl
      */
     public void setUpId( String upId )
     {
-        this.upId = StringTools.trim( upId );
+        setUpId( upId, null );
+    }
+
+    
+    /**
+     * Check that the upId is either a name or the OID of a given AT
+     */
+    private boolean areCompatible( String id, AttributeType attributeType )
+    {
+        // First, get rid of the options, if any
+        int optPos = id.indexOf( ";" );
+        String idNoOption = id;
         
-        if ( this.upId.length() == 0 )
+        if ( optPos != -1 )
         {
-            this.upId = null;
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04132 ) );
+            idNoOption = id.substring( 0, optPos );
+        }
+        
+        // Check that we find the ID in the AT names
+        for ( String name : attributeType.getNames() )
+        {
+            if ( name.equalsIgnoreCase( idNoOption ) )
+            {
+                return true;
+            }
+        }
+        
+        // Not found in names, check the OID
+        if ( OID.isOID( id )  && attributeType.getOid().equals( id ) )
+        {
+            return true;
+        }
+
+        return false;
+    }
+    
+
+    /**
+     * <p>
+     * Set the user provided ID. If we have none, the upId is assigned
+     * the attributetype's name. If it does not have any name, we will
+     * use the OID.
+     * </p>
+     * <p>
+     * If we have an upId and an AttributeType, they must be compatible. :
+     *  - if the upId is an OID, it must be the AttributeType's OID
+     *  - otherwise, its normalized form must be equals to ones of
+     *  the attributeType's names.
+     * </p>
+     * <p>
+     * In any case, the ATtributeType will be changed. The caller is responsible for
+     * the present values to be compatoble with the new AttributeType.
+     * </p>
+     *
+     * @param upId The attribute ID
+     * @param attributeType The associated attributeType
+     */
+    public void setUpId( String upId, AttributeType attributeType )
+    {
+        String trimmed = StringTools.trim( upId );
+
+        if ( StringTools.isEmpty( trimmed ) && ( attributeType == null ) )
+        {
+            throw new IllegalArgumentException( "Cannot set a null ID with a null AttributeType" );
+        }
+        
+        String id = StringTools.toLowerCase( trimmed );
+        
+        if ( attributeType == null )
+        {
+            if ( this.attributeType == null )
+            {
+                this.upId = upId;
+                this.id = id;
+                return;
+            }    
+            else
+            {
+                if ( areCompatible( id, this.attributeType ) )
+                {
+                    this.upId = upId;
+                    this.id = id;
+                    return;
+                }
+                else
+                {
+                    return;
+                }
+            }
+        }
+        
+        if ( StringTools.isEmpty( id ) )
+        {
+            this.attributeType = attributeType;
+            this.upId = attributeType.getName();
+            this.id = StringTools.trim( this.upId );
+            return;
+        }
+
+        if ( areCompatible( id, attributeType ) )
+        {
+            this.upId = upId;
+            this.id = id;
+            this.attributeType = attributeType;
+            return;
         }
 
-        this.id = StringTools.lowerCaseAscii( this.upId );
+        throw new IllegalArgumentException( "ID '" + id + "' and AttributeType '" + attributeType.getName() + "' are not compatible " );
     }
 
 
@@ -1243,6 +1350,120 @@ public class DefaultClientAttribute impl
         return add( vals.toArray( valArray ) );
     }
     
+
+
+    /**
+     * Get the attribute type associated with this ServerAttribute.
+     *
+     * @return the attributeType associated with this entry attribute
+     */
+    public AttributeType getAttributeType()
+    {
+        return attributeType;
+    }
+    
+    
+    /**
+     * <p>
+     * Set the attribute type associated with this ServerAttribute.
+     * </p>
+     * <p>
+     * The current attributeType will be replaced. It is the responsibility of
+     * the caller to insure that the existing values are compatible with the new
+     * AttributeType
+     * </p>
+     *
+     * @param attributeType the attributeType associated with this entry attribute
+     */
+    public void setAttributeType( AttributeType attributeType )
+    {
+        if ( attributeType == null )
+        {
+            throw new IllegalArgumentException( "The AttributeType parameter should not be null" );
+        }
+
+        this.attributeType = attributeType;
+        setUpId( null, attributeType );
+        
+        if ( attributeType.getSyntax().isHumanReadable() )
+        {
+            isHR = true;
+        }
+        else
+        {
+            isHR = false;
+        }
+    }
+    
+    
+    /**
+     * <p>
+     * Check if the current attribute type is of the expected attributeType
+     * </p>
+     * <p>
+     * This method won't tell if the current attribute is a descendant of 
+     * the attributeType. For instance, the "CN" serverAttribute will return
+     * false if we ask if it's an instance of "Name". 
+     * </p> 
+     *
+     * @param attributeId The AttributeType ID to check
+     * @return True if the current attribute is of the expected attributeType
+     * @throws LdapInvalidAttributeValueException If there is no AttributeType
+     */
+    public boolean instanceOf( String attributeId ) throws LdapInvalidAttributeValueException
+    {
+        String trimmedId = StringTools.trim( attributeId );
+        
+        if ( StringTools.isEmpty( trimmedId ) )
+        {
+            return false;
+        }
+        
+        String normId = StringTools.lowerCaseAscii( trimmedId );
+        
+        for ( String name:attributeType.getNames() )
+        {
+            if ( normId.equalsIgnoreCase( name ) )
+            {
+                return true;
+            }
+        }
+        
+        return normId.equalsIgnoreCase( attributeType.getOid() );
+    }
+
+    
+    /**
+     * Convert the ServerAttribute to a ClientAttribute
+     *
+     * @return An instance of ClientAttribute
+     */
+    public EntryAttribute toClientAttribute()
+    {
+        // Create the new EntryAttribute
+        EntryAttribute clientAttribute = new DefaultClientAttribute( upId );
+        
+        // Copy the values
+        for ( Value<?> value:this )
+        {
+            Value<?> clientValue = null;
+            
+            if ( value instanceof ServerStringValue )
+            {
+                clientValue = new ClientStringValue( value.getString() );
+            }
+            else
+            {
+                clientValue = new ClientBinaryValue( value.getBytes() );
+            }
+            
+            clientAttribute.add( clientValue );
+        }
+        
+        return clientAttribute;
+    }
+
+
     //-------------------------------------------------------------------------
     // Overloaded Object classes
     //-------------------------------------------------------------------------

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java Fri Mar 26 13:25:10 2010
@@ -179,7 +179,7 @@ public final class DefaultClientEntry ex
             else
             {
                 // Stores the attribute into the entry
-                this.attributes.put( attribute.getId(), (ClientAttribute)attribute );
+                this.attributes.put( attribute.getId(), attribute );
             }
         }
     }
@@ -508,7 +508,7 @@ public final class DefaultClientEntry ex
         String id = getId( upId );
         
         // Create a new attribute
-        ClientAttribute clientAttribute = new DefaultClientAttribute( upId, values );
+        EntryAttribute clientAttribute = new DefaultClientAttribute( upId, values );
 
         // Replace the previous one, and return it back
         return attributes.put( id, clientAttribute );
@@ -534,7 +534,7 @@ public final class DefaultClientEntry ex
         String id = getId( upId );
         
         // Create a new attribute
-        ClientAttribute clientAttribute = new DefaultClientAttribute( upId, values );
+        EntryAttribute clientAttribute = new DefaultClientAttribute( upId, values );
 
         // Replace the previous one, and return it back
         return attributes.put( id, clientAttribute );
@@ -560,7 +560,7 @@ public final class DefaultClientEntry ex
         String id = getId( upId );
         
         // Create a new attribute
-        ClientAttribute clientAttribute = new DefaultClientAttribute( upId, values );
+        EntryAttribute clientAttribute = new DefaultClientAttribute( upId, values );
 
         // Replace the previous one, and return it back
         return attributes.put( id, clientAttribute );
@@ -609,7 +609,7 @@ public final class DefaultClientEntry ex
                 returnedClientAttributes.add( attributes.remove( id ) );
             }
 
-            ClientAttribute newAttribute = new DefaultClientAttribute( upId );
+            EntryAttribute newAttribute = new DefaultClientAttribute( upId );
             attributes.put( id, newAttribute );
         }
         
@@ -649,7 +649,7 @@ public final class DefaultClientEntry ex
             }
             
             // add the new one
-            this.attributes.put( id, (ClientAttribute)attribute );            
+            this.attributes.put( id, (EntryAttribute)attribute );            
         }
         
         // return the previous attributes

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientModificationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientModificationTest.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientModificationTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientModificationTest.java Fri Mar 26 13:25:10 2010
@@ -128,7 +128,7 @@ public class ClientModificationTest
         
         attribute.remove( "test2" );
         
-        EntryAttribute clonedAttribute = (ClientAttribute)clone.getAttribute();
+        EntryAttribute clonedAttribute = clone.getAttribute();
         
         assertEquals( 1, mod.getAttribute().size() );
         assertTrue( mod.getAttribute().contains( "test1" ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java Fri Mar 26 13:25:10 2010
@@ -379,7 +379,7 @@ public class DefaultClientAttributeTest
         assertEquals( "test", attr.getUpId() );
         
         attr.setUpId(  "  TEST  " );
-        assertEquals( "TEST", attr.getUpId() );
+        assertEquals( "  TEST  ", attr.getUpId() );
     }
 
 
@@ -426,7 +426,7 @@ public class DefaultClientAttributeTest
         assertEquals( "test", attr.getId() );
         
         attr.setUpId( " Test " );
-        assertEquals( "Test", attr.getUpId() );
+        assertEquals( " Test ", attr.getUpId() );
         assertEquals( "test", attr.getId() );
     }
 
@@ -437,7 +437,7 @@ public class DefaultClientAttributeTest
     @Test
     public void testIsValidSyntaxChecker() throws LdapException
     {
-        ClientAttribute attr = new DefaultClientAttribute( "test" );
+        EntryAttribute attr = new DefaultClientAttribute( "test" );
         
         attr.add( "test", "another test" );