directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r616938 [1/4] - in /directory: apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/b...
Date Wed, 30 Jan 2008 22:52:00 GMT
Author: elecharny
Date: Wed Jan 30 14:51:36 2008
New Revision: 616938

URL: http://svn.apache.org/viewvc?rev=616938&view=rev
Log:
o Some more Attributes removal.
o Adding serialization for ServerEntry

Added:
    directory/apacheds/branches/bigbang/server-xml/src/main/resources/my-server.xml
Modified:
    directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryIT.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
    directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
    directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
    directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
    directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java
    directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
    directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
    directory/apacheds/branches/bigbang/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
    directory/installers/branches/bigbang/apacheds-noarch/apacheds.sh
    directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractBinaryValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractStringValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Modification.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ModificationOperation.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/AbstractClientAttribute.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java

Modified: directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Wed Jan 30 14:51:36 2008
@@ -23,8 +23,10 @@
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.IndexNotFoundException;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -49,9 +51,9 @@
 import org.apache.directory.server.schema.registries.SyntaxRegistry;
 import org.apache.directory.server.utils.AttributesFactory;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
@@ -67,7 +69,6 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -838,10 +839,13 @@
                 + "," + SchemaConstants.OU_AT + "=schema" );
         dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
         
-        ModificationItemImpl mod = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
-                new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT, "TRUE" ) );
+        Modification mod = new ServerModification( ModificationOperation.ADD_ATTRIBUTE,
+                new DefaultServerAttribute( 
+                    MetaSchemaConstants.M_DISABLED_AT, 
+                    registries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_DISABLED_AT ),
+                    "TRUE" ) );
         
-        List<ModificationItemImpl> mods = new ArrayList<ModificationItemImpl>();
+        List<Modification> mods = new ArrayList<Modification>();
         mods.add( mod );
         store.modify( dn, mods );
     }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java Wed Jan 30 14:51:36 2008
@@ -29,6 +29,10 @@
 import javax.naming.NamingException;
 import javax.naming.directory.InvalidAttributeValueException;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -194,6 +198,17 @@
 
 
     /**
+     * Get's the attribute's identifier. resolves to the AttributeType's name.
+     *
+     * @return the attribute's identifier.
+     */
+    public String getId()
+    {
+        return attributeType.getName();
+    }
+
+
+    /**
      * Get's the user provided identifier for this entry.  This is the value
      * that will be used as the identifier for the attribute within the
      * entry.  If this is a commonName attribute for example and the user
@@ -431,8 +446,10 @@
     /**
      * @see EntryAttribute#contains(org.apache.directory.shared.ldap.entry.Value)
      */
-    public boolean contains( ServerValue<?> val )
+    public boolean contains( ServerValue<?> val ) throws NamingException
     {
+        val.normalize();
+        
         return values.contains( val );
     }
 
@@ -440,7 +457,7 @@
     /**
      * @see EntryAttribute#contains(org.apache.directory.shared.ldap.entry.Value...)
      */
