directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r613608 [9/15] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ bootstrap-plugin/ bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core-entry/ core-entry/src/main/java/org/apache/directory/server/core/...
Date Sun, 20 Jan 2008 16:59:36 GMT
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java Sun Jan 20 08:59:10 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.MatchingRuleRegistry;
 import org.apache.directory.server.schema.registries.NormalizerRegistry;
@@ -42,7 +42,6 @@
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.Base64;
 
 
@@ -77,25 +76,27 @@
 
     
     
-    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 );
-        if ( desc != null && desc.size() > 0 )
+        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 );
-        if ( bytecode != null && bytecode.size() > 0 )
+        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 +104,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 );
         Normalizer normalizer = factory.getNormalizer( targetEntry, targetRegistries );
@@ -119,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 );
@@ -156,7 +157,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 );
     }
@@ -179,7 +180,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 );
 
@@ -209,7 +210,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 );
@@ -244,7 +245,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 );
@@ -286,7 +287,7 @@
     }
 
 
-    private void checkOidIsUniqueForNormalizer( Attributes entry ) throws NamingException
+    private void checkOidIsUniqueForNormalizer( ServerEntry entry ) throws NamingException
     {
         String oid = getOid( entry );
         

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=613608&r1=613607&r2=613608&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 Sun Jan 20 08:59:10 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.ObjectClassRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 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 schemaName = getSchemaName( name );
         ObjectClass oc = factory.getObjectClass( entry, targetRegistries, schemaName );
@@ -122,7 +121,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
     {
         Schema schema = getSchema( name );
         ObjectClass oldOc = factory.getObjectClass( entry, targetRegistries, schema.getSchemaName() );
@@ -136,9 +135,9 @@
                 ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        Attributes targetEntry = ( Attributes ) entry.clone();
+        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
-        targetEntry.put( new AttributeImpl( MetaSchemaConstants.M_OID_AT, newOid ) );
+        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         checkOidIsUnique( newOid );
         ObjectClass oc = factory.getObjectClass( targetEntry, targetRegistries, schema.getSchemaName() );
 
@@ -157,7 +156,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 );
         Schema oldSchema = getSchema( oriChildName );
@@ -173,10 +172,10 @@
         }
 
         Schema newSchema = getSchema( newParentName );
-        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 );
         ObjectClass oc = factory.getObjectClass( targetEntry, targetRegistries, newSchema.getSchemaName() );
 
         if ( ! oldSchema.isDisabled() )
@@ -196,7 +195,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/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=613608&r1=613607&r2=613608&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 Sun Jan 20 08:59:10 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;
@@ -34,11 +38,8 @@
 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 org.apache.directory.shared.ldap.util.NamespaceTools;
 
 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;
@@ -87,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 );
@@ -125,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 )
         {
@@ -159,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
     {
 
     }
@@ -171,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 );
@@ -184,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;
         }
@@ -237,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
@@ -268,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 );
@@ -309,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;
@@ -349,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 );
@@ -361,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 );
@@ -373,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 )
@@ -385,7 +395,7 @@
             case ( DirContext.ADD_ATTRIBUTE   ):
                 if ( disabledInEntry == null )
                 {
-                    if ( "TRUE".equalsIgnoreCase( ( String ) disabledInMods.get() ) )
+                    if ( "TRUE".equalsIgnoreCase( disabledInMods.getString() ) )
                     {
                         disableSchema( getSchemaName( name ) );
                     }
@@ -397,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 ) );
                 }
