directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r691847 [1/2] - in /directory: apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ apacheds/trunk/core/src/main/java/org/apache/direct...
Date Thu, 04 Sep 2008 01:23:13 GMT
Author: elecharny
Date: Wed Sep  3 18:23:12 2008
New Revision: 691847

URL: http://svn.apache.org/viewvc?rev=691847&view=rev
Log:
o Removed all the JNDI ModificationItem instances in the server
o Removed some asscoiated useless conversion methods
o Fixed the ModificationEnum values (REMOVE and REPLACE where inverted)
o Partially Fixed some errors in the way ;binay options where handled in modifications

Modified:
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
    directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ModificationOperation.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientModification.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Wed Sep  3 18:23:12 2008
@@ -57,7 +57,29 @@
 public class ServerEntryUtils
 {
     /**
-     * Convert a ServerEntry into a AttributesImpl. The DN is lost
+     * Convert a ServerAttribute into a BasicAttribute. The DN is lost
+     * during this conversion, as the Attributes object does not store
+     * this element.
+     *
+     * @return An instance of a AttributesImpl() object
+     */
+    public static Attribute toBasicAttribute( ServerAttribute entryAttribute )
+    {
+        AttributeType attributeType = entryAttribute.getAttributeType();
+        
+        Attribute attribute = new BasicAttribute( attributeType.getName() );
+        
+        for ( Value<?> value: entryAttribute )
+        {
+            attribute.add( value.get() );
+        }
+        
+        return attribute;
+    }
+    
+    
+    /**
+     * Convert a ServerEntry into a BasicAttributes. The DN is lost
      * during this conversion, as the Attributes object does not store
      * this element.
      *
@@ -86,14 +108,7 @@
                 }
             }
             
-            Attribute attribute = new BasicAttribute( attributeType.getName() );
-            
-            for ( Value<?> value: attr )
-            {
-                attribute.add( value.get() );
-            }
-            
-            attributes.put( attribute );
+            attributes.put( toBasicAttribute( (ServerAttribute)attr ) );
         }
         
         return attributes;
@@ -216,24 +231,6 @@
 
 
     /**
-     * Convert a ServerAttributeEntry into a AttributeImpl.
-     *
-     * @return An instance of a BasicAttribute() object
-     */
-    public static Attribute toAttributeImpl( EntryAttribute attr )
-    {
-        Attribute attribute = new BasicAttribute( attr.getUpId() );
-
-        for ( Value<?> value:attr )
-        {
-            attribute.add( value.get() );
-        }
-        
-        return attribute;
-    }
-
-
-    /**
      * Gets the target entry as it would look after a modification operation 
      * was performed on it.
      * 
@@ -348,17 +345,6 @@
     }
     
     
-    public static ModificationItem toModificationItem( Modification modification )
-    {
-        ModificationItem modificationItem = new ModificationItem( 
-            modification.getOperation().getValue(),
-            toAttributeImpl( (ServerAttribute)modification.getAttribute() ) ); 
-        
-        return modificationItem;
-        
-    }
-
-
     /**
      * Convert a ModificationItem to an instance of a ServerModification object
      *
@@ -368,8 +354,27 @@
      */
     private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType ) 
     {
+        ModificationOperation operation;
+        
+        switch ( modificationImpl.getModificationOp() )
+        {
+            case DirContext.REMOVE_ATTRIBUTE :
+                operation = ModificationOperation.REMOVE_ATTRIBUTE;
+                break;
+                
+            case DirContext.REPLACE_ATTRIBUTE :
+                operation = ModificationOperation.REPLACE_ATTRIBUTE;
+                break;
+
+            case DirContext.ADD_ATTRIBUTE :
+            default :
+                operation = ModificationOperation.ADD_ATTRIBUTE;
+                break;
+                
+        }
+        
         Modification modification = new ServerModification( 
-            modificationImpl.getModificationOp(),
+            operation,
             ServerEntryUtils.toServerAttribute( modificationImpl.getAttribute(), attributeType ) ); 
         
         return modification;
@@ -377,26 +382,6 @@
     }
 
     