-    public boolean contains( ServerValue<?>... vals )
+    public boolean contains( ServerValue<?>... vals ) throws NamingException
     {
         // Iterate through all the values, and quit if we 
         // don't find one in the values
@@ -459,7 +476,7 @@
     /**
      * @see EntryAttribute#contains(String)
      */
-    public boolean contains( String val )
+    public boolean contains( String val ) throws NamingException
     {
         try
         {
@@ -475,6 +492,7 @@
         }
         
         ServerStringValue value = new ServerStringValue( attributeType, val );
+        value.normalize();
         
         return values.contains( value );
     }
@@ -483,7 +501,7 @@
     /**
      * @see EntryAttribute#contains(String...)
      */
-    public boolean contains( String... vals )
+    public boolean contains( String... vals ) throws NamingException
     {
         // Iterate through all the values, and quit if we 
         // don't find one in the values
@@ -502,7 +520,7 @@
     /**
      * @see EntryAttribute#contains(byte[])
      */
-    public boolean contains( byte[] val )
+    public boolean contains( byte[] val ) throws NamingException
     {
         try
         {
@@ -518,6 +536,8 @@
         }
         
         ServerBinaryValue sbv = new ServerBinaryValue( attributeType, val );
+        sbv.normalize();
+        
         return values.contains( sbv );
     }
 
@@ -525,7 +545,7 @@
     /**
      * @see EntryAttribute#contains(byte[]...)
      */
-    public boolean contains( byte[]... vals )
+    public boolean contains( byte[]... vals ) throws NamingException
     {
         // Iterate through all the values, and quit if we 
         // don't find one in the values
@@ -544,7 +564,7 @@
     /**
      * @see EntryAttribute#contains(Object...)
      */
-    public boolean contains( Object... vals )
+    public boolean contains( Object... vals ) throws NamingException
     {
         boolean isHR = false;
         
@@ -750,4 +770,84 @@
         return attributeId.equalsIgnoreCase( attributeType.getOid() );
     }
     
+    /**
+     * @see Externalizable#writeExternal(ObjectOutput)
+     * 
+     * We have to store the UPid, and all the values, if any.
+     */
+    public void writeExternal( ObjectOutput out ) throws IOException
+    {
+        // Do nothing : we can't restore the AttributeType ...
+    }
+
+    
+    /**
+     * @see Externalizable#readExternal(ObjectInput)
+     */
+    public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
+    {
+        if ( in.available() == 0 )
+        {
+            String message = "Cannot read an null Attribute";
+            LOG.error( message );
+            throw new IOException( message );
+        }
+        else
+        {
+            // Read the HR flag
+            boolean hr = in.readBoolean();
+            
+            // Read the UPid
+            upId = in.readUTF();
+
+            // Read the number of values
+            int nbValues = in.readInt();
+            
+            switch ( nbValues )
+            {
+                case -1 :
+                    values = null;
+                    break;
+                    
+                case 0 :
+                    values = new ArrayList<ServerValue<?>>();
+                    break;
+                    
+                default :
+                    values = new ArrayList<ServerValue<?>>();
+                
+                    for ( int i = 0; i < nbValues; i++ )
+                    {
+                        if ( hr )
+                        {
+                            ServerStringValue value = new ServerStringValue( attributeType );
+                        }
+                    }
+                    
+                    break;
+            }
+                    
+            if ( nbValues != 0 )
+            {
+                
+            }
+            else
+            {
+                
+            }
+
+            String wrapped = in.readUTF();
+            /**
+            set( wrapped );
+            
+            normalizedValue = in.readUTF();
+            
+            if ( ( normalizedValue.length() == 0 ) &&  ( wrapped.length() != 0 ) )
+            {
+                // In this case, the normalized value is equal to the UP value
+                normalizedValue = wrapped;
+            }
+            */
+        }
+    }
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java Wed Jan 30 14:51:36 2008
@@ -30,11 +30,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.InvalidAttributeValueException;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
 import java.util.Iterator;
 
 
@@ -44,7 +39,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public final class DefaultServerAttribute extends AbstractServerAttribute implements Externalizable
+public final class DefaultServerAttribute extends AbstractServerAttribute
 {
     /** Used for serialization */
     public static final long serialVersionUID = 2L;
@@ -770,119 +765,5 @@
         }
         
         return sb.toString();
-    }
-
-    
-    /**
-     * @see Externalizable#writeExternal(ObjectOutput)
-     * 
-     * We have to store the UPid, and all the values, if any.
-     */
-    public void writeExternal( ObjectOutput out ) throws IOException
-    {
-        // Store the attribute's HR : true means H/R, false is for binary
-        try
-        {
-            out.writeBoolean( attributeType.getSyntax().isHumanReadable() );
-        }
-        catch ( NamingException ne )
-        {
-            out.writeBoolean( false );
-        }
-        
-        // Store the UP id
-        out.writeUTF( upId );
-        
-        // The number of values
-        if ( values == null ) 
-        {
-            out.writeInt( -1 );
-        }
-        else if ( values.size() == 0 )
-        {
-            out.writeInt( 0 );
-        }
-        else
-        {
-            out.writeInt( values.size() );
-
-            for ( ServerValue<?> value:values )
-            {
-                out.writeObject( value );
-            }
-        }
-        
-        out.flush();
-    }
-
-    
-    /**
-     * @see Externalizable#readExternal(ObjectInput)
-     */
-    public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
-    {
-        if ( in.available() == 0 )
-        {
-            String message = "Cannot read an null Attribute";
-            LOG.error( message );
-            throw new IOException( message );
-        }
-        else
-        {
-            // Read the HR flag
-            boolean hr = in.readBoolean();
-            
-            // Read the UPid
-            upId = in.readUTF();
-
-            // Read the number of values
-            int nbValues = in.readInt();
-            
-            switch ( nbValues )
-            {
-                case -1 :
-                    values = null;
-                    break;
-                    
-                case 0 :
-                    values = new ArrayList<ServerValue<?>>();
-                    break;
-                    
-                default :
-                    values = new ArrayList<ServerValue<?>>();
-                
-                    for ( int i = 0; i < nbValues; i++ )
-                    {
-                        if ( hr )
-                        {
-                            ServerStringValue value = new ServerStringValue( attributeType );
-                        }
-                    }
-                    
-                    break;
-            }
-                    
-            if ( nbValues != 0 )
-            {
-                
-            }
-            else
-            {
-                
-            }
-
-            String wrapped = in.readUTF();
-            /**
-            set( wrapped );
-            
-            normalizedValue = in.readUTF();
-            
-            if ( ( normalizedValue.length() == 0 ) &&  ( wrapped.length() != 0 ) )
-            {
-                // In this case, the normalized value is equal to the UP value
-                normalizedValue = wrapped;
-            }
-            */
-        }
     }
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java Wed Jan 30 14:51:36 2008
@@ -115,16 +115,15 @@
 
     
     /**
-     * Creates a new instance of DefaultServerEntry.
+     * Creates a new instance of DefaultServerEntry. This is a private constructor
+     * which will only be used by the desrialization method 
      * <p>
      * This entry <b>must</b> be initialized before being used !
      */
-    /*public DefaultServerEntry()
+    public DefaultServerEntry()
     {
         registries = null;
-        
-        initObjectClassAT( registries );
-    }*/
+    }
 
 
     /**
@@ -1695,19 +1694,62 @@
      */
     public void writeExternal( ObjectOutput out ) throws IOException
     {
+        // First, the DN
         if ( dn == null )
         {
-            // We don't have a DN, so write a -1 instead of a real length
+            // Write an empty DN
+            LdapDN.EMPTY_LDAPDN.writeExternal( out );
+        }
+        else
+        {
+            // Write the DN
+            out.writeObject( dn );
+        }
+        
+        // Then the attributes. 
+        if ( serverAttributeMap == null )
+        {
             out.writeInt( -1 );
         }
         else
         {
-            // Here, we should ask ourselves if it would not be better
-            // to serialize the current LdapDN instead of a String.
-            String dnString = dn.getUpName();
-            out.writeInt( dnString.length() );
-            out.writeUTF( dnString );
+            out.writeInt( serverAttributeMap.size() );
             
+            // Iterate through the keys. We store the Attribute
+            // here, to be able to restore it in the readExternal :
+            // we need access to the registries, which are not available
+            // in the ServerAttribute class.
+            for ( AttributeType attributeType:serverAttributeMap.keySet() )
+            {
+                // We store the OID, as the AttributeType might have no name
+                out.writeUTF( attributeType.getOid() );
+                
+                // And store the attribute.
+                ServerAttribute attribute = serverAttributeMap.get( attributeType );
+
+                // Store the UP id
+                out.writeUTF( attribute.getUpId() );
+                
+                // The number of values
+                int nbValues = attribute.size();
+                
+                if ( nbValues == 0 ) 
+                {
+                    out.writeInt( 0 );
+                }
+                else 
+                {
+                    out.writeInt( nbValues );
+
+                    for ( ServerValue<?> value:attribute )
+                    {
+                        out.writeObject( value );
+                    }
+                }
+            }
+
+            // Note : we don't store the ObjectClassAttribute. I has already
+            // been stored as an attribute.
         }
         
         out.flush();
@@ -1719,67 +1761,52 @@
      */
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
-        if ( in.available() == 0 )
+        /*if ( in.available() == 0 )
         {
             String message = "Cannot read an null Attribute";
             LOG.error( message );
             throw new IOException( message );
-        }
-        else
-        {
-            // Read the HR flag
-            boolean hr = in.readBoolean();
-        }
-        /*
-            // Read the UPid
-            upId = in.readUTF();
+        }*/
 
-            // Read the number of values
-            int nbValues = in.readInt();
+        // Read the DN
+        LdapDN dn = (LdapDN)in.readObject();
+        
+        // Read the number of attributes
+        int nbAttributes = in.readInt();
+        
+        serverAttributeMap = new HashMap<AttributeType, ServerAttribute>();
+
+        // Read the attributes
+        for ( int i = 0; i < nbAttributes; i++ )
+        {
+            String oid = in.readUTF();
             
-            switch ( nbValues )
+            try
             {
-                case -1 :
-                    values = null;
-                    break;
-                    
-                case 0 :
-                    values = new ArrayList<ServerValue<?>>();
-                    break;
-                    
-                default :
-                    values = new ArrayList<ServerValue<?>>();
+                AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( oid );
                 
-                    for ( int i = 0; i < nbValues; i++ )
-                    {
-                        if ( hr )
-                        {
-                            ServerStringValue value = new ServerStringValue( attributeType ); 
-                    }
-                    
-                    break;
-            }
-            if ( nbValues != 0 )
-            {
+                ServerAttribute attribute = new DefaultServerAttribute( attributeType );
                 
-            }
-            else
-            {
+                // Read the attribute upID
+                String upId = in.readUTF();
+                attribute.setUpId( upId, attributeType );
                 
+                // Read the number of values
+                int nbValues = in.readInt();
+                
+                for ( int j = 0; j < nbValues; j++ )
+                {
+                    ServerValue<?> value = (ServerValue<?>)in.readObject();
+                    attribute.add( value );
+                }
+                
+                serverAttributeMap.put(  attributeType, attribute );
             }
-            //
-            String wrapped = in.readUTF();
-            
-            set( wrapped );
-            
-            normalizedValue = in.readUTF();
-            
-            if ( ( normalizedValue.length() == 0 ) &&  ( wrapped.length() != 0 ) )
+            catch ( NamingException ne )
             {
-                // In this case, the normalized value is equal to the UP value
-                normalizedValue = wrapped;
+                
             }
-        }*/
+        }
     }
 
         

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java Wed Jan 30 14:51:36 2008
@@ -22,6 +22,7 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.entry.AbstractBinaryValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.ByteArrayComparator;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -90,6 +91,7 @@
         }
 
         this.attributeType = attributeType;
