directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r612574 [2/2] - in /directory/apacheds/branches/bigbang: core-entry/src/main/java/org/apache/directory/server/core/entry/ core-integ/src/test/java/org/apache/directory/server/core/schema/ core/src/main/java/org/apache/directory/server/core/...
Date Wed, 16 Jan 2008 21:37:34 GMT
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Wed Jan 16 13:37:31 2008
@@ -21,6 +21,10 @@
 
 
 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.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.schema.registries.SchemaObjectRegistry;
@@ -36,8 +40,6 @@
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 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.util.Iterator;
@@ -86,28 +88,31 @@
      * @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, Attributes mods, Attributes entry, 
-        Attributes targetEntry, boolean cascade ) throws NamingException
+    public void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, 
+        ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
-        Attribute disabledInMods = AttributeUtils.getAttribute( mods, disabledAT );
+        ServerAttribute disabledInMods = mods.get( disabledAT );
+        
         if ( disabledInMods != null )
         {
-            disable( name, modOp, disabledInMods, AttributeUtils.getAttribute( entry, disabledAT ) );
+            disable( name, modOp, disabledInMods, entry.get( disabledAT ) );
         }
         
         // check if the new schema is enabled or disabled
         boolean isEnabled = false;
-        Attribute disabled = AttributeUtils.getAttribute( targetEntry, this.disabledAT );
+        ServerAttribute disabled = targetEntry.get( this.disabledAT );
+        
         if ( disabled == null )
         {
             isEnabled = true;
         }
-        else if ( ! disabled.get().equals( "TRUE" ) )
+        else if ( ! disabled.getString().equals( "TRUE" ) )
         {
             isEnabled = true;
         }
 
-        Attribute dependencies = AttributeUtils.getAttribute( mods, dependenciesAT );
+        ServerAttribute dependencies = mods.get( dependenciesAT );
+        
         if ( dependencies != null )
         {
             checkForDependencies( isEnabled, targetEntry );
@@ -124,32 +129,36 @@
      * @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, Attributes entry,
-        Attributes targetEntry, boolean cascade ) throws NamingException
+    public void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry,
+        ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
-        Attribute disabledInEntry = AttributeUtils.getAttribute( entry, disabledAT );
+        ServerAttribute disabledInEntry = entry.get( disabledAT );
         ModificationItem disabledModification = AttributeUtils.getModificationItem( mods, disabledAT );
         
         if ( disabledModification != null )
         {
-            disable( name, disabledModification.getModificationOp(), disabledModification.getAttribute(), 
-                disabledInEntry );
+            disable( name, 
+                     disabledModification.getModificationOp(), 
+                     ServerEntryUtils.toServerAttribute( disabledModification.getAttribute(), disabledAT ), 
+                     disabledInEntry );
         }
 
         // check if the new schema is enabled or disabled
         boolean isEnabled = false;
-        Attribute disabled = AttributeUtils.getAttribute( targetEntry, this.disabledAT );
+        ServerAttribute disabled = targetEntry.get( disabledAT );
         
         if ( disabled == null )
         {
             isEnabled = true;
         }
-        else if ( ! disabled.get().equals( "TRUE" ) )
+        else if ( ! disabled.contains( "TRUE" ) )
         {
             isEnabled = true;
         }
 
-        Attribute dependencies = AttributeUtils.getAttribute( mods, dependenciesAT );
+        ServerAttribute dependencies = 
+            ServerEntryUtils.toServerAttribute( 
+                AttributeUtils.getAttribute( mods, dependenciesAT ), dependenciesAT );
         
         if ( dependencies != null )
         {
@@ -158,7 +167,7 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, Attributes entry, boolean cascaded ) throws NamingException
+    public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, ServerEntry entry, boolean cascaded ) throws NamingException
     {
 
     }
@@ -170,7 +179,7 @@
      * @param name the dn of the new metaSchema object
      * @param entry the attributes of the new metaSchema object
      */