-    public static List<ModificationItem> toModificationItemImpl( List<Modification> modifications )
-    {
-        if ( modifications != null )
-        {
-            List<ModificationItem> modificationItems = new ArrayList<ModificationItem>();
-
-            for ( Modification modification: modifications )
-            {
-                modificationItems.add( toModificationItem( modification ) );
-            }
-        
-            return modificationItems;
-        }
-        else
-        {
-            return null;
-        }
-    }
-    
-    
     /**
      * 
      * Convert a list of ModificationItemImpl to a list of 
@@ -428,6 +413,77 @@
     }
     
     
+    /**
+     * Convert a Modification to an instance of a ServerModification object.
+     *
+     * @param modificationImpl the modification instance to convert
+     * @param attributeType the associated attributeType
+     * @return a instance of a ServerModification object
+     */
+    private static Modification toServerModification( Modification modification, AttributeType attributeType ) 
+    {
+        if ( modification instanceof ServerModification )
+        {
+            return modification;
+        }
+        
+        Modification serverModification = new ServerModification( 
+            modification.getOperation(),
+            new DefaultServerAttribute( attributeType, modification.getAttribute() ) ); 
+        
+        return serverModification;
+        
+    }
+
+    
+    public static List<Modification> toServerModification( Modification[] modifications, 
+        AttributeTypeRegistry atRegistry ) throws NamingException
+    {
+        if ( modifications != null )
+        {
+            List<Modification> modificationsList = new ArrayList<Modification>();
+    
+            for ( Modification modification: modifications )
+            {
+                String attributeId = modification.getAttribute().getId();
+                String id = stripOptions( attributeId );
+                modification.getAttribute().setId( id );
+                Set<String> options = getOptions( attributeId );
+
+                // -------------------------------------------------------------------
+                // DIRSERVER-646 Fix: Replacing an unknown attribute with no values 
+                // (deletion) causes an error
+                // -------------------------------------------------------------------
+                
+                // TODO - after removing JNDI we need to make the server handle 
+                // this in the codec
+                
+                if ( ! atRegistry.hasAttributeType( id ) 
+                     && modification.getAttribute().size() == 0 
+                     && modification.getOperation() == ModificationOperation.REPLACE_ATTRIBUTE )
+                {
+                    continue;
+                }
+
+                // -------------------------------------------------------------------
+                // END DIRSERVER-646 Fix
+                // -------------------------------------------------------------------
+                
+                
+                // TODO : handle options
+                AttributeType attributeType = atRegistry.lookup( id );
+                modificationsList.add( toServerModification( modification, attributeType ) );
+            }
+        
+            return modificationsList;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
     public static List<Modification> toServerModification( ModificationItem[] modifications, 
         AttributeTypeRegistry atRegistry ) throws NamingException
     {

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java Wed Sep  3 18:23:12 2008
@@ -24,7 +24,7 @@
 import java.io.ObjectOutput;
 
 import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
+//import javax.naming.directory.DirContext;
 
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
@@ -81,19 +81,6 @@
     }
     
     
-    /**
-     * Create a new instance of a ServerModification.
-     * 
-     * @param operation the Modification operation (one of add, replace or remove)
-     * @param attribute the modified attribute
-     */
-    public ServerModification( int operation, EntryAttribute attribute )
-    {
-        setOperation( operation );
-        this.attribute = attribute;
-    }
-    
-    
     public ServerModification( Registries registries, Modification modification )
     {
         operation = modification.getOperation();
@@ -142,20 +129,7 @@
      */
     public void setOperation( int operation )
     {
-        switch ( operation )
-        {
-            case DirContext.ADD_ATTRIBUTE :
-                this.operation = ModificationOperation.ADD_ATTRIBUTE;
-                break;
-
-            case DirContext.REPLACE_ATTRIBUTE :
-                this.operation = ModificationOperation.REPLACE_ATTRIBUTE;
-                break;
-            
-            case DirContext.REMOVE_ATTRIBUTE :
-                this.operation = ModificationOperation.REMOVE_ATTRIBUTE;
-                break;
-        }
+        this.operation = ModificationOperation.getOperation( operation );
     }
 
     

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Wed Sep  3 18:23:12 2008
@@ -248,6 +248,9 @@
         for ( Modification modItem : opContext.getModItems() )
         {
             Modification mod = ((ServerModification)modItem).toClientModification();
+            
+            // TODO: handle correctly http://issues.apache.org/jira/browse/DIRSERVER-1198
+            mod.getAttribute().setId( modItem.getAttribute().getId() );
             mods.add( mod );
             
             forward.addModificationItem( mod );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Wed Sep  3 18:23:12 2008
@@ -35,6 +35,7 @@
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -106,9 +107,23 @@
     {
         for ( Modification mod:mods )
         {
+            // TODO: handle http://issues.apache.org/jira/browse/DIRSERVER-1198
             ServerAttribute attr = (ServerAttribute)mod.getAttribute();
-            String attrID = attr.getId();
-            AttributeType attrType = attrTypeRegistry.lookup( attrID );
+            AttributeType attrType = attr.getAttributeType();
+
+            if ( attrType == null )
+            {
+                if ( !attrTypeRegistry.hasAttributeType( attr.getUpId() ) )
+                {
+                    throw new LdapInvalidAttributeIdentifierException();
+                }
+                else
+                {
+                    attrType = attrTypeRegistry.lookup( attr.getUpId() );
+                }
+            }
+            
+            
             ModificationOperation modOp = mod.getOperation();
             
             if ( ( ( modOp == ModificationOperation.ADD_ATTRIBUTE ) || ( modOp == ModificationOperation.REPLACE_ATTRIBUTE ) ) &&

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Wed Sep  3 18:23:12 2008
@@ -815,6 +815,7 @@
         }
         catch ( Exception ne )
         {
+            ne.printStackTrace();
             throw ne;
         }
         catch ( Throwable e )
@@ -1210,6 +1211,7 @@
                     }
                     catch ( Exception ne )
                     {
+                        ne.printStackTrace();
                         throw ne;
                     }
                     catch ( Throwable e )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Wed Sep  3 18:23:12 2008
@@ -24,7 +24,6 @@
 import java.util.List;
 
 import javax.naming.NamingException;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.server.core.CoreSession;
@@ -34,6 +33,7 @@
 import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.entry.client.ClientModification;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ModifyRequest;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -84,7 +84,7 @@
     {
         super( session, modifyRequest.getName() );
         this.modItems = ServerEntryUtils.toServerModification( 
-            modifyRequest.getModificationItems().toArray( new ModificationItem[0]), 
+            modifyRequest.getModificationItems().toArray( new ClientModification[0]), 
             session.getDirectoryService().getRegistries().getAttributeTypeRegistry() );
         this.requestControls = modifyRequest.getControls();
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Wed Sep  3 18:23:12 2008
@@ -542,7 +542,7 @@
         }
 
         Set<String> rdnAttributes = getRdnAttributes( name );
-        String id = attribute.getUpId();
+        String id = attribute.getId();
 
         if ( !rdnAttributes.contains( oidRegistry.getOid( id ) ) )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Sep  3 18:23:12 2008
@@ -1289,7 +1289,8 @@
             ModificationOperation modOp = mod.getOperation();
             ServerAttribute change = ( ServerAttribute ) mod.getAttribute();
 
-            if ( !atRegistry.hasAttributeType( change.getUpId() )
+            // TODO/ handle http://issues.apache.org/jira/browse/DIRSERVER-1198
+            if ( ( change.getAttributeType() == null ) && !atRegistry.hasAttributeType( change.getUpId() )
                 && !objectClass.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
             {
                 throw new LdapInvalidAttributeIdentifierException();
@@ -1297,7 +1298,12 @@
 
             // We will forbid modification of operational attributes which are not
             // user modifiable.
-            AttributeType attributeType = atRegistry.lookup( change.getUpId() );
+            AttributeType attributeType = change.getAttributeType();
+            
+            if ( attributeType == null )
+            {
+                attributeType = atRegistry.lookup( change.getUpId() );
+            }
 
             if ( !attributeType.isCanUserModify() )
             {
@@ -1307,7 +1313,7 @@
             switch ( modOp )
             {
                 case ADD_ATTRIBUTE:
-                    EntryAttribute attr = tmpEntry.get( change.getUpId() );
+                    EntryAttribute attr = tmpEntry.get( attributeType.getName() );
 
                     if ( attr != null )
                     {
@@ -1331,7 +1337,7 @@
                     break;
 
                 case REMOVE_ATTRIBUTE:
-                    if ( tmpEntry.get( change.getUpId() ) == null )
+                    if ( tmpEntry.get( change.getId() ) == null )
                     {
                         LOG.error( "Trying to remove an non-existant attribute: " + change.getUpId() );
                         throw new LdapNoSuchAttributeException();
@@ -1359,7 +1365,7 @@
                         }
 
                         // Now remove the attribute and all its values
-                        EntryAttribute modified = tmpEntry.removeAttributes( change.getUpId() ).get( 0 );
+                        EntryAttribute modified = tmpEntry.removeAttributes( change.getId() ).get( 0 );
 
                         // And inject back the values except the ones to remove
                         for ( Value<?> value : change )
@@ -1369,7 +1375,7 @@
 
                         // ok, done. Last check : if the attribute does not content any more value;
                         // and if it's a MUST one, we should thow an exception
-                        if ( ( modified.size() == 0 ) && isRequired( change.getUpId(), objectClass ) )
+                        if ( ( modified.size() == 0 ) && isRequired( change.getId(), objectClass ) )
                         {
                             LOG.error( "Trying to remove a required attribute: " + change.getUpId() );
                             throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Wed Sep  3 18:23:12 2008
@@ -44,6 +44,7 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
@@ -595,14 +596,14 @@
             return;
         }
 
-        mods.add( new ServerModification( DirContext.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
             MetaSchemaConstants.M_DISABLED_AT, attrRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT ) ) ) );
 
-        mods.add( new ServerModification( DirContext.ADD_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
             SchemaConstants.MODIFIERS_NAME_AT, attrRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ),
             ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
 
-        mods.add( new ServerModification( DirContext.ADD_ATTRIBUTE, new DefaultServerAttribute(
+        mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
             SchemaConstants.MODIFY_TIMESTAMP_AT, attrRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
                 .getGeneralizedTime() ) ) );
 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Wed Sep  3 18:23:12 2008
@@ -122,7 +122,7 @@
         
         for ( ServerAttribute attribute:attributes )
         {
-            jndiAttributes.add( ServerEntryUtils.toAttributeImpl( attribute ) );
+            jndiAttributes.add( ServerEntryUtils.toBasicAttribute( attribute ) );
         }
         
         return jndiAttributes;

Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java Wed Sep  3 18:23:12 2008
@@ -27,13 +27,9 @@
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.nio.channels.SocketChannel;
-import java.util.Iterator;
 
 import javax.naming.InvalidNameException;
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
@@ -44,7 +40,6 @@
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapDecoder;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
@@ -61,6 +56,7 @@
 import org.apache.directory.shared.ldap.codec.unbind.UnBindRequest;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.ldif.ChangeType;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
@@ -411,10 +407,8 @@
      * Send the entry to the encoder, then wait for a
      * reponse from the LDAP server on the results of the operation.
      * 
-     * @param entry
-     *            The entry to modify
-     * @param msgId
-     *            message id number
+     * @param entry The entry to modify
+     * @param msgId message id number
      */
     private int changeModifyEntry( LdifEntry entry, int messageId ) throws IOException, DecoderException,
         InvalidNameException, NamingException, EncoderException
@@ -431,35 +425,13 @@
         modifyRequest.setObject( new LdapDN( dn ) );
         modifyRequest.initModifications();
 
-        Iterator modifications = entry.getModificationItems().iterator();
-
-        while ( modifications.hasNext() )
+        for ( Modification modification: entry.getModificationItems() )
         {
-            ModificationItem modification = ( ModificationItem ) modifications.next();
-
-            switch ( modification.getModificationOp() )
-            {
-                case DirContext.ADD_ATTRIBUTE:
-                    modifyRequest.setCurrentOperation( LdapConstants.OPERATION_ADD );
-                    break;
-
-                case DirContext.REMOVE_ATTRIBUTE:
-                    modifyRequest.setCurrentOperation( LdapConstants.OPERATION_DELETE );
-                    break;
-
-                case DirContext.REPLACE_ATTRIBUTE:
-                    modifyRequest.setCurrentOperation( LdapConstants.OPERATION_REPLACE );
-                    break;
-
-                default:
-                    System.err.println( "Unknown modify operation for DN " + dn );
-            }
-
-            modifyRequest.addAttributeTypeAndValues( modification.getAttribute().getID() );
+            modifyRequest.setCurrentOperation( modification.getOperation() );
+            modifyRequest.addAttributeTypeAndValues( modification.getAttribute().getId() );
 
-            for ( NamingEnumeration values = modification.getAttribute().getAll(); values.hasMoreElements(); )
+            for ( Value<?> value:modification.getAttribute() )
             {
-                Object value = values.nextElement();
                 modifyRequest.addAttributeValue( value );
             }
         }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java Wed Sep  3 18:23:12 2008
@@ -25,7 +25,6 @@
 import java.util.List;
 
 import javax.naming.InvalidNameException;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -64,6 +63,7 @@
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControlCodec;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
@@ -436,7 +436,7 @@
         if ( modifyRequest.getModifications() != null )
         {
             // Loop through the modifications
-            for ( ModificationItem modification:modifyRequest.getModifications() )
+            for ( Modification modification:modifyRequest.getModifications() )
             {
                 snickersMessage.addModification( modification );
             }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java Wed Sep  3 18:23:12 2008
@@ -63,7 +63,7 @@
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         // Store the value. It can't be null
-        Object value = StringTools.EMPTY_BYTES;
+        byte[] value = StringTools.EMPTY_BYTES;
 
         if ( tlv.getLength() == 0 )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java Wed Sep  3 18:23:12 2008
@@ -26,19 +26,18 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+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;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -78,7 +77,7 @@
     // -----------------------------------------------------------------
 
     /** The logger */
-    private static final Logger log = LoggerFactory.getLogger( ModifyRequest.class );
+    private static final Logger LOG = LoggerFactory.getLogger( ModifyRequest.class );
 
     // ~ Instance fields
     // ----------------------------------------------------------------------------
@@ -86,14 +85,14 @@
     /** The DN to be modified. */
     private LdapDN object;
 
-    /** The modifications list. This is an array of ModificationItemImpl. */
-    private List<ModificationItem> modifications;
+    /** The modifications list. This is an array of Modification. */
+    private List<Modification> modifications;
 
     /** The current attribute being decoded */
-    private Attribute currentAttribute;
+    private EntryAttribute currentAttribute;
 
     /** A local storage for the operation */
-    private int currentOperation;
+    private ModificationOperation currentOperation;
 
     /** The modify request length */
     private int modifyRequestLength;
@@ -142,7 +141,7 @@
      */
     public void initModifications()
     {
-        modifications = new ArrayList<ModificationItem>();
+        modifications = new ArrayList<Modification>();
     }
 
 
@@ -151,7 +150,7 @@
      * 
      * @return Returns the modifications.
      */
-    public List<ModificationItem> getModifications()
+    public List<Modification> getModifications()
     {
         return modifications;
     }
@@ -164,11 +163,11 @@
      */
     public void addModification( int operation )
     {
-        currentOperation = operation;
+        currentOperation = ModificationOperation.getOperation( operation );
 
         if ( currentAttribute == null )
         {
-            modifications = new ArrayList<ModificationItem>();
+            modifications = new ArrayList<Modification>();
         }
     }
 
@@ -180,28 +179,32 @@
      */
     public void addAttributeTypeAndValues( String type )
     {
-        currentAttribute = new BasicAttribute( StringTools.lowerCaseAscii( type ) );
+        currentAttribute = new DefaultClientAttribute( StringTools.lowerCaseAscii( type ) );
 
-        int operation = 0;
+        Modification modification = new ClientModification( currentOperation, currentAttribute );
+        modifications.add( modification );
+    }
 
-        switch ( currentOperation )
-        {
 
-            case LdapConstants.OPERATION_ADD: // add
-                operation = DirContext.ADD_ATTRIBUTE;
-                break;
-
-            case LdapConstants.OPERATION_DELETE: // delete
-                operation = DirContext.REMOVE_ATTRIBUTE;
-                break;
-
-            case LdapConstants.OPERATION_REPLACE: // replace
-                operation = DirContext.REPLACE_ATTRIBUTE;
-                break;
-        }
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( String value )
+    {
+        currentAttribute.add( value );
+    }
 
-        ModificationItem modification = new ModificationItem( operation, currentAttribute );
-        modifications.add( modification );
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( org.apache.directory.shared.ldap.entry.Value<?> value )
+    {
+        currentAttribute.add( value );
     }
 
 
@@ -210,7 +213,7 @@
      * 
      * @param value The value to add
      */
-    public void addAttributeValue( Object value )
+    public void addAttributeValue( byte[] value )
     {
         currentAttribute.add( value );
     }
@@ -221,7 +224,7 @@
      */
     public String getCurrentAttributeType()
     {
-        return currentAttribute.getID();
+        return currentAttribute.getId();
     }
 
 
@@ -254,7 +257,7 @@
      */
     public int getCurrentOperation()
     {
-        return currentOperation;
+        return currentOperation.getValue();
     }
 
 
@@ -265,6 +268,17 @@
      */
     public void setCurrentOperation( int currentOperation )
     {
+        this.currentOperation = ModificationOperation.getOperation( currentOperation );
+    }
+
+
+    /**
+     * Store the current operation
+     * 
+     * @param currentOperation The currentOperation to set.
+     */
+    public void setCurrentOperation( ModificationOperation currentOperation )
+    {
         this.currentOperation = currentOperation;
     }
 
@@ -323,48 +337,36 @@
             modificationLength = new LinkedList<Integer>();
             valuesLength = new LinkedList<Integer>();
 
-            for ( ModificationItem modification:modifications )
+            for ( Modification modification:modifications )
             {
                 // Modification sequence length initialized with the operation
                 int localModificationSequenceLength = 1 + 1 + 1;
                 int localValuesLength = 0;
 
                 // Modification length initialized with the type
-                int typeLength = modification.getAttribute().getID().length();
+                int typeLength = modification.getAttribute().getId().length();
                 int localModificationLength = 1 + TLV.getNbBytes( typeLength ) + typeLength;
 
-                try
+                // Get all the values
+                if ( modification.getAttribute().size() != 0 )
                 {
-
-                    NamingEnumeration<?> values = modification.getAttribute().getAll();
-
-                    // Get all the values
-                    if ( values.hasMoreElements() )
+                    for ( org.apache.directory.shared.ldap.entry.Value<?> value:modification.getAttribute() )
                     {
-                        while ( values.hasMore() )
+                        if ( value instanceof ClientStringValue )
                         {
-                            Object value = values.next();
-
-                            if ( value instanceof String )
-                            {
-                                int valueLength = StringTools.getBytesUtf8( ( String ) value ).length;
-                                localValuesLength += 1 + TLV.getNbBytes( valueLength ) + valueLength;
-                            }
-                            else
-                            {
-                                localValuesLength += 1 + TLV.getNbBytes( ( ( byte[] ) value ).length )
-                                    + ( ( byte[] ) value ).length;
-                            }
+                            int valueLength = StringTools.getBytesUtf8( (String)value.get() ).length;
+                            localValuesLength += 1 + TLV.getNbBytes( valueLength ) + valueLength;
+                        }
+                        else
+                        {
+                            localValuesLength += 1 + TLV.getNbBytes( ( ( byte[] ) value.getReference() ).length )
+                                + ( ( byte[] ) value.getReference() ).length;
                         }
                     }
-
-                    localModificationLength += 1 + TLV.getNbBytes( localValuesLength ) + localValuesLength;
-                }
-                catch ( NamingException ne )
-                {
-                    continue;
                 }
 
+                localModificationLength += 1 + TLV.getNbBytes( localValuesLength ) + localValuesLength;
+
                 // Compute the modificationSequenceLength
                 localModificationSequenceLength += 1 + TLV.getNbBytes( localModificationLength )
                     + localModificationLength;
@@ -442,7 +444,7 @@
                 int modificationNumber = 0;
 
                 // Compute the modifications length
-                for ( ModificationItem modification:modifications )
+                for ( Modification modification:modifications )
                 {
                     // The modification sequence
                     buffer.put( UniversalTag.SEQUENCE_TAG );
@@ -454,22 +456,7 @@
                     // the same value in DirContext and in RFC 2251.
                     buffer.put( UniversalTag.ENUMERATED_TAG );
                     buffer.put( ( byte ) 1 );
-
-                    switch ( modification.getModificationOp() )
-                    {
-
-                        case DirContext.ADD_ATTRIBUTE: // add
-                            buffer.put( ( byte ) LdapConstants.OPERATION_ADD );
-                            break;
-
-                        case DirContext.REMOVE_ATTRIBUTE: // delete
-                            buffer.put( ( byte ) LdapConstants.OPERATION_DELETE );
-                            break;
-
-                        case DirContext.REPLACE_ATTRIBUTE: // replace
-                            buffer.put( ( byte ) LdapConstants.OPERATION_REPLACE );
-                            break;
-                    }
+                    buffer.put( ( byte ) modification.getOperation().getValue() );
 
                     // The modification
                     buffer.put( UniversalTag.SEQUENCE_TAG );
@@ -477,38 +464,26 @@
                     buffer.put( TLV.getBytes( localModificationLength ) );
 
                     // The modification type
-                    Value.encode( buffer, modification.getAttribute().getID() );
+                    Value.encode( buffer, modification.getAttribute().getId() );
 
                     // The values
                     buffer.put( UniversalTag.SET_TAG );
                     int localValuesLength = valuesLength.get( modificationNumber );
                     buffer.put( TLV.getBytes( localValuesLength ) );
 
-                    try
+                    if ( modification.getAttribute().size() != 0 )
                     {
-                        NamingEnumeration<?> values = modification.getAttribute().getAll();
-
-                        if ( values.hasMoreElements() )
+                        for ( org.apache.directory.shared.ldap.entry.Value<?> value:modification.getAttribute() )
                         {
-                            while ( values.hasMoreElements() )
+                            if ( value instanceof ClientStringValue )
                             {
-                                Object value = values.next();
-
-                                if ( value instanceof String )
-                                {
-                                    Value.encode( buffer, ( String ) value );
-                                }
-                                else
-                                {
-                                    Value.encode( buffer, ( byte[] ) value );
-                                }
+                                Value.encode( buffer, ( String ) value.get() );
+                            }
+                            else
+                            {
+                                Value.encode( buffer, ( byte[] ) value.getReference() );
                             }
                         }
-
-                    }
-                    catch ( NamingException ne )
-                    {
-                        throw new EncoderException( "Cannot enumerate the values" );
                     }
 
                     // Go to the next modification number;
@@ -541,67 +516,36 @@
         {
             int i = 0;
             
-            for ( ModificationItem modification:modifications )
+            for ( Modification modification:modifications )
             {
                 sb.append( "            Modification[" ).append( i ).append( "]\n" );
                 sb.append( "                Operation : " );
 
                 if ( modification != null )
                 {
-                    switch ( modification.getModificationOp() )
+                    switch ( modification.getOperation() )
                     {
     
-                        case DirContext.ADD_ATTRIBUTE:
+                        case ADD_ATTRIBUTE:
                             sb.append( " add\n" );
                             break;
     
-                        case DirContext.REPLACE_ATTRIBUTE:
+                        case REPLACE_ATTRIBUTE:
                             sb.append( " replace\n" );
                             break;
     
-                        case DirContext.REMOVE_ATTRIBUTE:
+                        case REMOVE_ATTRIBUTE:
                             sb.append( " delete\n" );
                             break;
                     }
 
                     sb.append( "                Modification\n" );
     
-                    Attribute attribute = modification.getAttribute();
+                    EntryAttribute attribute = modification.getAttribute();
     
                     if ( attribute != null )
                     {
-                        try
-                        {
-                            sb.append( "                    Type : '" ).append( attribute.getID() ).append( "'\n" );
-                            sb.append( "                    Vals\n" );
-        
-                            for ( int j = 0; j < attribute.size(); j++ )
-                            {
-        
-                                Object attributeValue = attribute.get( j );
-                                sb.append( "                        Val[" ).append( j ).append( "] : '" );
-        
-                                if ( attributeValue != null )
-                                {
-                                    if ( attributeValue instanceof String )
-                                    {
-                                        sb.append( attributeValue ).append( "' \n" );
-                                    }
-                                    else
-                                    {
-                                        sb.append( StringTools.utf8ToString( ( byte[] ) attributeValue ) ).append( "' \n" );
-                                    }
-                                }
-                                else
-                                {
-                                    sb.append( "<null>'\n" );
-                                }
-                            }
-                        }
-                        catch ( NamingException ne )
-                        {
-                            log.error( "Naming exception while printing the '{}'", attribute.getID() );
-                        }
+                        sb.append( attribute );
                     }
                 }
                 else

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=691847&r1=691846&r2=691847&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 Wed Sep  3 18:23:12 2008
@@ -232,6 +232,23 @@
 
     /**
      * <p>
+     * Get the nth value of this attribute. If there is none, 
+     * null is returned.
+     * </p>
+     * <p>
+     * Note : even if we are storing values into a Set, one can assume
+     * the values are ordered following the insertion order.
+     * </p>
+     * <p> 
+     * 
+     * @param i the index  of the value to get
+     *  @return The nth value for this attribute.
+     */
+    Value<?> get( int i );
+    
+    
+    /**
+     * <p>
      * Get the byte[] value, if and only if the value is known to be Binary,
      * otherwise a InvalidAttributeValueException will be thrown
      * </p>

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ModificationOperation.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ModificationOperation.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ModificationOperation.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ModificationOperation.java Wed Sep  3 18:23:12 2008
@@ -29,9 +29,9 @@
  */
 public enum ModificationOperation
 {
-    ADD_ATTRIBUTE( 1 ),
-    REPLACE_ATTRIBUTE( 2 ),
-    REMOVE_ATTRIBUTE( 3 );
+    ADD_ATTRIBUTE( 0 ),
+    REMOVE_ATTRIBUTE( 1 ),
+    REPLACE_ATTRIBUTE( 2 );
 
     /** Internal value */
     private int value;

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=691847&r1=691846&r2=691847&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 Wed Sep  3 18:23:12 2008
@@ -158,11 +158,6 @@
             return true;
         }
         
-        if ( o == null )
-        {
-           return false;
-        }
-        
         if ( ! (o instanceof ClientModification ) )
         {
             return false;

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=691847&r1=691846&r2=691847&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 Wed Sep  3 18:23:12 2008
@@ -934,6 +934,46 @@
 
 
     /**
+     * <p>
+     * Get the nth value of this attribute. If there is none, 
+     * null is returned.
+     * </p>
+     * <p>
+     * Note : even if we are storing values into a Set, one can assume
+     * the values are ordered following the insertion order.
+     * </p>
+     * <p> 
+     * 
+     * @param i the index  of the value to get
+     *  @return The nth value for this attribute.
+     */
+    public Value<?> get( int i )
+    {
+        if ( values.size() < i )
+        {
+            return null;
+        }
+        else
+        {
+            int n = 0;
+            
+            for ( Value<?> value:values )
+            {
+                if ( n == i )
+                {
+                    return value;
+                }
+                
+                n++;
+            }
+        }
+        
+        // fallback to 
+        return null;
+    }
+    
+    
+    /**
      * Returns an iterator over all the attribute's values.
      * <p>
      * The effect on the returned enumeration of adding or removing values of

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java Wed Sep  3 18:23:12 2008
@@ -36,6 +36,7 @@
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 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.ClientModification;
@@ -188,12 +189,14 @@
     /**
      * Add a modification item (used by modify operations)
      * 
-     * @param modOp The operation. One of : DirContext.ADD_ATTRIBUTE
-     *            DirContext.REMOVE_ATTRIBUTE DirContext.REPLACE_ATTRIBUTE
+     * @param modOp The operation. One of : 
+     * - ModificationOperation.ADD_ATTRIBUTE
+     * - ModificationOperation.REMOVE_ATTRIBUTE 
+     * - ModificationOperation.REPLACE_ATTRIBUTE
      * 
      * @param attr The attribute to be added
      */
-    public void addModificationItem( int modOp, EntryAttribute attr )
+    public void addModificationItem( ModificationOperation modOp, EntryAttribute attr )
     {
         if ( changeType == ChangeType.Modify )
         {
@@ -203,18 +206,20 @@
         }
     }
 
+
     /**
      * Add a modification item
      * 
-     * @param modOp
-     *            The operation. One of : DirContext.ADD_ATTRIBUTE
-     *            DirContext.REMOVE_ATTRIBUTE DirContext.REPLACE_ATTRIBUTE
+     * @param modOp The operation. One of : 
+     *  - ModificationOperation.ADD_ATTRIBUTE
+     *  - ModificationOperation.REMOVE_ATTRIBUTE 
+     *  - ModificationOperation.REPLACE_ATTRIBUTE
      * 
      * @param modOp The modification operation value
      * @param id The attribute's ID
      * @param value The attribute's value
      */
-    public void addModificationItem( int modOp, String id, Object value )
+    public void addModificationItem( ModificationOperation modOp, String id, Object value )
     {
         if ( changeType == ChangeType.Modify )
         {
@@ -236,6 +241,7 @@
         }
     }
 
+
     /**
      * Add an attribute to the entry
      * 
@@ -990,7 +996,7 @@
                     String modStr = in.readUTF();
                     DefaultClientAttribute value = (DefaultClientAttribute)in.readObject();
                     
-                    addModificationItem( operation, modStr, value );
+                    addModificationItem( ModificationOperation.getOperation( operation ), modStr, value );
                 }
                 
                 break;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java Wed Sep  3 18:23:12 2008
@@ -43,12 +43,12 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.DirContext;
 import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.LdapDnParser;
@@ -987,7 +987,7 @@
     {
         int state = MOD_SPEC;
         String modified = null;
-        int modificationType = 0;
+        ModificationOperation modificationType = ModificationOperation.ADD_ATTRIBUTE;
         EntryAttribute attribute = null;
 
         // The following flag is used to deal with empty modifications
@@ -1032,7 +1032,7 @@
                 }
 
                 modified = StringTools.trim( line.substring( "add:".length() ) );
-                modificationType = DirContext.ADD_ATTRIBUTE;
+                modificationType = ModificationOperation.ADD_ATTRIBUTE;
                 attribute = new DefaultClientAttribute( modified );
 
                 state = ATTRVAL_SPEC;
@@ -1046,7 +1046,7 @@
                 }
 
                 modified = StringTools.trim( line.substring( "delete:".length() ) );
-                modificationType = DirContext.REMOVE_ATTRIBUTE;
+                modificationType = ModificationOperation.REMOVE_ATTRIBUTE;
                 attribute = new DefaultClientAttribute( modified );
 
                 state = ATTRVAL_SPEC_OR_SEP;
@@ -1060,7 +1060,7 @@
                 }
 
                 modified = StringTools.trim( line.substring( "replace:".length() ) );
-                modificationType = DirContext.REPLACE_ATTRIBUTE;
+                modificationType = ModificationOperation.REPLACE_ATTRIBUTE;
                 attribute = new DefaultClientAttribute( modified );
 
                 state = ATTRVAL_SPEC_OR_SEP;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java Wed Sep  3 18:23:12 2008
@@ -21,7 +21,7 @@
 
 
 /**
- * Lockable implementation of an AbandonRequest.
+ * Implementation of an AbandonRequest.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMutableControlImpl.java Wed Sep  3 18:23:12 2008
@@ -21,7 +21,7 @@
 
 
 /**
- * Lockable Control implementation.
+ * Control implementation.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java Wed Sep  3 18:23:12 2008
@@ -21,7 +21,7 @@
 
 
 /**
- * Lockable AddResponse implementation.
+ * AddResponse implementation.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java Wed Sep  3 18:23:12 2008
@@ -21,7 +21,7 @@
 
 
 /**
- * Lockable CompareResponse implementation.
+ * CompareResponse implementation.
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  * @version $Rev$

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java Wed Sep  3 18:23:12 2008
@@ -21,7 +21,7 @@
 
 
 /**
- * Lockable DeleteResponse implementation
+ * DeleteResponse implementation
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  * @version $Rev$
@@ -37,7 +37,7 @@
 
 
     /**
-     * Creates a Lockable DeleteResponse as a reply to an DeleteRequest.
+     * Creates a DeleteResponse as a reply to an DeleteRequest.
      * 
      * @param id
      *            the session unique message id

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java Wed Sep  3 18:23:12 2008
@@ -22,10 +22,7 @@
 
 import java.util.Collection;
 
-import javax.naming.directory.ModificationItem;
-
-
-
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -130,28 +127,25 @@
      * Gets an immutable Collection of modification items representing the
      * atomic changes to perform on the candidate entry to modify.
      * 
-     * @return an immutatble Collection of ModificationItem instances.
-     * @see javax.naming.directory.ModificationItem
+     * @return an immutable Collection of Modification instances.
      */
-    Collection<ModificationItem> getModificationItems();
+    Collection<Modification> getModificationItems();
 
 
     /**
      * Adds a ModificationItem to the set of modifications composing this modify
      * request.
      * 
-     * @param mod
-     *            a ModificationItem to add.
+     * @param mod a Modification to add.
      */
-    void addModification( ModificationItem mod );
+    void addModification( Modification mod );
 
 
     /**
      * Removes a ModificationItem to the set of modifications composing this
      * modify request.
      * 
-     * @param mod
-     *            a ModificationItem to remove.
+     * @param mod a Modification to remove.
      */
-    void removeModification( ModificationItem mod );
+    void removeModification( Modification mod );
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java Wed Sep  3 18:23:12 2008
@@ -23,19 +23,12 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.client.ClientModification;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,13 +44,13 @@
     static final long serialVersionUID = -505803669028990304L;
 
     /** The logger */
-    private static final transient Logger log = LoggerFactory.getLogger( ModifyRequestImpl.class );
+    private static final transient Logger LOG = LoggerFactory.getLogger( ModifyRequestImpl.class );
 
     /** Dn of the entry to modify or PDU's <b>object</b> field */
     private LdapDN name;
 
     /** Sequence of modifications or PDU's <b>modification</b> seqence field */
-    private List<ModificationItem> mods = new ArrayList<ModificationItem>();
+    private List<Modification> mods = new ArrayList<Modification>();
 
     private ModifyResponse response;
 
@@ -82,15 +75,13 @@
     // ------------------------------------------------------------------------
     // ModifyRequest Interface Method Implementations
     // ------------------------------------------------------------------------
-
     /**
      * Gets an immutable Collection of modification items representing the
      * atomic changes to perform on the candidate entry to modify.
      * 
-     * @return an immutatble Collection of ModificationItem instances.
-     * @see <{javax.naming.directory.ModificationItem}>
+     * @return an immutable Collection of Modification instances.
      */
-    public Collection<ModificationItem> getModificationItems()
+    public Collection<Modification> getModificationItems()
     {
         return Collections.unmodifiableCollection( mods );
     }
@@ -122,26 +113,24 @@
 
 
     /**
-     * Adds a ModificationItem to the set of modifications composing this modify
+     * Adds a Modification to the set of modifications composing this modify
      * request.
      * 
-     * @param mod
-     *            a ModificationItem to add.
+     * @param mod a Modification to add
      */
-    public void addModification( ModificationItem mod )
+    public void addModification( Modification mod )
     {
         mods.add( mod );
     }
 
 
     /**
-     * Removes a ModificationItem to the set of modifications composing this
+     * Removes a Modification to the set of modifications composing this
      * modify request.
      * 
-     * @param mod
-     *            a ModificationItem to remove.
+     * @param mod a Modification to remove.
      */
-    public void removeModification( ModificationItem mod )
+    public void removeModification( Modification mod )
     {
         mods.remove( mod );
     }
@@ -224,13 +213,22 @@
             return false;
         }
 
-        Iterator<ModificationItem> list = req.getModificationItems().iterator();
+        Iterator<Modification> list = req.getModificationItems().iterator();
 
-        for ( int ii = 0; ii < mods.size(); ii++ )
+        for ( int i = 0; i < mods.size(); i++ )
         {
-            ModificationItem item = ( ModificationItem ) list.next();
+            Modification item = list.next();
 
-            if ( !equals( ( ModificationItem ) mods.get( ii ), item ) )
+            if ( item == null )
+            {
+                if ( mods.get( i ) != null )
+                {
+                    return false;
+                }
+            }
+            else
+                
+            if ( !item.equals((ClientModification) mods.get( i ) ) )
             {
                 return false;
             }
@@ -241,90 +239,6 @@
 
 
     /**
-     * Checks to see if two ModificationItems are equal by factoring in the
-     * modification operation as well as the attribute of each item.
-     * 
-     * @param item0
-     *            the first ModificationItem to compare
-     * @param item1
-     *            the second ModificationItem to compare
-     * @return true if the ModificationItems are equal, false otherwise
-     */
-    private boolean equals( ModificationItem item0, ModificationItem item1 )
-    {
-        if ( item0 == item1 )
-        {
-            return true;
-        }
-
-        if ( item0.getModificationOp() != item1.getModificationOp() )
-        {
-            return false;
-        }
-
-        // compare attribute id's at the very least
-        if ( !item0.getAttribute().getID().equals( item1.getAttribute().getID() ) )
-        {
-            return false;
-        }
-
-        try
-        {
-            Attribute attr0 = item0.getAttribute();
-            Attribute attr1 = item1.getAttribute();
-
-            Set<Object> attrHash0 = new HashSet<Object>();
-
-            NamingEnumeration<?> iter0 = attr0.getAll();
-
-            while ( iter0.hasMoreElements() )
-            {
-                attrHash0.add( iter0.next() );
-            }
-
-            NamingEnumeration<?> iter1 = attr1.getAll();
-
-            while ( iter1.hasMoreElements() )
-            {
-                Object value = iter1.next();
-
-                if ( attrHash0.contains( value ) == false )
-                {
-                    if ( value instanceof byte[] )
-                    {
-                        String sValue = StringTools.utf8ToString( ( byte[] ) value );
-
-                        if ( attrHash0.contains( sValue ) == false )
-                        {
-                            return false;
-                        }
-                        else
-                        {
-                            attrHash0.remove( sValue );
-                            continue;
-                        }
-                    }
-                    else
-                    {
-                        return false;
-                    }
-                }
-                else
-                {
-                    attrHash0.remove( value );
-                }
-            }
-
-            return ( attrHash0.size() == 0 );
-        }
-        catch ( NamingException ne )
-        {
-            return false;
-        }
-    }
-
-
-    /**
      * Get a String representation of a ModifyRequest
      * 
      * @return A ModifyRequest String
@@ -343,64 +257,28 @@
             for ( int i = 0; i < mods.size(); i++ )
             {
 
-                ModificationItem modification = ( ModificationItem ) mods.get( i );
+                ClientModification modification = ( ClientModification ) mods.get( i );
 
                 sb.append( "            Modification[" ).append( i ).append( "]\n" );
                 sb.append( "                Operation : " );
 
-                switch ( modification.getModificationOp() )
+                switch ( modification.getOperation() )
                 {
-
-                    case DirContext.ADD_ATTRIBUTE:
+                    case ADD_ATTRIBUTE:
                         sb.append( " add\n" );
                         break;
 
-                    case DirContext.REPLACE_ATTRIBUTE:
+                    case REPLACE_ATTRIBUTE:
                         sb.append( " replace\n" );
                         break;
 
-                    case DirContext.REMOVE_ATTRIBUTE:
+                    case REMOVE_ATTRIBUTE:
                         sb.append( " delete\n" );
                         break;
                 }
 
                 sb.append( "                Modification\n" );
-
-                Attribute attribute = modification.getAttribute();
-
-                try
-                {
-                    sb.append( "                    Type : '" ).append( attribute.getID() ).append( "'\n" );
-                    sb.append( "                    Vals\n" );
-
-                    for ( int j = 0; j < attribute.size(); j++ )
-                    {
-                        sb.append( "                        Val[" ).append( j ).append( "] : '" );
-
-                        Object attributeValue = attribute.get( j );
-
-                        if ( attributeValue instanceof byte[] )
-                        {
-                            sb.append( StringTools.utf8ToString( ( byte[] ) attributeValue ) ).append( '/' ).append(
-                                StringTools.dumpBytes( ( byte[] ) attributeValue ) );
-                        }
-                        else if ( attributeValue instanceof String )
-                        {
-                            sb.append( attributeValue );
-                        }
-                        else
-                        {
-                            sb.append( StringTools.dumpBytes( StringTools.getBytesUtf8( attributeValue.toString() ) ) );
-                        }
-
-                        sb.append( "' \n" );
-
-                    }
-                }
-                catch ( NamingException ne )
-                {
-                    log.error( "Naming exception while printing the '" + attribute.getID() + "'" );
-                }
+                sb.append( modification.getAttribute() );
             }
         }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImpl.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImpl.java Wed Sep  3 18:23:12 2008
@@ -21,7 +21,7 @@
 
 
 /**
- * Lockable SearchResponseDone implementation
+ * SearchResponseDone implementation
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  * @version $Rev$

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=691847&r1=691846&r2=691847&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java Wed Sep  3 18:23:12 2008
@@ -237,52 +237,6 @@
     
     
     /**
-     * Utility method to extract a modification item from an array of modifications.
-     * 
-     * @param mods the array of ModificationItems to extract the Attribute from.
-     * @param type the attributeType spec of the Attribute to extract
-     * @return the modification item on the attributeType specified
-     */
-    public static final ModificationItem getModificationItem( List<ModificationItem> mods, AttributeType type )
-    {
-        // optimization bypass to avoid cost of the loop below
-        if ( type.getNamesRef().length == 1 )
-        {
-            for ( ModificationItem mod:mods )
-            {
-                if ( mod.getAttribute().getID().equalsIgnoreCase( type.getNamesRef()[0] ) )
-                {
-                    return mod;
-                }
-            }
-        }
-        
-        // check if the attribute's OID is used
-        for ( ModificationItem mod:mods )
-        {
-            if ( mod.getAttribute().getID().equals( type.getOid() ) )
-            {
-                return mod;
-            }
-        }
-        
-        // iterate through aliases
-        for ( int ii = 0; ii < type.getNamesRef().length; ii++ )
-        {
-            for ( ModificationItem mod:mods )
-            {
-                if ( mod.getAttribute().getID().equalsIgnoreCase( type.getNamesRef()[ii] ) )
-                {
-                    return mod;
-                }
-            }
-        }
-        
-        return null;
-    }
-
-    
-    /**
      * Check if an attribute contains a specific value, using the associated matchingRule for that
      *
      * @param attr The attribute we are searching in



Mime
View raw message