directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r601982 [2/3] - in /directory: apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/ apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ apacheds/branches/bigbang/core/src/...
Date Fri, 07 Dec 2007 04:29:10 GMT
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=601982&r1=601981&r2=601982&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 Thu Dec  6 20:29:07 2007
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.schema;
 
 
-import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
@@ -42,8 +41,13 @@
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.message.*;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.*;
-import org.apache.directory.shared.ldap.schema.syntax.*;
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
 import org.apache.directory.shared.ldap.util.SingletonEnumeration;
@@ -113,6 +117,8 @@
 
     private SchemaOperationControl schemaManager;
 
+    private SchemaService schemaService;
+
     // the base DN (normalized) of the schema partition
     private LdapDN schemaBaseDN;
 
@@ -151,7 +157,7 @@
 
         schemaBaseDN = new LdapDN( "ou=schema" );
         schemaBaseDN.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
-
+        schemaService = directoryService.getSchemaService();
         schemaManager = directoryService.getSchemaService().getSchemaControl();
 
         // stuff for dealing with subentries (garbage for now)
@@ -520,7 +526,7 @@
                     && ( node instanceof EqualityNode ) )
                 {
                     // call.setBypass( true );
-                    Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
+                    Attributes attrs = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
                     SearchResult result = new ServerSearchResult( base.toString(), null, attrs );
                     return new SingletonEnumeration<SearchResult>( result );
                 }