-    public void add( LdapDN name, Attributes entry ) throws NamingException
+    public void add( LdapDN name, ServerEntry entry ) throws NamingException
     {
         LdapDN parentDn = ( LdapDN ) name.clone();
         parentDn.remove( parentDn.size() - 1 );
@@ -183,12 +192,13 @@
 
         // check if the new schema is enabled or disabled
         boolean isEnabled = false;
-        Attribute disabled = AttributeUtils.getAttribute( entry, this.disabledAT );
+        ServerAttribute disabled = entry.get( disabledAT );
+        
         if ( disabled == null )
         {
             isEnabled = true;
         }
-        else if ( ! disabled.get().equals( "TRUE" ) )
+        else if ( ! disabled.contains( "TRUE" ) )
         {
             isEnabled = true;
         }
@@ -236,10 +246,10 @@
      * @param name the dn of the metaSchema object being deleted
      * @param entry the attributes of the metaSchema object 
      */
-    public void delete( LdapDN name, Attributes entry, boolean cascade ) throws NamingException
+    public void delete( LdapDN name, ServerEntry entry, boolean cascade ) throws NamingException
     {
-        Attribute cn = AttributeUtils.getAttribute( entry, cnAT );
-        String schemaName = ( String ) cn.get();
+        ServerAttribute cn = entry.get( cnAT );
+        String schemaName = cn.getString();
 
         // Before allowing a schema object to be deleted we must check
         // to make sure it's not depended upon by another schema
@@ -267,7 +277,7 @@
      * @param entry the entry of the metaSchema object before the rename
      * @param newRdn the new commonName of the metaSchema object
      */
-    public void rename( LdapDN name, Attributes entry, Rdn newRdn, boolean cascade ) throws NamingException
+    public void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascade ) throws NamingException
     {
         String rdnAttribute = newRdn.getUpType();
         String rdnAttributeOid = globalRegistries.getOidRegistry().getOid( rdnAttribute );
@@ -308,7 +318,8 @@
 
         // check if the new schema is enabled or disabled
         boolean isEnabled = false;
-        Attribute disabled = AttributeUtils.getAttribute( entry, this.disabledAT );
+        ServerAttribute disabled = entry.get( disabledAT );
+        
         if ( disabled == null )
         {
             isEnabled = true;
@@ -348,7 +359,7 @@
      * UNWILLING_TO_PERFORM LdapException.
      */
     public void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn, 
-        Attributes entry, boolean cascade ) throws NamingException
+        ServerEntry entry, boolean cascade ) throws NamingException
     {
         throw new LdapOperationNotSupportedException( "Moving around schemas is not allowed.",
             ResultCodeEnum.UNWILLING_TO_PERFORM );
@@ -360,7 +371,7 @@
      * UNWILLING_TO_PERFORM LdapException.
      */
     public void replace( LdapDN oriChildName, LdapDN newParentName, 
-        Attributes entry, boolean cascade ) throws NamingException
+        ServerEntry entry, boolean cascade ) throws NamingException
     {
         throw new LdapOperationNotSupportedException( "Moving around schemas is not allowed.",
             ResultCodeEnum.UNWILLING_TO_PERFORM );
@@ -372,7 +383,7 @@
     // -----------------------------------------------------------------------
 
     
-    private void disable( LdapDN name, int modOp, Attribute disabledInMods, Attribute disabledInEntry )
+    private void disable( LdapDN name, int modOp, ServerAttribute disabledInMods, ServerAttribute disabledInEntry )
         throws NamingException
     {
         switch ( modOp )
@@ -384,7 +395,7 @@
             case ( DirContext.ADD_ATTRIBUTE   ):
                 if ( disabledInEntry == null )
                 {
-                    if ( "TRUE".equalsIgnoreCase( ( String ) disabledInMods.get() ) )
+                    if ( "TRUE".equalsIgnoreCase( disabledInMods.getString() ) )
                     {
                         disableSchema( getSchemaName( name ) );
                     }
@@ -396,7 +407,7 @@
              * disabled.  If so we enable the schema.
              */
             case ( DirContext.REMOVE_ATTRIBUTE   ):
-                if ( "TRUE".equalsIgnoreCase( ( String ) disabledInEntry.get() ) )
+                if ( "TRUE".equalsIgnoreCase( disabledInEntry.getString() ) )
                 {
                     enableSchema( getSchemaName( name ) );
                 }
@@ -408,8 +419,8 @@
              * schema is not disabled we disable it if the mods set m-disabled to true.
              */
             case ( DirContext.REPLACE_ATTRIBUTE   ):
-                boolean isCurrentlyDisabled = "TRUE".equalsIgnoreCase( ( String ) disabledInEntry.get() );
-                boolean isNewStateDisabled = "TRUE".equalsIgnoreCase( ( String ) disabledInMods.get() );
+                boolean isCurrentlyDisabled = "TRUE".equalsIgnoreCase( disabledInEntry.getString() );
+                boolean isNewStateDisabled = "TRUE".equalsIgnoreCase( disabledInMods.getString() );
 
                 if ( isCurrentlyDisabled && !isNewStateDisabled )
                 {
@@ -474,9 +485,9 @@
      * @throws NamingException if the dependencies do not resolve or are not
      * loaded (enabled)
      */
-    private void checkForDependencies( boolean isEnabled, Attributes entry ) throws NamingException
+    private void checkForDependencies( boolean isEnabled, ServerEntry entry ) throws NamingException
     {
-        Attribute dependencies = AttributeUtils.getAttribute( entry, this.dependenciesAT );
+        ServerAttribute dependencies = entry.get( this.dependenciesAT );
 
         if ( dependencies == null )
         {
@@ -486,10 +497,14 @@
         if ( isEnabled )
         {
             // check to make sure all the dependencies are also enabled
-            Map<String,Schema> loaded = globalRegistries.getLoadedSchemas(); 
-            for ( int ii = 0; ii < dependencies.size(); ii++ )
+            Map<String,Schema> loaded = globalRegistries.getLoadedSchemas();
+            
+            Iterator<ServerValue<?>> values = dependencies.getAll();
+            
+            while ( values.hasNext() )
             {
-                String dependency = ( String ) dependencies.get( ii );
+                String dependency = ( String ) values.next().get();
+                
                 if ( ! loaded.containsKey( dependency ) )
                 {
                     throw new LdapOperationNotSupportedException( 
@@ -501,9 +516,13 @@
         else
         {
             Set<String> allSchemas = loader.getSchemaNames();
-            for ( int ii = 0; ii < dependencies.size(); ii++ )
+            
+            Iterator<ServerValue<?>> values = dependencies.getAll();
+            
+            while ( values.hasNext() )
             {
-                String dependency = ( String ) dependencies.get( ii );
+                String dependency = ( String ) values.next().get();
+                
                 if ( ! allSchemas.contains( dependency ) )
                 {
                     throw new LdapOperationNotSupportedException( 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java Wed Jan 16 13:37:31 2008
@@ -24,10 +24,10 @@
 import java.util.List;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 
 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.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.schema.registries.SyntaxCheckerRegistry;
@@ -36,14 +36,12 @@
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.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.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;
 
 
@@ -76,7 +74,7 @@
     }
 
 
-    private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, Attributes entry ) 
+    private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, ServerEntry entry ) 
         throws NamingException
     {
         SyntaxCheckerDescription description = new SyntaxCheckerDescription();
@@ -84,18 +82,20 @@
         List<String> values = new ArrayList<String>();
         values.add( schemaName );
         description.addExtension( MetaSchemaConstants.X_SCHEMA, values );
-        description.setFqcn( ( String ) AttributeUtils.getAttribute( entry, fqcnAT ).get() );
+        description.setFqcn( entry.get( fqcnAT ).getString() );
+        
+        ServerAttribute desc = entry.get( descAT );
         
-        Attribute desc = AttributeUtils.getAttribute( entry, descAT );
         if ( desc != null && desc.size() > 0 )
         {
-            description.setDescription( ( String ) desc.get() );
+            description.setDescription( desc.getString() );
         }
         
-        Attribute bytecode = AttributeUtils.getAttribute( entry, byteCodeAT );
+        ServerAttribute bytecode = entry.get( byteCodeAT );
+        
         if ( bytecode != null && bytecode.size() > 0 )
         {
-            byte[] bytes = ( byte[] ) bytecode.get();
+            byte[] bytes = bytecode.getBytes();
             description.setBytecode( new String( Base64.encode( bytes ) ) );
         }
 
@@ -103,7 +103,7 @@
     }
 
     
-    protected void modify( LdapDN name, Attributes entry, Attributes targetEntry, boolean cascade ) throws NamingException
+    protected void modify( LdapDN name, ServerEntry entry, ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
         String oid = getOid( entry );
         SyntaxChecker syntaxChecker = factory.getSyntaxChecker( targetEntry, targetRegistries );
@@ -120,7 +120,7 @@
     }
 
 
-    public void add( LdapDN name, Attributes entry ) throws NamingException
+    public void add( LdapDN name, ServerEntry entry ) throws NamingException
     {
         LdapDN parentDn = ( LdapDN ) name.clone();
         parentDn.remove( parentDn.size() - 1 );
@@ -164,7 +164,7 @@
     }
 
 
-    public void delete( LdapDN name, Attributes entry, boolean cascade ) throws NamingException
+    public void delete( LdapDN name, ServerEntry entry, boolean cascade ) throws NamingException
     {
         delete( getOid( entry ), cascade );
     }
@@ -187,7 +187,7 @@
     }
 
 
-    public void rename( LdapDN name, Attributes entry, Rdn newRdn, boolean cascade ) throws NamingException
+    public void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascade ) throws NamingException
     {
         String oldOid = getOid( entry );
 
@@ -200,7 +200,7 @@
         }
 
         Schema schema = getSchema( name );
-        Attributes targetEntry = ( Attributes ) entry.clone();
+        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         if ( super.targetRegistries.getSyntaxCheckerRegistry().hasSyntaxChecker( newOid ) )
         {
@@ -208,7 +208,7 @@
                 ResultCodeEnum.OTHER );
         }
 
-        targetEntry.put( new AttributeImpl( MetaSchemaConstants.M_OID_AT, newOid ) );
+        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         if ( ! schema.isDisabled() )
         {
             SyntaxChecker syntaxChecker = factory.getSyntaxChecker( targetEntry, targetRegistries );
@@ -222,7 +222,7 @@
 
 
     public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn, 
-        Attributes entry, boolean cascade ) throws NamingException
+        ServerEntry entry, boolean cascade ) throws NamingException
     {
         checkNewParent( newParentName );
         String oldOid = getOid( entry );
@@ -237,7 +237,7 @@
 
         Schema oldSchema = getSchema( oriChildName );
         Schema newSchema = getSchema( newParentName );
-        Attributes targetEntry = ( Attributes ) entry.clone();
+        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         
         String newOid = ( String ) newRdn.getValue();
         if ( super.targetRegistries.getSyntaxCheckerRegistry().hasSyntaxChecker( newOid ) )
@@ -246,7 +246,7 @@
                 ResultCodeEnum.OTHER );
         }
 
-        targetEntry.put( new AttributeImpl( MetaSchemaConstants.M_OID_AT, newOid ) );
+        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         SyntaxChecker syntaxChecker = factory.getSyntaxChecker( targetEntry, targetRegistries );
 
         if ( ! oldSchema.isDisabled() )
@@ -264,7 +264,7 @@
     }
 
 
-    public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry, boolean cascade ) 
+    public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
         throws NamingException
     {
         checkNewParent( newParentName );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java Wed Jan 16 13:37:31 2008
@@ -23,17 +23,16 @@
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 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.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.server.schema.registries.SyntaxRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
@@ -63,7 +62,7 @@
     }
 
     
-    protected void modify( LdapDN name, Attributes entry, Attributes targetEntry, 
+    protected void modify( LdapDN name, ServerEntry entry, ServerEntry targetEntry, 
         boolean cascade ) throws NamingException
     {
         String oid = getOid( entry );
@@ -78,7 +77,7 @@
     }
 
     
-    public void add( LdapDN name, Attributes entry ) throws NamingException
+    public void add( LdapDN name, ServerEntry entry ) throws NamingException
     {
         LdapDN parentDn = ( LdapDN ) name.clone();
         parentDn.remove( parentDn.size() - 1 );
@@ -91,7 +90,7 @@
     }
 
 
-    public void delete( LdapDN name, Attributes entry, boolean cascade ) throws NamingException
+    public void delete( LdapDN name, ServerEntry entry, boolean cascade ) throws NamingException
     {
         String oid = getOid( entry );
         
@@ -125,7 +124,7 @@
     }
 
     
-    public void rename( LdapDN name, Attributes entry, Rdn newRdn, boolean cascade ) throws NamingException
+    public void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascade ) throws NamingException
     {
         String oldOid = getOid( entry );
 
@@ -140,11 +139,11 @@
         }
 
         Schema schema = getSchema( name );
-        Attributes targetEntry = ( Attributes ) entry.clone();
+        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         
-        targetEntry.put( new AttributeImpl( MetaSchemaConstants.M_OID_AT, newOid ) );
+        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         Syntax syntax = factory.getSyntax( targetEntry, targetRegistries, schema.getSchemaName() );
         
         if ( ! schema.isDisabled() )
@@ -164,7 +163,7 @@
 
 
     public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn,
-        Attributes entry, boolean cascade ) throws NamingException
+        ServerEntry entry, boolean cascade ) throws NamingException
     {
         checkNewParent( newParentName );
         String oldOid = getOid( entry );
@@ -181,11 +180,11 @@
 
         Schema oldSchema = getSchema( oriChildName );
         Schema newSchema = getSchema( newParentName );
-        Attributes targetEntry = ( Attributes ) entry.clone();
+        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRn.getValue();
         checkOidIsUnique( newOid );
         
-        targetEntry.put( new AttributeImpl( MetaSchemaConstants.M_OID_AT, newOid ) );
+        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         Syntax syntax = factory.getSyntax( targetEntry, targetRegistries, newSchema.getSchemaName() );
 
         if ( ! oldSchema.isDisabled() )
@@ -207,7 +206,7 @@
     }
 
 
-    public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry, boolean cascade ) 
+    public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
         throws NamingException
     {
         checkNewParent( newParentName );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Wed Jan 16 13:37:31 2008
@@ -36,10 +36,13 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 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.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -201,15 +204,19 @@
         
         while ( ne.hasMore() )
         {
-            Attributes attrs = ne.next().getAttributes();
-            String oid = ( String ) AttributeUtils.getAttribute( attrs, mOidAT ).get();
-            Attribute names = AttributeUtils.getAttribute( attrs, mNameAT );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( ne.next().getAttributes(), new LdapDN( "" ), registries );
+            String oid = entry.get( mOidAT ).getString();
+            ServerAttribute names = entry.get( mNameAT );
             targetRegistries.getOidRegistry().register( oid, oid );
-            for ( int ii = 0; ii < names.size(); ii++ )
+            
+            Iterator<ServerValue<?>> namesValues = names.getAll();
+            
+            while ( namesValues.hasNext() )
             {
-                targetRegistries.getOidRegistry().register( ( String ) names.get( ii ), oid );
+                targetRegistries.getOidRegistry().register( ( String ) namesValues.next().get( ), oid );
             }
         }
+        
         ne.close();
         
         
@@ -254,7 +261,7 @@
         for ( SearchResult sr: results )
         {
             Attribute cn = AttributeUtils.getAttribute( sr.getAttributes(), cnAT );
-            dependees.add( ( String ) cn.get() );
+            dependees.add( (String)cn.get() );
         }
         
         return dependees;
@@ -282,7 +289,7 @@
         for ( SearchResult sr: results )
         {
             Attribute cn = AttributeUtils.getAttribute( sr.getAttributes(), cnAT );
-            dependees.add( ( String ) cn.get() );
+            dependees.add( (String)cn.get() );
         }
         
         return dependees;
@@ -430,7 +437,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             ObjectClass oc = factory.getObjectClass( attrs, targetRegistries, schema.getSchemaName() );
             
             try
@@ -531,7 +538,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             AttributeType at = factory.getAttributeType( attrs, targetRegistries, schema.getSchemaName() );
             try
             {
@@ -629,7 +636,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             MatchingRule mrule = factory.getMatchingRule( attrs, targetRegistries, schema.getSchemaName() );
             targetRegistries.getMatchingRuleRegistry().register( mrule );
 
@@ -662,7 +669,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             Syntax syntax = factory.getSyntax( attrs, targetRegistries, schema.getSchemaName() );
             targetRegistries.getSyntaxRegistry().register( syntax );
         }
@@ -694,7 +701,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             SyntaxChecker sc = factory.getSyntaxChecker( attrs, targetRegistries );
             SyntaxCheckerDescription syntaxCheckerDescription = 
                 getSyntaxCheckerDescription( schema.getSchemaName(), attrs );
@@ -728,7 +735,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             Normalizer normalizer = factory.getNormalizer( attrs, targetRegistries );
             NormalizerDescription normalizerDescription = getNormalizerDescription( schema.getSchemaName(), attrs );
             targetRegistries.getNormalizerRegistry().register( normalizerDescription, normalizer );
@@ -736,36 +743,39 @@
     }
 
 
-    private String getOid( Attributes entry ) throws NamingException
+    private String getOid( ServerEntry entry ) throws NamingException
     {
-        Attribute oid = AttributeUtils.getAttribute( entry, mOidAT );
+        ServerAttribute oid = entry.get( mOidAT );
+        
         if ( oid == null )
         {
             return null;
         }
-        return ( String ) oid.get();
+        
+        return oid.getString();
     }
 
     
-    private NormalizerDescription getNormalizerDescription( String schemaName, Attributes entry ) throws NamingException
+    private NormalizerDescription getNormalizerDescription( String schemaName, ServerEntry entry ) throws NamingException
     {
         NormalizerDescription description = new NormalizerDescription();
         description.setNumericOid( getOid( entry ) );
         List<String> values = new ArrayList<String>();
         values.add( schemaName );
         description.addExtension( MetaSchemaConstants.X_SCHEMA, values );
-        description.setFqcn( ( String ) AttributeUtils.getAttribute( entry, fqcnAT ).get() );
+        description.setFqcn( entry.get( fqcnAT ).getString() );
         
-        Attribute desc = AttributeUtils.getAttribute( entry, descAT );
+        ServerAttribute desc = entry.get( descAT );
         if ( desc != null && desc.size() > 0 )
         {
-            description.setDescription( ( String ) desc.get() );
+            description.setDescription( desc.getString() );
         }
         
-        Attribute bytecode = AttributeUtils.getAttribute( entry, byteCodeAT );
+        ServerAttribute bytecode = entry.get( byteCodeAT );
+        
         if ( bytecode != null && bytecode.size() > 0 )
         {
-            byte[] bytes = ( byte[] ) bytecode.get();
+            byte[] bytes = bytecode.getBytes();
             description.setBytecode( new String( Base64.encode( bytes ) ) );
         }
 
@@ -773,6 +783,14 @@
     }
 
     
+    private ServerEntry lookupPartition( LdapDN dn ) throws NamingException
+    {
+        return ServerEntryUtils.toServerEntry( 
+            partition.lookup( 
+                new LookupOperationContext( registries, dn ) ), 
+            dn, registries );
+    }
+    
     private void loadComparators( Schema schema, Registries targetRegistries ) throws NamingException
     {
         LdapDN dn = staticComparatorsDNs.get( schema.getSchemaName() );
@@ -798,7 +816,7 @@
             SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
             resultDN.normalize( atRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( registries, resultDN ) );
+            ServerEntry attrs = lookupPartition( resultDN );
             Comparator comparator = factory.getComparator( attrs, targetRegistries );
             ComparatorDescription comparatorDescription = getComparatorDescription( schema.getSchemaName(), attrs );
             targetRegistries.getComparatorRegistry().register( comparatorDescription, comparator );
@@ -806,25 +824,27 @@
     }
 
 
-    private ComparatorDescription getComparatorDescription( String schemaName, Attributes entry ) throws NamingException
+    private ComparatorDescription getComparatorDescription( String schemaName, ServerEntry entry ) throws NamingException
     {
         ComparatorDescription description = new ComparatorDescription();
         description.setNumericOid( getOid( entry ) );
         List<String> values = new ArrayList<String>();
         values.add( schemaName );
         description.addExtension( MetaSchemaConstants.X_SCHEMA, values );
-        description.setFqcn( ( String ) AttributeUtils.getAttribute( entry, fqcnAT ).get() );
+        description.setFqcn( entry.get( fqcnAT ).getString() );
+        
+        ServerAttribute desc = entry.get( descAT );
         
-        Attribute desc = AttributeUtils.getAttribute( entry, descAT );
         if ( desc != null && desc.size() > 0 )
         {
-            description.setDescription( ( String ) desc.get() );
+            description.setDescription( desc.getString() );
         }
         
-        Attribute bytecode = AttributeUtils.getAttribute( entry, byteCodeAT );
+        ServerAttribute bytecode = entry.get( byteCodeAT );
+        
         if ( bytecode != null && bytecode.size() > 0 )
         {
-            byte[] bytes = ( byte[] ) bytecode.get();
+            byte[] bytes = bytecode.getBytes();
             description.setBytecode( new String( Base64.encode( bytes ) ) );
         }
 
@@ -832,7 +852,7 @@
     }
 
     
-    private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, Attributes entry ) 
+    private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, ServerEntry entry ) 
         throws NamingException
     {
         SyntaxCheckerDescription description = new SyntaxCheckerDescription();
@@ -840,18 +860,20 @@
         List<String> values = new ArrayList<String>();
         values.add( schemaName );
         description.addExtension( MetaSchemaConstants.X_SCHEMA, values );
-        description.setFqcn( ( String ) AttributeUtils.getAttribute( entry, fqcnAT ).get() );
+        description.setFqcn( entry.get( fqcnAT ).getString() );
+        
+        ServerAttribute desc = entry.get( descAT );
         
-        Attribute desc = AttributeUtils.getAttribute( entry, descAT );
         if ( desc != null && desc.size() > 0 )
         {
-            description.setDescription( ( String ) desc.get() );
+            description.setDescription( desc.getString() );
         }
         
-        Attribute bytecode = AttributeUtils.getAttribute( entry, byteCodeAT );
+        ServerAttribute bytecode = entry.get( byteCodeAT );
+        
         if ( bytecode != null && bytecode.size() > 0 )
         {
-            byte[] bytes = ( byte[] ) bytecode.get();
+            byte[] bytes = bytecode.getBytes();
             description.setBytecode( new String( Base64.encode( bytes ) ) );
         }
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java Wed Jan 16 13:37:31 2008
@@ -20,12 +20,12 @@
 package org.apache.directory.server.core.schema;
 
 
+import org.apache.directory.server.core.entry.ServerEntry;
 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.NamingException;
-import javax.naming.directory.Attributes;
 import java.util.List;
 
 
@@ -38,20 +38,20 @@
  */
 public interface SchemaChangeHandler
 {
-    void add( LdapDN name, Attributes entry ) throws NamingException;
+    void add( LdapDN name, ServerEntry entry ) throws NamingException;
     
-    void delete( LdapDN name, Attributes entry, boolean cascaded ) throws NamingException;
+    void delete( LdapDN name, ServerEntry entry, boolean cascaded ) throws NamingException;
     
-    void rename( LdapDN name, Attributes entry, Rdn newRdn, boolean cascaded ) throws NamingException;
+    void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascaded ) throws NamingException;
     
-    void modify( LdapDN name, int modOp, Attributes mods, Attributes entry, Attributes targetEntry, boolean cascaded ) 
+    void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, ServerEntry targetEntry, boolean cascaded ) 
         throws NamingException;
     