+        setNormalized( false );
     }
 
 
@@ -103,6 +105,7 @@
     {
         this( attributeType );
         super.set( wrapped );
+        setNormalized( false );
     }
 
 
@@ -135,6 +138,7 @@
 
         normalizedValue = null;
         valid = null;
+        setNormalized( false );
         super.set( wrapped );
     }
 
@@ -144,6 +148,12 @@
     // -----------------------------------------------------------------------
     public void normalize() throws NamingException
     {
+        if ( isNormalized() )
+        {
+            // Bypass the normalization if it has already been done. 
+            return;
+        }
+        
         if ( getReference() != null )
         {
             Normalizer normalizer = getNormalizer();
@@ -151,10 +161,12 @@
             if ( normalizer == null )
             {
                 normalizedValue = getCopy();
+                setNormalized( false );
             }
             else
             {
                 normalizedValue = ( byte[] ) normalizer.normalize( getCopy() );
+                setNormalized( true );
             }
             
             if ( Arrays.equals( super.getReference(), normalizedValue ) )
@@ -170,6 +182,7 @@
         {
             normalizedValue = null;
             same = true;
+            setNormalized( false );
         }
     }
 
@@ -192,7 +205,7 @@
             return null;
         }
 
-        if ( normalizedValue == null )
+        if ( !isNormalized() )
         {
             normalize();
         }
@@ -275,9 +288,37 @@
         {
             ServerBinaryValue binaryValue = ( ServerBinaryValue ) value;
 
+            // Normalizes the compared value
+            try
+            {
+                binaryValue.normalize();
+            }
+            catch ( NamingException ne )
+            {
+                LOG.error( "Cannot nnormalize the wrapped value '" + binaryValue.get() + "'" );
+            }
+            
+            // Normalizes the value
+            try
+            {
+                normalize();
+            }
+            catch ( NamingException ne )
+            {
+                LOG.error( "Cannot normalize the wrapped value '" + get() + "'" );
+            }
             try
             {
-                return getComparator().compare( getNormalizedReference(), binaryValue.getNormalizedReference() );
+                Comparator comparator = getComparator();
+                
+                if ( comparator != null )
+                {
+                    return getComparator().compare( getNormalizedReference(), binaryValue.getNormalizedReference() );
+                }
+                else
+                {
+                    return ByteArrayComparator.INSTANCE.compare( getNormalizedReference(), binaryValue.getNormalizedReference() );
+                }
             }
             catch ( NamingException e )
             {
@@ -377,6 +418,9 @@
             return false;
         }
 
+        return compareTo( (ServerValue<byte[]>)other ) == 0;
+        
+        /*
         // now unlike regular values we have to compare the normalized values
         try
         {
@@ -392,6 +436,7 @@
             // recover by comparing non-normalized values
             return Arrays.equals( getReference(), other.getReference() );
         }
+        */
     }
 
 
@@ -543,12 +588,14 @@
                 case -1 :
                     // No value, no normalized value
                     same = true;
+                    setNormalized( false );
                     break;
                     
                 case 0 :
                     // Empty value, so is the normalized value
                     wrapped = StringTools.EMPTY_BYTES;
                     normalizedValue = wrapped;
+                    setNormalized( true );
                     same = true;
                     break;
                     
@@ -570,12 +617,14 @@
                         case 0 :
                             normalizedValue = StringTools.EMPTY_BYTES;
                             same = true;
+                            setNormalized( false );
                             break;
                             
                         default :
                             same = false;
                             normalizedValue = new byte[normalizedLength];
                             in.readFully( normalizedValue );