@@ -537,7 +543,7 @@
                 if ( node.getAttribute().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
                 {
                     // call.setBypass( true );
-                    Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
+                    Attributes attrs = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
                     SearchResult result = new ServerSearchResult( base.toString(), null, attrs, false );
                     return new SingletonEnumeration<SearchResult>( result );
                 }
@@ -550,294 +556,6 @@
 
 
     /**
-     *
-     * @param ids
-     * @return
-     * @throws NamingException
-     */
-    private Attributes getSubschemaEntry( String[] ids ) throws NamingException
-    {
-        if ( ids == null )
-        {
-            ids = EMPTY_STRING_ARRAY;
-        }
-
-        Set<String> setOids = new HashSet<String>();
-        AttributesImpl attrs = new AttributesImpl();
-        AttributeImpl attr;
-        boolean returnAllOperationalAttributes = false;
-
-        // Transform the attributes to their OID counterpart
-        for ( String id:ids )
-        {
-            // Check whether the set contains a plus, and use it below to include all
-            // operational attributes.  Due to RFC 3673, and issue DIREVE-228 in JIRA
-            if ( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES.equals( id ) )
-            {
-                returnAllOperationalAttributes = true;
-            }
-            else if ( SchemaConstants.ALL_USER_ATTRIBUTES.equals(  id ) )
-            {
-                setOids.add( id );
-            }
-            else
-            {
-                setOids.add( registries.getOidRegistry().getOid( id ) );
-            }
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.COMPARATORS_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.COMPARATORS_AT );
-            Iterator<ComparatorDescription> list = registries.getComparatorRegistry().comparatorDescriptionIterator();
-
-            while ( list.hasNext() )
-            {
-                ComparatorDescription description = list.next();
-                attr.add( SchemaUtils.render( description ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.NORMALIZERS_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.NORMALIZERS_AT );
-            Iterator<NormalizerDescription> list = registries.getNormalizerRegistry().normalizerDescriptionIterator();
-
-            while ( list.hasNext() )
-            {
-                NormalizerDescription normalizer = list.next();
-                attr.add( SchemaUtils.render( normalizer ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.SYNTAX_CHECKERS_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.SYNTAX_CHECKERS_AT );
-            Iterator<SyntaxCheckerDescription> list =
-                registries.getSyntaxCheckerRegistry().syntaxCheckerDescriptionIterator();
-
-            while ( list.hasNext() )
-            {
-                SyntaxCheckerDescription syntaxCheckerDescription = list.next();
-                attr.add( SchemaUtils.render( syntaxCheckerDescription ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.OBJECT_CLASSES_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.OBJECT_CLASSES_AT );
-            Iterator<ObjectClass> list = registries.getObjectClassRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                ObjectClass oc = list.next();
-                attr.add( SchemaUtils.render( oc ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.ATTRIBUTE_TYPES_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.ATTRIBUTE_TYPES_AT );
-            Iterator<AttributeType> list = registries.getAttributeTypeRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                AttributeType at = list.next();
-                attr.add( SchemaUtils.render( at ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MATCHING_RULES_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.MATCHING_RULES_AT );
-            Iterator<MatchingRule> list = registries.getMatchingRuleRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                MatchingRule mr = list.next();
-                attr.add( SchemaUtils.render( mr ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MATCHING_RULE_USE_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.MATCHING_RULE_USE_AT );
-            Iterator<MatchingRuleUse> list = registries.getMatchingRuleUseRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                MatchingRuleUse mru = list.next();
-                attr.add( SchemaUtils.render( mru ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.LDAP_SYNTAXES_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.LDAP_SYNTAXES_AT );
-            Iterator<Syntax> list = registries.getSyntaxRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                Syntax syntax = list.next();
-                attr.add( SchemaUtils.render( syntax ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.DIT_CONTENT_RULES_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.DIT_CONTENT_RULES_AT );
-            Iterator<DITContentRule> list = registries.getDitContentRuleRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                DITContentRule dcr = list.next();
-                attr.add( SchemaUtils.render( dcr ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.DIT_STRUCTURE_RULES_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.DIT_STRUCTURE_RULES_AT );
-            Iterator<DITStructureRule> list = registries.getDitStructureRuleRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                DITStructureRule dsr =list.next();
-                attr.add( SchemaUtils.render( dsr ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.NAME_FORMS_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.NAME_FORMS_AT );
-            Iterator<NameForm> list = registries.getNameFormRegistry().iterator();
-
-            while ( list.hasNext() )
-            {
-                NameForm nf = list.next();
-                attr.add( SchemaUtils.render( nf ).toString() );
-            }
-
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.SUBTREE_SPECIFICATION_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.SUBTREE_SPECIFICATION_AT, "{}" );
-            attrs.put( attr );
-        }
-
-        int minSetSize = 0;
-
-        if ( setOids.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
-        {
-            minSetSize++;
-        }
-
-        if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) )
-        {
-            minSetSize++;
-        }
-
-        if ( setOids.contains( SchemaConstants.REF_AT_OID ) )
-        {
-            minSetSize++;
-        }
-
-        // add the objectClass attribute
-        if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
-             setOids.contains( SchemaConstants.OBJECT_CLASS_AT_OID ) ||
-             setOids.size() == minSetSize )
-        {
-            attr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-            attr.add( SchemaConstants.TOP_OC );
-            attr.add( "subschema" );
-            attr.add( SchemaConstants.SUBENTRY_OC );
-            attr.add( ApacheSchemaConstants.APACHE_SUBSCHEMA_OC );
-            attrs.put( attr );
-        }
-
-        // add the cn attribute as required for the RDN
-        if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
-             setOids.contains( SchemaConstants.CN_AT_OID ) ||
-             setOids.size() == minSetSize )
-        {
-            attrs.put( SchemaConstants.CN_AT, "schema" );
-        }
-
-        // -------------------------------------------------------------------
-        // set operational attributes for the subentry
-        // -------------------------------------------------------------------
-
-        // look up cn=schemaModifications,ou=schema and get values for the
-        // modifiers and creators operational information
-
-        Attributes modificationAttributes = nexus.lookup( new LookupOperationContext( schemaModificationAttributesDN ) );
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.CREATE_TIMESTAMP_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.CREATE_TIMESTAMP_AT );
-            AttributeType createTimestampAT = registries.
-                getAttributeTypeRegistry().lookup( SchemaConstants.CREATE_TIMESTAMP_AT );
-            Attribute createTimestamp = AttributeUtils.getAttribute( modificationAttributes, createTimestampAT );
-            attr.add( createTimestamp.get() );
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.CREATORS_NAME_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.CREATORS_NAME_AT );
-            attr.add( PartitionNexus.ADMIN_PRINCIPAL );
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MODIFY_TIMESTAMP_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-            AttributeType schemaModifyTimestampAT = registries.
-                getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT );
-            Attribute schemaModifyTimestamp =
-                AttributeUtils.getAttribute( modificationAttributes, schemaModifyTimestampAT );
-            attr.add( schemaModifyTimestamp.get() );
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MODIFIERS_NAME_AT_OID ) )
-        {
-            attr = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-            AttributeType schemaModifiersNameAT = registries.
-                getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
-            Attribute schemaModifiersName = 
-                AttributeUtils.getAttribute( modificationAttributes, schemaModifiersNameAT );
-            attr.add( schemaModifiersName.get() );
-            attrs.put( attr );
-        }
-        
-        return attrs;
-    }
-
-    
-    /**
      * Search for an entry, using its DN. Binary attributes and ObjectClass attribute are removed.
      */
     public Attributes lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
@@ -1190,7 +908,7 @@
     public void rename( NextInterceptor next, RenameOperationContext opContext ) throws NamingException
     {
         LdapDN name = opContext.getDn();
-        String newRdn = opContext.getNewRdn();
+        Rdn newRdn = opContext.getNewRdn();
         boolean deleteOldRn = opContext.getDelOldDn();
         
         Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
@@ -1215,7 +933,7 @@
         // and never try to look it up in the nexus below
         if ( name.getNormName().equalsIgnoreCase( subschemaSubentryDnNorm ) )
         {
-            entry = getSubschemaEntry( SCHEMA_SUBENTRY_RETURN_ATTRIBUTES );
+            entry = schemaService.getSubschemaEntry( SCHEMA_SUBENTRY_RETURN_ATTRIBUTES );
         }
         else
         {

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=601982&r1=601981&r2=601982&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 Thu Dec  6 20:29:07 2007
@@ -46,6 +46,7 @@
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.*;
 import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 import org.apache.directory.shared.ldap.schema.syntax.ComparatorDescription;
@@ -423,7 +424,7 @@
     }
 
 
-    public void modifyRn( LdapDN name, String newRdn, boolean deleteOldRn, Attributes entry, boolean doCascadeModify ) 
+    public void modifyRn( LdapDN name, Rdn newRdn, boolean deleteOldRn, Attributes entry, boolean doCascadeModify ) 
         throws NamingException
     {
         Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
@@ -480,7 +481,7 @@
     }
 
 
-    public void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn, 
+    public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn,
         Attributes entry, boolean cascade ) throws NamingException
     {
         Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Thu Dec  6 20:29:07 2007
@@ -696,8 +696,7 @@
     public void rename( NextInterceptor next, RenameOperationContext opContext ) throws NamingException
     {
         LdapDN name = opContext.getDn();
-        String newRdn = opContext.getNewRdn();
-        
+
         Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
         Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
 
@@ -712,10 +711,7 @@
             LdapDN newName = ( LdapDN ) name.clone();
             newName.remove( newName.size() - 1 );
 
-            LdapDN rdn = new LdapDN( newRdn );
-            newName.addAll( rdn );
-            rdn.normalize( attrRegistry.getNormalizerMapping() );
-            newName.normalize( attrRegistry.getNormalizerMapping() );
+            newName.add( opContext.getNewRdn() );
 
             String newNormName = newName.toNormName();
             subentryCache.setSubentry( newNormName, ss, subentry.getTypes() );
@@ -757,7 +753,7 @@
             // attributes contained within this regular entry with name changes
             LdapDN newName = ( LdapDN ) name.clone();
             newName.remove( newName.size() - 1 );
-            newName.add( newRdn );
+            newName.add( opContext.getNewRdn() );
             newName.normalize( attrRegistry.getNormalizerMapping() );
             List<ModificationItemImpl> mods = getModsOnEntryRdnChange( name, newName, entry );
 
@@ -774,8 +770,7 @@
     {
         LdapDN oriChildName = opContext.getDn();
         LdapDN parent = opContext.getParent();
-        String newRn = opContext.getNewRdn();
-        
+
         
         Attributes entry = nexus.lookup( new LookupOperationContext( oriChildName ) );
         Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
@@ -791,11 +786,8 @@
             LdapDN newName = ( LdapDN ) parent.clone();
             newName.remove( newName.size() - 1 );
 
-            LdapDN rdn = new LdapDN( newRn );
-            newName.addAll( rdn );
-            rdn.normalize( attrRegistry.getNormalizerMapping() );
-            newName.normalize( attrRegistry.getNormalizerMapping() );
-            
+            newName.add( opContext.getNewRdn() );
+
             String newNormName = newName.toNormName();
             subentryCache.setSubentry( newNormName, ss, subentry.getTypes() );
             next.moveAndRename( opContext );
@@ -837,7 +829,7 @@
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
             LdapDN newName = ( LdapDN ) parent.clone();
-            newName.add( newRn );
+            newName.add( opContext.getNewRdn() );
             newName.normalize( attrRegistry.getNormalizerMapping() );
             List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java Thu Dec  6 20:29:07 2007
@@ -20,27 +20,27 @@
 
 package org.apache.directory.server.core.trigger;
 
-import java.util.Map;
-
-import javax.naming.NamingException;
-
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
 
+import javax.naming.NamingException;
+import java.util.Map;
+
 
 public class ModifyDNStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
 {
     private boolean deleteOldRn;
     private LdapDN oldRDN;
-    private LdapDN newRDN;
+    private Rdn newRDN;
     private LdapDN oldSuperiorDN;
     private LdapDN newSuperiorDN;
     private LdapDN oldDN;
     private LdapDN newDN;
 
 	public ModifyDNStoredProcedureParameterInjector( Invocation invocation, boolean deleteOldRn,
-        LdapDN oldRDN, LdapDN newRDN, LdapDN oldSuperiorDN, LdapDN newSuperiorDN, LdapDN oldDN, LdapDN newDN)
+        LdapDN oldRDN, Rdn newRDN, LdapDN oldSuperiorDN, LdapDN newSuperiorDN, LdapDN oldDN, LdapDN newDN)
     {
         super( invocation );
         this.deleteOldRn = deleteOldRn;
@@ -84,7 +84,7 @@
             return new LdapDN( newRDN.getUpName() );
         }
     };
-    
+
     /**
      * Injector for 'newrdn' parameter of ModifyDNRequest as in RFC4511.
      */
@@ -93,10 +93,10 @@
         public Object inject( StoredProcedureParameter param ) throws NamingException
         {
             // Return a safe copy constructed with user provided name.
-            return new Boolean( deleteOldRn );
+            return deleteOldRn;
         }
     };
-    
+
     /**
      * Injector for 'newSuperior' parameter of ModifyDNRequest as in RFC4511.
      */

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Thu Dec  6 20:29:07 2007
@@ -40,6 +40,7 @@
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 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.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.trigger.ActionTime;
 import org.apache.directory.shared.ldap.trigger.LdapOperation;
@@ -54,7 +55,10 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -343,7 +347,7 @@
     public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws NamingException
     {
         LdapDN name = renameContext.getDn();
-        String newRdn = renameContext.getNewRdn();
+        Rdn newRdn = renameContext.getNewRdn();
         boolean deleteOldRn = renameContext.getDelOldDn();
         
         // Bypass trigger handling if the service is disabled.
@@ -360,7 +364,6 @@
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
         
         LdapDN oldRDN = new LdapDN( name.getRdn().getUpName() );
-        LdapDN newRDN = new LdapDN( newRdn );
         LdapDN oldSuperiorDN = ( LdapDN ) name.clone();
         oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
         LdapDN newSuperiorDN = ( LdapDN ) oldSuperiorDN.clone();
@@ -369,7 +372,7 @@
         newDN.add( newRdn );
         
         StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
-            invocation, deleteOldRn, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
+            invocation, deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
         
         // Gather Trigger Specifications which apply to the entry being renamed.
         List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
@@ -390,7 +393,7 @@
     {
         LdapDN oriChildName = moveAndRenameContext.getDn();
         LdapDN parent = moveAndRenameContext.getParent();
-        String newRn = moveAndRenameContext.getNewRdn();
+        Rdn newRdn = moveAndRenameContext.getNewRdn();
         boolean deleteOldRn = moveAndRenameContext.getDelOldDn();
 
         // Bypass trigger handling if the service is disabled.
@@ -407,16 +410,15 @@
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
         
         LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
-        LdapDN newRDN = new LdapDN( newRn );
         LdapDN oldSuperiorDN = ( LdapDN ) oriChildName.clone();
         oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
         LdapDN newSuperiorDN = ( LdapDN ) parent.clone();
         LdapDN oldDN = ( LdapDN ) oriChildName.clone();
         LdapDN newDN = ( LdapDN ) parent.clone();
-        newDN.add( newRn );
+        newDN.add( newRdn.getUpName() );
 
         StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector(
-            invocation, deleteOldRn, oldRDN, newRDN, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
+            invocation, deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
 
         // Gather Trigger Specifications which apply to the entry being exported.
         List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
@@ -481,7 +483,7 @@
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
         
         LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
-        LdapDN newRDN = new LdapDN( oriChildName.getRdn().getUpName() );
+        Rdn newRDN = new Rdn( oriChildName.getRdn().getUpName() );
         LdapDN oldSuperiorDN = ( LdapDN ) oriChildName.clone();
         oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
         LdapDN newSuperiorDN = ( LdapDN ) newParentName.clone();

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Thu Dec  6 20:29:07 2007
@@ -37,6 +37,7 @@
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
@@ -1058,6 +1059,13 @@
             addAliasIndices( id, normName, ( String ) aliasAttr.get() );
         }
 
+
+        if ( ! Character.isDigit( normName.toNormName().charAt( 0 ) ) )
+        {
+            throw new IllegalStateException( "Not a normalized name: " + normName.toNormName() );
+        }
+
+
         ndnIdx.add( normName.toNormName(), id );
         updnIdx.add( normName.getUpName(), id );
         hierarchyIdx.add( parentId, id );
@@ -1566,11 +1574,11 @@
      * @throws NamingException if there are any errors propagating the name
      *        changes.
      */
-    public void rename( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn ) throws NamingException
     {
-        String newRdnAttr = NamespaceTools.getRdnAttribute( newRdn );
-        String newRdnValue = NamespaceTools.getRdnValue( newRdn );
-        Long id = getEntryId( dn.toString() );
+        String newRdnAttr = newRdn.getNormType();
+        String newRdnValue = ( String ) newRdn.getValue();
+        Long id = getEntryId( dn.getNormName() );
         Attributes entry = lookup( id );
         LdapDN updn = new LdapDN( getEntryUpdn( id ) );
 
@@ -1583,8 +1591,7 @@
          * new Rdn attribute within this entry.
          */
 
-        String newRdnAttrOid = oidRegistry.getOid( newRdnAttr );
-        AttributeType newRdnAttrType = attributeTypeRegistry.lookup( newRdnAttrOid );
+        AttributeType newRdnAttrType = attributeTypeRegistry.lookup( newRdn.getNormType() );
         Attribute rdnAttr = AttributeUtils.getAttribute( entry, newRdnAttrType );
         
         if ( rdnAttr == null )
@@ -1593,22 +1600,22 @@
         }
 
         // add the new Rdn value only if it is not already present in the entry
-        if ( !rdnAttr.contains( newRdnValue ) )
+        if ( ! AttributeUtils.containsValue( rdnAttr, newRdnValue, newRdnAttrType ) )
         {
             rdnAttr.add( newRdnValue );
         }
 
         entry.put( rdnAttr );
 
-        if ( hasUserIndexOn( newRdnAttrOid ) )
+        if ( hasUserIndexOn( newRdn.getNormType() ) )
         {
-            Index idx = getUserIndex( newRdnAttrOid );
+            Index idx = getUserIndex( newRdn.getNormType() );
             idx.add( newRdnValue, id );
 
             // Make sure the altered entry shows the existance of the new attrib
-            if ( !existanceIdx.hasValue( newRdnAttrOid, id ) )
+            if ( !existanceIdx.hasValue( newRdn.getNormType(), id ) )
             {
-                existanceIdx.add( newRdnAttrOid, id );
+                existanceIdx.add( newRdn.getNormType(), id );
             }
         }
 
@@ -1617,7 +1624,7 @@
          * ====================================================================
          * If the old Rdn is to be removed we need to get the attribute and 
          * value for it.  Keep in mind the old Rdn need not be based on the 
-         * same Rdn as the new one.  We remove the Rdn value from the entry
+         * same attr as the new one.  We remove the Rdn value from the entry
          * and remove the value/id tuple from the index on the old Rdn attr
          * if any.  We also test if the delete of the old Rdn index tuple 
          * removed all the attribute values of the old Rdn using a reverse
@@ -1628,18 +1635,16 @@
 
         if ( deleteOldRdn )
         {
-            String oldRdn = updn.get( updn.size() - 1 );
-            String oldRdnAttr = NamespaceTools.getRdnAttribute( oldRdn );
-            String oldRdnAttrOid = oidRegistry.getOid( oldRdnAttr );
-            String oldRdnValue = NamespaceTools.getRdnValue( oldRdn );
-            AttributeType oldRdnAttrType = attributeTypeRegistry.lookup( oldRdnAttrOid );
-            
-            AttributeUtils.getAttribute( entry, oldRdnAttrType ).remove( oldRdnValue );
+            Rdn oldRdn = updn.getRdn();
+            AttributeType oldRdnAttrType = attributeTypeRegistry.lookup( oldRdn.getNormType() );
 
-            if ( hasUserIndexOn( oldRdnAttrOid ) )
+            Attribute oldRdnAttr = AttributeUtils.getAttribute( entry, oldRdnAttrType );
+            AttributeUtils.removeValue( oldRdnAttr, oldRdn.getUpValue(), oldRdnAttrType );
+
+            if ( hasUserIndexOn( oldRdn.getNormType() ) )
             {
-                Index idx = getUserIndex( oldRdnAttrOid );
-                idx.drop( oldRdnValue, id );
+                Index idx = getUserIndex( oldRdn.getNormType() );
+                idx.drop( oldRdn.getValue(), id );
 
                 /*
                  * If there is no value for id in this index due to our
@@ -1647,7 +1652,7 @@
                  */
                 if ( null == idx.reverseLookup( id ) )
                 {
-                    existanceIdx.drop( oldRdnAttrOid, id );
+                    existanceIdx.drop( oldRdn.getNormType(), id );
                 }
             }
         }
@@ -1665,7 +1670,11 @@
 
         LdapDN newUpdn = ( LdapDN ) updn.clone(); // copy da old updn
         newUpdn.remove( newUpdn.size() - 1 ); // remove old upRdn
-        newUpdn.add( newUpdn.size(), newRdn ); // add da new upRdn
+        newUpdn.add( newRdn.getUpName() ); // add da new upRdn
+
+        // gotta normalize cuz this thang is cloned and not normalized by default
+        newUpdn.normalize( attributeTypeRegistry.getNormalizerMapping() );
+        
         modifyDn( id, newUpdn, false ); // propagate dn changes
         
         if ( isSyncOnWrite )
@@ -1698,10 +1707,13 @@
 
         // Now we can handle the appropriate name userIndices for all cases
         ndnIdx.drop( id );
-        
-        LdapDN normalizedDn = ( updn.isNormalized() ? updn : LdapDN.normalize( updn, attributeTypeRegistry.getNormalizerMapping() ) );
-        
-        ndnIdx.add( ndnIdx.getNormalized( normalizedDn.toNormName() ), id );
+
+        if ( ! updn.isNormalized() )
+        {
+            updn.normalize( attributeTypeRegistry.getNormalizerMapping() );
+        }
+
+        ndnIdx.add( ndnIdx.getNormalized( updn.toNormName() ), id );
 
         updnIdx.drop( id );
         updnIdx.add( updn.getUpName(), id );
@@ -1727,12 +1739,11 @@
         }
 
         NamingEnumeration children = list( id );
-        
         while ( children.hasMore() )
         {
             // Get the child and its id
             IndexRecord rec = ( IndexRecord ) children.next();
-            Long childId = (Long)rec.getEntryId();
+            Long childId = ( Long ) rec.getEntryId();
 
             /* 
              * Calculate the Dn for the child's new name by copying the parents
@@ -1740,8 +1751,11 @@
              */
             LdapDN childUpdn = ( LdapDN ) updn.clone();
             LdapDN oldUpdn = new LdapDN( getEntryUpdn( childId ) );
+
             String rdn = oldUpdn.get( oldUpdn.size() - 1 );
-            childUpdn.add( childUpdn.size(), rdn );
+            LdapDN rdnDN = new LdapDN( rdn );
+            rdnDN.normalize( attributeTypeRegistry.getNormalizerMapping() );
+            childUpdn.add( rdnDN.getRdn() );
 
             // Recursively change the names of the children below
             modifyDn( childId, childUpdn, isMove );
@@ -1749,7 +1763,7 @@
     }
 
 
-    public void move( LdapDN oldChildDn, LdapDN newParentDn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void move( LdapDN oldChildDn, LdapDN newParentDn, Rdn newRdn, boolean deleteOldRdn ) throws NamingException
     {
         Long childId = getEntryId( oldChildDn.toString() );
         rename( oldChildDn, newRdn, deleteOldRdn );

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Thu Dec  6 20:29:07 2007
@@ -31,10 +31,11 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 import javax.naming.NameAlreadyBoundException;
@@ -198,10 +199,10 @@
      * Returns a new {@link Operation} that performs "modifyRN" operation.
      * This operation is a subset of "move" operation.
      * Calling this method actually forwards the call to
-     * {@link #newMove(LdapDN, LdapDN, String, boolean)} with unchanged
+     * {@link #newMove(LdapDN, LdapDN, Rdn, boolean)} with unchanged
      * <tt>newParentName</tt>. 
      */
-    public Operation newModifyRn( LdapDN oldName, String newRdn, boolean deleteOldRn ) throws NamingException
+    public Operation newModifyRn( LdapDN oldName, Rdn newRdn, boolean deleteOldRn ) throws NamingException
     {
         LdapDN newParentName = ( LdapDN ) oldName.clone();
         newParentName.remove( oldName.size() - 1 );
@@ -213,12 +214,12 @@
     /**
      * Returns a new {@link Operation} that performs "move" operation.
      * Calling this method actually forwards the call to
-     * {@link #newMove(LdapDN, LdapDN, String, boolean)} with unchanged
+     * {@link #newMove(LdapDN, LdapDN, Rdn, boolean)} with unchanged
      * <tt>newRdn</tt> and '<tt>true</tt>' <tt>deleteOldRn</tt>. 
      */
     public Operation newMove( LdapDN oldName, LdapDN newParentName ) throws NamingException
     {
-        return newMove( oldName, newParentName, oldName.get( oldName.size() - 1 ), true );
+        return newMove( oldName, newParentName, oldName.getRdn(), true );
     }
 
 
@@ -227,7 +228,7 @@
      * Please note this operation is the most fragile operation I've written
      * so it should be reviewed completely again.
      */
-    public Operation newMove( LdapDN oldName, LdapDN newParentName, String newRdn, boolean deleteOldRn )
+    public Operation newMove( LdapDN oldName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn )
         throws NamingException
     {
         // Prepare to create composite operations
@@ -273,8 +274,8 @@
                     }
                 }
                 // Add the new RDN attribute value.
-                String newRDNAttributeID = NamespaceTools.getRdnAttribute( newRdn );
-                String newRDNAttributeValue = NamespaceTools.getRdnValue( newRdn );
+                String newRDNAttributeID = newRdn.getUpType();
+                String newRDNAttributeValue = ( String ) newRdn.getUpValue();
                 Attribute newRDNAttribute = entry.get( newRDNAttributeID );
                 if ( newRDNAttribute != null )
                 {
@@ -312,6 +313,8 @@
      * Make sure the specified <tt>newEntryName</tt> already exists.  It
      * checked {@link Constants#ENTRY_DELETED} additionally to see if the
      * entry actually exists in a {@link Partition} but maked as deleted.
+     *
+     * @param newEntryName makes sure an entry already exists.
      */
     private void checkBeforeAdd( LdapDN newEntryName ) throws NamingException
     {

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java Thu Dec  6 20:29:07 2007
@@ -407,7 +407,9 @@
     @Override
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameOpContext ) throws NamingException
     {
-        Operation op = operationFactory.newMove( moveAndRenameOpContext.getDn(), moveAndRenameOpContext.getParent(), moveAndRenameOpContext.getNewRdn(), moveAndRenameOpContext.getDelOldDn() );
+        Operation op = operationFactory.newMove( moveAndRenameOpContext.getDn(),
+                moveAndRenameOpContext.getParent(), moveAndRenameOpContext.getNewRdn(),
+                moveAndRenameOpContext.getDelOldDn() );
         op.execute( nexus, store, attrRegistry );
     }
 

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java Thu Dec  6 20:29:07 2007
@@ -107,7 +107,7 @@
                 if ( partition instanceof BTreePartition )
                 {
                     BTreePartition btPartition = ( BTreePartition ) partition;
-                    PartitionFrame frame = new PartitionFrame( btPartition, btPartition.getSearchEngine() );
+                    PartitionFrame frame = new PartitionFrame( btPartition );
                     Point pos = getCenteredPosition( frame );
                     pos.y = launchedWindowCount * 20 + pos.y;
                     double multiplier = getAspectRatio() * 20.0;

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/AbstractSchemaLoader.java Thu Dec  6 20:29:07 2007
@@ -40,7 +40,7 @@
 public abstract class AbstractSchemaLoader implements SchemaLoader
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( AbstractSchemaLoader.class );
+    private static final Logger LOG = LoggerFactory.getLogger( AbstractSchemaLoader.class );
     
     protected SchemaLoaderListener listener;
     
@@ -79,7 +79,7 @@
      * @param notLoaded hash of schemas keyed by name which have yet to be loaded
      * @param schema the current schema we are attempting to load
      * @param registries the set of registries to use while loading
-     * @param props to use while trying resolve other schemas
+     * @param props to use while trying to resolve other schemas
      * @throws NamingException if there is a cycle detected and/or another
      * failure results while loading, producing and or registering schema objects
      */
@@ -88,7 +88,7 @@
     {
         if ( registries.getLoadedSchemas().containsKey( schema.getSchemaName() ) )
         {
-            log.warn( "{} schema has already been loaded" + schema.getSchemaName() );
+            LOG.warn( "{} schema has already been loaded" + schema.getSchemaName() );
             return;
         }
         
@@ -117,20 +117,27 @@
          * all deps loading them with their deps first if they have not been
          * loaded.
          */
-        for ( int ii = 0; ii < deps.length; ii++ )
+        for ( String depName : deps )
         {
-            if ( !notLoaded.containsKey( deps[ii] ) )
+            // @todo if a dependency is not loaded it's not in this list
+            // @todo why is it not in this list?  Without being in this list
+            // @todo this for loop is absolutely useless - we will not load
+            // @todo any disabled dependencies at all.  I'm shocked that the
+            // @todo samba schema is actually loading when the nis dependency
+            // @todo is not loaded.
+
+            if ( !notLoaded.containsKey( depName ) )
             {
                 continue;
             }
 
-            Schema dep = notLoaded.get( deps[ii] );
-            
+            Schema dep = notLoaded.get( depName );
+
             // dep is not in the set of schema objects we need to try to resolve it
             if ( dep == null )
             {
-                // try to load dependency with the provided properties default 
-                dep = getSchema( deps[ii], props );
+                // try to load dependency with the provided properties default
+                dep = getSchema( depName, props );
             }
 
             if ( beenthere.contains( dep.getSchemaName() ) )

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java Thu Dec  6 20:29:07 2007
@@ -68,9 +68,12 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+
     /**
-     * Creates an empty BootstrapAttributeTypeRegistry.
-     * @param oidRegistry a numeric object identifier registry
+     * Creates an empty DefaultAttributeTypeRegistry.
+     *
+     * @param oidRegistry used by this registry for OID to name resolution of
+     * dependencies and to automatically register and unregister it's aliases and OIDs
      */
     public DefaultAttributeTypeRegistry( OidRegistry oidRegistry )
     {
@@ -100,6 +103,11 @@
         }
         oidRegistry.register( attributeType.getOid(), attributeType.getOid() );
 
+        if ( mapping != null )
+        {
+            addMappingFor( attributeType );
+        }
+
         registerDescendants( attributeType );
         byOid.put( attributeType.getOid(), attributeType );
         
@@ -236,7 +244,50 @@
     {
         return byOid.values().iterator();
     }
-    
+
+
+    private void removeMappingFor( AttributeType type ) throws NamingException
+    {
+        if ( type == null )
+        {
+            return;
+        }
+        
+        MatchingRule matchingRule = type.getEquality();
+        mapping.remove( type.getOid() );
+        String[] aliases = type.getNames();
+        for ( String aliase : aliases )
+        {
+            mapping.remove( aliase );
+            mapping.remove( aliase.toLowerCase() );
+        }
+    }
+
+
+    private void addMappingFor( AttributeType type ) throws NamingException
+    {
+        MatchingRule matchingRule = type.getEquality();
+        OidNormalizer oidNormalizer;
+
+        if ( matchingRule == null )
+        {
+            LOG.debug( "Attribute " + type.getName() + " does not have normalizer : using NoopNormalizer" );
+            oidNormalizer = new OidNormalizer( type.getOid(), new NoOpNormalizer() );
+        }
+        else
+        {
+            oidNormalizer = new OidNormalizer( type.getOid(), matchingRule.getNormalizer() );
+        }
+
+        mapping.put( type.getOid(), oidNormalizer );
+        String[] aliases = type.getNames();
+        for ( String aliase : aliases )
+        {
+            mapping.put( aliase, oidNormalizer );
+            mapping.put( aliase.toLowerCase(), oidNormalizer );
+        }
+    }
+
     
     public Map<String,OidNormalizer> getNormalizerMapping() throws NamingException
     {
@@ -245,26 +296,7 @@
             mapping = new HashMap<String,OidNormalizer>( byOid.size() << 1 );
             for ( AttributeType type : byOid.values() )
             {
-                MatchingRule matchingRule = type.getEquality();
-                OidNormalizer oidNormalizer;
-
-                if ( matchingRule == null )
-                {
-                    LOG.debug( "Attribute " + type.getName() + " does not have normalizer : using NoopNormalizer" );
-                    oidNormalizer = new OidNormalizer( type.getOid(), new NoOpNormalizer() );
-                }
-                else
-                {
-                    oidNormalizer = new OidNormalizer( type.getOid(), matchingRule.getNormalizer() );
-                }
-
-                mapping.put( type.getOid(), oidNormalizer );
-                String[] aliases = type.getNames();
-                for ( String aliase : aliases )
-                {
-                    mapping.put( aliase, oidNormalizer );
-                    mapping.put( aliase.toLowerCase(), oidNormalizer );
-                }
+                addMappingFor( type );
             }
         }
         
@@ -306,7 +338,13 @@
             throw new NamingException( "Looks like the arg is not a numeric OID" );
         }
 
+        if ( mapping != null )
+        {
+            removeMappingFor( byOid.get( numericOid ));
+        }
+
         byOid.remove( numericOid );
         oidToDescendantSet.remove( numericOid );
+        oidRegistry.unregister( numericOid );
     }
 }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java Thu Dec  6 20:29:07 2007
@@ -43,7 +43,7 @@
 public class DefaultComparatorRegistry implements ComparatorRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultComparatorRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultComparatorRegistry.class );
     /** the comparators in this registry */
     private final Map<String,Comparator> byOid;
     /** maps oids to a comparator description */
@@ -54,8 +54,9 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+
     /**
-     * Creates a default ComparatorRegistry by initializing the map and the
+     * Creates a DefaultComparatorRegistry by initializing the map and the
      * montior.
      */
     public DefaultComparatorRegistry()
@@ -74,16 +75,15 @@
     {
         if ( byOid.containsKey( description.getNumericOid() ) )
         {
-            NamingException e = new NamingException( "Comparator with OID " + description.getNumericOid() 
+            throw new NamingException( "Comparator with OID " + description.getNumericOid() 
                 + " already registered!" );
-            throw e;
         }
 
         oidToDescription.put( description.getNumericOid(), description );
         byOid.put( description.getNumericOid(), comparator );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registed comparator with OID: " + description.getNumericOid() );
+            LOG.debug( "registed comparator with OID: " + description.getNumericOid() );
         }
     }
 
@@ -106,15 +106,14 @@
         if ( byOid.containsKey( oid ) )
         {
             Comparator c = byOid.get( oid );
-            if ( log.isDebugEnabled() )
+            if ( LOG.isDebugEnabled() )
             {
-                log.debug( "looked up comparator with OID: " + oid );
+                LOG.debug( "looked up comparator with OID: " + oid );
             }
             return c;
         }
 
-        NamingException e = new NamingException( "Comparator not found for OID: " + oid );
-        throw e;
+        throw new NamingException( "Comparator not found for OID: " + oid );
     }
 
 

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitContentRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitContentRuleRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitContentRuleRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitContentRuleRegistry.java Thu Dec  6 20:29:07 2007
@@ -40,7 +40,7 @@
 public class DefaultDitContentRuleRegistry implements DITContentRuleRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultDitContentRuleRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultDitContentRuleRegistry.class );
     /** maps an OID to an DITContentRule */
     private final Map<String,DITContentRule> byOid;
     /** the registry used to resolve names to OIDs */
@@ -52,9 +52,12 @@
     // ------------------------------------------------------------------------
 
     /**
-     * Creates an empty BootstrapDitContentRuleRegistry.
+     * Creates an empty DefaultDitContentRuleRegistry.
+     *
+     * @param oidRegistry used by this registry for OID to name resolution of
+     * dependencies and to automatically register and unregister it's aliases and OIDs
      */
-    public DefaultDitContentRuleRegistry(OidRegistry oidRegistry)
+    public DefaultDitContentRuleRegistry( OidRegistry oidRegistry )
     {
         this.byOid = new HashMap<String,DITContentRule>();
         this.oidRegistry = oidRegistry;
@@ -70,16 +73,15 @@
     {
         if ( byOid.containsKey( dITContentRule.getOid() ) )
         {
-            NamingException e = new NamingException( "dITContentRule w/ OID " + dITContentRule.getOid()
+            throw new NamingException( "dITContentRule w/ OID " + dITContentRule.getOid()
                 + " has already been registered!" );
-            throw e;
         }
 
         oidRegistry.register( dITContentRule.getName(), dITContentRule.getOid() );
         byOid.put( dITContentRule.getOid(), dITContentRule );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registed dITContentRule: " + dITContentRule );
+            LOG.debug( "registed dITContentRule: " + dITContentRule );
         }
     }
 
@@ -90,14 +92,13 @@
 
         if ( !byOid.containsKey( id ) )
         {
-            NamingException e = new NamingException( "dITContentRule w/ OID " + id + " not registered!" );
-            throw e;
+            throw new NamingException( "dITContentRule w/ OID " + id + " not registered!" );
         }
 
         DITContentRule dITContentRule = byOid.get( id );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "lookup with id '" + id + "' of dITContentRule: " + dITContentRule );
+            LOG.debug( "lookup with id '" + id + "' of dITContentRule: " + dITContentRule );
         }
         return dITContentRule;
     }
@@ -148,5 +149,6 @@
         }
 
         byOid.remove( numericOid );
+        oidRegistry.unregister( numericOid );
     }
 }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitStructureRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitStructureRuleRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitStructureRuleRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultDitStructureRuleRegistry.java Thu Dec  6 20:29:07 2007
@@ -42,7 +42,7 @@
 public class DefaultDitStructureRuleRegistry implements DITStructureRuleRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultDitStructureRuleRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultDitStructureRuleRegistry.class );
     /** maps an OID to an DITStructureRule */
     private final Map<String,DITStructureRule> byOid;
     /** maps an OID to an DITStructureRule */
@@ -57,9 +57,12 @@
 
     
     /**
-     * Creates an empty BootstrapDitStructureRuleRegistry.
+     * Creates an empty DefaultDitStructureRuleRegistry.
+     *
+     * @param oidRegistry used by this registry for OID to name resolution of
+     * dependencies and to automatically register and unregister it's aliases and OIDs
      */
-    public DefaultDitStructureRuleRegistry(OidRegistry oidRegistry)
+    public DefaultDitStructureRuleRegistry( OidRegistry oidRegistry )
     {
         this.byRuleId = new HashMap<Integer,DITStructureRule>();
         this.byOid = new HashMap<String,DITStructureRule>();
@@ -75,17 +78,16 @@
     {
         if ( byOid.containsKey( dITStructureRule.getOid() ) )
         {
-            NamingException e = new NamingException( "dITStructureRule w/ OID " + dITStructureRule.getOid()
+            throw new NamingException( "dITStructureRule w/ OID " + dITStructureRule.getOid()
                 + " has already been registered!" );
-            throw e;
         }
 
         oidRegistry.register( dITStructureRule.getName(), dITStructureRule.getOid() );
         byOid.put( dITStructureRule.getOid(), dITStructureRule );
         byRuleId.put( dITStructureRule.getRuleId(), dITStructureRule );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registered dITStructureRule: " + dITStructureRule );
+            LOG.debug( "registered dITStructureRule: " + dITStructureRule );
         }
     }
 
@@ -96,14 +98,13 @@
 
         if ( !byOid.containsKey( id ) )
         {
-            NamingException e = new NamingException( "dITStructureRule w/ OID " + id + " not registered!" );
-            throw e;
+            throw new NamingException( "dITStructureRule w/ OID " + id + " not registered!" );
         }
 
         DITStructureRule dITStructureRule = byOid.get( id );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "lookup with id '" + id + "' for dITStructureRule: " + dITStructureRule );
+            LOG.debug( "lookup with id '" + id + "' for dITStructureRule: " + dITStructureRule );
         }
         return dITStructureRule;
     }
@@ -186,20 +187,14 @@
 
         DITStructureRule dsr = byOid.remove( numericOid );
         byRuleId.remove( dsr.getRuleId() );
+        oidRegistry.unregister( numericOid );
     }
 
 
     public boolean hasDITStructureRule( Integer ruleId )
     {
         DITStructureRule dsr = byRuleId.get( ruleId );
-        if ( dsr == null )
-        {
-            return false;
-        }
-        else
-        {
-            return true;
-        }
+        return dsr != null;
     }
 
 

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleRegistry.java Thu Dec  6 20:29:07 2007
@@ -41,7 +41,7 @@
 public class DefaultMatchingRuleRegistry implements MatchingRuleRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultMatchingRuleRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultMatchingRuleRegistry.class );
     /** a map using an OID for the key and a MatchingRule for the value */
     private final Map<String,MatchingRule> byOid;
     /** the registry used to resolve names to OIDs */