-    void modify( LdapDN name, List<ModificationItemImpl> mods, Attributes entry, Attributes targetEntry, boolean cascaded )
+    void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry, ServerEntry targetEntry, boolean cascaded )
         throws NamingException;
     
-    void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, Attributes entry,
+    void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, ServerEntry entry,
         boolean cascaded ) throws NamingException;
     
-    void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry, boolean cascaded ) throws NamingException;
+    void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascaded ) throws NamingException;
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java Wed Jan 16 13:37:31 2008
@@ -24,15 +24,17 @@
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
+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;
@@ -50,7 +52,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;
 
 
@@ -63,9 +64,11 @@
 public class SchemaEntityFactory
 {
     /** Used for looking up the setRegistries(Registries) method */
-    private final static Class[] parameterTypes = new Class[] { Registries.class };
+    private final static Class<?>[] parameterTypes = new Class[] { Registries.class };
+    
     /** Used for looking up the setSyntaxOid(String) method */
-    private final static Class[] setOidParameterTypes = new Class[] { String.class };
+    private final static Class<?>[] setOidParameterTypes = new Class[] { String.class };
+    
     private static final String[] EMPTY = new String[0];
     
     /** Used for dependency injection of Registries via setter into schema objects */
@@ -85,7 +88,7 @@
     }
 
     
