directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r616938 [3/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/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Wed Jan 30 14:51:36 2008
@@ -29,6 +29,8 @@
 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;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -48,6 +50,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.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -55,9 +59,6 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -66,17 +67,12 @@
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.Control;
@@ -444,7 +440,7 @@
              */
             Subentry subentry = new Subentry();
             subentry.setTypes( getSubentryTypes( entry ) );
-            Attributes operational = getSubentryOperatationalAttributes( name, subentry );
+            ServerEntry operational = getSubentryOperatationalAttributes( name, subentry );
 
             /* ----------------------------------------------------------------
              * Parse the subtreeSpecification of the subentry and add it to the
@@ -494,11 +490,11 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( result.getAttributes(), dn, registries );
 
-                if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational )  ));
                 }
@@ -628,11 +624,11 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
-
-                if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( result.getAttributes(), dn, registries );
+                
+                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
                 }
@@ -676,10 +672,10 @@
     }
 
 
-    private List<ModificationItemImpl> getModsOnEntryRdnChange( Name oldName, Name newName, ServerEntry entry )
+    private List<Modification> getModsOnEntryRdnChange( Name oldName, Name newName, ServerEntry entry )
         throws NamingException
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<Modification> modList = new ArrayList<Modification>();
 
         /*
          * There are two different situations warranting action.  Firt if
@@ -715,7 +711,7 @@
             {
                 for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                 {
-                    int op = DirContext.REPLACE_ATTRIBUTE;
+                    ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
                     ServerAttribute opAttr = entry.get( aSUBENTRY_OPATTRS );
                     
                     if ( opAttr != null )
@@ -725,10 +721,10 @@
 
                         if ( opAttr.size() < 1 )
                         {
-                            op = DirContext.REMOVE_ATTRIBUTE;
+                            op = ModificationOperation.REMOVE_ATTRIBUTE;
                         }
 
-                        modList.add( new ModificationItemImpl( op, ServerEntryUtils.toAttributeImpl( opAttr ) ) );
+                        modList.add( new ServerModification( op, opAttr ) );
                     }
                 }
             }
@@ -737,10 +733,12 @@
             {
                 for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                 {
-                    int op = DirContext.ADD_ATTRIBUTE;
-                    Attribute opAttr = new AttributeImpl( aSUBENTRY_OPATTRS );
+                    ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
+                    ServerAttribute opAttr = new DefaultServerAttribute( 
+                        aSUBENTRY_OPATTRS,
+                        atRegistry.lookup( aSUBENTRY_OPATTRS ) );
                     opAttr.add( subentryDn );
-                    modList.add( new ModificationItemImpl( op, opAttr ) );
+                    modList.add( new ServerModification( op, opAttr ) );
                 }
             }
         }
@@ -785,11 +783,15 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
 
-                if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( 
+                    result.getAttributes(),
+                    dn,
+                    registries );
+
+                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( name, newName, subentry, candidate ) ) );
                 }
@@ -812,7 +814,7 @@
             newName.remove( newName.size() - 1 );
             newName.add( opContext.getNewRdn() );
             newName.normalize( atRegistry.getNormalizerMapping() );
-            List<ModificationItemImpl> mods = getModsOnEntryRdnChange( name, newName, entry );
+            List<Modification> mods = getModsOnEntryRdnChange( name, newName, entry );
 
             if ( mods.size() > 0 )
             {
@@ -861,11 +863,14 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( 
+                    result.getAttributes(),
+                    dn,
+                    registries );
 
-                if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
                         candidate ) ) );
@@ -888,7 +893,7 @@
             LdapDN newName = ( LdapDN ) parent.clone();
             newName.add( opContext.getNewRdn() );
             newName.normalize( atRegistry.getNormalizerMapping() );
-            List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
+            List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 
             if ( mods.size() > 0 )
             {
@@ -936,11 +941,14 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( 
+                    result.getAttributes(),
+                    dn,
+                    registries );
 
-                if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
                         candidate ) ) );
@@ -962,7 +970,7 @@
             // attributes contained within this regular entry with name changes
             LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( oriChildName.get( oriChildName.size() - 1 ) );
-            List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
+            List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 
             if ( mods.size() > 0 )
             {
@@ -977,34 +985,34 @@
     // -----------------------------------------------------------------------
 
     
-    private int getSubentryTypes( ServerEntry entry, List<ModificationItemImpl> mods ) throws NamingException
+    private int getSubentryTypes( ServerEntry entry, List<Modification> mods ) throws NamingException
     {
         ServerAttribute ocFinalState = ( ServerAttribute ) entry.get( SchemaConstants.OBJECT_CLASS_AT ).clone();
         
-        for ( ModificationItemImpl mod : mods )
+        for ( Modification mod : mods )
         {
-            if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+            if ( mod.getAttribute().getId().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
             {
-                switch ( mod.getModificationOp() )
+                switch ( mod.getOperation() )
                 {
-                    case ( DirContext.ADD_ATTRIBUTE ):
-                        for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
+                    case ADD_ATTRIBUTE :
+                        for ( ServerValue<?> value:(ServerAttribute)mod.getAttribute() )
                         {
-                            ocFinalState.add( (String)mod.getAttribute().get( jj ) );
+                            ocFinalState.add( (String)value.get() );
                         }
                     
                         break;
                         
-                    case ( DirContext.REMOVE_ATTRIBUTE ):
-                        for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
+                    case REMOVE_ATTRIBUTE :
+                        for ( ServerValue<?> value:(ServerAttribute)mod.getAttribute() )
                         {
-                            ocFinalState.remove( (String)mod.getAttribute().get( jj ) );
+                            ocFinalState.remove( (String)value.get() );
                         }
                     
                         break;
                         
-                    case ( DirContext.REPLACE_ATTRIBUTE ):
-                        ocFinalState = ServerEntryUtils.toServerAttribute( mod.getAttribute(), atRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT ) );
+                    case REPLACE_ATTRIBUTE :
+                        ocFinalState = (ServerAttribute)mod.getAttribute();
                         break;
                 }
             }
@@ -1018,18 +1026,18 @@
     public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
     {
         LdapDN name = opContext.getDn();
-        List<ModificationItemImpl> mods = opContext.getModItems();
+        List<Modification> mods = opContext.getModItems();
         
         ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
         
         ServerEntry oldEntry = (ServerEntry) entry.clone();
         ServerAttribute objectClasses = entry.get( objectClassType );
         boolean isSubtreeSpecificationModification = false;
-        ModificationItem subtreeMod = null;
+        Modification subtreeMod = null;
 
-        for ( ModificationItem mod : mods )
+        for ( Modification mod : mods )
         {
-            if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getID() ) )
+            if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getId() ) )
             {
                 isSubtreeSpecificationModification = true;
                 subtreeMod = mod;
@@ -1043,7 +1051,7 @@
 
             try
             {
-                ssNew = ssParser.parse( ( String ) subtreeMod.getAttribute().get() );
+                ssNew = ssParser.parse( ((ServerAttribute)subtreeMod.getAttribute()).getString() );
             }
             catch ( Exception e )
             {
@@ -1071,11 +1079,11 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( result.getAttributes(), dn, registries );
 
-                if ( evaluator.evaluate( ssOld, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
                 }
@@ -1083,7 +1091,7 @@
 
             // search for all selected entries by the new SS and add references to subentry
             Subentry subentry = subentryCache.getSubentry( name.toNormName() );
-            Attributes operational = getSubentryOperatationalAttributes( name, subentry );
+            ServerEntry operational = getSubentryOperatationalAttributes( name, subentry );
             LdapDN newBaseDn = ( LdapDN ) apName.clone();
             newBaseDn.addAll( ssNew.getBase() );
             subentries = nexus.search(
@@ -1091,11 +1099,11 @@
             while ( subentries.hasMore() )
             {
                 SearchResult result = subentries.next();
-                Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
+                ServerEntry candidate = ServerEntryUtils.toServerEntry( result.getAttributes(), dn, registries );
 
-                if ( evaluator.evaluate( ssNew, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+                if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
                 {
                     nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) )) ;
                 }
@@ -1109,7 +1117,7 @@
             {
                 ServerEntry newEntry = nexus.lookup( new LookupOperationContext( registries, name ) );
 
-	            List<ModificationItemImpl> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
+	            List<Modification> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
                 
 	            if ( subentriesOpAttrMods.size() > 0)
 	            {
@@ -1124,20 +1132,22 @@
     // Utility Methods
     // -----------------------------------------------------------------------
 
-    private List<ModificationItemImpl> getOperationalModsForReplace( Name oldName, Name newName, Subentry subentry,
-        Attributes entry )
+    private List<Modification> getOperationalModsForReplace( Name oldName, Name newName, Subentry subentry,
+        ServerEntry entry ) throws NamingException
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<Modification> modList = new ArrayList<Modification>();
         
-        Attribute operational;
+        ServerAttribute operational;
 
         if ( subentry.isAccessControlSubentry() )
         {
-            operational = ( Attribute ) entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ).clone();
+            operational = (ServerAttribute)entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ).clone();
             
             if ( operational == null )
             {
-                operational = new AttributeImpl( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
+                operational = new DefaultServerAttribute( 
+                    SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
+                    atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
                 operational.add( newName.toString() );
             }
             else
@@ -1146,16 +1156,18 @@
                 operational.add( newName.toString() );
             }
             
-            modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+            modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
         }
         
         if ( subentry.isSchemaSubentry() )
         {
-            operational = ( Attribute ) entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).clone();
+            operational = (ServerAttribute)entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).clone();
             
             if ( operational == null )
             {
-                operational = new AttributeImpl( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
+                operational = new DefaultServerAttribute( 
+                    SchemaConstants.SUBSCHEMA_SUBENTRY_AT,
+                    atRegistry.lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
                 operational.add( newName.toString() );
             }
             else
@@ -1164,16 +1176,18 @@
                 operational.add( newName.toString() );
             }
             
-            modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+            modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
         }
         
         if ( subentry.isCollectiveSubentry() )
         {
-            operational = ( Attribute ) entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ).clone();
+            operational = (ServerAttribute)entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ).clone();
            
             if ( operational == null )
             {
-                operational = new AttributeImpl( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+                operational = new DefaultServerAttribute( 
+                    SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
+                    atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
                 operational.add( newName.toString() );
             }
             else
@@ -1182,16 +1196,18 @@
                 operational.add( newName.toString() );
             }
             
-            modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+            modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
         }
         
         if ( subentry.isTriggerSubentry() )
         {
-            operational = ( Attribute ) entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ).clone();
+            operational = (ServerAttribute)entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ).clone();
             
             if ( operational == null )
             {
-                operational = new AttributeImpl( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
+                operational = new DefaultServerAttribute( 
+                    SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
+                    atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
                 operational.add( newName.toString() );
             }
             else
@@ -1200,7 +1216,7 @@
                 operational.add( newName.toString() );
             }
             
-            modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+            modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
         } 
 
         return modList;
@@ -1215,9 +1231,9 @@
      * @param subentry the subentry to get attributes from
      * @return the set of attributes to be added or removed from entries
      */
-    private Attributes getSubentryOperatationalAttributes( Name name, Subentry subentry )
+    private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry ) throws NamingException
     {
-        Attributes operational = new AttributesImpl();
+        ServerEntry operational = new DefaultServerEntry( registries, name );
         
         if ( subentry.isAccessControlSubentry() )
         {
@@ -1281,20 +1297,20 @@
      * @return the set of modifications required to remove an entry's reference to
      * a subentry
      */
-    private List<ModificationItemImpl> getOperationalModsForRemove( LdapDN subentryDn, Attributes candidate )
+    private List<Modification> getOperationalModsForRemove( LdapDN subentryDn, ServerEntry candidate ) throws NamingException
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<Modification> modList = new ArrayList<Modification>();
         String dn = subentryDn.toNormName();
 
         for ( String opAttrId : SUBENTRY_OPATTRS )
         {
-            Attribute opAttr = candidate.get( opAttrId );
+            ServerAttribute opAttr = candidate.get( opAttrId );
 
-            if ( opAttr != null && opAttr.contains( dn ) )
+            if ( ( opAttr != null ) && opAttr.contains( dn ) )
             {
-                Attribute attr = new AttributeImpl( opAttrId );
-                attr.add( dn );
-                modList.add( new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr ) );
+                AttributeType attributeType = atRegistry.lookup( opAttrId );
+                ServerAttribute attr = new DefaultServerAttribute( opAttrId, attributeType, dn );
+                modList.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attr ) );
             }
         }
 