@@ -409,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 )
                 {
@@ -475,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 )
         {
@@ -487,10 +497,12 @@
         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();
+            
+            for ( ServerValue<?> value:dependencies )
             {
-                String dependency = ( String ) dependencies.get( ii );
+                String dependency = ( String ) value.get();
+                
                 if ( ! loaded.containsKey( dependency ) )
                 {
                     throw new LdapOperationNotSupportedException( 
@@ -502,9 +514,11 @@
         else
         {
             Set<String> allSchemas = loader.getSchemaNames();
-            for ( int ii = 0; ii < dependencies.size(); ii++ )
+            
+            for ( ServerValue<?> value:dependencies )
             {
-                String dependency = ( String ) dependencies.get( ii );
+                String dependency = ( String ) value.get();
+                
                 if ( ! allSchemas.contains( dependency ) )
                 {
                     throw new LdapOperationNotSupportedException( 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java Sun Jan 20 08:59:10 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/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=613608&r1=613607&r2=613608&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 Sun Jan 20 08:59:10 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/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=613608&r1=613607&r2=613608&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 Sun Jan 20 08:59:10 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;
@@ -81,7 +84,13 @@
     private final SchemaPartitionDao dao;
     private SchemaEntityFactory factory;
     private Partition partition;
-    private AttributeTypeRegistry attrRegistry;
+    
+    /** The attributeType registry */
+    private AttributeTypeRegistry atRegistry;
+    
+    /** The global registries */
+    private Registries registries;
+    
     private final AttributeType mOidAT;
     private final AttributeType mNameAT;
     private final AttributeType cnAT;
@@ -97,19 +106,20 @@
     private static Map<String, LdapDN> staticSyntaxCheckersDNs = new HashMap<String, LdapDN>();
     private static Map<String, LdapDN> staticSyntaxesDNs = new HashMap<String, LdapDN>();
     
-    public PartitionSchemaLoader( Partition partition, Registries bootstrapRegistries ) throws NamingException
+    public PartitionSchemaLoader( Partition partition, Registries registries ) throws NamingException
     {
-        this.factory = new SchemaEntityFactory( bootstrapRegistries );
+        this.factory = new SchemaEntityFactory( registries );
         this.partition = partition;
-        this.attrRegistry = bootstrapRegistries.getAttributeTypeRegistry();
+        this.registries = registries;
+        atRegistry = registries.getAttributeTypeRegistry();
         
-        this.dao = new SchemaPartitionDao( this.partition, bootstrapRegistries );
-        this.mOidAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_OID_AT );
-        this.mNameAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_NAME_AT );
-        this.cnAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( SchemaConstants.CN_AT );
-        this.byteCodeAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_BYTECODE_AT );
-        this.descAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_DESCRIPTION_AT );
-        this.fqcnAT = bootstrapRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_FQCN_AT );
+        dao = new SchemaPartitionDao( this.partition, registries );
+        mOidAT = atRegistry.lookup( MetaSchemaConstants.M_OID_AT );
+        mNameAT = atRegistry.lookup( MetaSchemaConstants.M_NAME_AT );
+        cnAT = atRegistry.lookup( SchemaConstants.CN_AT );
+        byteCodeAT = atRegistry.lookup( MetaSchemaConstants.M_BYTECODE_AT );
+        descAT = atRegistry.lookup( MetaSchemaConstants.M_DESCRIPTION_AT );
+        fqcnAT = atRegistry.lookup( MetaSchemaConstants.M_FQCN_AT );
         
         initStaticDNs( "system" );
         initStaticDNs( "core" );
@@ -127,37 +137,37 @@
         
         // Initialize AttributeType Dns
         LdapDN dn = new LdapDN( "ou=attributeTypes,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticAttributeTypeDNs.put( schemaName, dn );
 
         // Initialize ObjectClasses Dns
         dn = new LdapDN( "ou=objectClasses,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticObjectClassesDNs.put( schemaName, dn );
 
         // Initialize MatchingRules Dns
         dn = new LdapDN( "ou=matchingRules,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticMatchingRulesDNs.put( schemaName, dn );
 
         // Initialize Comparators Dns
         dn = new LdapDN( "ou=comparators,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticComparatorsDNs.put( schemaName, dn );
         
         // Initialize Normalizers Dns
         dn = new LdapDN( "ou=normalizers,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticNormalizersDNs.put( schemaName, dn );
 
         // Initialize SyntaxCheckers Dns
         dn = new LdapDN( "ou=syntaxCheckers,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticSyntaxCheckersDNs.put( schemaName, dn );
 
         // Initialize Syntaxes Dns
         dn = new LdapDN( "ou=syntaxes,cn=" + schemaName + ",ou=schema" );
-        dn.normalize( this.attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         staticSyntaxesDNs.put( schemaName, dn );
 
     }
@@ -190,18 +200,21 @@
          * OID registry.  To prevent this we need to load all the OID's in advance
          * regardless of whether they are used or not.
          */
-        NamingEnumeration ne = dao.listAllNames();
+        NamingEnumeration<SearchResult> ne = dao.listAllNames();
+        
         while ( ne.hasMore() )
         {
-            Attributes attrs = ( ( SearchResult ) 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++ )
+            
+            for ( ServerValue<?> value:names )
             {
-                targetRegistries.getOidRegistry().register( ( String ) names.get( ii ), oid );
+                targetRegistries.getOidRegistry().register( ( String ) value.get(), oid );
             }
         }
+        
         ne.close();
         
         
@@ -246,7 +259,7 @@
         for ( SearchResult sr: results )
         {
             Attribute cn = AttributeUtils.getAttribute( sr.getAttributes(), cnAT );
-            dependees.add( ( String ) cn.get() );
+            dependees.add( (String)cn.get() );
         }
         
         return dependees;
@@ -274,7 +287,7 @@
         for ( SearchResult sr: results )
         {
             Attribute cn = AttributeUtils.getAttribute( sr.getAttributes(), cnAT );
-            dependees.add( ( String ) cn.get() );
+            dependees.add( (String)cn.get() );
         }
         
         return dependees;
@@ -404,24 +417,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=objectClasses,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticObjectClassesDNs.put( schema.getSchemaName(), dn );
         }
         
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading objectClasses", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             ObjectClass oc = factory.getObjectClass( attrs, targetRegistries, schema.getSchemaName() );
             
             try
@@ -504,24 +518,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=attributeTypes,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticAttributeTypeDNs.put( schema.getSchemaName(), dn );
         }
         
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading attributeTypes", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             AttributeType at = factory.getAttributeType( attrs, targetRegistries, schema.getSchemaName() );
             try
             {
@@ -601,24 +616,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=matchingRules,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticMatchingRulesDNs.put( schema.getSchemaName(), dn );
         }
         
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading matchingRules", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             MatchingRule mrule = factory.getMatchingRule( attrs, targetRegistries, schema.getSchemaName() );
             targetRegistries.getMatchingRuleRegistry().register( mrule );
 
@@ -633,24 +649,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=syntaxes,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticSyntaxesDNs.put( schema.getSchemaName(), dn );
         }
         
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading syntaxes", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             Syntax syntax = factory.getSyntax( attrs, targetRegistries, schema.getSchemaName() );
             targetRegistries.getSyntaxRegistry().register( syntax );
         }
@@ -664,24 +681,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=syntaxCheckers,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticSyntaxCheckersDNs.put( schema.getSchemaName(), dn );
         }
         
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading syntaxCheckers", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             SyntaxChecker sc = factory.getSyntaxChecker( attrs, targetRegistries );
             SyntaxCheckerDescription syntaxCheckerDescription = 
                 getSyntaxCheckerDescription( schema.getSchemaName(), attrs );
@@ -697,24 +715,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=normalizers,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticNormalizersDNs.put( schema.getSchemaName(), dn );
         }
         
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading normalizers", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             Normalizer normalizer = factory.getNormalizer( attrs, targetRegistries );
             NormalizerDescription normalizerDescription = getNormalizerDescription( schema.getSchemaName(), attrs );
             targetRegistries.getNormalizerRegistry().register( normalizerDescription, normalizer );
@@ -722,36 +741,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 ) ) );
         }
 
