directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r638228 [12/20] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ apacheds-xbean-spring/src/site/ benchmarks/src/site/ bootstrap-extract/src/site/ bootstrap-partition/src/site/ bootstrap-plugin/src/main/java/org/apache/directory/server...
Date Tue, 18 Mar 2008 06:13:18 GMT
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java Mon Mar 17 23:12:41 2008
@@ -45,10 +45,30 @@
 
     private final Registries registries;
     
+    /** The syntax OID associated with this AttributeType */
     private String syntaxOid;
+    
+    /** The syntax associated with the syntaxID */
+    private Syntax syntax;
+    
+    /** The equality OID associated with this AttributeType */
     private String equalityOid;
+
+    /** The equality MatchingRule associated with the equalityID */
+    private MatchingRule equalityMR;
+    
+    /** The substring OID associated with this AttributeType */
     private String substrOid;
+
+    /** The substring MatchingRule associated with the substringID */
+    private MatchingRule substringMR;
+    
+    /** The ordering OID associated with this AttributeType */
     private String orderingOid;
+    
+    /** The ordering MatchingRule associated with the orderingID */
+    private MatchingRule orderingMR;
+    
     private String superiorOid;
     
     
@@ -64,12 +84,19 @@
      */
     public MatchingRule getEquality() throws NamingException
     {
-        if ( equalityOid == null )
+        if ( equalityMR == null )
         {
-            return findEquality( getSuperior() );
+            if ( equalityOid == null )
+            {
+                equalityMR = findEquality( getSuperior() );
+            }
+            else
+            {
+                equalityMR = registries.getMatchingRuleRegistry().lookup( equalityOid );
+            }
         }
         
-        return registries.getMatchingRuleRegistry().lookup( equalityOid );
+        return equalityMR;
     }
 
 
@@ -88,6 +115,7 @@
         }
         
         MatchingRule mr = at.getEquality();