@@ -1317,39 +1333,36 @@
      * @return the set of modifications needed to update the entry
      * @throws NamingException if there are probelms accessing modification items
      */
-    public List<ModificationItemImpl> getOperationalModsForAdd( Attributes entry, Attributes operational )
+    public List<Modification> getOperationalModsForAdd( ServerEntry entry, ServerEntry operational )
         throws NamingException
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<Modification> modList = new ArrayList<Modification>();
 
-        NamingEnumeration<String> opAttrIds = operational.getIDs();
-        
-        while ( opAttrIds.hasMore() )
+        for ( AttributeType attributeType:operational.getAttributeTypes() )
         {
-            int op = DirContext.REPLACE_ATTRIBUTE;
-            String opAttrId = opAttrIds.next();
-            Attribute result = new AttributeImpl( opAttrId );
-            Attribute opAttrAdditions = operational.get( opAttrId );
-            Attribute opAttrInEntry = entry.get( opAttrId );
+            ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
+            ServerAttribute result = new DefaultServerAttribute( attributeType );
+            ServerAttribute opAttrAdditions = operational.get( attributeType );
+            ServerAttribute opAttrInEntry = entry.get( attributeType );
 
-            for ( int ii = 0; ii < opAttrAdditions.size(); ii++ )
+            for ( ServerValue<?> value:opAttrAdditions )
             {
-                result.add( opAttrAdditions.get( ii ) );
+                result.add( value );
             }
 
             if ( opAttrInEntry != null && opAttrInEntry.size() > 0 )
             {
-                for ( int ii = 0; ii < opAttrInEntry.size(); ii++ )
+                for ( ServerValue<?> value:opAttrInEntry )
                 {
-                    result.add( opAttrInEntry.get( ii ) );
+                    result.add( value );
                 }
             }
             else
             {
-                op = DirContext.ADD_ATTRIBUTE;
+                op = ModificationOperation.ADD_ATTRIBUTE;
             }
 
-            modList.add( new ModificationItemImpl( op, result ) );
+            modList.add( new ServerModification( op, result ) );
         }
 
         return modList;