+                            setNormalized( true );
                             break;
                     }
                     

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryPropertyEditor.java Wed Jan 30 14:51:36 2008
@@ -167,7 +167,6 @@
         }
         catch ( Exception e )
         {
-            e.printStackTrace();
             return null;
         }
     }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Wed Jan 30 14:51:36 2008
@@ -18,7 +18,9 @@
  */
 package org.apache.directory.server.core.entry;
 
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -26,11 +28,13 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
 import javax.naming.directory.InvalidAttributeIdentifierException;
 
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -260,21 +264,21 @@
      * @return the resultant entry after the modification has taken place
      * @throws NamingException if there are problems accessing attributes
      */
-    public static ServerEntry getTargetEntry( ModificationItemImpl mod, ServerEntry entry, Registries registries ) throws NamingException
+    public static ServerEntry getTargetEntry( Modification mod, ServerEntry entry, Registries registries ) throws NamingException
     {
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
-        int modOp = mod.getModificationOp();
-        String id = mod.getAttribute().getID();
+        ModificationOperation modOp = mod.getOperation();
+        String id = mod.getAttribute().getId();
         AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( id );
         
         switch ( modOp )
         {
-            case ( DirContext.REPLACE_ATTRIBUTE  ):
-                targetEntry.put( toServerAttribute( mod.getAttribute(), attributeType ) );
+            case REPLACE_ATTRIBUTE :
+                targetEntry.put( (ServerAttribute)mod.getAttribute() );
                 break;
                 
-            case ( DirContext.REMOVE_ATTRIBUTE  ):
-                ServerAttribute toBeRemoved = toServerAttribute( mod.getAttribute(), attributeType );
+            case REMOVE_ATTRIBUTE :
+                ServerAttribute toBeRemoved = (ServerAttribute)mod.getAttribute();
 
                 if ( toBeRemoved.size() == 0 )
                 {
@@ -294,9 +298,9 @@
                 }
                 break;
                 
-            case ( DirContext.ADD_ATTRIBUTE  ):
+            case ADD_ATTRIBUTE :
                 ServerAttribute combined = new DefaultServerAttribute( id, attributeType );
-                ServerAttribute toBeAdded = toServerAttribute( mod.getAttribute(), attributeType );
+                ServerAttribute toBeAdded = (ServerAttribute)mod.getAttribute();
                 ServerAttribute existing = entry.get( id );
 
                 if ( existing != null )
@@ -366,5 +370,112 @@
         }
 
         return attr;
+    }
+    
+    
+    public static ModificationItemImpl toModificationItemImpl( Modification modification )
+    {
+        ModificationItemImpl modificationItem = new ModificationItemImpl( 
+            modification.getOperation().getValue(),
+            toAttributeImpl( (ServerAttribute)modification.getAttribute() ) ); 
+        
+        return modificationItem;
+        
+    }
+
+
+    public static Modification toModification( ModificationItemImpl modificationImpl, AttributeType attributeType ) throws InvalidAttributeIdentifierException
+    {
+        Modification modification = new ServerModification( 
+            modificationImpl.getModificationOp(),
+            ServerEntryUtils.toServerAttribute( modificationImpl.getAttribute(), attributeType ) ); 
+        
+        return modification;
+        
+    }
+
+
+    public static List<ModificationItemImpl> toModificationItemImpl( List<Modification> modifications )
+    {
+        if ( modifications != null )
+        {
+            List<ModificationItemImpl> modificationItems = new ArrayList<ModificationItemImpl>();
+
+            for ( Modification modification: modifications )
+            {
+                modificationItems.add( toModificationItemImpl( modification ) );
+            }
+        
+            return modificationItems;
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
+    
+    public static List<Modification> toServerModification( List<ModificationItemImpl> modificationImpls, AttributeTypeRegistry atRegistry )
+        throws NamingException
+    {
+        if ( modificationImpls != null )
+        {
+            List<Modification> modifications = new ArrayList<Modification>();
+
+            for ( ModificationItemImpl modificationImpl: modificationImpls )
+            {
+                AttributeType attributeType = atRegistry.lookup( modificationImpl.getAttribute().getID() );
+                modifications.add( toModification( modificationImpl, attributeType ) );
+            }
+        
+            return modifications;
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
+    
+    /**
+     * 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 Modification getModificationItem( List<Modification> mods, AttributeType type )
+    {
+        for ( Modification modification:mods )
+        {
+            ServerAttribute attribute = (ServerAttribute)modification.getAttribute();
+            
+            if ( attribute.getType() == type )
+            {
+                return modification;
+            }
+        }
+        
+        return null;
+    }
+    
+    
+    /**
+     * Utility method to extract an attribute from a list of modifications.
+     * 
+     * @param mods the list of ModificationItems to extract the Attribute from.
+     * @param type the attributeType spec of the Attribute to extract
+     * @return the extract Attribute or null if no such attribute exists
+     */
+    public static ServerAttribute getAttribute( List<Modification> mods, AttributeType type )
+    {
+        Modification mod = getModificationItem( mods, type );
+        
+        if ( mod != null )
+        {
+            return (ServerAttribute)mod.getAttribute();
+        }
+        
+        return null;
     }
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java Wed Jan 30 14:51:36 2008
@@ -19,10 +19,9 @@
  */
 package org.apache.directory.server.core.entry;
 
-import java.io.Serializable;
-
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 
@@ -33,7 +32,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ServerModification<T extends ServerAttribute> implements Modification<T>, Serializable
+public class ServerModification implements Modification
 {
     public static final long serialVersionUID = 1L;
     
@@ -41,9 +40,23 @@
     private ModificationOperation operation;
     
     /** The attribute which contains the modification */
-    private T attribute;
+    private ServerAttribute attribute;
  
     
+    public ServerModification( ModificationOperation operation, ServerAttribute attribute )
+    {
+        this.operation = operation;
+        this.attribute = attribute;
+    }
+    
+    
+    public ServerModification( int operation, ServerAttribute attribute )
+    {
+        setOperation( operation );
+        this.attribute = attribute;
+    }
+    
+    
     /**
      *  @return the operation
      */
@@ -64,12 +77,15 @@
         {
             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;
         }
     }
 
@@ -88,7 +104,7 @@
     /**
      * @return the attribute containing the modifications
      */
-    public T getAttribute()
+    public EntryAttribute<?> getAttribute()
     {
         return attribute;
     }
@@ -99,9 +115,9 @@
      *
      * @param attribute The modified attribute 
      */
-    public void setAttribute( T attribute )
+    public void setAttribute( EntryAttribute<?> attribute )
     {
-        this.attribute = attribute;
+        this.attribute = (ServerAttribute)attribute;
     }
     
     
@@ -118,6 +134,21 @@
         return h;
     }
     
+    
+    public ServerModification clone()
+    {
+        try
+        {
+            ServerModification clone = (ServerModification)super.clone();
+            
+            clone.attribute = (ServerAttribute)this.attribute.clone();
+            return clone;
+        }
+        catch ( CloneNotSupportedException cnse )
+        {
+            return null;
+        }
+    }
     
     /**
      * @see Object#toString()

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java Wed Jan 30 14:51:36 2008
@@ -86,6 +86,7 @@
         }
 
         this.attributeType = attributeType;
+        setNormalized( false );
     }
 
 
@@ -98,7 +99,9 @@
     public ServerStringValue( AttributeType attributeType, String wrapped )
     {
         this( attributeType );
+        set( wrapped );
         super.set( wrapped );
+        setNormalized( false );
     }
 
 
@@ -124,9 +127,56 @@
             return;
         }
 
-        normalizedValue = null;
+        setNormalized( false );
         valid = null;
         super.set( wrapped );
+
+        /*
+        try
+        {
+            Normalizer normalizer = getNormalizer();
+            
+            if ( normalizer != null )
+            {
+                normalizedValue = (String)getNormalizer().normalize( wrapped );
+            }
+            else
+            {
+                normalizedValue = wrapped;
+            }
+            
+            // This is a special case : null values are allowed in LDAP 
+            if ( normalizedValue == null )
+            {
+                valid = true;
+                return;
+            }
+
+            valid = attributeType.getSyntax().getSyntaxChecker().isValidSyntax( normalizedValue );
+            
+            if ( !valid )
+            {
+                String message = "The wrapped value '" + wrapped + "'is not valid";
+                LOG.warn( message );
+            }
+        }
+        catch ( NamingException ne )
+        {
+            String message = "The wrapped value '" + wrapped + "'is not valid";
+            try
+            {
+                Normalizer normalizer = getNormalizer();
+                normalizedValue = (String)getNormalizer().normalize( wrapped );
+                valid = attributeType.getSyntax().getSyntaxChecker().isValidSyntax( normalizedValue );
+            }
+            catch ( Exception e )
+            {
+                
+            }
+            LOG.error( message );
+            throw new IllegalArgumentException( message );
+        }
+        */
     }
 
 
@@ -141,15 +191,23 @@
      */
     public void normalize() throws NamingException
     {
+        // If the value is already normalized, get out.
+        if ( isNormalized() )
+        {
+            return;
+        }
+        
         Normalizer normalizer = getNormalizer();
 
         if ( normalizer == null )
         {
             normalizedValue = get();
+            setNormalized( false );
         }
         else
         {
             normalizedValue = ( String ) normalizer.normalize( get() );
+            setNormalized( true );
         }
     }
 
@@ -171,7 +229,7 @@
             return null;
         }
 
-        if ( normalizedValue == null )
+        if ( !isNormalized() )
         {
             normalize();
         }
@@ -227,6 +285,27 @@
         if ( value instanceof ServerStringValue )
         {
             ServerStringValue stringValue = ( ServerStringValue ) value;
+            
+            // Normalizes the compared value
+            try
+            {
+                stringValue.normalize();
+            }
+            catch ( NamingException ne )
+            {
+                LOG.error( "Cannot nnormalize the wrapped value '" + stringValue.get() + "'" );
+            }
+            
+            // Normalizes the value
+            try
+            {
+                normalize();
+            }
+            catch ( NamingException ne )
+            {
+                LOG.error( "Cannot normalize the wrapped value '" + get() + "'" );
+            }
+
             try
             {
                 //noinspection unchecked
@@ -328,17 +407,32 @@
             return false;
         }
 
-        // now unlike regular values we have to compare the normalized values
-        try
+        // Shortcut : compare the values without normalization
+        // If they are equal, we may avoid a normalization.
+        // Note : if two values are equals, then their normalized
+        // value is equal too.
+        if ( get().equals( other.get() ) )
         {
-            return getNormalized().equals( other.getNormalized() );
+            return true;
         }
-        catch ( NamingException e )
+        else 
         {
-            String msg = "Failed to normalize while testing for equality on String values: \"";
-            msg += get() + "\"" + " and \"" + other.get() + "\"" ;
-            LOG.error( msg, e );
-            throw new IllegalStateException( msg, e );
+            try
+            {
+                // Compare normalized values
+                if ( getComparator() == null )
+                {
+                    ServerStringValue stringValue = ( ServerStringValue )other;
+
+                    return getNormalized().equals( stringValue.getNormalized() );
+                }
+            }
+            catch ( NamingException ne )
+            {
+                return this.get().equals( other.get() );
+            }
+
+            return ( compareTo( other ) == 0 );
         }
     }
 
@@ -422,7 +516,9 @@
     {
         try
         {
-            return (ServerStringValue)super.clone();
+            ServerStringValue clone = (ServerStringValue)super.clone();
+            
+            return clone;
         }
         catch ( CloneNotSupportedException cnse )
         {
@@ -448,7 +544,16 @@
         {
             out.writeUTF( get() );
             
-            if ( normalizedValue.equals( get() ) )
+            try
+            {
+                normalize();
+            }
+            catch ( NamingException ne )
+            {
+                normalizedValue = null;
+            }
+            
+            if ( get().equals( normalizedValue ) )
             {
                 // If the normalized value is equal to the UP value,
                 // don't save it
@@ -486,6 +591,11 @@
             {
                 // In this case, the normalized value is equal to the UP value
                 normalizedValue = wrapped;
+                setNormalized( true );
+            }
+            else
+            {
+                setNormalized( false );
             }
         }
     }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java Wed Jan 30 14:51:36 2008
@@ -29,6 +29,7 @@
 import org.apache.directory.shared.ldap.schema.AbstractSyntax;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.ByteArrayComparator;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.Syntax;
@@ -299,7 +300,7 @@
             }
             public boolean isValidSyntax( Object value )
             {
-                return ((String)value).length() < 5 ;
+                return ((String)value == null) || (((String)value).length() < 7) ;
             }
 
             public void assertSyntax( Object value ) throws NamingException
@@ -323,12 +324,17 @@
             }
         };
         