+        
         if ( mr == null )
         {
             return findEquality( at.getSuperior() );
@@ -104,12 +132,19 @@
      */
     public MatchingRule getOrdering() throws NamingException
     {
-        if ( orderingOid == null )
+        if ( orderingMR == null )
         {
-            return findOrdering( getSuperior() );
+            if ( orderingOid == null )
+            {
+                orderingMR = findOrdering( getSuperior() );
+            }
+            else
+            {
+                orderingMR = registries.getMatchingRuleRegistry().lookup( orderingOid );
+            }
         }
         
-        return registries.getMatchingRuleRegistry().lookup( orderingOid );
+        return orderingMR;
     }
 
 
@@ -144,12 +179,19 @@
      */
     public MatchingRule getSubstr() throws NamingException
     {
-        if ( substrOid == null )
+        if ( substringMR == null )
         {
-            return findSubstr( getSuperior() );
+            if ( substrOid == null )
+            {
+                substringMR = findSubstr( getSuperior() );
+            }
+            else
+            {
+                substringMR = registries.getMatchingRuleRegistry().lookup( substrOid );
+            }
         }
         
-        return registries.getMatchingRuleRegistry().lookup( substrOid );
+        return substringMR;
     }
 
 
@@ -198,12 +240,19 @@
      */
     public Syntax getSyntax() throws NamingException
     {
-        if ( syntaxOid == null )
+        if ( syntax == null )
         {
-            return findSyntax( getSuperior() );
+            if ( syntaxOid == null )
+            {
+                syntax = findSyntax( getSuperior() );
+            }
+            else
+            {
+                syntax = registries.getSyntaxRegistry().lookup( syntaxOid );
+            }
         }
         
-        return registries.getSyntaxRegistry().lookup( syntaxOid );
+        return syntax;
     }
     
     

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Mon Mar 17 23:12:41 2008
@@ -27,9 +27,9 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -144,7 +144,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             try
             {
@@ -176,7 +176,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             try
             {
@@ -207,7 +207,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             try
             {
@@ -246,7 +246,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             AttributeTypeDescription desc = null;
             
@@ -381,7 +381,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             ObjectClassDescription desc = null;
             
@@ -482,7 +482,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             MatchingRuleUseDescription desc = null;
             
@@ -529,7 +529,7 @@
 
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             LdapSyntaxDescription desc = null;
             
@@ -583,7 +583,7 @@
 
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             MatchingRuleDescription desc = null;
 
@@ -636,7 +636,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             DITStructureRuleDescription desc = null;
      
@@ -685,7 +685,7 @@
 
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             DITContentRuleDescription desc = null;
      
@@ -736,7 +736,7 @@
 
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             NameFormDescription desc = null;
             

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java Mon Mar 17 23:12:41 2008
@@ -23,10 +23,10 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
@@ -109,7 +109,8 @@
     {
         String schemaName = getSchemaName( name );
         AttributeType at = factory.getAttributeType( entry, targetRegistries, schemaName );
-        Set<SearchResult> dependees = dao.listAttributeTypeDependents( at );
+        Set<ServerSearchResult> dependees = dao.listAttributeTypeDependents( at );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The attributeType with OID " + at.getOid() 
@@ -138,7 +139,8 @@
     {
         Schema schema = getSchema( name );
         AttributeType oldAt = factory.getAttributeType( entry, targetRegistries, schema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listAttributeTypeDependents( oldAt );
+        Set<ServerSearchResult> dependees = dao.listAttributeTypeDependents( oldAt );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The attributeType with OID " + oldAt.getOid()
@@ -174,7 +176,8 @@
         checkNewParent( newParentName );
         Schema oldSchema = getSchema( oriChildName );
         AttributeType oldAt = factory.getAttributeType( entry, targetRegistries, oldSchema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listAttributeTypeDependents( oldAt );
+        Set<ServerSearchResult> dependees = dao.listAttributeTypeDependents( oldAt );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The attributeType with OID " + oldAt.getOid()
@@ -214,7 +217,8 @@
         checkNewParent( newParentName );
         Schema oldSchema = getSchema( oriChildName );
         AttributeType oldAt = factory.getAttributeType( entry, targetRegistries, oldSchema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listAttributeTypeDependents( oldAt );
+        Set<ServerSearchResult> dependees = dao.listAttributeTypeDependents( oldAt );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The attributeType with OID " + oldAt.getOid() 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java Mon Mar 17 23:12:41 2008
@@ -23,10 +23,10 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.MatchingRuleRegistry;
 import org.apache.directory.server.schema.registries.Registries;
@@ -94,7 +94,8 @@
     {
         String schemaName = getSchemaName( name );
         MatchingRule mr = factory.getMatchingRule( entry, targetRegistries, schemaName );
-        Set<SearchResult> dependees = dao.listMatchingRuleDependents( mr );
+        Set<ServerSearchResult> dependees = dao.listMatchingRuleDependents( mr );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The matchingRule with OID " + mr.getOid() 
@@ -123,7 +124,8 @@
     {
         Schema schema = getSchema( name );
         MatchingRule oldMr = factory.getMatchingRule( entry, targetRegistries, schema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listMatchingRuleDependents( oldMr );
+        Set<ServerSearchResult> dependees = dao.listMatchingRuleDependents( oldMr );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The matchingRule with OID " + oldMr.getOid()
@@ -160,7 +162,8 @@
         checkNewParent( newParentName );
         Schema oldSchema = getSchema( oriChildName );
         MatchingRule oldMr = factory.getMatchingRule( entry, targetRegistries, oldSchema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listMatchingRuleDependents( oldMr );
+        Set<ServerSearchResult> dependees = dao.listMatchingRuleDependents( oldMr );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The matchingRule with OID " + oldMr.getOid()
@@ -201,7 +204,8 @@
         checkNewParent( newParentName );
         Schema oldSchema = getSchema( oriChildName );
         MatchingRule oldMr = factory.getMatchingRule( entry, targetRegistries, oldSchema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listMatchingRuleDependents( oldMr );
+        Set<ServerSearchResult> dependees = dao.listMatchingRuleDependents( oldMr );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The matchingRule with OID " + oldMr.getOid() 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java Mon Mar 17 23:12:41 2008
@@ -23,10 +23,10 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
 import org.apache.directory.server.schema.registries.Registries;
@@ -94,7 +94,8 @@
     {
         String schemaName = getSchemaName( name );
         ObjectClass oc = factory.getObjectClass( entry, targetRegistries, schemaName );
-        Set<SearchResult> dependees = dao.listObjectClassDependents( oc );
+        Set<ServerSearchResult> dependees = dao.listObjectClassDependents( oc );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The objectClass with OID " + oc.getOid() 
@@ -125,7 +126,8 @@
     {
         Schema schema = getSchema( name );
         ObjectClass oldOc = factory.getObjectClass( entry, targetRegistries, schema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listObjectClassDependents( oldOc );
+        Set<ServerSearchResult> dependees = dao.listObjectClassDependents( oldOc );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldOc.getOid()
@@ -161,7 +163,8 @@
         checkNewParent( newParentName );
         Schema oldSchema = getSchema( oriChildName );
         ObjectClass oldOc = factory.getObjectClass( entry, targetRegistries, oldSchema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listObjectClassDependents( oldOc );
+        Set<ServerSearchResult> dependees = dao.listObjectClassDependents( oldOc );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldOc.getOid()
@@ -201,7 +204,8 @@
         checkNewParent( newParentName );
         Schema oldSchema = getSchema( oriChildName );
         ObjectClass oldAt = factory.getObjectClass( entry, targetRegistries, oldSchema.getSchemaName() );
-        Set<SearchResult> dependees = dao.listObjectClassDependents( oldAt );
+        Set<ServerSearchResult> dependees = dao.listObjectClassDependents( oldAt );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldAt.getOid() 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Mon Mar 17 23:12:41 2008
@@ -24,24 +24,22 @@
 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.schema.bootstrap.Schema;
 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.entry.Value;
 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 );
         }
@@ -499,7 +499,7 @@
             // check to make sure all the dependencies are also enabled
             Map<String,Schema> loaded = globalRegistries.getLoadedSchemas();
             
-            for ( ServerValue<?> value:dependencies )
+            for ( Value<?> value:dependencies )
             {
                 String dependency = ( String ) value.get();
                 
@@ -515,7 +515,7 @@
         {
             Set<String> allSchemas = loader.getSchemaNames();
             
-            for ( ServerValue<?> value:dependencies )
+            for ( Value<?> value:dependencies )
             {
                 String dependency = ( String ) value.get();
                 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java Mon Mar 17 23:12:41 2008
@@ -23,10 +23,10 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.schema.registries.SyntaxRegistry;
@@ -94,7 +94,8 @@
     {
         String oid = getOid( entry );
         
-        Set<SearchResult> dependees = dao.listSyntaxDependents( oid );
+        Set<ServerSearchResult> dependees = dao.listSyntaxDependents( oid );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The syntax with OID " + oid 
@@ -128,7 +129,8 @@
     {
         String oldOid = getOid( entry );
 
-        Set<SearchResult> dependees = dao.listSyntaxDependents( oldOid );
+        Set<ServerSearchResult> dependees = dao.listSyntaxDependents( oldOid );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The syntax with OID " + oldOid
@@ -168,7 +170,8 @@
         checkNewParent( newParentName );
         String oldOid = getOid( entry );
 
-        Set<SearchResult> dependees = dao.listSyntaxDependents( oldOid );
+        Set<ServerSearchResult> dependees = dao.listSyntaxDependents( oldOid );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The syntax with OID " + oldOid 
@@ -212,7 +215,8 @@
         checkNewParent( newParentName );
         String oid = getOid( entry );
         
-        Set<SearchResult> dependees = dao.listSyntaxDependents( oid );
+        Set<ServerSearchResult> dependees = dao.listSyntaxDependents( oid );
+        
         if ( dependees != null && dependees.size() > 0 )
         {
             throw new LdapOperationNotSupportedException( "The syntax with OID " + oid 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java Mon Mar 17 23:12:41 2008
@@ -47,11 +47,16 @@
 
     private ObjectClassTypeEnum objectClassType;
     private ObjectClass[] superClasses;
+
+    private String[] mayListOids;
     private AttributeType[] mayList = EMPTY_AT_ARRAY;
+    private boolean mayListReloaded;
+    
+    private String[] mustListOids;
     private AttributeType[] mustList = EMPTY_AT_ARRAY;
+    private boolean mustListReloaded;
+
     private String[] superClassOids;
-    private String[] mayListOids;
-    private String[] mustListOids;
     
     
     protected ObjectClassImpl( String oid, Registries registries )
@@ -91,59 +96,73 @@
         {
             return EMPTY_AT_ARRAY;
         }
-        
-        for ( int ii = 0; ii < mayListOids.length; ii++ )
+
+        if ( mayListReloaded )
         {
-            mayList[ii] = registries.getAttributeTypeRegistry().lookup( mayListOids[ii] );
+            for ( int ii = 0; ii < mayListOids.length; ii++ )
+            {
+                mayList[ii] = registries.getAttributeTypeRegistry().lookup( mayListOids[ii] );
+            }
+            
+            mayListReloaded = false;
         }
-        
+
         return mayList;
     }
     
     
-    public void setMayListOids( String[] mayListOids )
+    public void setMayListOids( String[] mayListOids ) throws NamingException
     {
         if ( mayListOids == null )
         {
             this.mayListOids = EMPTY_STR_ARRAY;
-            this.mayList = EMPTY_AT_ARRAY;
+            mayList = EMPTY_AT_ARRAY;
         }
         else
         {
             this.mayListOids = mayListOids;
-            this.mayList = new AttributeType[mayListOids.length];
+            mayList = new AttributeType[mayListOids.length];
         }
+
+        mayListReloaded = true;
     }
 
 
     public AttributeType[] getMustList() throws NamingException
     {
-        if ( this.mustListOids == null )
+        if ( mustListOids == null )
         {
             return EMPTY_AT_ARRAY;
         }
         
-        for ( int ii = 0; ii < mustListOids.length; ii++ )
+        if ( mustListReloaded )
         {
-            mustList[ii] = registries.getAttributeTypeRegistry().lookup( mustListOids[ii] );
+            for ( int ii = 0; ii < mustListOids.length; ii++ )
+            {
+                mustList[ii] = registries.getAttributeTypeRegistry().lookup( mustListOids[ii] );
+            }
+            
+            mustListReloaded = false;
         }
         
         return mustList;
     }
     
     
-    public void setMustListOids( String[] mustListOids )
+    public void setMustListOids( String[] mustListOids ) throws NamingException
     {
         if ( mustListOids == null )
         {
             this.mustListOids = EMPTY_STR_ARRAY;
-            this.mustList = EMPTY_AT_ARRAY;
+            mustList = EMPTY_AT_ARRAY;
         }
         else
         {
             this.mustListOids = mustListOids;
-            this.mustList = new AttributeType[mustListOids.length];
+            mustList = new AttributeType[mustListOids.length];
         }
+        
+        mustListReloaded = true;
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Mon Mar 17 23:12:41 2008
@@ -35,14 +35,11 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 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.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -53,6 +50,7 @@
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.schema.registries.SchemaLoader;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.Normalizer;
@@ -63,7 +61,6 @@
 import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.Base64;
     
 import org.slf4j.Logger;
@@ -200,16 +197,16 @@
          * OID registry.  To prevent this we need to load all the OID's in advance
          * regardless of whether they are used or not.
          */
-        NamingEnumeration<SearchResult> ne = dao.listAllNames();
+        NamingEnumeration<ServerSearchResult> ne = dao.listAllNames();
         
         while ( ne.hasMore() )
         {
-            ServerEntry entry = ServerEntryUtils.toServerEntry( ne.next().getAttributes(), new LdapDN( "" ), registries );
+            ServerEntry entry = ne.next().getServerEntry();
             String oid = entry.get( mOidAT ).getString();
             ServerAttribute names = entry.get( mNameAT );
             targetRegistries.getOidRegistry().register( oid, oid );
             
-            for ( ServerValue<?> value:names )
+            for ( Value<?> value:names )
             {
                 targetRegistries.getOidRegistry().register( ( String ) value.get(), oid );
             }
@@ -249,17 +246,17 @@
     public Set<String> listDependentSchemaNames( String schemaName ) throws NamingException
     {
         Set<String> dependees = new HashSet<String>();
-        Set<SearchResult> results = dao.listSchemaDependents( schemaName );
+        Set<ServerSearchResult> results = dao.listSchemaDependents( schemaName );
         
         if ( results.isEmpty() )
         {
             return dependees;
         }
         
-        for ( SearchResult sr: results )
+        for ( ServerSearchResult sr: results )
         {
-            Attribute cn = AttributeUtils.getAttribute( sr.getAttributes(), cnAT );
-            dependees.add( (String)cn.get() );
+            ServerAttribute cn = sr.getServerEntry().get( cnAT );
+            dependees.add( cn.getString() );
         }
         
         return dependees;
@@ -277,17 +274,17 @@
     public Set<String> listEnabledDependentSchemaNames( String schemaName ) throws NamingException
     {
         Set<String> dependees = new HashSet<String>();
-        Set<SearchResult> results = dao.listEnabledSchemaDependents( schemaName );
+        Set<ServerSearchResult> results = dao.listEnabledSchemaDependents( schemaName );
         
         if ( results.isEmpty() )
         {
             return dependees;
         }
         
-        for ( SearchResult sr: results )
+        for ( ServerSearchResult sr: results )
         {
-            Attribute cn = AttributeUtils.getAttribute( sr.getAttributes(), cnAT );
-            dependees.add( (String)cn.get() );
+            ServerAttribute cn = sr.getServerEntry().get( cnAT );
+            dependees.add( cn.getString() );
         }
         
         return dependees;
@@ -428,12 +425,12 @@
         
         LOG.debug( "{} schema: loading objectClasses", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             ObjectClass oc = factory.getObjectClass( attrs, targetRegistries, schema.getSchemaName() );
@@ -529,12 +526,12 @@
         
         LOG.debug( "{} schema: loading attributeTypes", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             AttributeType at = factory.getAttributeType( attrs, targetRegistries, schema.getSchemaName() );
@@ -627,12 +624,12 @@
         
         LOG.debug( "{} schema: loading matchingRules", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             MatchingRule mrule = factory.getMatchingRule( attrs, targetRegistries, schema.getSchemaName() );
@@ -660,12 +657,12 @@
         
         LOG.debug( "{} schema: loading syntaxes", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             Syntax syntax = factory.getSyntax( attrs, targetRegistries, schema.getSchemaName() );
@@ -692,12 +689,12 @@
         
         LOG.debug( "{} schema: loading syntaxCheckers", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             SyntaxChecker sc = factory.getSyntaxChecker( attrs, targetRegistries );
@@ -726,12 +723,12 @@
         
         LOG.debug( "{} schema: loading normalizers", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             Normalizer normalizer = factory.getNormalizer( attrs, targetRegistries );
@@ -783,10 +780,7 @@
     
     private ServerEntry lookupPartition( LdapDN dn ) throws NamingException
     {
-        return ServerEntryUtils.toServerEntry( 
-            partition.lookup( 
-                new LookupOperationContext( registries, dn ) ), 
-            dn, registries );
+        return partition.lookup( new LookupOperationContext( registries, dn ) );
     }
     
     private void loadComparators( Schema schema, Registries targetRegistries ) throws NamingException
@@ -807,12 +801,12 @@
         
         LOG.debug( "{} schema: loading comparators", schema.getSchemaName() );
         
-        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        NamingEnumeration<ServerSearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
         
         while ( list.hasMore() )
         {
-            SearchResult result = list.next();
-            LdapDN resultDN = new LdapDN( result.getName() );
+        	ServerSearchResult result = list.next();
+            LdapDN resultDN = result.getDn();
             resultDN.normalize( atRegistry.getNormalizerMapping() );
             ServerEntry attrs = lookupPartition( resultDN );
             Comparator comparator = factory.getComparator( attrs, targetRegistries );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java Mon Mar 17 23:12:41 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/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java Mon Mar 17 23:12:41 2008
@@ -20,11 +20,17 @@
 package org.apache.directory.server.core.schema;
 
 
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
 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.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
@@ -34,10 +40,12 @@
 
 import javax.naming.NamingException;
 import javax.naming.Name;
-import javax.naming.NamingEnumeration;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.Attribute;
+
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -68,15 +76,15 @@
      * @throws NamingException if modify operations leave the entry inconsistent
      * without a STRUCTURAL objectClass
      */
-    public static void preventStructuralClassRemovalOnModifyReplace( ObjectClassRegistry registry, Name name, int mod,
-        Attribute attribute ) throws NamingException
+    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;
         }
 
-        if ( !SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( attribute.getID() ) )
+        if ( !SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( attribute.getUpId() ) )
         {
             return;
         }
@@ -86,17 +94,20 @@
         if ( attribute.size() == 0 )
         {
             String msg = "Modify operation leaves no structural objectClass for entry " + name;
+            
             if ( log.isInfoEnabled() )
             {
                 log.info( msg + ".  Raising LdapSchemaViolationException." );
             }
+            
             throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED );
         }
 
         // check that there is at least one structural objectClass in the replacement set
-        for ( int ii = 0; ii < attribute.size(); ii++ )
+        for ( Value<?> value:attribute )
         {
-            ObjectClass ocType = registry.lookup( ( String ) attribute.get( ii ) );
+            ObjectClass ocType = registry.lookup( ( String ) value.get() );
+
             if ( ocType.getType() == ObjectClassTypeEnum.STRUCTURAL )
             {
                 return;
@@ -188,39 +199,49 @@
      * @throws NamingException if modify operations leave the entry inconsistent
      * without a STRUCTURAL objectClass
      */
-    public static void preventStructuralClassRemovalOnModifyRemove( ObjectClassRegistry registry, Name name, int mod,
-        Attribute attribute, Attribute entryObjectClasses ) throws NamingException
+    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;
         }
 
-        if ( !SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( attribute.getID() ) )
+        if ( !attribute.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) )
         {
             return;
         }
         
         // check if there is any attribute value as "".
         // if there is remove it so that it will be considered as not even provided.
-        for( int ii = 0; ii < attribute.size(); ii++ )
+        List<Value<?>> removed = new ArrayList<Value<?>>();
+        
+        // Fist gather the value to remove
+        for ( Value<?> value:attribute )
         {
-            Object value = attribute.get( ii );
-            if ( "".equals( value ) )
+            if ( ((String)value.get()).length() == 0 )
             {
-                attribute.remove( ii );
+                removed.add( value );
             }
         }
+        
+        // Now remove the values from the attribute
+        for ( Value<?> value:removed )
+        {
+            attribute.remove( value );
+        }
 
         // whoever issued the modify operation is insane they want to delete
         // all the objectClass values in which case we must throw an exception
         if ( attribute.size() == 0 )
         {
             String msg = "Modify operation leaves no structural objectClass for entry " + name;
+            
             if ( log.isInfoEnabled() )
             {
                 log.info( msg + ".  Raising LdapSchemaViolationException." );
             }
+            
             throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED );
         }
 
@@ -228,17 +249,19 @@
         // we can analyze what remains in this attribute to make sure a structural
         // objectClass is present for the entry
 
-        Attribute cloned = ( Attribute ) entryObjectClasses.clone();
-        for ( int ii = 0; ii < attribute.size(); ii++ )
+        ServerAttribute cloned = ( ServerAttribute ) entryObjectClasses.clone();
+        
+        for ( Value<?> value:attribute )
         {
-            cloned.remove( attribute.get( ii ) );
+            cloned.remove( value );
         }
 
         // check resultant set of objectClass values for a structural objectClass
-        for ( int ii = 0; ii < cloned.size(); ii++ )
+        for ( Value<?> objectClass:cloned )
         {
-            ObjectClass ocType = registry.lookup( ( String ) cloned.get( ii ) );
-            if ( ocType.getType() == ObjectClassTypeEnum.STRUCTURAL )
+            ObjectClass oc = registry.lookup( (String)objectClass.get() );
+            
+            if ( oc.getType() == ObjectClassTypeEnum.STRUCTURAL )
             {
                 return;
             }
@@ -247,10 +270,12 @@
         // no structural object classes exist for the entry after the modifications
         // to the objectClass attribute so we need to complain about that
         String msg = "Modify operation leaves no structural objectClass for entry " + name;
+
         if ( log.isInfoEnabled() )
         {
             log.info( msg + ".  Raising LdapSchemaViolationException." );
         }
+        
         throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECT_CLASS_MODS_PROHIBITED );
     }
 
@@ -268,7 +293,7 @@
      * @param entryObjectClasses the entry being modified
      * @throws NamingException if modify operations leave the entry inconsistent
      * without a STRUCTURAL objectClass
-     */
+     *
     public static void preventStructuralClassRemovalOnModifyRemove( ObjectClassRegistry registry, Name name, int mod,
         Attributes attributes, Attribute entryObjectClasses ) throws NamingException
     {
@@ -356,16 +381,16 @@
      * @param attribute the attribute being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyReplace( Name name, int mod, Attribute 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;
         }
 
-        Set rdnAttributes = getRdnAttributes( name );
-        String id = oidRegistry.getOid( attribute.getID() );
+        Set<String> rdnAttributes = getRdnAttributes( name );
+        String id = oidRegistry.getOid( attribute.getUpId() );
 
         if ( !rdnAttributes.contains( id ) )
         {
@@ -429,7 +454,7 @@
      * @param attributes the attributes being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyReplace( Name name, int mod, Attributes attributes, OidRegistry oidRegistry )
+    public static void preventRdnChangeOnModifyReplace( LdapDN name, int mod, ServerEntry entry, OidRegistry oidRegistry )
         throws NamingException
     {
         if ( mod != DirContext.REPLACE_ATTRIBUTE )
@@ -437,18 +462,20 @@
             return;
         }
 
-        Set rdnAttributes = getRdnAttributes( name );
-        NamingEnumeration list = attributes.getIDs();
-        while ( list.hasMore() )
+        Set<String> rdnAttributes = getRdnAttributes( name );
+        
+        for ( AttributeType attributeType:entry.getAttributeTypes() )
         {
-            String id = ( String ) list.next();
+            String id = attributeType.getName();
 
             if ( rdnAttributes.contains( id ) )
             {
+                ServerAttribute rdnAttr = entry.get( id );
+
                 // if the attribute values to delete are not specified then all values
                 // for the attribute are to be deleted in which case we must just throw
                 // a schema violation exception with the notAllowedOnRdn result code
-                if ( attributes.get( id ).size() == 0 )
+                if ( rdnAttr.size() == 0 )
                 {
                     String msg = "Modify operation attempts to delete RDN attribute ";
                     msg += id + " on entry " + name + " violates schema constraints";
@@ -457,6 +484,7 @@
                     {
                         log.info( msg + ". SchemaChecker is throwing a schema violation exception." );
                     }
+                    
                     throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
                 }
 
@@ -464,22 +492,20 @@
                 // of the Rdn attribute so we must check to make sure all the old
                 // rdn attribute values are present in the replacement set
                 String rdnValue = getRdnValue( id, name, oidRegistry );
-                Attribute rdnAttr = attributes.get( id );
-                for ( int ii = 0; ii < rdnAttr.size(); ii++ )
+
+                // if the old rdn value is not in the rdn attribute then
+                // we must complain with a schema violation
+                if ( !rdnAttr.contains( rdnValue ) )
                 {
-                    // if the old rdn value is not in the rdn attribute then
-                    // we must complain with a schema violation
-                    if ( !rdnAttr.contains( rdnValue ) )
-                    {
-                        String msg = "Modify operation attempts to delete RDN attribute values in use for ";
-                        msg += id + " on entry " + name + " and violates schema constraints";
+                    String msg = "Modify operation attempts to delete RDN attribute values in use for ";
+                    msg += id + " on entry " + name + " and violates schema constraints";
 
-                        if ( log.isInfoEnabled() )
-                        {
-                            log.info( msg + ". SchemaChecker is throwing a schema violation exception." );
-                        }
-                        throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
+                    if ( log.isInfoEnabled() )
+                    {
+                        log.info( msg + ". SchemaChecker is throwing a schema violation exception." );
                     }
+                    
+                    throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
                 }
             }
         }
@@ -505,16 +531,16 @@
      * @param attribute the attribute being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyRemove( Name name, int mod, Attribute 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;
         }
 
-        Set rdnAttributes = getRdnAttributes( name );
-        String id = attribute.getID();
+        Set<String> rdnAttributes = getRdnAttributes( name );
+        String id = attribute.getUpId();
 
         if ( !rdnAttributes.contains( oidRegistry.getOid( id ) ) )
         {
@@ -533,6 +559,7 @@
             {
                 log.info( msg + ". SchemaChecker is throwing a schema violation exception." );
             }
+            
             throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
         }
 
@@ -540,9 +567,10 @@
         // of the Rdn attribute so we must check if one of those values
         // are used by the Rdn attribute value pair for the name of the entry
         String rdnValue = getRdnValue( id, name, oidRegistry );
-        for ( int ii = 0; ii < attribute.size(); ii++ )
+        
+        for ( Value<?> value:attribute )
         {
-            if ( rdnValue.equals( attribute.get( ii ) ) )
+            if ( rdnValue.equals( (String)value.get() ) )
             {
                 String msg = "Modify operation attempts to delete RDN attribute values in use for ";
                 msg += id + " on entry " + name + " and violates schema constraints";
@@ -551,6 +579,7 @@
                 {
                     log.info( msg + ". SchemaChecker is throwing a schema violation exception." );
                 }
+                
                 throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
             }
         }
@@ -576,7 +605,7 @@
      * @param attributes the attributes being modified
      * @throws NamingException if the modify operation is removing an Rdn attribute
      */
-    public static void preventRdnChangeOnModifyRemove( Name name, int mod, Attributes attributes, OidRegistry oidRegistry )
+    public static void preventRdnChangeOnModifyRemove( LdapDN name, int mod, ServerEntry entry, OidRegistry oidRegistry )
         throws NamingException
     {
         if ( mod != DirContext.REMOVE_ATTRIBUTE )
@@ -584,18 +613,18 @@
             return;
         }
 
-        Set rdnAttributes = getRdnAttributes( name );
-        NamingEnumeration list = attributes.getIDs();
-        while ( list.hasMore() )
+        Set<String> rdnAttributes = getRdnAttributes( name );
+        
+        for ( AttributeType attributeType:entry.getAttributeTypes() )
         {
-            String id = ( String ) list.next();
+            String id = attributeType.getName();
 
             if ( rdnAttributes.contains( id ) )
             {
                 // if the attribute values to delete are not specified then all values
                 // for the attribute are to be deleted in which case we must just throw
                 // a schema violation exception with the notAllowedOnRdn result code
-                if ( attributes.get( id ).size() == 0 )
+                if ( entry.get( id ).size() == 0 )
                 {
                     String msg = "Modify operation attempts to delete RDN attribute ";
                     msg += id + " on entry " + name + " violates schema constraints";
@@ -611,10 +640,11 @@
                 // of the Rdn attribute so we must check if one of those values
                 // are used by the Rdn attribute value pair for the name of the entry
                 String rdnValue = getRdnValue( id, name, oidRegistry );
-                Attribute rdnAttr = attributes.get( id );
-                for ( int ii = 0; ii < rdnAttr.size(); ii++ )
+                ServerAttribute rdnAttr = entry.get( id );
+                
+                for ( Value<?> value:rdnAttr )
                 {
-                    if ( rdnValue.equals( rdnAttr.get( ii ) ) )
+                    if ( rdnValue.equals( (String)value.get() ) )
                     {
                         String msg = "Modify operation attempts to delete RDN attribute values in use for ";
                         msg += id + " on entry " + name + " and violates schema constraints";
@@ -686,11 +716,10 @@
      * @return the set of attributes composing the Rdn for the name
      * @throws NamingException if the syntax of the Rdn is incorrect
      */
-    @SuppressWarnings("unchecked")
-    private static Set getRdnAttributes( Name name ) throws NamingException
+    private static Set<String> getRdnAttributes( LdapDN name ) throws NamingException
     {
         String[] comps = NamespaceTools.getCompositeComponents( name.get( name.size() - 1 ) );
-        Set attributes = new HashSet();
+        Set<String> attributes = new HashSet<String>();
 
         for ( int ii = 0; ii < comps.length; ii++ )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java Mon Mar 17 23:12:41 2008
@@ -33,10 +33,10 @@
 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.ServerValue;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -126,7 +126,7 @@
             Set<String> depsSet = new HashSet<String>();
             ServerAttribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT );
             
-            for ( ServerValue<?> value:depsAttr )
+            for ( Value<?> value:depsAttr )
             {
                 depsSet.add( (String)value.get() );
             }
@@ -589,7 +589,7 @@
         
         int pos = 0;
         
-        for ( ServerValue<?> value:attr )
+        for ( Value<?> value:attr )
         {
             strings[pos++] = (String)value.get();
         }
@@ -713,7 +713,7 @@
         {
             List<String> values = new ArrayList<String>();
             
-            for ( ServerValue<?> name:names )
+            for ( Value<?> name:names )
             {
                 values.add( (String)name.get() );
             }



Mime
View raw message