@@ -1372,29 +1385,14 @@
             }
 
             // see if we can use objectclass if present
-            Attribute objectClasses = result.getAttributes().get( SchemaConstants.OBJECT_CLASS_AT );
+            ServerAttribute objectClasses = 
+                ServerEntryUtils.toServerAttribute( 
+                    result.getAttributes().get( SchemaConstants.OBJECT_CLASS_AT ), 
+                    atRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT ) );
+            
             if ( objectClasses != null )
             {
-                if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
-                {
-                    return false;
-                }
-
-                if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC_OID ) )
-                {
-                    return false;
-                }
-
-                for ( int ii = 0; ii < objectClasses.size(); ii++ )
-                {
-                    String oc = ( String ) objectClasses.get( ii );
-                    if ( oc.equalsIgnoreCase( SchemaConstants.SUBENTRY_OC ) )
-                    {
-                        return false;
-                    }
-                }
-
-                return true;
+                return !objectClasses.contains( SchemaConstants.SUBENTRY_OC );
             }
 
             if ( !result.isRelative() )
@@ -1433,29 +1431,15 @@
             }
 
             // see if we can use objectclass if present
-            Attribute objectClasses = result.getAttributes().get( SchemaConstants.OBJECT_CLASS_AT );
+            ServerAttribute objectClasses = 
+                ServerEntryUtils.toServerAttribute( 
+                    result.getAttributes().get( 
+                        SchemaConstants.OBJECT_CLASS_AT),
+                    atRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT ) );
+            
             if ( objectClasses != null )
             {
-                if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
-                {
-                    return true;
-                }
-
-                if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC_OID ) )
-                {
-                    return true;
-                }
-
-                for ( int ii = 0; ii < objectClasses.size(); ii++ )
-                {
-                    String oc = ( String ) objectClasses.get( ii );
-                    if ( oc.equalsIgnoreCase( SchemaConstants.SUBENTRY_OC ) )
-                    {
-                        return true;
-                    }
-                }
-
-                return false;
+                return objectClasses.contains( SchemaConstants.SUBENTRY_OC );
             }
 
             if ( !result.isRelative() )
@@ -1476,10 +1460,10 @@
     }
     
     
-    private List<ModificationItemImpl> getModsOnEntryModification( LdapDN name, ServerEntry oldEntry, ServerEntry newEntry )
+    private List<Modification> getModsOnEntryModification( LdapDN name, ServerEntry oldEntry, ServerEntry newEntry )
     throws NamingException
 	{
-	    List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+	    List<Modification> modList = new ArrayList<Modification>();
 	
 	    Iterator<String> subentries = subentryCache.nameIterator();
 	    
@@ -1502,7 +1486,7 @@
 	        {
                 for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                 {
-                    int op = DirContext.REPLACE_ATTRIBUTE;
+                    ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
                     ServerAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS );
                     
                     if ( opAttr != null )
@@ -1512,22 +1496,23 @@
 
                         if ( opAttr.size() < 1 )
                         {
-                            op = DirContext.REMOVE_ATTRIBUTE;
+                            op = ModificationOperation.REMOVE_ATTRIBUTE;
                         }
 
-                        modList.add( new ModificationItemImpl( op, ServerEntryUtils.toAttributeImpl( opAttr ) ) );
+                        modList.add( new ServerModification( op, opAttr ) );
                     }
                 }
 	        }
 	        // need to add references to the subentry
 	        else if ( isNewEntrySelected && !isOldEntrySelected )
 	        {
-                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
+                for ( String attribute : SUBENTRY_OPATTRS )
                 {
-                    int op = DirContext.ADD_ATTRIBUTE;
-                    Attribute opAttr = new AttributeImpl( aSUBENTRY_OPATTRS );
+                    ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
+                    AttributeType type = atRegistry.lookup( attribute );
+                    ServerAttribute opAttr = new DefaultServerAttribute( attribute, type );
                     opAttr.add( subentryDn );
-                    modList.add( new ModificationItemImpl( op, opAttr ) );
+                    modList.add( new ServerModification( op, opAttr ) );
                 }
 	        }
 	    }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Wed Jan 30 14:51:36 2008
@@ -25,7 +25,6 @@
 import java.util.Map;
 
 import javax.naming.NamingException;