@@ -54,11 +54,13 @@
 
     
     /**
-     * Creates a BootstrapMatchingRuleRegistry using existing MatchingRulees
+     * Creates a DefaultMatchingRuleRegistry using existing MatchingRulees
      * for lookups.
-     * 
+     *
+     * @param oidRegistry used by this registry for OID to name resolution of
+     * dependencies and to automatically register and unregister it's aliases and OIDs
      */
-    public DefaultMatchingRuleRegistry(OidRegistry oidRegistry)
+    public DefaultMatchingRuleRegistry( OidRegistry oidRegistry )
     {
         this.oidRegistry = oidRegistry;
         this.byOid = new HashMap<String,MatchingRule>();
@@ -79,41 +81,39 @@
         if ( byOid.containsKey( id ) )
         {
             MatchingRule matchingRule = byOid.get( id );
-            if ( log.isDebugEnabled() )
+            if ( LOG.isDebugEnabled() )
             {
-                log.debug( "lookup with id '"+id+"' of matchingRule: " + matchingRule );
+                LOG.debug( "lookup with id '"+id+"' of matchingRule: " + matchingRule );
             }
             return matchingRule;
         }
 
-        NamingException fault = new NamingException( "Unknown MatchingRule OID " + id );
-        throw fault;
+        throw new NamingException( "Unknown MatchingRule OID " + id );
     }
 
 
     /**
-     * @see MatchingRuleRegistry#register(String, MatchingRule)
+     * @see MatchingRuleRegistry#register(MatchingRule)
      */
     public void register( MatchingRule matchingRule ) throws NamingException
     {
         if ( byOid.containsKey( matchingRule.getOid() ) )
         {
-            NamingException e = new NamingException( "matchingRule w/ OID " + matchingRule.getOid()
+            throw new NamingException( "matchingRule w/ OID " + matchingRule.getOid()
                 + " has already been registered!" );
-            throw e;
         }
 
         String[] names = matchingRule.getNames();
-        for ( int ii = 0; ii < names.length; ii++ )
+        for ( String name : names )
         {
-            oidRegistry.register( names[ii], matchingRule.getOid() );
+            oidRegistry.register( name, matchingRule.getOid() );
         }
         oidRegistry.register( matchingRule.getOid(), matchingRule.getOid() );
 
         byOid.put( matchingRule.getOid(), matchingRule );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registed matchingRule: " + matchingRule);
+            LOG.debug( "registed matchingRule: " + matchingRule);
         }
     }
 
