directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r938097 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry: DefaultServerEntry.java Entry.java ServerEntry.java client/DefaultClientEntry.java
Date Mon, 26 Apr 2010 15:42:02 GMT
Author: elecharny
Date: Mon Apr 26 15:42:02 2010
New Revision: 938097

URL: http://svn.apache.org/viewvc?rev=938097&view=rev
Log:
Moved some of the put() methods from ServerEntry to ClientEntry

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java

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=938097&r1=938096&r2=938097&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
Mon Apr 26 15:42:02 2010
@@ -65,22 +65,6 @@ public final class DefaultServerEntry ex
     // Helper methods
     //-------------------------------------------------------------------------
     /**
-     * Returns the attributeType from an Attribute ID.
-     */
-    private AttributeType getAttributeType( String upId ) throws LdapException
-    {
-        if ( StringTools.isEmpty( StringTools.trim( upId ) ) )
-        {
-            String message = I18n.err( I18n.ERR_04457 );
-            LOG.error( message );
-            throw new IllegalArgumentException( message );
-        }
-        
-        return schemaManager.lookupAttributeTypeRegistry( upId );
-    }
-
-    
-    /**
      * This method is used to initialize the OBJECT_CLASS_AT attributeType.
      * 
      * We want to do it only once, so it's a synchronized method. Note that
@@ -460,81 +444,6 @@ public final class DefaultServerEntry ex
     
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and binary values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param attributeType the type of the new attribute to be put
-     * @param values the binary values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures
-     */
-    public EntryAttribute put( AttributeType attributeType, byte[]... values ) throws LdapException
-    {
-        return put( null, attributeType, values );
-    }
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and String values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param attributeType the type of the new attribute to be put
-     * @param values the String values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures
-     */
-    public EntryAttribute put( AttributeType attributeType, String... values ) throws LdapException
-    {
-        return put( null, attributeType, values );
-    }
-
-    
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param attributeType the type of the new attribute to be put
-     * @param values the values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures
-     */
-    public EntryAttribute put( AttributeType attributeType, Value<?>... values ) throws
LdapException
-    {
-        return put( null, attributeType, values );
-    }
-
-
-    /**
-     * <p>
      * Places attributes in the attribute collection. 
      * </p>
      * <p>If there is already an attribute with the same ID as any of the 
@@ -575,202 +484,6 @@ public final class DefaultServerEntry ex
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and some binary values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * The given User provided ID will be used for this new AttributeEntry.
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param upId The User Provided ID to be stored into the AttributeEntry
-     * @param attributeType the type of the new attribute to be put
-     * @param values the binary values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures.
-     */
-    public EntryAttribute put( String upId, AttributeType attributeType, byte[]... values
) throws LdapException
-    {
-        if ( attributeType == null )
-        {
-            try
-            {
-                attributeType = getAttributeType( upId );
-            }
-            catch ( Exception e )
-            {
-                String message = I18n.err( I18n.ERR_04460 );
-                LOG.error( message );
-                throw new IllegalArgumentException( message );
-            }
-        }
-        else
-        {
-            if ( !StringTools.isEmpty( upId ) )
-            {
-                AttributeType tempAT = getAttributeType( upId );
-            
-                if ( !tempAT.equals( attributeType ) )
-                {
-                    String message = I18n.err( I18n.ERR_04463, upId, attributeType );
-                    LOG.error( message );
-                    throw new IllegalArgumentException( message );
-                }
-            }
-            else
-            {
-                upId = getUpId( upId, attributeType );
-            }
-        }
-        
-        if ( attributeType.equals( OBJECT_CLASS_AT ) )
-        {
-            String message = I18n.err( I18n.ERR_04461 );
-            LOG.error( message );
-            throw new UnsupportedOperationException( message );
-        }
-
-        EntryAttribute attribute = new DefaultEntryAttribute( upId, attributeType, values
);
-        
-        return attributes.put( attributeType.getOid(), attribute );
-    }
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some String values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * The given User provided ID will be used for this new AttributeEntry.
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param upId The User Provided ID to be stored into the AttributeEntry
-     * @param attributeType the type of the new attribute to be put
-     * @param values the String values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures.
-     */
-    public EntryAttribute put( String upId, AttributeType attributeType, String... values
) throws LdapException
-    {
-        if ( attributeType == null )
-        {
-            try
-            {
-                attributeType = getAttributeType( upId );
-            }
-            catch ( Exception e )
-            {
-                String message = I18n.err( I18n.ERR_04460 );
-                LOG.error( message );
-                throw new IllegalArgumentException( message );
-            }
-        }
-        else
-        {
-            if ( !StringTools.isEmpty( upId ) )
-            {
-                AttributeType tempAT = getAttributeType( upId );
-            
-                if ( !tempAT.equals( attributeType ) )
-                {
-                    String message = I18n.err( I18n.ERR_04463, upId, attributeType );
-                    LOG.error( message );
-                    throw new IllegalArgumentException( message );
-                }
-            }
-            else
-            {
-                upId = getUpId( upId, attributeType );
-            }
-        }
-        
-        EntryAttribute attribute = new DefaultEntryAttribute( upId, attributeType, values
);
-        
-        return attributes.put( attributeType.getOid(), attribute );
-    }
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * The given User provided ID will be used for this new AttributeEntry.
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param upId The User Provided ID to be stored into the AttributeEntry
-     * @param attributeType the type of the new attribute to be put
-     * @param values the values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures.
-     */
-    public EntryAttribute put( String upId, AttributeType attributeType, Value<?>...
values ) throws LdapException
-    {
-        if ( attributeType == null )
-        {
-            try
-            {
-                attributeType = getAttributeType( upId );
-            }
-            catch ( Exception e )
-            {
-                String message = I18n.err( I18n.ERR_04460 );
-                LOG.error( message );
-                throw new IllegalArgumentException( message );
-            }
-        }
-        else
-        {
-            if ( !StringTools.isEmpty( upId ) )
-            {
-                AttributeType tempAT = getAttributeType( upId );
-            
-                if ( !tempAT.equals( attributeType ) )
-                {
-                    String message = I18n.err( I18n.ERR_04463, upId, attributeType );
-                    LOG.error( message );
-                    throw new IllegalArgumentException( message );
-                }
-            }
-            else
-            {
-                upId = getUpId( upId, attributeType );
-            }
-        }
-        
-        EntryAttribute attribute = new DefaultEntryAttribute( upId, attributeType, values
);
-        
-        return attributes.put( attributeType.getOid(), attribute );
-    }
-
-
-    /**
-     * <p>
      * Put an attribute (represented by its ID and some binary values) into an entry. 
      * </p>
      * <p> 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java?rev=938097&r1=938096&r2=938097&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
Mon Apr 26 15:42:02 2010
@@ -380,6 +380,149 @@ public interface Entry extends Cloneable
 
     /**
      * <p>
+     * Places a new attribute with the supplied AttributeType and binary values 
+     * into the attribute collection. 
+     * </p>
+     * <p>
+     * If there is already an attribute with the same AttributeType, the old
+     * one is removed from the collection and is returned by this method. 
+     * </p>
+     * <p>
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value may be <code>null</code>.
+     *
+     * @param attributeType the type of the new attribute to be put
+     * @param values the binary values of the new attribute to be put
+     * @return the old attribute with the same identifier, if exists; otherwise
+     * <code>null</code>
+     * @throws LdapException if there are failures
+     */
+    EntryAttribute put( AttributeType attributeType, byte[]... values ) throws LdapException;
+
+
+    /**
+     * <p>
+     * Places a new attribute with the supplied AttributeType and String values 
+     * into the attribute collection. 
+     * </p>
+     * <p>
+     * If there is already an attribute with the same AttributeType, the old
+     * one is removed from the collection and is returned by this method. 
+     * </p>
+     * <p>
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value may be <code>null</code>.
+     *
+     * @param attributeType the type of the new attribute to be put
+     * @param values the String values of the new attribute to be put
+     * @return the old attribute with the same identifier, if exists; otherwise
+     * <code>null</code>
+     * @throws LdapException if there are failures
+     */
+    EntryAttribute put( AttributeType attributeType, String... values ) throws LdapException;
+
+
+    /**
+     * <p>
+     * Places a new attribute with the supplied AttributeType and some values 
+     * into the attribute collection. 
+     * </p>
+     * <p>
+     * If there is already an attribute with the same AttributeType, the old
+     * one is removed from the collection and is returned by this method. 
+     * </p>
+     * <p>
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value may be <code>null</code>.
+     *
+     * @param attributeType the type of the new attribute to be put
+     * @param values the values of the new attribute to be put
+     * @return the old attribute with the same identifier, if exists; otherwise
+     * <code>null</code>
+     * @throws LdapException if there are failures
+     */
+    EntryAttribute put( AttributeType attributeType, Value<?>... values ) throws LdapException;
+
+
+    /**
+     * <p>
+     * Places a new attribute with the supplied AttributeType and some binary values 
+     * into the attribute collection. 
+     * </p>
+     * <p>
+     * The given User provided ID will be used for this new AttributeEntry.
+     * </p>
+     * <p>
+     * If there is already an attribute with the same AttributeType, the old
+     * one is removed from the collection and is returned by this method. 
+     * </p>
+     * <p>
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value may be <code>null</code>.
+     *
+     * @param upId The User Provided ID to be stored into the AttributeEntry
+     * @param values the binary values of the new attribute to be put
+     * @return the old attribute with the same identifier, if exists; otherwise
+     * <code>null</code>
+     * @throws LdapException if there are failures.
+     */
+    EntryAttribute put( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException;
+
+
+    /**
+     * <p>
+     * Places a new attribute with the supplied AttributeType and some String values 
+     * into the attribute collection. 
+     * </p>
+     * <p>
+     * The given User provided ID will be used for this new AttributeEntry.
+     * </p>
+     * <p>
+     * If there is already an attribute with the same AttributeType, the old
+     * one is removed from the collection and is returned by this method. 
+     * </p>
+     * <p>
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value may be <code>null</code>.
+     *
+     * @param upId The User Provided ID to be stored into the AttributeEntry
+     * @param attributeType the type of the new attribute to be put
+     * @param values the String values of the new attribute to be put
+     * @return the old attribute with the same identifier, if exists; otherwise
+     * <code>null</code>
+     * @throws LdapException if there are failures.
+     */
+    EntryAttribute put( String upId, AttributeType attributeType, String... values ) throws
LdapException;
+
+
+    /**
+     * <p>
+     * Places a new attribute with the supplied AttributeType and some values 
+     * into the attribute collection. 
+     * </p>
+     * <p>
+     * The given User provided ID will be used for this new AttributeEntry.
+     * </p>
+     * <p>
+     * If there is already an attribute with the same AttributeType, the old
+     * one is removed from the collection and is returned by this method. 
+     * </p>
+     * <p>
+     * This method provides a mechanism to put an attribute with a
+     * <code>null</code> value: the value may be <code>null</code>.
+     *
+     * @param upId The User Provided ID to be stored into the AttributeEntry
+     * @param attributeType the type of the new attribute to be put
+     * @param values the values of the new attribute to be put
+     * @return the old attribute with the same identifier, if exists; otherwise
+     * <code>null</code>
+     * @throws LdapException if there are failures.
+     */
+    EntryAttribute put( String upId, AttributeType attributeType, Value<?>... values
) throws LdapException;
+
+
+    /**
+     * <p>
      * Put an attribute (represented by its ID and some binary values) into an entry. 
      * </p>
      * <p> 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java?rev=938097&r1=938096&r2=938097&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java
Mon Apr 26 15:42:02 2010
@@ -46,149 +46,6 @@ public interface ServerEntry extends Ent
     
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and binary values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param attributeType the type of the new attribute to be put
-     * @param values the binary values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures
-     */
-    EntryAttribute put( AttributeType attributeType, byte[]... values ) throws LdapException;
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and String values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param attributeType the type of the new attribute to be put
-     * @param values the String values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures
-     */
-    EntryAttribute put( AttributeType attributeType, String... values ) throws LdapException;
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param attributeType the type of the new attribute to be put
-     * @param values the values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures
-     */
-    EntryAttribute put( AttributeType attributeType, Value<?>... values ) throws LdapException;
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some binary values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * The given User provided ID will be used for this new AttributeEntry.
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param upId The User Provided ID to be stored into the AttributeEntry
-     * @param values the binary values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures.
-     */
-    EntryAttribute put( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException;
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some String values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * The given User provided ID will be used for this new AttributeEntry.
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param upId The User Provided ID to be stored into the AttributeEntry
-     * @param attributeType the type of the new attribute to be put
-     * @param values the String values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures.
-     */
-    EntryAttribute put( String upId, AttributeType attributeType, String... values ) throws
LdapException;
-
-
-    /**
-     * <p>
-     * Places a new attribute with the supplied AttributeType and some values 
-     * into the attribute collection. 
-     * </p>
-     * <p>
-     * The given User provided ID will be used for this new AttributeEntry.
-     * </p>
-     * <p>
-     * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
-     * </p>
-     * <p>
-     * This method provides a mechanism to put an attribute with a
-     * <code>null</code> value: the value may be <code>null</code>.
-     *
-     * @param upId The User Provided ID to be stored into the AttributeEntry
-     * @param attributeType the type of the new attribute to be put
-     * @param values the values of the new attribute to be put
-     * @return the old attribute with the same identifier, if exists; otherwise
-     * <code>null</code>
-     * @throws LdapException if there are failures.
-     */
-    EntryAttribute put( String upId, AttributeType attributeType, Value<?>... values
) throws LdapException;
-
-
-    /**
-     * <p>
      * Removes the specified binary values from an attribute.
      * </p>
      * <p>

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=938097&r1=938096&r2=938097&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
Mon Apr 26 15:42:02 2010
@@ -241,6 +241,22 @@ public class DefaultClientEntry implemen
     }
     
     
+    /**
+     * Returns the attributeType from an Attribute ID.
+     */
+    protected AttributeType getAttributeType( String upId ) throws LdapException
+    {
+        if ( StringTools.isEmpty( StringTools.trim( upId ) ) )
+        {
+            String message = I18n.err( I18n.ERR_04457 );
+            LOG.error( message );
+            throw new IllegalArgumentException( message );
+        }
+        
+        return schemaManager.lookupAttributeTypeRegistry( upId );
+    }
+
+    
     //-------------------------------------------------------------------------
     // Entry methods
     //-------------------------------------------------------------------------
@@ -1196,6 +1212,172 @@ public class DefaultClientEntry implemen
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    public EntryAttribute put( AttributeType attributeType, byte[]... values ) throws LdapException
+    {
+        return put( null, attributeType, values );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public EntryAttribute put( AttributeType attributeType, String... values ) throws LdapException
+    {
+        return put( null, attributeType, values );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public EntryAttribute put( AttributeType attributeType, Value<?>... values ) throws
LdapException
+    {
+        return put( null, attributeType, values );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public EntryAttribute put( String upId, AttributeType attributeType, byte[]... values
) throws LdapException
+    {
+        if ( attributeType == null )
+        {
+            try
+            {
+                attributeType = getAttributeType( upId );
+            }
+            catch ( Exception e )
+            {
+                String message = I18n.err( I18n.ERR_04460 );
+                LOG.error( message );
+                throw new IllegalArgumentException( message );
+            }
+        }
+        else
+        {
+            if ( !StringTools.isEmpty( upId ) )
+            {
+                AttributeType tempAT = getAttributeType( upId );
+            
+                if ( !tempAT.equals( attributeType ) )
+                {
+                    String message = I18n.err( I18n.ERR_04463, upId, attributeType );
+                    LOG.error( message );
+                    throw new IllegalArgumentException( message );
+                }
+            }
+            else
+            {
+                upId = getUpId( upId, attributeType );
+            }
+        }
+        
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
+        {
+            String message = I18n.err( I18n.ERR_04461 );
+            LOG.error( message );
+            throw new UnsupportedOperationException( message );
+        }
+
+        EntryAttribute attribute = new DefaultEntryAttribute( upId, attributeType, values
);
+        
+        return attributes.put( attributeType.getOid(), attribute );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public EntryAttribute put( String upId, AttributeType attributeType, String... values
) throws LdapException
+    {
+        if ( attributeType == null )
+        {
+            try
+            {
+                attributeType = getAttributeType( upId );
+            }
+            catch ( Exception e )
+            {
+                String message = I18n.err( I18n.ERR_04460 );
+                LOG.error( message );
+                throw new IllegalArgumentException( message );
+            }
+        }
+        else
+        {
+            if ( !StringTools.isEmpty( upId ) )
+            {
+                AttributeType tempAT = getAttributeType( upId );
+            
+                if ( !tempAT.equals( attributeType ) )
+                {
+                    String message = I18n.err( I18n.ERR_04463, upId, attributeType );
+                    LOG.error( message );
+                    throw new IllegalArgumentException( message );
+                }
+            }
+            else
+            {
+                upId = getUpId( upId, attributeType );
+            }
+        }
+        
+        EntryAttribute attribute = new DefaultEntryAttribute( upId, attributeType, values
);
+        
+        return attributes.put( attributeType.getOid(), attribute );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public EntryAttribute put( String upId, AttributeType attributeType, Value<?>...
values ) throws LdapException
+    {
+        if ( attributeType == null )
+        {
+            try
+            {
+                attributeType = getAttributeType( upId );
+            }
+            catch ( Exception e )
+            {
+                String message = I18n.err( I18n.ERR_04460 );
+                LOG.error( message );
+                throw new IllegalArgumentException( message );
+            }
+        }
+        else
+        {
+            if ( !StringTools.isEmpty( upId ) )
+            {
+                AttributeType tempAT = getAttributeType( upId );
+            
+                if ( !tempAT.equals( attributeType ) )
+                {
+                    String message = I18n.err( I18n.ERR_04463, upId, attributeType );
+                    LOG.error( message );
+                    throw new IllegalArgumentException( message );
+                }
+            }
+            else
+            {
+                upId = getUpId( upId, attributeType );
+            }
+        }
+        
+        EntryAttribute attribute = new DefaultEntryAttribute( upId, attributeType, values
);
+        
+        return attributes.put( attributeType.getOid(), attribute );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public List<EntryAttribute> remove( EntryAttribute... attributes ) throws LdapException
     {
         List<EntryAttribute> removedAttributes = new ArrayList<EntryAttribute>();
@@ -1214,19 +1396,7 @@ public class DefaultClientEntry implemen
 
 
     /**
-     * <p>
-     * Removes the attribute with the specified alias. 
-     * </p>
-     * <p>
-     * The removed attribute are returned by this method. 
-     * </p>
-     * <p>
-     * If there is no attribute with the specified alias,
-     * the return value is <code>null</code>.
-     * </p>
-     *
-     * @param attributes an aliased name of the attribute to be removed
-     * @return the removed attributes, if any, as a list; otherwise <code>null</code>
+     * {@inheritDoc}
      */
     public List<EntryAttribute> removeAttributes( String... attributes )
     {



Mime
View raw message