-import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -33,14 +32,14 @@
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 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.name.LdapDN;
 import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
 
 public class ModifyStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
 {
     private LdapDN modifiedEntryName;
-    private List<ModificationItemImpl> modifications;
+    private List<Modification> modifications;
     private ServerEntry oldEntry;
     
     
@@ -70,18 +69,11 @@
     {
         public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
         {
-            List<ModificationItem> newMods = new ArrayList<ModificationItem>();
+            List<Modification> newMods = new ArrayList<Modification>();
             
-            try
+            for ( Modification mod:modifications )
             {
-                for ( ModificationItem mod:modifications )
-                {
-                    newMods.add( (ModificationItemImpl)((ModificationItemImpl)mod).clone() );
-                }
-            }
-            catch ( CloneNotSupportedException cnse )
-            {
-                // do nothing ...
+                newMods.add( mod.clone() );
             }
             
             return newMods;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Wed Jan 30 14:51:36 2008
@@ -32,10 +32,10 @@
 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.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.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
@@ -202,11 +202,11 @@
         }
 
         LdapDN normName = opContext.getDn();
-        List<ModificationItemImpl> mods = opContext.getModItems();
+        List<Modification> mods = opContext.getModItems();
 
         boolean isTriggerSpecModified = false;
 
-        for ( ModificationItemImpl mod : mods )
+        for ( Modification mod : mods )
         {
             isTriggerSpecModified |= mod.getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR );
         }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java Wed Jan 30 14:51:36 2008
@@ -43,6 +43,7 @@
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -372,7 +373,7 @@
 
         // this should pass
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
-        int mod = DirContext.REPLACE_ATTRIBUTE;
+        ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
         SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, new DefaultServerAttribute( "cn", CN_AT ) );
 
         // this should succeed since person is still in replaced set and is structural
@@ -417,7 +418,7 @@
     {
         AttributeTypeRegistry atReg = registries.getAttributeTypeRegistry();
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
-        int mod = DirContext.REMOVE_ATTRIBUTE;
+        ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
         AttributeType ocAt = atReg.lookup( "objectClass" );
         
         ServerAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
@@ -479,7 +480,7 @@
     public void testPreventRdnChangeOnModifyRemoveAttribute() throws Exception
     {
         OidRegistry registry = new MockOidRegistry();
-        int mod = DirContext.REMOVE_ATTRIBUTE;
+        ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
         LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
         AttributeType cnAt = registries.getAttributeTypeRegistry().lookup( "cn" );
         AttributeType ouAt = registries.getAttributeTypeRegistry().lookup( "ou" );

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java Wed Jan 30 14:51:36 2008
@@ -20,8 +20,6 @@
 package org.apache.directory.server.core.subtree;
 
 
-import junit.framework.TestCase;
-
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.DefaultDirectoryService;

Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Wed Jan 30 14:51:36 2008
@@ -31,9 +31,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.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
@@ -58,7 +55,8 @@
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerBinaryValue;
 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.ServerStringValue;
 import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.trigger.TriggerInterceptor;
@@ -69,11 +67,12 @@
 import org.apache.directory.server.kerberos.shared.io.encoder.EncryptionKeyEncoder;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
+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.LdapAuthenticationException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -214,65 +213,64 @@
     void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext )
         throws NamingException
     {
-        List<ModificationItemImpl> mods = modContext.getModItems();
+        List<Modification> mods = modContext.getModItems();
 
         String operation = null;
 
         // Loop over attributes being modified to pick out 'userPassword' and 'krb5PrincipalName'.
-        for ( ModificationItem mod:mods )
+        for ( Modification mod:mods )
         {
             if ( log.isDebugEnabled() )
             {
-                switch ( mod.getModificationOp() )
+                switch ( mod.getOperation() )
                 {
-                    case DirContext.ADD_ATTRIBUTE:
+                    case ADD_ATTRIBUTE:
                         operation = "Adding";
                         break;
                         
-                    case DirContext.REMOVE_ATTRIBUTE:
+                    case REMOVE_ATTRIBUTE:
                         operation = "Removing";
                         break;
                         
-                    case DirContext.REPLACE_ATTRIBUTE:
+                    case REPLACE_ATTRIBUTE:
                         operation = "Replacing";
                         break;
                 }
             }
 
-            Attribute attr = mod.getAttribute();
-            String attrId = attr.getID();
+            ServerAttribute attr = (ServerAttribute)mod.getAttribute();
 
-            if ( attrId.equalsIgnoreCase( SchemaConstants.USER_PASSWORD_AT ) )
+            if ( attr.isA( SchemaConstants.USER_PASSWORD_AT ) )
             {
                 Object firstValue = attr.get();
+                String password = null;
 
-                if ( firstValue instanceof String )
+                if ( firstValue instanceof ServerStringValue )
                 {
-                    log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, firstValue );
+                    password = ((ServerStringValue)firstValue).get();
+                    log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, password );
                 }
-                else if ( firstValue instanceof byte[] )
+                else if ( firstValue instanceof ServerBinaryValue )
                 {
-                    String string = StringTools.utf8ToString( ( byte[] ) firstValue );
+                    password = StringTools.utf8ToString( ((ServerBinaryValue)firstValue).get() );
 
                     if ( log.isDebugEnabled() )
                     {
                         StringBuffer sb = new StringBuffer();
-                        sb.append( "'" + string + "' ( " );
-                        sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
+                        sb.append( "'" + password + "' ( " );
+                        sb.append( StringTools.dumpBytes( ((ServerBinaryValue)firstValue).get() ).trim() );
                         sb.append( " )" );
                         log.debug( "{} Attribute id : 'userPassword',  Values : [ {} ]", operation, sb.toString() );
                     }
-
-                    firstValue = string;
                 }
 
-                subContext.setUserPassword( ( String ) firstValue );
+                subContext.setUserPassword( password );
                 log.debug( "Got userPassword '{}'.", subContext.getUserPassword() );
             }
 
-            if ( attrId.equalsIgnoreCase( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) )
+            if ( attr.isA( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) )
             {
-                subContext.setPrincipalName( ( String ) attr.get() );
+                subContext.setPrincipalName( attr.getString() );
                 log.debug( "Got principal '{}'.", subContext.getPrincipalName() );
             }
         }