@@ -759,6 +781,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() );
@@ -766,24 +796,25 @@
         if ( dn == null )
         {
             dn = new LdapDN( "ou=comparators,cn=" + schema.getSchemaName() + ",ou=schema" );
-            dn.normalize( this.attrRegistry.getNormalizerMapping() );
+            dn.normalize( atRegistry.getNormalizerMapping() );
             staticComparatorsDNs.put( schema.getSchemaName(), dn );
         }
 
-        if ( ! partition.hasEntry( new EntryOperationContext( dn ) ) )
+        if ( ! partition.hasEntry( new EntryOperationContext( registries, dn ) ) )
         {
             return;
         }
         
         LOG.debug( "{} schema: loading comparators", schema.getSchemaName() );
         
-        NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
+        NamingEnumeration<SearchResult> list = partition.list( new ListOperationContext( registries, dn ) );
+        
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult ) list.next();
+            SearchResult result = list.next();
             LdapDN resultDN = new LdapDN( result.getName() );
-            resultDN.normalize( attrRegistry.getNormalizerMapping() );
-            Attributes attrs = partition.lookup( new LookupOperationContext( resultDN ) );
+            resultDN.normalize( atRegistry.getNormalizerMapping() );
+            ServerEntry attrs = lookupPartition( resultDN );
             Comparator comparator = factory.getComparator( attrs, targetRegistries );
             ComparatorDescription comparatorDescription = getComparatorDescription( schema.getSchemaName(), attrs );
             targetRegistries.getComparatorRegistry().register( comparatorDescription, comparator );