@@ -166,5 +166,6 @@
         }
 
         byOid.remove( numericOid );
+        oidRegistry.unregister( numericOid );
     }
 }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleUseRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleUseRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleUseRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultMatchingRuleUseRegistry.java Thu Dec  6 20:29:07 2007
@@ -41,7 +41,7 @@
 public class DefaultMatchingRuleUseRegistry implements MatchingRuleUseRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultMatchingRuleUseRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultMatchingRuleUseRegistry.class );
     /** maps a name to an MatchingRuleUse */
     private final Map<String,MatchingRuleUse> byName;
 
@@ -52,7 +52,7 @@
 
     
     /**
-     * Creates an empty BootstrapMatchingRuleUseRegistry.
+     * Creates an empty DefaultMatchingRuleUseRegistry.
      */
     public DefaultMatchingRuleUseRegistry()
     {
@@ -69,15 +69,14 @@
     {
         if ( byName.containsKey( matchingRuleUse.getName() ) )
         {
-            NamingException e = new NamingException( "matchingRuleUse w/ name " + matchingRuleUse.getName()
+            throw new NamingException( "matchingRuleUse w/ name " + matchingRuleUse.getName()
                 + " has already been registered!" );
-            throw e;
         }
 
         byName.put( matchingRuleUse.getName(), matchingRuleUse );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registed matchingRuleUse: " + matchingRuleUse );
+            LOG.debug( "registed matchingRuleUse: " + matchingRuleUse );
         }
     }
 
@@ -86,14 +85,13 @@
     {
         if ( !byName.containsKey( name ) )
         {
-            NamingException e = new NamingException( "matchingRuleUse w/ name " + name + " not registered!" );
-            throw e;
+            throw new NamingException( "matchingRuleUse w/ name " + name + " not registered!" );
         }
 
         MatchingRuleUse matchingRuleUse = byName.get( name );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "lookup with name '"+ name + "' of matchingRuleUse: " + matchingRuleUse );
+            LOG.debug( "lookup with name '"+ name + "' of matchingRuleUse: " + matchingRuleUse );
         }
         return matchingRuleUse;
     }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNameFormRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNameFormRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNameFormRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNameFormRegistry.java Thu Dec  6 20:29:07 2007