@@ -360,7 +358,7 @@
      */
     void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext ) throws NamingException
     {
-        List<ModificationItemImpl> mods = modContext.getModItems();
+        List<Modification> mods = modContext.getModItems();
 
         String principalName = subContext.getPrincipalName();
         String userPassword = subContext.getUserPassword();
@@ -370,22 +368,35 @@
 
         Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
 
-        List<ModificationItemImpl> newModsList = new ArrayList<ModificationItemImpl>();
+        List<Modification> newModsList = new ArrayList<Modification>();
 
         // Make sure we preserve any other modification items.
-        for ( ModificationItemImpl mod:mods )
+        for ( Modification mod:mods )
         {
             newModsList.add( mod );
         }
+        
+        AttributeTypeRegistry atRegistry = modContext.getRegistries().getAttributeTypeRegistry();
 
         // Add our modification items.
-        newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
-            KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalName ) ) );
-        newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
-            KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, Integer.toString( kvno ) ) ) );
+        newModsList.add( 
+            new ServerModification( 
+                ModificationOperation.REPLACE_ATTRIBUTE, 
+                new DefaultServerAttribute(
+                    KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, 
+                    atRegistry.lookup( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ),
+                    principalName ) ) );
+        newModsList.add( 
+            new ServerModification( 
+                ModificationOperation.REPLACE_ATTRIBUTE, 
+                new DefaultServerAttribute(
+                    KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, 
+                    atRegistry.lookup( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ),
+                    Integer.toString( kvno ) ) ) );
         