@@ -791,25 +822,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 ) ) );
         }
 
@@ -817,7 +850,7 @@
     }
 
     
-    private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, Attributes entry ) 
+    private SyntaxCheckerDescription getSyntaxCheckerDescription( String schemaName, ServerEntry entry ) 
         throws NamingException
     {
         SyntaxCheckerDescription description = new SyntaxCheckerDescription();
@@ -825,18 +858,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/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=613608&r1=613607&r2=613608&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 Sun Jan 20 08:59:10 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/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=613608&r1=613607&r2=613608&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 Sun Jan 20 08:59:10 2008
@@ -28,11 +28,12 @@
 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 +51,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 +63,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 +87,7 @@
     }
 
     
-    public Schema getSchema( Attributes entry ) throws NamingException
+    public Schema getSchema( ServerEntry entry ) throws NamingException
     {
         String name;
         String owner;
@@ -101,18 +103,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 +124,13 @@
         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 );
+            
+            for ( ServerValue<?> value:depsAttr )
             {
-               depsSet.add( ( String ) depsAttr.get( ii ) ); 
+                depsSet.add( (String)value.get() );
             }
+
             dependencies = depsSet.toArray( EMPTY );
         }
         
@@ -132,10 +138,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 +198,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 +211,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 +221,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 +235,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 +258,7 @@
         else
         {
             classLoader.setAttribute( bytecode );
+            
             try
             {
                 clazz = classLoader.loadClass( className );
@@ -291,12 +299,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 +319,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 +332,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 +392,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 +412,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 +425,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 +546,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 +578,7 @@
     }
     
     
-    private String[] getStrings( Attribute attr ) throws NamingException
+    private String[] getStrings( ServerAttribute attr ) throws NamingException
     {
         if ( attr == null )
         {
@@ -576,17 +586,21 @@
         }
         
         String[] strings = new String[attr.size()];
-        for ( int ii = 0; ii < strings.length; ii++ )
+        
+        int pos = 0;
+        
+        for ( ServerValue<?> value:attr )
         {
-            strings[ii] = ( String ) attr.get( ii );
+            strings[pos++] = (String)value.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 +621,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 +635,89 @@
     }
     
     
-    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++ )
+            
+            for ( ServerValue<?> name:names )
             {
-                values.add( ( String ) names.get( ii ) );
+                values.add( (String)name.get() );
             }
+            
             mso.setNames( values.toArray( EMPTY ) );
         }
     }



Mime
View raw message