-    public Schema getSchema( Attributes entry ) throws NamingException
+    public Schema getSchema( ServerEntry entry ) throws NamingException
     {
         String name;
         String owner;
@@ -101,18 +104,20 @@
         {
             throw new NullPointerException( "entry must have a valid cn attribute" );
         }
-        name = ( String ) entry.get( SchemaConstants.CN_AT ).get();
+        
+        name = entry.get( SchemaConstants.CN_AT ).getString();
         
         if ( entry.get( SchemaConstants.CREATORS_NAME_AT ) == null )
         {
             throw new NullPointerException( "entry must have a valid " 
                 + SchemaConstants.CREATORS_NAME_AT + " attribute" );
         }
-        owner = ( String ) entry.get( SchemaConstants.CREATORS_NAME_AT ).get();
+        
+        owner = entry.get( SchemaConstants.CREATORS_NAME_AT ).getString();
         
         if ( entry.get( MetaSchemaConstants.M_DISABLED_AT ) != null )
         {
-            String value = ( String ) entry.get( MetaSchemaConstants.M_DISABLED_AT ).get();
+            String value = entry.get( MetaSchemaConstants.M_DISABLED_AT ).getString();
             value = value.toUpperCase();
             isDisabled = value.equals( "TRUE" );
         }
@@ -120,11 +125,15 @@
         if ( entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT ) != null )
         {
             Set<String> depsSet = new HashSet<String>();
-            Attribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT );
-            for ( int ii = 0; ii < depsAttr.size(); ii++ )
+            ServerAttribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT );
+            
+            Iterator<ServerValue<?>> values = depsAttr.getAll();
+            
+            while ( values.hasNext() )
             {
-               depsSet.add( ( String ) depsAttr.get( ii ) ); 
+                depsSet.add( (String)values.next().get() );
             }