@@ -40,7 +40,7 @@
 public class DefaultNameFormRegistry implements NameFormRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultNameFormRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultNameFormRegistry.class );
     /** maps an OID to an NameForm */
     private final Map<String,NameForm> byOid;
     /** the registry used to resolve names to OIDs */
@@ -51,10 +51,14 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+
     /**
-     * Creates an empty BootstrapNameFormRegistry.
+     * Creates an empty DefaultNameFormRegistry.
+     *
+     * @param oidRegistry used by this registry for OID to name resolution of
+     * dependencies and to automatically register and unregister it's aliases and OIDs
      */
-    public DefaultNameFormRegistry(OidRegistry oidRegistry)
+    public DefaultNameFormRegistry( OidRegistry oidRegistry )
     {
         this.byOid = new HashMap<String,NameForm>();
         this.oidRegistry = oidRegistry;
@@ -69,16 +73,15 @@
     {
         if ( byOid.containsKey( nameForm.getOid() ) )
         {
-            NamingException e = new NamingException( "nameForm w/ OID " + nameForm.getOid()
+            throw new NamingException( "nameForm w/ OID " + nameForm.getOid()
                 + " has already been registered!" );
-            throw e;
         }
 
         oidRegistry.register( nameForm.getName(), nameForm.getOid() );
         byOid.put( nameForm.getOid(), nameForm );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registered nameForm: " + nameForm );
+            LOG.debug( "registered nameForm: " + nameForm );
         }
     }
 
@@ -89,14 +92,13 @@
 
         if ( !byOid.containsKey( id ) )
         {
-            NamingException e = new NamingException( "nameForm w/ OID " + id + " not registered!" );
-            throw e;
+            throw new NamingException( "nameForm w/ OID " + id + " not registered!" );
         }
 
         NameForm nameForm = byOid.get( id );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "lookup with id '"+ id + "' of nameForm: " + nameForm );