-        mr.normalizer = new Normalizer()
-        {
+        mr.normalizer = new DeepTrimToLowerNormalizer();
+        /*{
             public static final long serialVersionUID = 1L;
             
             public Object normalize( Object value ) throws NamingException
             {
+                if ( value == null )
+                {  
+                    return null;
+                }
+                
                 if ( value instanceof String )
                 {
                     return ( ( String ) value ).toLowerCase();
@@ -336,7 +342,7 @@
 
                 throw new IllegalStateException( "expected string to normalize" );
             }
-        };
+        };*/
         
         at.setEquality( mr );
         at.setSyntax( s );

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Wed Jan 30 14:51:36 2008
@@ -169,4 +169,23 @@
         assertTrue( attribute.contains( "Test2" ) );
         assertTrue( attribute.contains( "Test3" ) );
     }
+
+
+    /**
+     * Test the contains() method
+     */
+    @Test public void testContains() throws NamingException
+    {
+        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
+        
+        DefaultServerAttribute attr = new DefaultServerAttribute( at );
+        
+        attr.add( "Test  1" );
+        attr.add( "Test  2" );
+        attr.add( "Test  3" );
+        
+        assertTrue( attr.contains( "test 1" ) );
+        assertTrue( attr.contains( "Test 2" ) );
+        assertTrue( attr.contains( "TEST     3" ) );
+    }
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java Wed Jan 30 14:51:36 2008
@@ -19,9 +19,16 @@
  */
 package org.apache.directory.server.core.entry;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.naming.InvalidNameException;