+
             dependencies = depsSet.toArray( EMPTY );
         }
         
@@ -132,10 +141,10 @@
     }
     
     
-    private SyntaxChecker getSyntaxChecker( String syntaxOid, String className, Attribute bytecode, Registries targetRegistries )
+    private SyntaxChecker getSyntaxChecker( String syntaxOid, String className, ServerAttribute bytecode, Registries targetRegistries )
         throws NamingException
     {
-        Class clazz = null;
+        Class<?> clazz = null;
         SyntaxChecker syntaxChecker = null;
         
         try
@@ -192,7 +201,7 @@
      * @return the loaded SyntaxChecker
      * @throws NamingException if anything fails during loading
      */
-    public SyntaxChecker getSyntaxChecker( Attributes entry, Registries targetRegistries ) throws NamingException
+    public SyntaxChecker getSyntaxChecker( ServerEntry entry, Registries targetRegistries ) throws NamingException
     {
         if ( entry == null )
         {
@@ -205,9 +214,9 @@
                 + MetaSchemaConstants.M_FQCN_AT + " attribute" );
         }
 
-        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get();
-        String syntaxOid = ( String ) AttributeUtils.getAttribute( entry, oidAT ).get();
-        return getSyntaxChecker( syntaxOid, className, AttributeUtils.getAttribute( entry, byteCodeAT ), 
+        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get().get();
+        String syntaxOid = ( String ) entry.get( oidAT ).get().get();
+        return getSyntaxChecker( syntaxOid, className, entry.get( byteCodeAT ), 
             targetRegistries );
     }
     
@@ -215,12 +224,13 @@
     public SyntaxChecker getSyntaxChecker( SyntaxCheckerDescription syntaxCheckerDescription, 
         Registries targetRegistries ) throws NamingException
     {
-        BasicAttribute attr = null;
+        ServerAttribute attr = null;
         
         if ( syntaxCheckerDescription.getBytecode() != null )
         {
             byte[] bytecode = Base64.decode( syntaxCheckerDescription.getBytecode().toCharArray() );
-            attr = new BasicAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode );
+            AttributeType byteCodeAT = targetRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_BYTECODE_AT );
+            attr = new DefaultServerAttribute( byteCodeAT, bytecode );
         }
         
         return getSyntaxChecker( syntaxCheckerDescription.getNumericOid(), 
@@ -228,11 +238,11 @@
     }
     
     
-    private Comparator getComparator( String className, Attribute bytecode, Registries targetRegistries ) 
+    private Comparator getComparator( String className, ServerAttribute bytecode, Registries targetRegistries ) 
         throws NamingException
     {
         Comparator comparator = null;
-        Class clazz = null;
+        Class<?> clazz = null;
         
         if ( bytecode == null ) 
         {
@@ -251,6 +261,7 @@
         else
         {
             classLoader.setAttribute( bytecode );
+            
             try
             {
                 clazz = classLoader.loadClass( className );
@@ -291,12 +302,13 @@
     public Comparator getComparator( ComparatorDescription comparatorDescription, Registries targetRegistries ) 
         throws NamingException
     {
-        BasicAttribute attr = null;
+        ServerAttribute attr = null;
         
         if ( comparatorDescription.getBytecode() != null )
         { 
             byte[] bytecode = Base64.decode( comparatorDescription.getBytecode().toCharArray() );
-            attr = new BasicAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode );
+            AttributeType byteCodeAT = targetRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_BYTECODE_AT );
+            attr = new DefaultServerAttribute( byteCodeAT, bytecode );
         }
         
         return getComparator( comparatorDescription.getFqcn(), attr, targetRegistries );
@@ -310,7 +322,7 @@
      * @return the loaded Comparator
      * @throws NamingException if anything fails during loading
      */
-    public Comparator getComparator( Attributes entry, Registries targetRegistries ) throws NamingException
+    public Comparator getComparator( ServerEntry entry, Registries targetRegistries ) throws NamingException
     {
         if ( entry == null )
         {
@@ -323,15 +335,15 @@
                 + MetaSchemaConstants.M_FQCN_AT + " attribute" );
         }
         
-        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get();
+        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get().get();
         return getComparator( className, entry.get( MetaSchemaConstants.M_BYTECODE_AT ), targetRegistries );
     }
     
     
-    private Normalizer getNormalizer( String className, Attribute bytecode, Registries targetRegistries ) 
+    private Normalizer getNormalizer( String className, ServerAttribute bytecode, Registries targetRegistries ) 
         throws NamingException
     {
-        Class clazz = null;
+        Class<?> clazz = null;
         Normalizer normalizer = null;
         
         try
@@ -383,12 +395,13 @@
     public Normalizer getNormalizer( NormalizerDescription normalizerDescription, Registries targetRegistries )
         throws NamingException
     {
-        BasicAttribute attr = null;
+        ServerAttribute attr = null;
         
         if ( normalizerDescription.getBytecode() != null )
         {
             byte[] bytecode = Base64.decode( normalizerDescription.getBytecode().toCharArray() );
-            attr = new BasicAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode );
+            AttributeType byteCodeAT = targetRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_BYTECODE_AT );
+            attr = new DefaultServerAttribute( byteCodeAT, bytecode );
         }
         
         return getNormalizer( normalizerDescription.getFqcn(), attr, targetRegistries );
@@ -402,7 +415,7 @@
      * @return the loaded Normalizer
      * @throws NamingException if anything fails during loading
      */
-    public Normalizer getNormalizer( Attributes entry, Registries targetRegistries ) throws NamingException
+    public Normalizer getNormalizer( ServerEntry entry, Registries targetRegistries ) throws NamingException
     {
         if ( entry == null )
         {
@@ -415,7 +428,7 @@
                 + MetaSchemaConstants.M_FQCN_AT + " attribute" );
         }
         
-        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get();
+        String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get().get();
         return getNormalizer( className, entry.get( MetaSchemaConstants.M_BYTECODE_AT ), targetRegistries );
     }
     
@@ -536,31 +549,31 @@
     }
 
 