+            LOG.debug( "lookup with id '"+ id + "' of nameForm: " + nameForm );
         }
         return nameForm;
     }
@@ -147,5 +149,6 @@
         }
 
         byOid.remove( numericOid );
+        oidRegistry.unregister( numericOid );
     }
 }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java Thu Dec  6 20:29:07 2007
@@ -44,7 +44,7 @@
 public class DefaultNormalizerRegistry implements NormalizerRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultNormalizerRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultNormalizerRegistry.class );
     /** a map of Normalizers looked up by OID */
     private final Map<String,Normalizer> byOid;
     /** maps an OID to a normalizerDescription */
@@ -55,8 +55,9 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+
     /**
-     * Creates a default normalizer registry.
+     * Creates a new default DefaultNormalizerRegistry.
      */
     public DefaultNormalizerRegistry()
     {
@@ -75,15 +76,14 @@
         String oid = description.getNumericOid();
         if ( byOid.containsKey( oid ) )
         {
-            NamingException e = new NamingException( "Normalizer already " + "registered for OID " + oid );
-            throw e;
+            throw new NamingException( "Normalizer already " + "registered for OID " + oid );
         }
 
         oidToDescription.put( oid, description );
         byOid.put( oid, normalizer );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registered normalizer with oid: " + oid );
+            LOG.debug( "registered normalizer with oid: " + oid );
         }
     }
 