-        Attribute attribute = ServerEntryUtils.toAttributeImpl( getKeyAttribute( modContext.getRegistries(), keys ) );
-        newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute ) );
+        ServerAttribute attribute = getKeyAttribute( modContext.getRegistries(), keys );
+        newModsList.add( 
+            new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );
 
         modContext.setModItems( newModsList );
     }

Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java Wed Jan 30 14:51:36 2008
@@ -20,25 +20,24 @@
 package org.apache.directory.server.core.kerberos;
 
 
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerBinaryValue;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerStringValue;
+import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -115,61 +114,69 @@
     {
         LdapDN name = modContext.getDn();
 
-        List<ModificationItemImpl> mods = modContext.getModItems();
+        List<Modification> mods = modContext.getModItems();
 
         String operation = null;
 
-        for ( ModificationItem mod:mods )
+        for ( Modification mod:mods )
         {
             if ( log.isDebugEnabled() )
             {
-            	switch ( mod.getModificationOp() )
+            	switch ( mod.getOperation() )
 	            {
-	                case DirContext.ADD_ATTRIBUTE:
+	                case ADD_ATTRIBUTE:
 	                    operation = "Adding";
 	                    break;
 	                    
-	                case DirContext.REMOVE_ATTRIBUTE:
+	                case REMOVE_ATTRIBUTE:
 	                    operation = "Removing";
 	                    break;
 	                    
-	                case DirContext.REPLACE_ATTRIBUTE:
+	                case REPLACE_ATTRIBUTE:
 	                    operation = "Replacing";
 	                    break;
 	            }
             }
 
-            Attribute attr = mod.getAttribute();
-            String id = attr.getID();
+            ServerAttribute attr = (ServerAttribute)mod.getAttribute();
 
-            if ( id.equalsIgnoreCase( SchemaConstants.USER_PASSWORD_AT ) )
+            if ( attr.isA( SchemaConstants.USER_PASSWORD_AT ) )
             {
-                Object userPassword = attr.get();
+                ServerValue<?> userPassword = attr.get();
+                String pwd = "";
 
                 if ( userPassword != null )
                 {
-                    if ( userPassword instanceof String )
+                    if ( userPassword instanceof ServerStringValue )
                     {
                         log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, attr );
+                        pwd = ((ServerStringValue)userPassword).get();
                     }
-                    else if ( userPassword instanceof byte[] )
+                    else if ( userPassword instanceof ServerBinaryValue )
                     {
-                        String string = StringTools.utf8ToString( ( byte[] ) userPassword );
+                        ServerBinaryValue password = (ServerBinaryValue)userPassword.get();
+                        
+                        String string = "";
+                        
+                        if ( password != null )
+                        {
+                            string = StringTools.utf8ToString( password.get() );
+                        }
 
                         if ( log.isDebugEnabled() )
                         {
                             StringBuffer sb = new StringBuffer();
                             sb.append( "'" + string + "' ( " );
-                            sb.append( StringTools.dumpBytes( ( byte[] ) userPassword ).trim() );
+                            sb.append( StringTools.dumpBytes( password.get() ).trim() );
                             sb.append( " )" );
                             log.debug( "{} Attribute id : 'userPassword',  Values : [ {} ]", operation, sb.toString() );
                         }
 
-                        userPassword = string;
+                        pwd = string;
                     }
 
                     // if userPassword fails checks, throw new NamingException.
-                    check( name.getUpName(), ( String ) userPassword );
+                    check( name.getUpName(), pwd );
                 }
             }
 

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Wed Jan 30 14:51:36 2008
@@ -25,8 +25,10 @@
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.CacheRecordManager;
 
+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.ServerValue;
 import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.IndexAssertion;
@@ -37,11 +39,12 @@
 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.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-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;
@@ -55,8 +58,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -1311,14 +1312,14 @@
      * @throws NamingException if index alteration or attribute addition
      * fails.
      */
-    private void add( Long id, Attributes entry, Attribute mods ) throws NamingException
+    private void add( Long id, Attributes entry, ServerAttribute mods ) throws NamingException
     {
-        String modsOid = oidRegistry.getOid( mods.getID() );
+        String modsOid = oidRegistry.getOid( mods.getId() );
         
         if ( hasUserIndexOn( modsOid ) )
         {
             Index idx = getUserIndex( modsOid );
-            idx.add( mods, id );
+            idx.add( ServerEntryUtils.toAttributeImpl( mods ), id );
 
             // If the attr didn't exist for this id add it to existance index
             if ( !existanceIdx.hasValue( modsOid, id ) )
@@ -1333,19 +1334,19 @@
 
         if ( entryAttrToAddTo == null )
         {
-            entryAttrToAddTo = new AttributeImpl( mods.getID() );
+            entryAttrToAddTo = new AttributeImpl( mods.getId() );
             entry.put( entryAttrToAddTo );
         }
 
-        for ( int ii = 0; ii < mods.size(); ii++ )
+        for ( ServerValue<?> value:mods )
         {
-            entryAttrToAddTo.add( mods.get( ii ) );
+            entryAttrToAddTo.add( value.get() );
         }
 
         if ( modsOid.equals( oidRegistry.getOid( SchemaConstants.ALIASED_OBJECT_NAME_AT ) ) )
         {
             String ndnStr = ( String ) ndnIdx.reverseLookup( id );
-            addAliasIndices( id, new LdapDN( ndnStr ), ( String ) mods.get() );
+            addAliasIndices( id, new LdapDN( ndnStr ), mods.getString() );
         }
     }
 
@@ -1364,14 +1365,14 @@
      * @throws NamingException if index alteration or attribute modification 
      * fails.
      */
-    private void remove( Long id, Attributes entry, Attribute mods ) throws NamingException
+    private void remove( Long id, Attributes entry, ServerAttribute mods ) throws NamingException
     {
-        String modsOid = oidRegistry.getOid( mods.getID() );
+        String modsOid = oidRegistry.getOid( mods.getId() );
         
         if ( hasUserIndexOn( modsOid ) )
         {
             Index idx = getUserIndex( modsOid );
-            idx.drop( mods, id );
+            idx.drop( ServerEntryUtils.toAttributeImpl( mods ), id );
 
             /* 
              * If no attribute values exist for this entryId in the index then
@@ -1397,11 +1398,10 @@
         else
         {
             Attribute entryAttr = AttributeUtils.getAttribute( entry, attrType );
-            NamingEnumeration<?> values = mods.getAll();
             
-            while ( values.hasMore() )
+            for ( ServerValue<?> value:mods )
             {
-                entryAttr.remove( values.next() );
+                entryAttr.remove( value.get() );
             }
 
             // if nothing is left just remove empty attribute
@@ -1431,9 +1431,9 @@
      * @throws NamingException if index alteration or attribute modification 
      * fails.
      */
-    private void replace( Long id, Attributes entry, Attribute mods ) throws NamingException
+    private void replace( Long id, Attributes entry, ServerAttribute mods ) throws NamingException
     {
-        String modsOid = oidRegistry.getOid( mods.getID() );
+        String modsOid = oidRegistry.getOid( mods.getId() );
         
         if ( hasUserIndexOn( modsOid ) )
         {
@@ -1441,7 +1441,7 @@
 
             // Drop all existing attribute value index entries and add new ones
             idx.drop( id );
-            idx.add( mods, id );
+            idx.add( ServerEntryUtils.toAttributeImpl( mods ), id );
 
             /* 
              * If no attribute values exist for this entryId in the index then
@@ -1463,67 +1463,49 @@
         // replaces old attributes with new modified ones if they exist
         if ( mods.size() > 0 )
         {
-            entry.put( mods );
+            entry.put( ServerEntryUtils.toAttributeImpl( mods ) );
         }
         else  // removes old attributes if new replacements do not exist
         {
-            entry.remove( mods.getID() );
+            entry.remove( mods.getId() );
         }
 
         if ( modsOid.equals( aliasAttributeOid ) && mods.size() > 0 )
         {
             String ndnStr = ( String ) ndnIdx.reverseLookup( id );
-            addAliasIndices( id, new LdapDN( ndnStr ), ( String ) mods.get() );
+            addAliasIndices( id, new LdapDN( ndnStr ), mods.getString() );
         }
     }
 
 
-    public void modify( LdapDN dn, int modOp, Attributes mods ) throws NamingException
+    public void modify( LdapDN dn, ModificationOperation modOp, ServerEntry mods ) throws NamingException
     {
         NamingEnumeration<String> attrs;
         Long id = getEntryId( dn.toString() );
         Attributes entry = master.get( id );
 
-        switch ( modOp )
+        for ( AttributeType attributeType:mods.getAttributeTypes() )
         {
-            case ( DirContext.ADD_ATTRIBUTE  ):
-                attrs = mods.getIDs();
+            ServerAttribute attr = mods.get( attributeType );
 
-                while ( attrs.hasMore() )
-                {
-                    String attrId = attrs.next();
-                    Attribute attr = mods.get( attrId );
+            switch ( modOp )
+            {
+                case ADD_ATTRIBUTE :
                     add( id, entry, attr );
-                }
-
-                break;
+                    break;
                 
-            case ( DirContext.REMOVE_ATTRIBUTE  ):
-                attrs = mods.getIDs();
-
-                while ( attrs.hasMore() )
-                {
-                    String attrId = attrs.next();
-                    Attribute attr = mods.get( attrId );
+                case REMOVE_ATTRIBUTE :
                     remove( id, entry, attr );
-                }
-
-                break;
+                    break;
                 
-            case ( DirContext.REPLACE_ATTRIBUTE  ):
-                attrs = mods.getIDs();
-
-                while ( attrs.hasMore() )
-                {
-                    String attrId = attrs.next();
-                    Attribute attr = mods.get( attrId );
+                case REPLACE_ATTRIBUTE :
                     replace( id, entry, attr );
-                }
-
-                break;
-                
-            default:
-                throw new NamingException( "Unidentified modification operation" );
+    
+                    break;
+                    
+                default:
+                    throw new NamingException( "Unidentified modification operation" );
+            }
         }
 
         master.put( entry, id );
@@ -1535,26 +1517,26 @@
     }
 
 
-    public void modify( LdapDN dn, List<ModificationItemImpl> mods ) throws NamingException
+    public void modify( LdapDN dn, List<Modification> mods ) throws NamingException
     {
         Long id = getEntryId( dn.toString() );
         Attributes entry = master.get( id );
 
-        for ( ModificationItem mod : mods )
+        for ( Modification mod : mods )
         {
-            Attribute attrMods = mod.getAttribute();
+            ServerAttribute attrMods = (ServerAttribute)mod.getAttribute();
 
-            switch ( mod.getModificationOp() )
+            switch ( mod.getOperation() )
             {
-                case ( DirContext.ADD_ATTRIBUTE ):
+                case ADD_ATTRIBUTE :
                     add( id, entry, attrMods );
                     break;
 
-                case ( DirContext.REMOVE_ATTRIBUTE ):
+                case REMOVE_ATTRIBUTE :
                     remove(id, entry, attrMods);
                     break;
 
-                case ( DirContext.REPLACE_ATTRIBUTE ):
+                case REPLACE_ATTRIBUTE :
                     replace( id, entry, attrMods );
                     break;
 

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Wed Jan 30 14:51:36 2008
@@ -103,10 +103,6 @@
         Serializer valueSerializer )
         throws NamingException
     {
-        /*System.out.println( "Creating BTree for " + name + ", key serializer = " + 
-            (keySerializer == null ? "null" : keySerializer.getClass().getName()) +
-            ", valueSerializer = " + 
-            (valueSerializer == null ? "null" : valueSerializer.getClass().getName()) );*/
         this.numDupLimit = numDupLimit;
         this.name = name;
         this.recMan = manager;

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java Wed Jan 30 14:51:36 2008
@@ -22,17 +22,16 @@
 
 import org.apache.directory.mitosis.common.CSN;
 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.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 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;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
 import java.util.List;
 
 
@@ -51,7 +50,7 @@
      * 
      * @param attribute an attribute to add
      */
-    public AddAttributeOperation( CSN csn, LdapDN name, Attribute attribute )
+    public AddAttributeOperation( CSN csn, LdapDN name, ServerAttribute attribute )
     {
         super( csn, name, attribute );
     }
@@ -59,16 +58,16 @@
 
     public String toString()
     {
-        return super.toString() + ".add( " + getAttribute() + " )";
+        return super.toString() + ".add( " + getAttributeString() + " )";
     }
 
 
     protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
     {
         ServerEntry serverEntry = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
-        Attribute attribute = getAttribute();
-        serverEntry.put( ServerEntryUtils.toServerAttribute( attribute, registries.getAttributeTypeRegistry().lookup( attribute.getID() ) ) );
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( serverEntry, DirContext.ADD_ATTRIBUTE );
+        ServerAttribute attribute = getAttribute( registries.getAttributeTypeRegistry() );
+        serverEntry.put( attribute );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.ADD_ATTRIBUTE );
         nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
     }
 }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java Wed Jan 30 14:51:36 2008
@@ -22,8 +22,12 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.InvalidAttributeIdentifierException;
 
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
@@ -40,6 +44,7 @@
 {
     private final LdapDN name;
     private final Attribute attribute;
+    private transient ServerAttribute serverAttribute;
 
 
     /**
@@ -48,24 +53,35 @@
      * @param name the normalized name of an entry 
      * @param attribute an attribute to modify
      */
-    public AttributeOperation( CSN csn, LdapDN name, Attribute attribute )
+    public AttributeOperation( CSN csn, LdapDN name, ServerAttribute serverAttribute )
     {
         super( csn );
 
         assert name != null;
-        assert attribute != null;
+        assert serverAttribute != null;
 
         this.name = name;
-        this.attribute = ( Attribute ) attribute.clone();
+        this.serverAttribute = (ServerAttribute)serverAttribute.clone();
+        this.attribute = ServerEntryUtils.toAttributeImpl( this.serverAttribute );
     }
 
 
     /**
      * Returns the attribute to modify.
      */
-    public Attribute getAttribute()
+    public ServerAttribute getAttribute( AttributeTypeRegistry atRegistry ) throws InvalidAttributeIdentifierException, NamingException
     {
-        return ( Attribute ) attribute.clone();
+        if ( serverAttribute != null )
+        {
+            return ( ServerAttribute ) serverAttribute.clone();
+        }
+        else
+        {
+            Attribute attr = (Attribute)attribute.clone();
+            
+            serverAttribute = ServerEntryUtils.toServerAttribute( attr, atRegistry.lookup( attr.getID() ) );
+            return (ServerAttribute)serverAttribute.clone();
+        }
     }
 
 
@@ -93,6 +109,14 @@
 
     protected abstract void execute1( PartitionNexus nexus, Registries registries ) throws NamingException;
 
+
+    /**
+     * Returns the attribute to modify.
+     */
+    public String getAttributeString()
+    {
+        return attribute.toString();
+    }
 
     /**
      * Returns string representation of this operation.

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java Wed Jan 30 14:51:36 2008
@@ -22,17 +22,16 @@
 
 import org.apache.directory.mitosis.common.CSN;
 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.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 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;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
 import java.util.List;
 
 
@@ -51,7 +50,7 @@
      * 
      * @param attribute an attribute to delete
      */
-    public DeleteAttributeOperation( CSN csn, LdapDN name, Attribute attribute )
+    public DeleteAttributeOperation( CSN csn, LdapDN name, ServerAttribute attribute )
     {
         super( csn, name, attribute );
     }
@@ -59,16 +58,16 @@
 
     public String toString()
     {
-        return super.toString() + ".delete( " + getAttribute() + " )";
+        return super.toString() + ".delete( " + getAttributeString() + " )";
     }
 
 
     protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
     {
         ServerEntry serverEntry = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
-        Attribute attribute = getAttribute();
-        serverEntry.put( ServerEntryUtils.toServerAttribute( attribute, registries.getAttributeTypeRegistry().lookup( attribute.getID() ) ) );
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( serverEntry, DirContext.REMOVE_ATTRIBUTE );
+        ServerAttribute attribute = getAttribute( registries.getAttributeTypeRegistry() );
+        serverEntry.put( attribute );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REMOVE_ATTRIBUTE );
 
         nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java Wed Jan 30 14:51:36 2008
@@ -77,7 +77,6 @@
         }
         catch ( IOException e )
         {
-            e.printStackTrace();
             throw ( InternalError ) new InternalError().initCause( e );
         }
         catch ( ClassNotFoundException e )

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Wed Jan 30 14:51:36 2008
@@ -26,6 +26,7 @@
 import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.server.core.DirectoryService;
+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;
@@ -38,19 +39,16 @@
 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.PresenceNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-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 javax.naming.NameAlreadyBoundException;
 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;
 
@@ -147,14 +145,17 @@
      * The created {@link Operation} doesn't actually delete the entry.
      * Instead, it sets {@link Constants#ENTRY_DELETED} to "TRUE". 
      */
-    public Operation newDelete( LdapDN normalizedName )
+    public Operation newDelete( LdapDN normalizedName ) throws NamingException
     {
         CSN csn = newCSN();
         CompositeOperation result = new CompositeOperation( csn );
 
         // Transform into replace operation.
-        result.add( new ReplaceAttributeOperation( csn, normalizedName, new AttributeImpl( Constants.ENTRY_DELETED,
-            "TRUE" ) ) );
+        result.add( new ReplaceAttributeOperation( csn, normalizedName, 
+            new DefaultServerAttribute( 
+                Constants.ENTRY_DELETED, 
+                attributeRegistry.lookup( Constants.ENTRY_DELETED ),
+                "TRUE" ) ) );
 
         return addDefaultOperations( result, csn, normalizedName );
     }
@@ -168,23 +169,34 @@
      * sets {@link Constants#ENTRY_DELETED} to "FALSE" to resurrect the
      * entry the modified attributes belong to.
      */
-    public Operation newModify( ModifyOperationContext opContext )
+    public Operation newModify( ModifyOperationContext opContext ) throws NamingException
     {
-        List<ModificationItemImpl> items = opContext.getModItems();
+        List<Modification> items = opContext.getModItems();
         LdapDN normalizedName = opContext.getDn();
 
         CSN csn = newCSN();
         CompositeOperation result = new CompositeOperation( csn );
         
         // Transform into multiple {@link AttributeOperation}s.
-        for ( ModificationItem item:items )
+        for ( Modification item:items )
         {
-            result.add( newModify( csn, normalizedName, item.getModificationOp(), item.getAttribute() ) );
+            result.add( 
+                newModify( 
+                    csn, 
+                    normalizedName, 
+                    item.getOperation(), 
+                    (ServerAttribute)item.getAttribute() ) );
         }
 
         // Resurrect the entry in case it is deleted.
-        result.add( new ReplaceAttributeOperation( csn, normalizedName, new AttributeImpl( Constants.ENTRY_DELETED,
-            "FALSE" ) ) );
+        result.add( 
+            new ReplaceAttributeOperation( 
+                csn, 
+                normalizedName, 
+                new DefaultServerAttribute( 
+                    Constants.ENTRY_DELETED,
+                    attributeRegistry.lookup( Constants.ENTRY_DELETED ),
+                    "FALSE" ) ) );
 
         return addDefaultOperations( result, csn, normalizedName );
     }
@@ -196,16 +208,19 @@
      * methods internally to create an appropriate {@link AttributeOperation}
      * instance from the specified <tt>modOp</tt> value.
      */
-    private Operation newModify( CSN csn, LdapDN normalizedName, int modOp, Attribute attribute )
+    private Operation newModify( CSN csn, LdapDN normalizedName, ModificationOperation modOp, ServerAttribute attribute )
     {
         switch ( modOp )
         {
-            case DirContext.ADD_ATTRIBUTE:
+            case ADD_ATTRIBUTE:
                 return new AddAttributeOperation( csn, normalizedName, attribute );
-            case DirContext.REPLACE_ATTRIBUTE:
+            
+            case REPLACE_ATTRIBUTE:
                 return new ReplaceAttributeOperation( csn, normalizedName, attribute );
-            case DirContext.REMOVE_ATTRIBUTE:
+            
+            case REMOVE_ATTRIBUTE:
                 return new DeleteAttributeOperation( csn, normalizedName, attribute );
+            
             default:
                 throw new IllegalArgumentException( "Unknown modOp: " + modOp );
         }
@@ -269,8 +284,14 @@
             oldEntryName.normalize( attributeRegistry.getNormalizerMapping() );
 
             // Delete the old entry
-            result.add( new ReplaceAttributeOperation( csn, oldEntryName, new AttributeImpl( Constants.ENTRY_DELETED,
-                "TRUE" ) ) );
+            result.add( 
+                new ReplaceAttributeOperation( 
+                    csn, 
+                    oldEntryName, 
+                    new DefaultServerAttribute( 
+                        Constants.ENTRY_DELETED,
+                        attributeRegistry.lookup( Constants.ENTRY_DELETED ),
+                        "TRUE" ) ) );
 
             // Get the old entry attributes and replace RDN if required
             LdapDN entryName = new LdapDN( sr.getName() ); 
@@ -371,10 +392,17 @@
      * currently adds only one attribute, {@link Constants#ENTRY_CSN}.
      * @return what you specified as a parameter to enable invocation chaining
      */
-    private CompositeOperation addDefaultOperations( CompositeOperation result, CSN csn, LdapDN normalizedName )
+    private CompositeOperation addDefaultOperations( CompositeOperation result, CSN csn, LdapDN normalizedName ) throws NamingException
     {
-        result.add( new ReplaceAttributeOperation( csn, normalizedName, new AttributeImpl( Constants.ENTRY_CSN, csn
-            .toOctetString() ) ) );
+        result.add( 
+            new ReplaceAttributeOperation( 
+                csn, 
+                normalizedName, 
+                new DefaultServerAttribute( 
+                    Constants.ENTRY_DELETED,
+                    attributeRegistry.lookup( Constants.ENTRY_CSN ),
+                    csn.toOctetString() ) ) );
+
         return result;
     }
 

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java Wed Jan 30 14:51:36 2008
@@ -22,17 +22,16 @@
 
 import org.apache.directory.mitosis.common.CSN;
 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.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 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;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
 import java.util.List;
 
 
@@ -53,7 +52,7 @@
      * @param csn ??
      * @param name ??
      */
-    public ReplaceAttributeOperation( CSN csn, LdapDN name, Attribute attribute )
+    public ReplaceAttributeOperation( CSN csn, LdapDN name, ServerAttribute attribute )
     {
         super( csn, name, attribute );
     }
@@ -61,16 +60,16 @@
 
     public String toString()
     {
-        return super.toString() + ".replace( " + getAttribute() + " )";
+        return super.toString() + ".replace( " + getAttributeString() + " )";
     }
 
 
     protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
     {
         ServerEntry serverEntry = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
-        Attribute attribute = getAttribute();
-        serverEntry.put( ServerEntryUtils.toServerAttribute( attribute, registries.getAttributeTypeRegistry().lookup( attribute.getID() ) ) );
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( serverEntry, DirContext.REPLACE_ATTRIBUTE );
+        ServerAttribute attribute = getAttribute( registries.getAttributeTypeRegistry() );
+        serverEntry.put( attribute );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
         nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=616938&r1=616937&r2=616938&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java Wed Jan 30 14:51:36 2008
@@ -453,7 +453,6 @@
             }
             catch ( NameNotFoundException e )
             {
-                System.out.println( e.toString( true ) );
                 hasEntry = false;
             }
         }



Mime
View raw message