-    public Syntax getSyntax( Attributes entry, Registries targetRegistries, String schema ) throws NamingException
+    public Syntax getSyntax( ServerEntry entry, Registries targetRegistries, String schema ) throws NamingException
     {
-        String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+        String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         SyntaxImpl syntax = new SyntaxImpl( oid, targetRegistries.getSyntaxCheckerRegistry() );
         syntax.setSchema( schema );
         
         if ( entry.get( MetaSchemaConstants.X_HUMAN_READABLE_AT ) != null )
         {
-            String val = ( String ) entry.get( MetaSchemaConstants.X_HUMAN_READABLE_AT ).get();
+            String val = entry.get( MetaSchemaConstants.X_HUMAN_READABLE_AT ).getString();
             syntax.setHumanReadable( val.toUpperCase().equals( "TRUE" ) );
         }
         
         if ( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ) != null )
         {
-            syntax.setDescription( ( String ) entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).get() ); 
+            syntax.setDescription( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).getString() ); 
         }
         
         return syntax;
     }
 
     
-    public MatchingRule getMatchingRule( Attributes entry, Registries targetRegistries, String schema ) throws NamingException
+    public MatchingRule getMatchingRule( ServerEntry entry, Registries targetRegistries, String schema ) throws NamingException
     {
-        String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
-        String syntaxOid = ( String ) entry.get( MetaSchemaConstants.M_SYNTAX_AT ).get();
+        String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
+        String syntaxOid = entry.get( MetaSchemaConstants.M_SYNTAX_AT ).getString();
         MatchingRuleImpl mr = new MatchingRuleImpl( oid, syntaxOid, targetRegistries );
         mr.setSchema( schema );
         setSchemaObjectProperties( mr, entry );
@@ -568,7 +581,7 @@
     }
     
     
-    private String[] getStrings( Attribute attr ) throws NamingException
+    private String[] getStrings( ServerAttribute attr ) throws NamingException
     {
         if ( attr == null )
         {
@@ -576,17 +589,22 @@
         }
         
         String[] strings = new String[attr.size()];
-        for ( int ii = 0; ii < strings.length; ii++ )
+        
+        Iterator<ServerValue<?>> values = attr.getAll();
+        int pos = 0;
+        
+        while ( values.hasNext() )
         {
-            strings[ii] = ( String ) attr.get( ii );
+            strings[pos++] = (String)values.next().get();
         }
+        
         return strings;
     }
     
     
-    public ObjectClass getObjectClass( Attributes entry, Registries targetRegistries, String schema ) throws NamingException
+    public ObjectClass getObjectClass( ServerEntry entry, Registries targetRegistries, String schema ) throws NamingException
     {
-        String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+        String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         ObjectClassImpl oc = new ObjectClassImpl( oid, targetRegistries );
         oc.setSchema( schema );
         
@@ -607,7 +625,7 @@
         
         if ( entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ) != null )
         {
-            String type = ( String ) entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ).get();
+            String type = entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ).getString();
             oc.setType( ObjectClassTypeEnum.getClassType( type ) );
         }
         else
@@ -621,86 +639,91 @@
     }
     
     
-    public AttributeType getAttributeType( Attributes entry, Registries targetRegistries, String schema ) throws NamingException
+    public AttributeType getAttributeType( ServerEntry entry, Registries targetRegistries, String schema ) throws NamingException
     {
-        String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+        String oid = entry.get( MetaSchemaConstants.M_OID_AT ).getString();
         AttributeTypeImpl at = new AttributeTypeImpl( oid, targetRegistries );
         at.setSchema( schema );
         setSchemaObjectProperties( at, entry );
         
         if ( entry.get( MetaSchemaConstants.M_SYNTAX_AT ) != null )
         {
-            at.setSyntaxOid( ( String ) entry.get( MetaSchemaConstants.M_SYNTAX_AT ).get() );
+            at.setSyntaxOid( entry.get( MetaSchemaConstants.M_SYNTAX_AT ).getString() );
         }
         
         if ( entry.get( MetaSchemaConstants.M_EQUALITY_AT ) != null )
         {
-            at.setEqualityOid( ( String ) entry.get( MetaSchemaConstants.M_EQUALITY_AT ).get() );
+            at.setEqualityOid( entry.get( MetaSchemaConstants.M_EQUALITY_AT ).getString() );
         }
         
         if ( entry.get( MetaSchemaConstants.M_ORDERING_AT ) != null )
         {
-            at.setOrderingOid( ( String ) entry.get( MetaSchemaConstants.M_ORDERING_AT ).get() );
+            at.setOrderingOid( entry.get( MetaSchemaConstants.M_ORDERING_AT ).getString() );
         }
         
         if ( entry.get( MetaSchemaConstants.M_SUBSTR_AT ) != null )
         {
-            at.setSubstrOid( ( String ) entry.get( MetaSchemaConstants.M_SUBSTR_AT ).get() );
+            at.setSubstrOid( entry.get( MetaSchemaConstants.M_SUBSTR_AT ).getString() );
         }
         
         if ( entry.get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT ) != null )
         {
-            at.setSuperiorOid( ( String ) entry.get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT ).get() );
+            at.setSuperiorOid( entry.get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT ).getString() );
         }
         
         if ( entry.get( MetaSchemaConstants.M_COLLECTIVE_AT ) != null )
         {
-            String val = ( String ) entry.get( MetaSchemaConstants.M_COLLECTIVE_AT ).get();
+            String val = entry.get( MetaSchemaConstants.M_COLLECTIVE_AT ).getString();
             at.setCollective( val.equalsIgnoreCase( "TRUE" ) );
         }
         
         if ( entry.get( MetaSchemaConstants.M_SINGLE_VALUE_AT ) != null )
         {
-            String val = ( String ) entry.get( MetaSchemaConstants.M_SINGLE_VALUE_AT ).get();
+            String val = entry.get( MetaSchemaConstants.M_SINGLE_VALUE_AT ).getString();
             at.setSingleValue( val.equalsIgnoreCase( "TRUE" ) );
         }
         
         if ( entry.get( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT ) != null )
         {
-            String val = ( String ) entry.get( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT ).get();
+            String val = entry.get( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT ).getString();
             at.setCanUserModify( ! val.equalsIgnoreCase( "TRUE" ) );
         }
         
         if ( entry.get( MetaSchemaConstants.M_USAGE_AT ) != null )
         {
-            at.setUsage( UsageEnum.getUsage( ( String ) entry.get( MetaSchemaConstants.M_USAGE_AT ).get() ) );
+            at.setUsage( UsageEnum.getUsage( entry.get( MetaSchemaConstants.M_USAGE_AT ).getString() ) );
         }
         
         return at;
     }
     
 
-    private void setSchemaObjectProperties( MutableSchemaObject mso, Attributes entry ) throws NamingException
+    private void setSchemaObjectProperties( MutableSchemaObject mso, ServerEntry entry ) throws NamingException
     {
         if ( entry.get( MetaSchemaConstants.M_OBSOLETE_AT ) != null )
         {
-            String val = ( String ) entry.get( MetaSchemaConstants.M_OBSOLETE_AT ).get();
+            String val = entry.get( MetaSchemaConstants.M_OBSOLETE_AT ).getString();
             mso.setObsolete( val.equalsIgnoreCase( "TRUE" ) );
         }
         
         if ( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ) != null )
         {
-            mso.setDescription( ( String ) entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).get() ); 
+            mso.setDescription( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).getString() ); 
         }
 