@@ -92,14 +92,13 @@
     {
         if ( !byOid.containsKey( oid ) )
         {
-            NamingException e = new NamingException( "Normalizer for OID " + oid + " does not exist!" );
-            throw e;
+            throw new NamingException( "Normalizer for OID " + oid + " does not exist!" );
         }
 
         Normalizer normalizer = byOid.get( oid );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registered normalizer with oid: " + oid );
+            LOG.debug( "registered normalizer with oid: " + oid );
         }
         return normalizer;
     }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java Thu Dec  6 20:29:07 2007
@@ -40,10 +40,10 @@
 public class DefaultObjectClassRegistry implements ObjectClassRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultObjectClassRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultObjectClassRegistry.class );
     
     /** Speedup for DEBUG mode */
-    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
     
     /** maps an OID to an ObjectClass */
     private final Map<String,ObjectClass> byOid;
@@ -56,9 +56,12 @@
     // ------------------------------------------------------------------------
 
     /**
-     * Creates an empty BootstrapObjectClassRegistry.
+     * Creates an empty DefaultObjectClassRegistry.
+     *
+     * @param oidRegistry used by this registry for OID to name resolution of
+     * dependencies and to automatically register and unregister it's aliases and OIDs
      */
-    public DefaultObjectClassRegistry(OidRegistry oidRegistry)
+    public DefaultObjectClassRegistry( OidRegistry oidRegistry )
     {
         this.byOid = new HashMap<String,ObjectClass>();
         this.oidRegistry = oidRegistry;
@@ -74,9 +77,8 @@
     {
         if ( byOid.containsKey( objectClass.getOid() ) )
         {
-            NamingException e = new NamingException( "objectClass w/ OID " + objectClass.getOid()
+            throw new NamingException( "objectClass w/ OID " + objectClass.getOid()
                 + " has already been registered!" );
-            throw e;
         }
 
         if ( objectClass.getNames() != null && objectClass.getNames().length > 0 )
@@ -92,7 +94,7 @@
         
         if ( IS_DEBUG )
         {
-            log.debug( "registered objectClass: " + objectClass );
+            LOG.debug( "registered objectClass: " + objectClass );
         }
     }
 
@@ -103,15 +105,14 @@
 
         if ( !byOid.containsKey( id ) )
         {
-            NamingException e = new NamingException( "objectClass w/ OID " + id + " not registered!" );
-            throw e;
+            throw new NamingException( "objectClass w/ OID " + id + " not registered!" );
         }
 
         ObjectClass objectClass = byOid.get( id );
         
         if ( IS_DEBUG )
         {
-            log.debug( "looked objectClass with OID '" + id + "' and got back " + objectClass );
+            LOG.debug( "looked objectClass with OID '" + id + "' and got back " + objectClass );
         }
         return objectClass;
     }
@@ -162,5 +163,6 @@
         }
 
         byOid.remove( numericOid );
