directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r616938 [2/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
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java Wed Jan 30 14:51:36 2008
@@ -19,7 +19,9 @@
 package org.apache.directory.server.core.changelog;
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -31,18 +33,16 @@
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+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.util.Base64;
 import org.apache.directory.shared.ldap.util.DateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.PrintWriter;
@@ -300,11 +300,11 @@
         buf.append( opContext.getDn() );
         buf.append( "\nchangetype: modify" );
 
-        List<ModificationItemImpl> mods = opContext.getModItems();
+        List<Modification> mods = opContext.getModItems();
         
-        for ( ModificationItemImpl mod :mods )
+        for ( Modification mod :mods )
         {
-            append( buf, mod.getAttribute(), getModOpStr( mod.getModificationOp() ) );
+            append( buf, (ServerAttribute)mod.getAttribute(), mod.getOperation().toString() + ": ");
         }
         
         buf.append( "\n" );
@@ -446,25 +446,23 @@
      * @return the buffer argument to allow for call chaining.
      * @throws NamingException if the attribute is not identified by the registry
      */
-    private StringBuilder append( StringBuilder buf, Attribute attr ) throws NamingException
+    private StringBuilder append( StringBuilder buf, ServerAttribute attr ) throws NamingException
     {
-        String id = attr.getID();
-        int sz = attr.size();
+        String id = attr.getId();
         boolean isBinary = ! atRegistry.lookup( id ).getSyntax().isHumanReadable();
         
         if ( isBinary )
         {
-            for ( int ii = 0; ii < sz; ii++  )
+            for ( ServerValue<?> value:attr )
             {
                 buf.append( "\n" );
                 buf.append( id );
                 buf.append( ":: " );
-                Object value = attr.get( ii );
                 String encoded;
                 
-                if ( value instanceof String )
+                if ( value.get() instanceof String )
                 {
-                    encoded = ( String ) value;
+                    encoded = ( String ) value.get();
                     
                     try
                     {
@@ -477,19 +475,19 @@
                 }
                 else
                 {
-                    encoded = new String( Base64.encode( ( byte[] ) attr.get( ii ) ) );
+                    encoded = new String( Base64.encode( ( byte[] ) value.get() ) );
                 }
                 buf.append( encoded );
             }
         }
         else
         {
-            for ( int ii = 0; ii < sz; ii++  )
+            for ( ServerValue<?> value:attr )
             {
                 buf.append( "\n" );
                 buf.append( id );
                 buf.append( ": " );
-                buf.append( attr.get( ii ) );
+                buf.append( value.get() );
             }
         }
         
@@ -512,46 +510,6 @@
 
 
     /**
-     * Gets a String representation of the JNDI attribute modificaion flag.  Here are the mappings:
-     * <table>
-     *   <tr><th>JNDI Constant</th><th>Returned String</th></tr>
-     *   <tr><td>DirContext.ADD_ATTRIBUTE</td><td>'add: '</td></tr>
-     *   <tr><td>DirContext.REMOVE_ATTRIBUTE</td><td>'delete: '</td></tr>
-     *   <tr><td>DirContext.REPLACE_ATTRIBUTE</td><td>'replace: '</td></tr>
-     * </table>
-     * <ul><li>
-     * Note that the String in right hand column is quoted to show trailing space.
-     * </li></ul>
-     * 
-     * @param modOp the int value of the JNDI modification operation
-     * @return the string representation of the JNDI Modification operation
-     */
-    private String getModOpStr( int modOp ) 
-    {
-        String opStr;
-        
-        switch( modOp )
-        {
-            case( DirContext.ADD_ATTRIBUTE ):
-                opStr = "add: ";
-                break;
-                
-            case( DirContext.REMOVE_ATTRIBUTE ):
-                opStr = "delete: ";
-                break;
-                
-            case( DirContext.REPLACE_ATTRIBUTE ):
-                opStr = "replace: ";
-                break;
-                
-            default:
-                throw new IllegalArgumentException( "Undefined attribute modify operation: " + modOp );
-        }
-        return opStr;
-    }
-    
-
-    /**
      * Appends a modification delta instruction to an LDIF: i.e. 
      * <pre>
      * add: telephoneNumber
@@ -566,11 +524,11 @@
      * @return the buffer argument provided for chaining
      * @throws NamingException if the modification attribute id is undefined
      */
-    private StringBuilder append( StringBuilder buf, Attribute mod, String modOp ) throws NamingException
+    private StringBuilder append( StringBuilder buf, ServerAttribute mod, String modOp ) throws NamingException
     {
         buf.append( "\n" );
         buf.append( modOp );
-        buf.append( mod.getID() );
+        buf.append( mod.getId() );
         append( buf, mod );
         buf.append( "\n-" );
         return buf;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Wed Jan 30 14:51:36 2008
@@ -24,9 +24,6 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -36,8 +33,9 @@
 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.exception.LdapSchemaViolationException;
-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;
@@ -79,11 +77,11 @@
         }
     }
     
-    public void checkModify( Registries registries, LdapDN normName, List<ModificationItemImpl> mods ) throws NamingException
+    public void checkModify( Registries registries, LdapDN normName, List<Modification> mods ) throws NamingException
     {
         ServerEntry originalEntry = nexus.lookup( new LookupOperationContext( registries, normName ) );
         ServerEntry targetEntry = ServerEntryUtils.toServerEntry( 
-            SchemaUtils.getTargetEntry( mods, ServerEntryUtils.toAttributesImpl( originalEntry ) ),
+            SchemaUtils.getTargetEntry( ServerEntryUtils.toModificationItemImpl( mods ), ServerEntryUtils.toAttributesImpl( originalEntry ) ),
             normName,
             registries);
         
@@ -106,16 +104,16 @@
     }
     
     
-    private boolean addsAnyCollectiveAttributes( List<ModificationItemImpl> mods ) throws NamingException
+    private boolean addsAnyCollectiveAttributes( List<Modification> mods ) throws NamingException
     {
-        for ( ModificationItem mod:mods )
+        for ( Modification mod:mods )
         {
-            Attribute attr = mod.getAttribute();
-            String attrID = attr.getID();
+            ServerAttribute attr = (ServerAttribute)mod.getAttribute();
+            String attrID = attr.getId();
             AttributeType attrType = attrTypeRegistry.lookup( attrID );
-            int modOp = mod.getModificationOp();
+            ModificationOperation modOp = mod.getOperation();
             
-            if ( ( ( modOp == DirContext.ADD_ATTRIBUTE ) || ( modOp == DirContext.REPLACE_ATTRIBUTE ) ) &&
+            if ( ( ( modOp == ModificationOperation.ADD_ATTRIBUTE ) || ( modOp == ModificationOperation.REPLACE_ATTRIBUTE ) ) &&
                 attrType.isCollective() )
             {
                 return true;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Wed Jan 30 14:51:36 2008
@@ -49,6 +49,7 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -56,7 +57,6 @@
 import org.apache.directory.shared.ldap.filter.NotNode;
 import org.apache.directory.shared.ldap.filter.ScopeNode;
 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.name.NameComponentNormalizer;
 import org.slf4j.Logger;
@@ -305,7 +305,7 @@
     }
 
 
-    private void notifyOnModify( Registries registries, LdapDN name, List<ModificationItemImpl> mods, ServerEntry oriEntry ) throws NamingException
+    private void notifyOnModify( Registries registries, LdapDN name, List<Modification> mods, ServerEntry oriEntry ) throws NamingException
     {
         ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
         Set<EventSourceRecord> selecting = getSelectingSources( name, entry );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Jan 30 14:51:36 2008
@@ -44,13 +44,14 @@
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 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.exception.LdapAttributeInUseException;
 import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
 import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-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.OidNormalizer;
@@ -58,8 +59,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchResult;
 
 import java.util.List;
@@ -319,24 +318,23 @@
         assertHasEntry( nextInterceptor, msg, opContext.getDn() );
 
         ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, opContext.getDn() ) );
-        List<ModificationItemImpl> items = opContext.getModItems();
+        List<Modification> items = opContext.getModItems();
 
-        for ( ModificationItemImpl item : items )
+        for ( Modification item : items )
         {
-            if ( item.getModificationOp() == DirContext.ADD_ATTRIBUTE )
+            if ( item.getOperation() == ModificationOperation.ADD_ATTRIBUTE )
             {
-                Attribute modAttr = item.getAttribute();
-                ServerAttribute entryAttr = entry.get( modAttr.getID() );
+                ServerAttribute modAttr = (ServerAttribute)item.getAttribute();
+                ServerAttribute entryAttr = entry.get( modAttr.getId() );
 
                 if ( entryAttr != null )
                 {
-                    for ( int jj = 0; jj < modAttr.size(); jj++ )
+                    for ( ServerValue<?> value:modAttr )
                     {
-                        // TODO Fix DIRSERVER-832
-                        if ( entryAttr.contains( modAttr.get( jj ) ) )
+                        if ( entryAttr.contains( value ) )
                         {
-                            throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( jj )
-                                    + "' to attribute " + modAttr.getID() );
+                            throw new LdapAttributeInUseException( "Trying to add existing value '" + value
+                                    + "' to attribute " + modAttr.getId() );
                         }
                     }
                 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Wed Jan 30 14:51:36 2008
@@ -23,13 +23,13 @@
 import java.util.List;
 
 import javax.naming.NamingException;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 /**
@@ -44,7 +44,7 @@
 public class ModifyOperationContext extends AbstractOperationContext
 {
     /** The modification items */
-    private List<ModificationItemImpl> modItems;
+    private List<Modification> modItems;
 
 
     /**
@@ -64,7 +64,7 @@
      * @param dn the dn of the entry to be modified
      * @param modItems the modifications to be performed on the entry
      */
-    public ModifyOperationContext( Registries registries, LdapDN dn, List<ModificationItemImpl> modItems )
+    public ModifyOperationContext( Registries registries, LdapDN dn, List<Modification> modItems )
     {
         super( registries, dn );
         this.modItems = modItems;
@@ -78,7 +78,7 @@
      * @param modItems the modifications to be performed on the entry
      * @param collateralOperation true if op is collateral, false otherwise
      */
-    public ModifyOperationContext( Registries registries, LdapDN dn, List<ModificationItemImpl> modItems, boolean collateralOperation )
+    public ModifyOperationContext( Registries registries, LdapDN dn, List<Modification> modItems, boolean collateralOperation )
     {
         super( registries, dn, collateralOperation );
         this.modItems = modItems;
@@ -89,7 +89,7 @@
      * Set the modified attributes
      * @param modItems The modified attributes
      */
-    public void setModItems( List<ModificationItemImpl> modItems )
+    public void setModItems( List<Modification> modItems )
     {
         this.modItems = modItems;
     }
@@ -98,19 +98,19 @@
     /**
      * @return The modifications
      */
-    public List<ModificationItemImpl> getModItems() 
+    public List<Modification> getModItems() 
     {
         return modItems;
     }
 
 
-    public static List<ModificationItemImpl> createModItems( ServerEntry serverEntry, int modOp ) throws NamingException
+    public static List<Modification> createModItems( ServerEntry serverEntry, ModificationOperation modOp ) throws NamingException
     {
-        List<ModificationItemImpl> items = new ArrayList<ModificationItemImpl>( serverEntry.size() );
+        List<Modification> items = new ArrayList<Modification>( serverEntry.size() );
         
         for ( ServerAttribute attribute:serverEntry )
         {
-            items.add( new ModificationItemImpl( modOp, ServerEntryUtils.toAttributeImpl( attribute  ) ) );
+            items.add( new ServerModification( modOp, attribute ) );
         }
 
         return items;
@@ -126,7 +126,7 @@
         
         sb.append("ModifyContext for DN '").append( getDn().getUpName() ).append( "', modifications :\n" );
         
-        for ( ModificationItem mod:modItems )
+        for ( Modification mod:modItems )
         {
             sb.append( mod ).append( '\n' );
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Wed Jan 30 14:51:36 2008
@@ -42,6 +42,7 @@
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -411,7 +412,8 @@
     protected void doModifyOperation( LdapDN dn, List<ModificationItemImpl> modItems ) throws NamingException
     {
         // setup the op context and populate with request controls
-        ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modItems );
+        List<Modification> newMods = ServerEntryUtils.toServerModification( modItems, registries.getAttributeTypeRegistry() );
+        ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, newMods );
         opCtx.addRequestControls( requestControls );
         
         // execute modify operation

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Wed Jan 30 14:51:36 2008
@@ -27,10 +27,12 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
@@ -51,8 +53,8 @@
 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.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
@@ -62,8 +64,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;
 
@@ -189,18 +189,26 @@
         // Add the operational attributes for the modifier first
         // -------------------------------------------------------------------
         
-        List<ModificationItemImpl> modItemList = new ArrayList<ModificationItemImpl>(2);
+        List<Modification> modItemList = new ArrayList<Modification>(2);
         
-        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-        attribute.add( getPrincipal().getName() );
-        ModificationItemImpl modifiers = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute );
-        modifiers.setServerModified();
+        AttributeType modifiersNameAt = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
+        ServerAttribute attribute = new DefaultServerAttribute( 
+            SchemaConstants.MODIFIERS_NAME_AT,
+            modifiersNameAt, 
+            getPrincipal().getName());
+
+        Modification modifiers = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+        //modifiers.setServerModified();
         modItemList.add( modifiers );
         
-        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        ModificationItemImpl timestamp = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute );
-        timestamp.setServerModified();
+        AttributeType modifyTimeStampAt = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT );
+        attribute = new DefaultServerAttribute( 
+            SchemaConstants.MODIFY_TIMESTAMP_AT,
+            modifyTimeStampAt,
+            DateUtils.getGeneralizedTime() );
+        
+        Modification timestamp = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+        //timestamp.setServerModified();
         modItemList.add( timestamp );
 
         // -------------------------------------------------------------------
@@ -227,7 +235,7 @@
         newDn.add( opContext.getNewRdn() );
         newDn.normalize( atRegistry.getNormalizerMapping() );
         
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( serverEntry, DirContext.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
         ModifyOperationContext newModify = new ModifyOperationContext( registries, newDn, items );
         
@@ -244,7 +252,7 @@
         serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
         serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( serverEntry, DirContext.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
 
         ModifyOperationContext newModify = 
@@ -264,7 +272,7 @@
         serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
         serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( serverEntry, DirContext.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
         ModifyOperationContext newModify = 
             new ModifyOperationContext( registries, 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Wed Jan 30 14:51:36 2008
@@ -47,7 +47,6 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
 
 import java.io.File;
 import java.util.HashSet;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Wed Jan 30 14:51:36 2008
@@ -70,12 +70,12 @@
 import org.apache.directory.shared.ldap.codec.util.LdapURL;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 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.LdapReferralException;
 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.schema.AttributeType;
@@ -86,9 +86,6 @@
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -148,29 +145,6 @@
     }
 
 
-    static boolean hasValue( Attribute attr, String value ) throws NamingException
-    {
-        if ( attr == null )
-        {
-            return false;
-        }
-        
-        for ( int ii = 0; ii < attr.size(); ii++ )
-        {
-            if ( !( attr.get( ii ) instanceof String ) )
-            {
-                continue;
-            }
-            
-            if ( value.equalsIgnoreCase( ( String ) attr.get( ii ) ) )
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
     static boolean isReferral( ServerEntry entry ) throws NamingException
     {
         ServerAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
@@ -773,7 +747,7 @@
     }
 
 
-    private void checkModify( LdapDN name, List<ModificationItemImpl> mods ) throws NamingException
+    private void checkModify( LdapDN name, List<Modification> mods ) throws NamingException
     {
         boolean isTargetReferral = lut.isReferral( name );
 
@@ -781,19 +755,19 @@
         // Check and update lut if we change the objectClass 
         // -------------------------------------------------------------------
 
-        for ( ModificationItem mod : mods )
+        for ( Modification mod : mods )
         {
-            if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+            if ( mod.getAttribute().getId().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
             {
-                boolean modsOcHasReferral = hasValue( mod.getAttribute(), SchemaConstants.REFERRAL_OC );
+                boolean modsOcHasReferral = ((ServerAttribute)mod.getAttribute()).contains( SchemaConstants.REFERRAL_OC );
 
-                switch ( mod.getModificationOp() )
+                switch ( mod.getOperation() )
                 {
                     /* 
                      * if ADD op where refferal is added to objectClass of a
                      * non-referral entry then we add a new referral to lut
                      */
-                    case ( DirContext.ADD_ATTRIBUTE ):
+                    case ADD_ATTRIBUTE :
                         if ( modsOcHasReferral && !isTargetReferral )
                         {
                             lut.referralAdded( name );
@@ -805,7 +779,7 @@
                         * if REMOVE op where refferal is removed from objectClass of a
                         * referral entry then we remove the referral from lut
                         */
-                    case ( DirContext.REMOVE_ATTRIBUTE ):
+                    case REMOVE_ATTRIBUTE :
                         if ( modsOcHasReferral && isTargetReferral )
                         {
                             lut.referralDeleted( name );
@@ -821,7 +795,7 @@
                         * if REPLACE op on non-referral has new set of OC values with
                         * referral value then we add the new referral to the lut
                         */
-                    case ( DirContext.REPLACE_ATTRIBUTE ):
+                    case REPLACE_ATTRIBUTE :
                         if ( isTargetReferral && !modsOcHasReferral )
                         {
                             lut.referralDeleted( name );
@@ -849,7 +823,7 @@
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
         LdapDN name = opContext.getDn();
-        List<ModificationItemImpl> mods = opContext.getModItems();
+        List<Modification> mods = opContext.getModItems();
 
         // handle a normal modify without following referrals
         if ( refval == null || refval.equals( IGNORE ) )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java Wed Jan 30 14:51:36 2008
@@ -25,8 +25,9 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
-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;
@@ -100,14 +101,14 @@
         throws NamingException;
     
     
-    public final void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, ServerEntry targetEntry, 
+    public final void modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry, ServerEntry targetEntry, 
         boolean cascade ) throws NamingException
     {
         modify( name, entry, targetEntry, cascade );
     }
 
 
-    public final void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry,
+    public final void modify( LdapDN name, List<Modification> mods, ServerEntry entry,
         ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
         modify( name, entry, targetEntry, cascade );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Wed Jan 30 14:51:36 2008
@@ -29,19 +29,17 @@
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.schema.registries.SchemaObjectRegistry;
 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.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-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.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -88,7 +86,7 @@
      * @param mods the attribute modifications as an Attributes object
      * @param entry the entry after the modifications have been applied
      */
-    public void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, 
+    public void modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry, 
         ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
         ServerAttribute disabledInMods = mods.get( disabledAT );
@@ -129,17 +127,17 @@
      * @param mods the attribute modifications as an ModificationItem arry
      * @param entry the entry after the modifications have been applied
      */
-    public void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry,
+    public void modify( LdapDN name, List<Modification> mods, ServerEntry entry,
         ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
         ServerAttribute disabledInEntry = entry.get( disabledAT );
-        ModificationItem disabledModification = AttributeUtils.getModificationItem( mods, disabledAT );
+        Modification disabledModification = ServerEntryUtils.getModificationItem( mods, disabledAT );
         
         if ( disabledModification != null )
         {
             disable( name, 
-                     disabledModification.getModificationOp(), 
-                     ServerEntryUtils.toServerAttribute( disabledModification.getAttribute(), disabledAT ), 
+                     disabledModification.getOperation(), 
+                     (ServerAttribute)disabledModification.getAttribute(), 
                      disabledInEntry );
         }
 
@@ -156,9 +154,7 @@
             isEnabled = true;
         }
 
-        ServerAttribute dependencies = 
-            ServerEntryUtils.toServerAttribute( 
-                AttributeUtils.getAttribute( mods, dependenciesAT ), dependenciesAT );
+        ServerAttribute dependencies = ServerEntryUtils.getAttribute( mods, dependenciesAT );
         
         if ( dependencies != null )
         {
@@ -383,7 +379,7 @@
     // -----------------------------------------------------------------------
 
     
-    private void disable( LdapDN name, int modOp, ServerAttribute disabledInMods, ServerAttribute disabledInEntry )
+    private void disable( LdapDN name, ModificationOperation modOp, ServerAttribute disabledInMods, ServerAttribute disabledInEntry )
         throws NamingException
     {
         switch ( modOp )
@@ -392,7 +388,7 @@
              * If the user is adding a new m-disabled attribute to an enabled schema, 
              * we check that the value is "TRUE" and disable that schema if so.
              */
-            case ( DirContext.ADD_ATTRIBUTE   ):
+            case ADD_ATTRIBUTE :
                 if ( disabledInEntry == null )
                 {
                     if ( "TRUE".equalsIgnoreCase( disabledInMods.getString() ) )
@@ -400,17 +396,19 @@
                         disableSchema( getSchemaName( name ) );
                     }
                 }
+                
                 break;
 
             /*
              * If the user is removing the m-disabled attribute we check if the schema is currently 
              * disabled.  If so we enable the schema.
              */
-            case ( DirContext.REMOVE_ATTRIBUTE   ):
+            case REMOVE_ATTRIBUTE :
                 if ( "TRUE".equalsIgnoreCase( disabledInEntry.getString() ) )
                 {
                     enableSchema( getSchemaName( name ) );
                 }
+                
                 break;
 
             /*
@@ -418,7 +416,7 @@
              * currently disabled and enable it if the new state has it as enabled.  If the
              * schema is not disabled we disable it if the mods set m-disabled to true.
              */
-            case ( DirContext.REPLACE_ATTRIBUTE   ):
+            case REPLACE_ATTRIBUTE :
                 boolean isCurrentlyDisabled = "TRUE".equalsIgnoreCase( disabledInEntry.getString() );
                 boolean isNewStateDisabled = "TRUE".equalsIgnoreCase( disabledInMods.getString() );
 
@@ -432,7 +430,9 @@
                 {
                     disableSchema( getSchemaName( name ) );
                 }
+                
                 break;
+                
             default:
                 throw new IllegalArgumentException( "Unknown modify operation type: " + modOp );
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java Wed Jan 30 14:51:36 2008
@@ -21,7 +21,8 @@
 
 
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 
@@ -44,10 +45,10 @@
     
     void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascaded ) throws NamingException;
     
-    void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, ServerEntry targetEntry, boolean cascaded ) 
+    void modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry, ServerEntry targetEntry, boolean cascaded ) 
         throws NamingException;
     
-    void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry, ServerEntry targetEntry, boolean cascaded )
+    void modify( LdapDN name, List<Modification> mods, ServerEntry entry, ServerEntry targetEntry, boolean cascaded )
         throws NamingException;
     
     void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, ServerEntry entry,

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Wed Jan 30 14:51:36 2008
@@ -26,6 +26,7 @@
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -75,10 +76,10 @@
      * @throws NamingException if modify operations leave the entry inconsistent
      * without a STRUCTURAL objectClass
      */
-    public static void preventStructuralClassRemovalOnModifyReplace( ObjectClassRegistry registry, LdapDN name, int mod,
+    public static void preventStructuralClassRemovalOnModifyReplace( ObjectClassRegistry registry, LdapDN name, ModificationOperation mod,
         ServerAttribute attribute ) throws NamingException
     {
-        if ( mod != DirContext.REPLACE_ATTRIBUTE )
+        if ( mod != ModificationOperation.REPLACE_ATTRIBUTE )
         {
             return;
         }
@@ -198,10 +199,10 @@
      * @throws NamingException if modify operations leave the entry inconsistent
      * without a STRUCTURAL objectClass
      */
-    public static void preventStructuralClassRemovalOnModifyRemove( ObjectClassRegistry registry, LdapDN name, int mod,
+    public static void preventStructuralClassRemovalOnModifyRemove( ObjectClassRegistry registry, LdapDN name, ModificationOperation mod,
         ServerAttribute attribute, ServerAttribute entryObjectClasses ) throws NamingException
     {
-        if ( mod != DirContext.REMOVE_ATTRIBUTE )
+        if ( mod != ModificationOperation.REMOVE_ATTRIBUTE )
         {
             return;
         }
@@ -380,10 +381,10 @@
      * @param attribute the attribute being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyReplace( LdapDN name, int mod, ServerAttribute attribute, OidRegistry oidRegistry )
+    public static void preventRdnChangeOnModifyReplace( LdapDN name, ModificationOperation mod, ServerAttribute attribute, OidRegistry oidRegistry )
         throws NamingException
     {
-        if ( mod != DirContext.REPLACE_ATTRIBUTE )
+        if ( mod != ModificationOperation.REPLACE_ATTRIBUTE )
         {
             return;
         }
@@ -530,10 +531,10 @@
      * @param attribute the attribute being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyRemove( LdapDN name, int mod, ServerAttribute attribute, 
+    public static void preventRdnChangeOnModifyRemove( LdapDN name, ModificationOperation mod, ServerAttribute attribute, 
         OidRegistry oidRegistry ) throws NamingException
     {
-        if ( mod != DirContext.REMOVE_ATTRIBUTE )
+        if ( mod != ModificationOperation.REMOVE_ATTRIBUTE )
         {
             return;
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Jan 30 14:51:36 2008
@@ -52,6 +52,8 @@
 import org.apache.directory.server.schema.registries.OidRegistry;
 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.exception.LdapAttributeInUseException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
@@ -71,7 +73,6 @@
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.CascadeControl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.ServerSearchResult;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -92,9 +93,7 @@
 import javax.naming.NamingException;
 import javax.naming.NoPermissionException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
 import javax.naming.directory.InvalidAttributeValueException;
-import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -883,7 +882,7 @@
      * @return
      * @throws NamingException
      */
-    private ServerAttribute getResultantObjectClasses( int modOp, ServerAttribute changes, ServerAttribute existing ) throws NamingException
+    private ServerAttribute getResultantObjectClasses( ModificationOperation modOp, ServerAttribute changes, ServerAttribute existing ) throws NamingException
     {
         if ( ( changes == null ) && ( existing == null ) )
         {
@@ -896,7 +895,7 @@
             return existing;
         }
 
-        if ( ( existing == null ) && ( modOp == DirContext.ADD_ATTRIBUTE ) )
+        if ( ( existing == null ) && ( modOp == ModificationOperation.ADD_ATTRIBUTE ) )
         {
             return changes;
         }
@@ -907,7 +906,7 @@
 
         switch ( modOp )
         {
-            case ( DirContext.ADD_ATTRIBUTE  ):
+            case ADD_ATTRIBUTE :
                 for ( ServerValue<?> value:changes )
                 {
                     existing.add( value );
@@ -915,10 +914,10 @@
             
                 return existing;
             
-            case ( DirContext.REPLACE_ATTRIBUTE  ):
+            case REPLACE_ATTRIBUTE :
                 return ( ServerAttribute ) changes.clone();
             
-            case ( DirContext.REMOVE_ATTRIBUTE  ):
+            case REMOVE_ATTRIBUTE :
                 for ( ServerValue<?> value:changes )
                 {
                     existing.remove( value );
@@ -1145,7 +1144,7 @@
     {
         ServerEntry entry;
         LdapDN name = opContext.getDn();
-        List<ModificationItemImpl> mods = opContext.getModItems();
+        List<Modification> mods = opContext.getModItems();
 
         // handle operations against the schema subentry in the schema service
         // and never try to look it up in the nexus below
@@ -1159,7 +1158,10 @@
         }
         
         // First, we get the entry from the backend. If it does not exist, then we throw an exception
-        ServerEntry targetEntry = ServerEntryUtils.toServerEntry( SchemaUtils.getTargetEntry( mods, ServerEntryUtils.toAttributesImpl( entry ) ),
+        ServerEntry targetEntry = ServerEntryUtils.toServerEntry( 
+            SchemaUtils.getTargetEntry( 
+                ServerEntryUtils.toModificationItemImpl( mods ), 
+                ServerEntryUtils.toAttributesImpl( entry ) ),
             name,
             registries );
 
@@ -1174,16 +1176,16 @@
         ServerEntry tmpEntry = ( ServerEntry ) entry.clone();
         
         Set<String> modset = new HashSet<String>();
-        ModificationItem objectClassMod = null;
+        Modification objectClassMod = null;
         
         // Check that we don't have two times the same modification.
         // This is somehow useless, as modification operations are supposed to
         // be atomic, so we may have a sucession of Add, DEL, ADD operations
         // for the same attribute, and this will be legal.
         // @TODO : check if we can remove this test.
-        for ( ModificationItem mod:mods )
+        for ( Modification mod:mods )
         {
-            if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+            if ( mod.getAttribute().getId().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
             {
                 objectClassMod = mod;
             }
@@ -1192,7 +1194,7 @@
             if ( mod.getAttribute().size() == 0 )
             {
                 // not ok for add but ok for replace and delete
-                if ( mod.getModificationOp() == DirContext.ADD_ATTRIBUTE )
+                if ( mod.getOperation() == ModificationOperation.ADD_ATTRIBUTE )
                 {
                     throw new LdapInvalidAttributeValueException( "No value is not a valid value for an attribute.", 
                         ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
@@ -1200,15 +1202,15 @@
             }
 
             StringBuffer keybuf = new StringBuffer();
-            keybuf.append( mod.getModificationOp() );
-            keybuf.append( mod.getAttribute().getID() );
+            keybuf.append( mod.getOperation() );
+            keybuf.append( mod.getAttribute().getId() );
 
-            for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
+            for ( ServerValue<?> value:(ServerAttribute)mod.getAttribute() )
             {
-                keybuf.append( mod.getAttribute().get( jj ) );
+                keybuf.append( value.get() );
             }
             
-            if ( !modset.add( keybuf.toString() ) && ( mod.getModificationOp() == DirContext.ADD_ATTRIBUTE ) )
+            if ( !modset.add( keybuf.toString() ) && ( mod.getOperation() == ModificationOperation.ADD_ATTRIBUTE ) )
             {
                 throw new LdapAttributeInUseException( "found two copies of the following modification item: " +
                  mod );
@@ -1231,9 +1233,8 @@
         else
         {
             objectClass = getResultantObjectClasses( 
-                objectClassMod.getModificationOp(), 
-                ServerEntryUtils.toServerAttribute( objectClassMod.getAttribute(), 
-                    atRegistry.lookup( objectClassMod.getAttribute().getID() ) ),
+                objectClassMod.getOperation(), 
+                (ServerAttribute)objectClassMod.getAttribute(),
                 entry.get( SchemaConstants.OBJECT_CLASS_AT ) );
         }
 
@@ -1246,19 +1247,18 @@
         
         if ( ( mods.size() == 1 ) && 
              ( mods.get( 0 ).getAttribute().size() == 0 ) && 
-             ( mods.get( 0 ).getModificationOp() == DirContext.REPLACE_ATTRIBUTE ) &&
-             ! atRegistry.hasAttributeType( mods.get( 0 ).getAttribute().getID() ) )
+             ( mods.get( 0 ).getOperation() == ModificationOperation.REPLACE_ATTRIBUTE ) &&
+             ! atRegistry.hasAttributeType( mods.get( 0 ).getAttribute().getId() ) )
         {
             return;
         }
         
         // Now, apply the modifications on the cloned entry before applying it on the
         // real object.
-        for ( ModificationItem mod:mods )
+        for ( Modification mod:mods )
         {
-            int modOp = mod.getModificationOp();
-            ServerAttribute change = ServerEntryUtils.toServerAttribute( 
-                mod.getAttribute(), atRegistry.lookup( mod.getAttribute().getID() ) );
+            ModificationOperation modOp = mod.getOperation();
+            ServerAttribute change = (ServerAttribute)mod.getAttribute();
 
             if ( !atRegistry.hasAttributeType( change.getUpId() ) && 
                 !objectClass.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
@@ -1277,7 +1277,7 @@
             
             switch ( modOp )
             {
-                case DirContext.ADD_ATTRIBUTE :
+                case ADD_ATTRIBUTE :
                     ServerAttribute attr = tmpEntry.get( change.getUpId() );
                     
                     if ( attr != null ) 
@@ -1301,7 +1301,7 @@
                     
                     break;
 
-                case DirContext.REMOVE_ATTRIBUTE :
+                case REMOVE_ATTRIBUTE :
                     if ( tmpEntry.get( change.getUpId() ) == null )
                     {
                         LOG.error( "Trying to remove an non-existant attribute: " + change.getUpId() );
@@ -1359,7 +1359,7 @@
                         .preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, modOp, change, objectClass );
                     break;
                         
-                case DirContext.REPLACE_ATTRIBUTE :
+                case REPLACE_ATTRIBUTE :
                     SchemaChecker.preventRdnChangeOnModifyReplace( name, modOp, change, 
                         registries.getOidRegistry() );
                     SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, modOp, change );
@@ -1398,12 +1398,11 @@
 
             if ( !alteredObjectClass.equals( objectClass ) )
             {
-                ServerAttribute ocMods = ServerEntryUtils.toServerAttribute( 
-                    objectClassMod.getAttribute(), OBJECT_CLASS );
+                ServerAttribute ocMods = (ServerAttribute)objectClassMod.getAttribute();
                 
-                switch ( objectClassMod.getModificationOp() )
+                switch ( objectClassMod.getOperation() )
                 {
-                    case ( DirContext.ADD_ATTRIBUTE  ):
+                    case ADD_ATTRIBUTE :
                         if ( ocMods.contains( SchemaConstants.TOP_OC ) )
                         {
                             ocMods.remove( SchemaConstants.TOP_OC );
@@ -1419,7 +1418,7 @@
                         
                         break;
                         
-                    case ( DirContext.REMOVE_ATTRIBUTE  ):
+                    case REMOVE_ATTRIBUTE :
                         for ( ServerValue<?> value:alteredObjectClass ) 
                         {
                             if ( !objectClass.contains( value ) )
@@ -1430,7 +1429,7 @@
                     
                         break;
                         
-                    case ( DirContext.REPLACE_ATTRIBUTE  ):
+                    case REPLACE_ATTRIBUTE :
                         for ( ServerValue<?> value:alteredObjectClass ) 
                         {
                             if ( !objectClass.contains( value ) )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Wed Jan 30 14:51:36 2008
@@ -34,9 +34,10 @@
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -51,11 +52,11 @@
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.NotImplementedException;
 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.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-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.Rdn;
@@ -78,7 +79,6 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 
 
 /**
@@ -383,7 +383,7 @@
     }
     
 
-    public void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, 
+    public void modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry, 
         ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
         ServerAttribute oc = entry.get( objectClassAT );
@@ -412,7 +412,7 @@
     }
 
 
-    public void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry, ServerEntry targetEntry,
+    public void modify( LdapDN name, List<Modification> mods, ServerEntry entry, ServerEntry targetEntry,
         boolean doCascadeModify ) throws NamingException
     {
         ServerAttribute oc = entry.get( objectClassAT );
@@ -543,31 +543,27 @@
      * to effect all dependents on the changed entity
      * @throws NamingException if the operation fails
      */
-    public void modifySchemaSubentry( LdapDN name, List<ModificationItemImpl> mods, ServerEntry subentry, 
+    public void modifySchemaSubentry( LdapDN name, List<Modification> mods, ServerEntry subentry, 
         ServerEntry targetSubentry, boolean doCascadeModify ) throws NamingException 
     {
-        for ( ModificationItem mod : mods )
+        for ( Modification mod : mods )
         {
-            String opAttrOid = registries.getOidRegistry().getOid( mod.getAttribute().getID() );
+            String opAttrOid = registries.getOidRegistry().getOid( mod.getAttribute().getId() );
             
-            AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( 
-                mod.getAttribute().getID() );
-        
-            ServerAttribute serverAttribute = 
-                ServerEntryUtils.toServerAttribute( mod.getAttribute(), attributeType );
+            ServerAttribute serverAttribute = (ServerAttribute)mod.getAttribute();
 
-            switch ( mod.getModificationOp() )
+            switch ( mod.getOperation() )
             {
-                case( DirContext.ADD_ATTRIBUTE ):
+                case ADD_ATTRIBUTE :
 
                     modifyAddOperation( opAttrOid, serverAttribute, doCascadeModify );
                     break;
                     
-                case( DirContext.REMOVE_ATTRIBUTE ):
+                case REMOVE_ATTRIBUTE :
                     modifyRemoveOperation( opAttrOid, serverAttribute, doCascadeModify );
                     break; 
                     
-                case( DirContext.REPLACE_ATTRIBUTE ):
+                case REPLACE_ATTRIBUTE :
                     throw new LdapOperationNotSupportedException( 
                         "Modify REPLACE operations on schema subentries are not allowed: " +
                         "it's just silly to destroy and recreate so many \nschema entities " +
@@ -576,7 +572,7 @@
                         ResultCodeEnum.UNWILLING_TO_PERFORM );
                 
                 default:
-                    throw new IllegalStateException( "Undefined modify operation: " + mod.getModificationOp() );
+                    throw new IllegalStateException( "Undefined modify operation: " + mod.getOperation() );
             }
         }
         
@@ -942,13 +938,19 @@
         String modifiersName = ctx.getPrincipal().getJndiName().getNormName();
         String modifyTimestamp = DateUtils.getGeneralizedTime();
         
-        List<ModificationItemImpl> mods = new ArrayList<ModificationItemImpl>( 2 );
-        
-        mods.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, 
-            new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, modifyTimestamp ) ) );
+        List<Modification> mods = new ArrayList<Modification>( 2 );
         
-        mods.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
-            new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, modifiersName ) ) );
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, 
+            new DefaultServerAttribute( 
+                ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT,
+                registries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT ),
+                modifyTimestamp ) ) );
+        
+        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE,
+            new DefaultServerAttribute( 
+                ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, 
+                registries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ),
+                modifiersName ) ) );
         
         LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
         name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Wed Jan 30 14:51:36 2008
@@ -29,9 +29,11 @@
 
 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.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
@@ -41,6 +43,7 @@
 import org.apache.directory.server.schema.registries.OidRegistry;
 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.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -48,9 +51,7 @@
 import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 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.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -578,7 +579,7 @@
         dn.normalize( attrRegistry.getNormalizerMapping() );
         ServerEntry entry = partition.lookup( new LookupOperationContext( registries, dn ) );
         ServerAttribute disabledAttr = entry.get( disabledAttributeType );
-        List<ModificationItemImpl> mods = new ArrayList<ModificationItemImpl>( 3 );
+        List<Modification> mods = new ArrayList<Modification>( 3 );
         
         if ( disabledAttr == null )
         {
@@ -593,14 +594,28 @@
             return;
         }
         
-        mods.add( new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, 
-            new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT ) ) );
-        
-        mods.add( new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
-            new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
-        
-        mods.add( new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
-            new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ) ) );
+        mods.add( 
+            new ServerModification( 
+                DirContext.REMOVE_ATTRIBUTE, 
+                new DefaultServerAttribute( 
+                    MetaSchemaConstants.M_DISABLED_AT ,
+                    attrRegistry.lookup(MetaSchemaConstants.M_DISABLED_AT) ) ) );
+        
+        mods.add( 
+            new ServerModification( 
+                DirContext.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( 
+                    SchemaConstants.MODIFY_TIMESTAMP_AT, 
+                    attrRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ),
+                    DateUtils.getGeneralizedTime() ) ) );
         
         partition.modify( new ModifyOperationContext( registries, dn, mods ) );
     }



Mime
View raw message