-        Attribute names = entry.get( MetaSchemaConstants.M_NAME_AT );
+        ServerAttribute names = entry.get( MetaSchemaConstants.M_NAME_AT );
+        
         if ( names != null )
         {
             List<String> values = new ArrayList<String>();
-            for ( int ii = 0; ii < names.size(); ii++ )
+            
+            Iterator<ServerValue<?>> namesValues = names.getAll();
+            
+            while ( namesValues.hasNext() )
             {
-                values.add( ( String ) names.get( ii ) );
+                values.add( (String)namesValues.next().get() );
             }
+            
             mso.setNames( values.toArray( EMPTY ) );
         }
     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Jan 16 13:37:31 2008
@@ -22,8 +22,8 @@
 
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
@@ -1080,7 +1080,10 @@
     {
         LdapDN oriChildName = opContext.getDn();
 
-        Attributes entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            nexus.lookup( new LookupOperationContext( registries, oriChildName ) ),
+            oriChildName,
+            registries );
 
         if ( oriChildName.startsWith( schemaBaseDN ) )
         {
@@ -1099,7 +1102,10 @@
     {
         LdapDN oriChildName = opContext.getDn();
         
-        Attributes entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) );
+        ServerEntry entry = ServerEntryUtils.toServerEntry(
+            nexus.lookup( new LookupOperationContext( registries, oriChildName ) ),
+            oriChildName,
+            registries );
 
         if ( oriChildName.startsWith( schemaBaseDN ) )
         {
@@ -1117,7 +1123,10 @@
         Rdn newRdn = opContext.getNewRdn();
         boolean deleteOldRn = opContext.getDelOldDn();
         
-        Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+        ServerEntry entry = ServerEntryUtils.toServerEntry(
+            nexus.lookup( new LookupOperationContext( registries, name ) ),
+            name,
+            registries );
 
         if ( name.startsWith( schemaBaseDN ) )
         {
@@ -1437,14 +1446,22 @@
         {
             LOG.debug( "Modification attempt on schema partition {}: \n{}", name, opContext );
         
-            schemaManager.modify( name, mods, entry, targetEntry,
+            schemaManager.modify( 
+                name, 
+                mods, 
+                ServerEntryUtils.toServerEntry( entry, name, registries ), 
+                ServerEntryUtils.toServerEntry( targetEntry, name, registries ),
                 opContext.hasRequestControl( CascadeControl.CONTROL_OID ));
         }
         else if ( subschemaSubentryDnNorm.equals( name.getNormName() ) )
         {
             LOG.debug( "Modification attempt on schema subentry {}: \n{}", name, opContext );
 
-            schemaManager.modifySchemaSubentry( name, mods, entry, targetEntry,
+            schemaManager.modifySchemaSubentry( 
+                name, 
+                mods, 
+                ServerEntryUtils.toServerEntry( entry, name, registries ), 
+                ServerEntryUtils.toServerEntry( targetEntry, name, registries ),
                 opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
             return;
         }
@@ -1645,7 +1662,7 @@
 
         if ( name.startsWith( schemaBaseDN ) )
         {
-            schemaManager.add( name, entry );
+            schemaManager.add( name, ServerEntryUtils.toServerEntry( entry, name, registries ) );
         }
 
         next.add( addContext );
@@ -1696,7 +1713,10 @@
     public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
     {
     	LdapDN name = opContext.getDn();
-        Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            nexus.lookup( new LookupOperationContext( registries, name ) ),
+            name, 
+            registries );
         
         if ( name.startsWith( schemaBaseDN ) )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Wed Jan 16 13:37:31 2008
@@ -24,6 +24,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -34,6 +35,10 @@
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -69,6 +74,7 @@
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.DateUtils;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -285,13 +291,18 @@
     }
 
 
-    public void add( LdapDN name, Attributes entry ) throws NamingException
+    public void add( LdapDN name, ServerEntry entry ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
+        
+        Iterator<ServerValue<?>> values = oc.getAll();
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -301,14 +312,14 @@
             }
         }
         
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.add( name, entry );
             updateSchemaModificationAttributes();
             return;
         }
         
-        if ( AttributeUtils.containsValue( oc, SchemaConstants.ORGANIZATIONAL_UNIT_OC, objectClassAT ) )
+        if ( oc.contains( SchemaConstants.ORGANIZATIONAL_UNIT_OC ) )
         {
             if ( name.size() != 3 )
             {
@@ -332,13 +343,18 @@
     }
     
 
-    public void delete( LdapDN name, Attributes entry, boolean doCascadeDelete ) throws NamingException
+    public void delete( LdapDN name, ServerEntry entry, boolean doCascadeDelete ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        Iterator<ServerValue<?>> values = oc.getAll();
+        
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+            
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -348,14 +364,14 @@
             }
         }
 
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.delete( name, entry, doCascadeDelete );
             updateSchemaModificationAttributes();
             return;
         }
         
-        if ( AttributeUtils.containsValue( oc, SchemaConstants.ORGANIZATIONAL_UNIT_OC, objectClassAT ) )
+        if ( oc.contains( SchemaConstants.ORGANIZATIONAL_UNIT_OC ) )
         {
             if ( name.size() != 3 )
             {
@@ -379,14 +395,19 @@
     }
     
 
-    public void modify( LdapDN name, int modOp, Attributes mods, Attributes entry, 
-        Attributes targetEntry, boolean cascade ) throws NamingException
+    public void modify( LdapDN name, int modOp, ServerEntry mods, ServerEntry entry, 
+        ServerEntry targetEntry, boolean cascade ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
+        
+        Iterator<ServerValue<?>> values = oc.getAll();
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -396,7 +417,7 @@
             }
         }
 
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.modify( name, modOp, mods, entry, targetEntry, cascade );
             updateSchemaModificationAttributes();
@@ -407,14 +428,18 @@
     }
 
 
-    public void modify( LdapDN name, List<ModificationItemImpl> mods, Attributes entry, Attributes targetEntry,
+    public void modify( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry, ServerEntry targetEntry,
         boolean doCascadeModify ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        Iterator<ServerValue<?>> values = oc.getAll();
+        
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -425,7 +450,7 @@
             }
         }
 
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.modify( name, mods, entry, targetEntry, doCascadeModify );
             updateSchemaModificationAttributes();
@@ -438,14 +463,19 @@
     }
 
 
-    public void modifyRn( LdapDN name, Rdn newRdn, boolean deleteOldRn, Attributes entry, boolean doCascadeModify ) 
+    public void modifyRn( LdapDN name, Rdn newRdn, boolean deleteOldRn, ServerEntry entry, boolean doCascadeModify ) 
         throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        Iterator<ServerValue<?>> values = oc.getAll();
+        
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -455,7 +485,7 @@
             }
         }
 
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.rename( name, entry, newRdn, doCascadeModify );
             updateSchemaModificationAttributes();
@@ -466,14 +496,18 @@
     }
 
 
-    public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry, 
+    public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, 
         boolean cascade ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
+        
+        Iterator<ServerValue<?>> values = oc.getAll();
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
             
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
@@ -484,7 +518,7 @@
             }
         }
 
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.replace( oriChildName, newParentName, entry, cascade );
             updateSchemaModificationAttributes();