+        oidRegistry.unregister( numericOid );
     }
 }

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java Thu Dec  6 20:29:07 2007
@@ -45,10 +45,10 @@
 public class DefaultOidRegistry implements OidRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultOidRegistry.class );
-    
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultOidRegistry.class );
+
     /** Speedup for DEBUG mode */
-    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
     
     /** Maps OID to a name or a list of names if more than one name exists */
     private Map<String, List<String>> byOid = new HashMap<String, List<String>>();
@@ -83,7 +83,7 @@
             
             if ( IS_DEBUG )
             {
-                log.debug( "looked up OID '" + oid + "' with id '" + name + "'" );
+                LOG.debug( "looked up OID '" + oid + "' with id '" + name + "'" );
             }
             
             return oid;
@@ -104,7 +104,7 @@
         {
             if ( IS_DEBUG )
             {
-                log.debug( "looked up OID '" + oid + "' with id '" + name + "'" );
+                LOG.debug( "looked up OID '" + oid + "' with id '" + name + "'" );
             }
 
             return oid;
@@ -112,7 +112,7 @@
 
         NamingException fault = new NamingException( "OID for name '" + name + "' was not "
             + "found within the OID registry" );
-        log.error( fault.getMessage() );
+        LOG.error( fault.getMessage() );
         throw fault;
     }
 
@@ -142,15 +142,14 @@
 
         if ( null == value )
         {
-            NamingException fault = new NamingException( "OID '" + oid + "' was not found within the OID registry" );
-            throw fault;
+            throw new NamingException( "OID '" + oid + "' was not found within the OID registry" );
         }
 
         String name = value.get( 0 );
         
         if ( IS_DEBUG )
         {
-            log.debug( "looked up primary name '" + name + "' with OID '" + oid + "'" );
+            LOG.debug( "looked up primary name '" + name + "' with OID '" + oid + "'" );
         }
         
         return name;
@@ -166,13 +165,12 @@
 
         if ( null == value )
         {
-            NamingException fault = new NamingException( "OID '" + oid + "' was not found within the OID registry" );
-            throw fault;
+            throw new NamingException( "OID '" + oid + "' was not found within the OID registry" );
         }
 
         if ( IS_DEBUG )
         {
-            log.debug( "looked up names '" + value + "' for OID '" + oid + "'" );
+            LOG.debug( "looked up names '" + value + "' for OID '" + oid + "'" );
         }
         
         return value;
@@ -220,14 +218,14 @@
         	String message = "Swap the parameter order: the oid " + 
     		"does not start with a digit, or is not an OID!";
         	
-        	log.debug( message );
+        	LOG.debug( message );
             throw new NamingException( message );
         }
         
         if ( StringTools.isEmpty( name ) )
         {
         	String message = "The name is empty";
-        	log.error( message );
+        	LOG.error( message );
             throw new NamingException( message );
         }
 
@@ -251,7 +249,7 @@
          *          Add new value to the list
          * 2). If we do not have a value then we just add it as a String
          */
-        List<String> value = null;
+        List<String> value;
         
         if ( !byOid.containsKey( oid ) )
         {
@@ -276,7 +274,7 @@
         
         if ( IS_DEBUG )
         {
-            log.debug( "registed name '" + name + "' with OID: " + oid );
+            LOG.debug( "registed name '" + name + "' with OID: " + oid );
         }
     }
 

Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java?rev=601982&r1=601981&r2=601982&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java Thu Dec  6 20:29:07 2007
@@ -43,7 +43,7 @@
 public class DefaultSyntaxCheckerRegistry implements SyntaxCheckerRegistry
 {
     /** static class logger */
-    private final static Logger log = LoggerFactory.getLogger( DefaultSyntaxCheckerRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultSyntaxCheckerRegistry.class );
     /** a map by OID of SyntaxCheckers */
     private final Map<String, SyntaxChecker> byOid;
     /** maps an OID to a syntaxCheckerDescription */
@@ -54,8 +54,9 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+
     /**
-     * Creates an instance of a BootstrapSyntaxRegistry.
+     * Creates an instance of a DefaultSyntaxRegistry.
      */
     public DefaultSyntaxCheckerRegistry()
     {
@@ -73,16 +74,15 @@
     {
         if ( byOid.containsKey( syntaxChecker.getSyntaxOid() ) )
         {
-            NamingException e = new NamingException( "SyntaxChecker with OID " + syntaxChecker.getSyntaxOid() 
+            throw new NamingException( "SyntaxChecker with OID " + syntaxChecker.getSyntaxOid()
                 + " already registered!" );
-            throw e;
         }
 
         byOid.put( syntaxChecker.getSyntaxOid(), syntaxChecker );
         oidToDescription.put( syntaxChecker.getSyntaxOid(), syntaxCheckerDescription );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "registered syntaxChecher for OID " + syntaxChecker.getSyntaxOid() );
+            LOG.debug( "registered syntaxChecher for OID " + syntaxChecker.getSyntaxOid() );
         }
     }
 
@@ -91,14 +91,13 @@
     {
         if ( !byOid.containsKey( oid ) )
         {
-            NamingException e = new NamingException( "SyntaxChecker for OID " + oid + " not found!" );
-            throw e;
+            throw new NamingException( "SyntaxChecker for OID " + oid + " not found!" );
         }
 
         SyntaxChecker syntaxChecker = byOid.get( oid );
-        if ( log.isDebugEnabled() )
+        if ( LOG.isDebugEnabled() )
         {
-            log.debug( "looked up syntaxChecher with OID " + oid );
+            LOG.debug( "looked up syntaxChecher with OID " + oid );
         }
         return syntaxChecker;
     }



Mime
View raw message