@@ -47,7 +54,10 @@
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import static org.junit.Assert.assertNotNull;
@@ -1806,6 +1816,123 @@
     @Test public void testRemoveSaElipsis()
     {
         
+    }
+    
+    
+    private ByteArrayOutputStream serializeEntry( ServerEntry entry ) throws IOException
+    {
+        ObjectOutputStream oOut = null;
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+        try
+        {
+            oOut = new ObjectOutputStream( out );
+            oOut.writeObject( entry );
+        }
+        catch ( IOException ioe )
+        {
+            throw ioe;
+        }
+        finally
+        {
+            try
+            {
+                if ( oOut != null )
+                {
+                    oOut.flush();
+                    oOut.close();
+                }
+            }
+            catch ( IOException ioe )
+            {
+                throw ioe;
+            }
+        }
+        
+        return out;
+    }
+    
+    
+    private ServerEntry deserializeEntry( ByteArrayOutputStream out ) throws IOException, ClassNotFoundException
+    {
+        ObjectInputStream oIn = null;
+        ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
+
+        try
+        {
+            oIn = new ObjectInputStream( in );
+
+            ServerEntry entry = ( ServerEntry ) oIn.readObject();
+            
+            return entry;
+        }
+        catch ( IOException ioe )
+        {
+            throw ioe;
+        }
+        finally
+        {
+            try
+            {
+                if ( oIn != null )
+                {
+                    oIn.close();
+                }
+            }
+            catch ( IOException ioe )
+            {
+                throw ioe;
+            }
+        }
+    }
+
+    
+    private Map<String, OidNormalizer> oids;
+    private Map<String, OidNormalizer> oidOids;
+
+    /**
+     * Initialize OIDs maps for normalization
+     */
+    @Before public void initMapOids()
+    {
+        oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "dc", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "domaincomponent", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+    
+    
+        // Another map where we store OIDs instead of names.
+        oidOids = new HashMap<String, OidNormalizer>();
+
+        oidOids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "domaincomponent", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
+    }
+    
+    
+    /**
+     * Test the serialization
+     */
+    @Test public void testSerialize() throws Exception
+    {
+        LdapDN dn = new LdapDN( "ou=test, dc=com" );
+        dn.normalize( oids );
+        
+        ServerEntry entry = new DefaultServerEntry( registries, dn );
+        
+        entry.put( "ObjectClass", "top", "person" );
+        entry.put( "cn", "A CN" );
+        entry.put( "ou", "test" );
+        entry.put( "l", (String)null );
+        
+        //assertEquals( entry, deserializeEntry( serializeEntry( entry ) ) );
     }
 
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java Wed Jan 30 14:51:36 2008
@@ -21,8 +21,12 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.junit.Test;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -35,12 +39,22 @@
 {
     @Test public void testCreateServerModification() throws NamingException
     {
-        /*Modification mod = new ServerModification();
+        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
+        ServerAttribute attribute = new DefaultServerAttribute( at );
+        attribute.add( "test1", "test2" );
         
-        mod.setOperation( ModificationOperation.ADD_ATTRIBUTE );
-        AttributeType cnat = null;//new AT( SchemaConstants.CN_AT_OID );
-        EntryAttribute entry = new BasicServerAttribute( cnat, "test" );
-        mod.setAttribute( entry );*/
-        assertTrue( true );
+        Modification mod = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
+        Modification clone = mod.clone();
+        
+        attribute.remove( "test2" );
+        
+        ServerAttribute clonedAttribute = (ServerAttribute)clone.getAttribute();
+        
+        assertEquals( 1, mod.getAttribute().size() );
+        assertTrue( mod.getAttribute().contains( "test1" ) );
+
+        assertEquals( 2, clonedAttribute.size() );
+        assertTrue( clone.getAttribute().contains( "test1" ) );
+        assertTrue( clone.getAttribute().contains( "test2" ) );
     }
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java Wed Jan 30 14:51:36 2008
@@ -20,16 +20,9 @@
 package org.apache.directory.server.core.entry;
 
 
-import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
-import org.apache.directory.shared.ldap.schema.AbstractMatchingRule;
-import org.apache.directory.shared.ldap.schema.AbstractSyntax;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.ByteArrayComparator;
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
-import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
-import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
 import org.junit.Before;
@@ -48,6 +41,8 @@
 import java.util.Comparator;
 import java.util.HashSet;
 
+import jdbm.helper.StringComparator;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNull;
@@ -87,7 +82,7 @@
         s.setSyntaxChecker( new AcceptAllSyntaxChecker( "1.1.1.1" ) );
         mr = new TestServerEntryUtils.MR( "1.1.2.1" );
         mr.syntax = s;
-        mr.comparator = new ByteArrayComparator();
+        mr.comparator = new StringComparator();
         mr.normalizer = new DeepTrimToLowerNormalizer();
         at = new TestServerEntryUtils.AT( "1.1.3.1" );
         at.setEquality( mr );
@@ -432,37 +427,31 @@
         {
             public int compare( ServerStringValue o1, ServerStringValue o2 )
             {
-                byte[] b1 = new byte[0];
-                byte[] b2 = new byte[0];
+                String n1 = null;
+                String n2 = null;
+                
+                if ( o1 != null )
+                {
+                    n1 = o1.get();
+                }
 
-                try
+                if ( o2 != null )
                 {
-                    if ( o1 != null )
-                    {
-                        String n1 = o1.get();
-                        if ( n1 != null )
-                        {
-                            b1 = n1.getBytes( "UTF-8" );
-                        }
-                    }
+                    n2 = o2.get();
+                }
 
-                    if ( o2 != null )
-                    {
-                        String n2 = o2.get();
-                        if ( n2 != null )
-                        {
-                            b2 = o2.get().getBytes( "UTF-8" );
-                        }
-                    }
+                if ( n1 == null )
+                {
+                    return ( n2 == null ) ? 0 : -1;
                 }
-                catch ( Exception e )
+                else if ( n2 == null )
                 {
-                    e.printStackTrace();
+                    return 1;
                 }
 
                 try
                 {
-                    return mr.getComparator().compare( b1, b2 );
+                    return mr.getComparator().compare( n1, n2 );
                 }
                 catch ( Exception e )
                 {

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryIT.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryIT.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryIT.java Wed Jan 30 14:51:36 2008
@@ -186,7 +186,6 @@
             throws Exception
         {
             // Only interested in Attributes with "person" objectclass
-            // System.out.println("object factory: " + attrs);
             Attribute oc = ( attrs != null ? attrs.get( "objectclass" ) : null );
             if ( oc != null && oc.contains( "person" ) )
             {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Wed Jan 30 14:51:36 2008
@@ -695,11 +695,10 @@
             {
                 ChangeLogEvent event = cursor.get();
                 Entry reverse = event.getReverseLdif();
-
+                
                 switch( reverse.getChangeType().getChangeType() )
                 {
                     case( ChangeType.ADD_ORDINAL ):
-                        //System.out.println( "Reverted attributes : --> " + reverse.getAttributes() );
                         ctx.createSubcontext( reverse.getDn(), reverse.getAttributes() );
                         break;
                     case( ChangeType.DELETE_ORDINAL ):

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Wed Jan 30 14:51:36 2008
@@ -60,9 +60,9 @@
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -71,8 +71,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -576,7 +574,7 @@
             return;
         }
 
-        List<ModificationItemImpl> mods = opContext.getModItems();
+        List<Modification> mods = opContext.getModItems();
 
         // bypass authz code but manage caches if operation is performed by the admin
         if ( isPrincipalAnAdministrator( principalDn ) )
@@ -603,28 +601,28 @@
         Collection<MicroOperation> perms = null;
         ServerEntry entryView = ( ServerEntry ) entry.clone();
         
-        for ( ModificationItemImpl mod : mods )
+        for ( Modification mod : mods )
         {
-            Attribute attr = mod.getAttribute();
+            ServerAttribute attr = (ServerAttribute)mod.getAttribute();
 
-            switch ( mod.getModificationOp() )
+            switch ( mod.getOperation() )
             {
-                case ( DirContext.ADD_ATTRIBUTE ):
+                case ADD_ATTRIBUTE :
                     perms = ADD_PERMS;
                 
                     // If the attribute is being created with an initial value ...
-                    if ( entry.get( attr.getID() ) == null )
+                    if ( entry.get( attr.getId() ) == null )
                     {
                         // ... we also need to check if adding the attribute is permitted
                         engine.checkPermission( registries, proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
-                                attr.getID(), null, perms, tuples, entry, null );
+                                attr.getId(), null, perms, tuples, entry, null );
                     }
                     
                     break;
 
-                case ( DirContext.REMOVE_ATTRIBUTE ):
+                case REMOVE_ATTRIBUTE :
                     perms = REMOVE_PERMS;
-                    ServerAttribute entryAttr = entry.get( attr.getID() );
+                    ServerAttribute entryAttr = entry.get( attr.getId() );
 
                     if ( entryAttr != null )
                     {
@@ -633,13 +631,13 @@
                         {
                             // ... we also need to check if removing the attribute at all is permitted
                             engine.checkPermission( registries, proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
-                                    attr.getID(), null, perms, tuples, entry, null );
+                                    attr.getId(), null, perms, tuples, entry, null );
                         }
                     }
                     
                     break;
 
-                case ( DirContext.REPLACE_ATTRIBUTE ):
+                case REPLACE_ATTRIBUTE :
                     perms = REPLACE_PERMS;
                     break;
             }
@@ -659,10 +657,10 @@
              */
             entryView = ServerEntryUtils.getTargetEntry( mod, entryView, registries );
             
-            for ( int jj = 0; jj < attr.size(); jj++ )
+            for ( ServerValue<?> value:attr )
             {                
                 engine.checkPermission( registries, proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
-                        attr.getID(), attr.get( jj ), perms, tuples, entry, entryView );
+                        attr.getId(), value, perms, tuples, entry, entryView );
             }
         }
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java Wed Jan 30 14:51:36 2008
@@ -37,11 +37,12 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
@@ -50,8 +51,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -336,16 +335,16 @@
      * @param members the members being added, removed or replaced
      * @throws NamingException if there are problems accessing attribute values
      */
-    private void modify( Set<String> memberSet, int modOp, ServerAttribute members ) throws NamingException
+    private void modify( Set<String> memberSet, ModificationOperation modOp, ServerAttribute members ) throws NamingException
     {
 
         switch ( modOp )
         {
-            case ( DirContext.ADD_ATTRIBUTE  ):
+            case ADD_ATTRIBUTE :
                 addMembers( memberSet, members );
                 break;
                 
-            case ( DirContext.REPLACE_ATTRIBUTE  ):
+            case REPLACE_ATTRIBUTE :
                 if ( members.size() > 0 )
                 {
                     memberSet.clear();
@@ -354,7 +353,7 @@
             
                 break;
                 
-            case ( DirContext.REMOVE_ATTRIBUTE  ):
+            case REMOVE_ATTRIBUTE :
                 removeMembers( memberSet, members );
                 break;
                 
@@ -373,21 +372,19 @@
      * @param entry the group entry being modified
      * @throws NamingException if there are problems accessing attribute  values
      */
-    public void groupModified( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry, Registries registries ) throws NamingException
+    public void groupModified( LdapDN name, List<Modification> mods, ServerEntry entry, Registries registries ) throws NamingException
     {
         ServerAttribute members = null;
         String memberAttrId = null;
         ServerAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
 
-        if ( oc.contains( SchemaConstants.GROUP_OF_NAMES_OC ) ||
-             oc.contains( SchemaConstants.GROUP_OF_NAMES_OC_OID ))
+        if ( oc.contains( SchemaConstants.GROUP_OF_NAMES_OC ) )
         {
             members = entry.get( memberAT );
             memberAttrId = SchemaConstants.MEMBER_AT;
         }
 
-        if ( oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ||
-             oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC_OID ) )
+        if ( oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) )
         {
             members = entry.get( uniqueMemberAT );
             memberAttrId = SchemaConstants.UNIQUE_MEMBER_AT;
@@ -398,9 +395,9 @@
             return;
         }
 
-        for ( ModificationItem modification:mods )
+        for ( Modification modification:mods )
         {
-            if ( memberAttrId.equalsIgnoreCase( modification.getAttribute().getID() ) )
+            if ( memberAttrId.equalsIgnoreCase( modification.getAttribute().getId() ) )
             {
                 Set<String> memberSet = groups.get( name.getNormName() );
                 
@@ -408,10 +405,8 @@
                 {
                     modify( 
                         memberSet, 
-                        modification.getModificationOp(), 
-                        ServerEntryUtils.toServerAttribute( 
-                            modification.getAttribute(),
-                            registries.getAttributeTypeRegistry().lookup( modification.getAttribute().getID() ) ) );
+                        modification.getOperation(), 
+                        (ServerAttribute)modification.getAttribute() );
                 }
                 
                 break;
@@ -434,7 +429,7 @@
      * @param mods the modifications being performed
      * @throws NamingException if there are problems accessing attribute  values
      */
-    public void groupModified( LdapDN name, int modOp, ServerEntry mods ) throws NamingException
+    public void groupModified( LdapDN name, ModificationOperation modOp, ServerEntry mods ) throws NamingException
     {
         ServerAttribute members = getMemberAttribute( mods );
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Wed Jan 30 14:51:36 2008
@@ -34,11 +34,11 @@
 import org.apache.directory.shared.ldap.aci.ACIItemParser;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
@@ -233,19 +233,16 @@
     }
 
 
-    public void subentryModified( LdapDN normName, List<ModificationItemImpl> mods, ServerEntry entry ) throws NamingException
+    public void subentryModified( LdapDN normName, List<Modification> mods, ServerEntry entry ) throws NamingException
     {
         if ( !hasPrescriptiveACI( entry ) )
         {
             return;
         }
 
-        for ( ModificationItemImpl mod : mods )
+        for ( Modification mod : mods )
         {
-            String attrID = mod.getAttribute().getID();
-            
-            if ( attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT ) ||
-                    attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT_OID ) )
+            if ( ((ServerAttribute)mod.getAttribute()).isA( SchemaConstants.PRESCRIPTIVE_ACI_AT ) )
             {
                 subentryDeleted( normName, entry );
                 subentryAdded( normName, entry );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Wed Jan 30 14:51:36 2008
@@ -39,14 +39,13 @@
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.ldif.ChangeType;
 import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -180,7 +179,8 @@
     public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
     {
         ServerEntry serverEntry = null;
-        boolean isDelete = AttributeUtils.getAttribute( opContext.getModItems(), entryDeleted ) != null;
+        Modification modification = ServerEntryUtils.getModificationItem( opContext.getModItems(), entryDeleted );
+        boolean isDelete = ( modification != null );
 
         if ( ! isDelete && ( changeLog.isEnabled() && ! opContext.isCollateralOperation() ) )
         {
@@ -204,12 +204,17 @@
         Entry forward = new Entry();
         forward.setChangeType( ChangeType.Modify );
         forward.setDn( opContext.getDn().getUpName() );
-        for ( ModificationItemImpl modItem : opContext.getModItems() )
+        
+        for ( Modification modItem : opContext.getModItems() )
         {
-            forward.addModificationItem( modItem );
+            forward.addModificationItem( ServerEntryUtils.toModificationItemImpl( modItem ) );
         }
 
-        Entry reverse = LdifUtils.reverseModify( opContext.getDn(), opContext.getModItems(), ServerEntryUtils.toAttributesImpl( serverEntry ) );
+        Entry reverse = LdifUtils.reverseModify( 
+            opContext.getDn(), 
+            ServerEntryUtils.toModificationItemImpl( opContext.getModItems() ), 
+            ServerEntryUtils.toAttributesImpl( serverEntry ) );
+        
         changeLog.log( getPrincipal(), forward, reverse );
     }
 
@@ -243,6 +248,7 @@
 
         Entry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl( serverEntry ), null, renameContext.getDn(),
                 new Rdn( renameContext.getNewRdn() ) );
+        
         changeLog.log( getPrincipal(), forward, reverse );
     }
 



Mime
View raw message