@@ -496,13 +530,18 @@
 
 
     public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn,
-        Attributes entry, boolean cascade ) throws NamingException
+        ServerEntry entry, boolean cascade ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
+        ServerAttribute oc = entry.get( objectClassAT );
+        
+        Iterator<ServerValue<?>> values = oc.getAll();
         
-        for ( int ii = 0; ii < oc.size(); ii++ )
+        while ( values.hasNext() )
         {
-            String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+            ServerValue<?> value = values.next();
+
+            String oid = registries.getOidRegistry().getOid( ( String ) value.get() );
+            
             if ( objectClass2handlerMap.containsKey( oid ) )
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -512,7 +551,7 @@
             }
         }
 
-        if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT ) )
+        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
         {
             metaSchemaHandler.move( oriChildName, newParentName, newRn, deleteOldRn, entry, cascade );
             updateSchemaModificationAttributes();
@@ -536,21 +575,28 @@
      * to effect all dependents on the changed entity
      * @throws NamingException if the operation fails
      */
-    public void modifySchemaSubentry( LdapDN name, List<ModificationItemImpl> mods, Attributes subentry, 
-        Attributes targetSubentry, boolean doCascadeModify ) throws NamingException 
+    public void modifySchemaSubentry( LdapDN name, List<ModificationItemImpl> mods, ServerEntry subentry, 
+        ServerEntry targetSubentry, boolean doCascadeModify ) throws NamingException 
     {
         for ( ModificationItem mod : mods )
         {
             String opAttrOid = registries.getOidRegistry().getOid( mod.getAttribute().getID() );
             
+            AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( 
+                mod.getAttribute().getID() );
+        
+            ServerAttribute serverAttribute = 
+                ServerEntryUtils.toServerAttribute( mod.getAttribute(), attributeType );
+
             switch ( mod.getModificationOp() )
             {
                 case( DirContext.ADD_ATTRIBUTE ):
-                    modifyAddOperation( opAttrOid, mod.getAttribute(), doCascadeModify );
+
+                    modifyAddOperation( opAttrOid, serverAttribute, doCascadeModify );
                     break;
                     
                 case( DirContext.REMOVE_ATTRIBUTE ):
-                    modifyRemoveOperation( opAttrOid, mod.getAttribute(), doCascadeModify );
+                    modifyRemoveOperation( opAttrOid, serverAttribute, doCascadeModify );
                     break; 
                     
                 case( DirContext.REPLACE_ATTRIBUTE ):
@@ -587,30 +633,31 @@
      * to effect all dependents on the changed entity
      * @throws NamingException if the modify fails
      */
-    public void modifySchemaSubentry( LdapDN name, int modOp, Attributes mods, Attributes subentry, 
-        Attributes targetSubentry, boolean doCascadeModify ) throws NamingException
+    public void modifySchemaSubentry( LdapDN name, int modOp, ServerEntry mods, ServerEntry subentry, 
+        ServerEntry targetSubentry, boolean doCascadeModify ) throws NamingException
     {
-        NamingEnumeration<String> ids = mods.getIDs();
+        Set<AttributeType> attributeTypes = mods.getAttributeTypes();
+        
         switch ( modOp )
         {
             case( DirContext.ADD_ATTRIBUTE ):
-                while ( ids.hasMore() )
+                for ( AttributeType attributeType:attributeTypes )
                 {
-                    String id = ids.next();
-                    AttributeType opAttrAT = registries.getAttributeTypeRegistry().lookup( id );
-                    modifyAddOperation( opAttrAT.getOid(), 
-                        AttributeUtils.getAttribute( mods, opAttrAT ), doCascadeModify );
+                    modifyAddOperation( attributeType.getOid(), 
+                        mods.get( attributeType ), doCascadeModify );
                 }
+            
                 break;
+                
             case( DirContext.REMOVE_ATTRIBUTE ):
-                while ( ids.hasMore() )
+                for ( AttributeType attributeType:attributeTypes )
                 {
-                    String id = ids.next();
-                    AttributeType opAttrAT = registries.getAttributeTypeRegistry().lookup( id );
-                    modifyRemoveOperation( opAttrAT.getOid(), 
-                        AttributeUtils.getAttribute( mods, opAttrAT ), doCascadeModify );
+                    modifyRemoveOperation( attributeType.getOid(), 
+                        mods.get( attributeType ), doCascadeModify );
                 }
+            
                 break;
+                
             case( DirContext.REPLACE_ATTRIBUTE ):
                 throw new LdapOperationNotSupportedException( 
                     "Modify REPLACE operations on schema subentries are not allowed: " +
@@ -618,9 +665,11 @@
                     "that reside in schema operational attributes.  Instead use \na " +
                     "targeted combination of modify ADD and REMOVE operations.", 
                     ResultCodeEnum.UNWILLING_TO_PERFORM );
+            
             default:
                 throw new IllegalStateException( "Undefined modify operation: " + modOp );
         }
+        
         updateSchemaModificationAttributes();
     }
 
@@ -646,11 +695,12 @@
      * @throws NamingException if there are problems updating the registries and the
      * schema partition
      */
-    private void modifyRemoveOperation( String opAttrOid, Attribute mods, boolean doCascadeModify ) 
+    private void modifyRemoveOperation( String opAttrOid, ServerAttribute mods, boolean doCascadeModify ) 
         throws NamingException
     {
         int index = opAttr2handlerIndex.get( opAttrOid );
         SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
+        
         switch( index )
         {
             case( COMPARATOR_INDEX ):
@@ -779,7 +829,7 @@
      * @throws NamingException if there are problems updating the registries and the
      * schema partition
      */
-    private void modifyAddOperation( String opAttrOid, Attribute mods, boolean doCascadeModify ) throws NamingException
+    private void modifyAddOperation( String opAttrOid, ServerAttribute mods, boolean doCascadeModify ) throws NamingException
     {
         if ( doCascadeModify )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Wed Jan 16 13:37:31 2008
@@ -29,6 +29,7 @@
 
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
@@ -166,7 +167,11 @@
         while( list.hasMore() )
         {
             SearchResult sr = list.next();
-            Schema schema = factory.getSchema( sr.getAttributes() ); 
+            Schema schema = factory.getSchema( 
+                ServerEntryUtils.toServerEntry( 
+                    sr.getAttributes(),
+                    LdapDN.EMPTY_LDAPDN,
+                    registries ) ); 
             schemas.put( schema.getSchemaName(), schema );
         }
         
@@ -206,7 +211,11 @@
     {
         LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
         dn.normalize( attrRegistry.getNormalizerMapping() );
-        return factory.getSchema( partition.lookup( new LookupOperationContext( registries, dn ) ) );
+        return factory.getSchema( 
+            ServerEntryUtils.toServerEntry( 
+                partition.lookup( new LookupOperationContext( registries, dn ) ),
+                dn,
+                registries ) );
     }
 
 

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java?rev=612574&r1=612573&r2=612574&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java Wed Jan 16 13:37:31 2008
@@ -500,6 +500,7 @@
     public void load( String schemaName, Properties schemaProperties ) throws NamingException
     {
         Schema schema = schemaLoader.getSchema( schemaName, schemaProperties );
+        
         if ( schema.isDisabled() )
         {
             throw new NamingException( "Disabled schemas cannot be loaded into registries." );



Mime
View raw message