directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r883258 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/
Date Mon, 23 Nov 2009 06:14:08 GMT
Author: elecharny
Date: Mon Nov 23 06:14:07 2009
New Revision: 883258

URL: http://svn.apache.org/viewvc?rev=883258&view=rev
Log:
o Removed the now useless register() methods, when it's handled by the super class
o Added some missing clear() methods
o The SchemaObject iterator now iterates on the byOid table to avoid returning many times

the same object
o Cleaned up the register() method
o Fixed a nasty bug in copy() : an object wa spotentially copied twice if it has more 
than one reference in the byName table, leading to inconsistent updates of the object's
references

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultAttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleUseRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNameFormRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNormalizerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableObjectClassRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableSyntaxCheckerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultAttributeTypeRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultAttributeTypeRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultAttributeTypeRegistry.java
Mon Nov 23 06:14:07 2009
@@ -128,28 +128,6 @@
     /**
      * {@inheritDoc}
      */
-    public void register( AttributeType attributeType ) throws NamingException
-    {
-        try
-        {
-            super.register( attributeType );
-            
-            // Internally associate the OID to the registered AttributeType
-            if ( IS_DEBUG )
-            {
-                LOG.debug( "registred attributeType: {}", attributeType );
-            }
-        }
-        catch ( NamingException ne )
-        {
-            throw new NoSuchAttributeException( ne.getMessage() );
-        }
-    }
-
-    
-    /**
-     * {@inheritDoc}
-     */
     public void registerDescendants( AttributeType attributeType, AttributeType ancestor
) 
         throws NamingException
     {
@@ -260,7 +238,7 @@
 
         if ( equality == null )
         {
-            LOG.debug( "Attribute {} does not have normalizer : using NoopNormalizer", attributeType.getName()
);
+            LOG.debug( "Attribute {} does not have an EQUALITY MatchingRule : using NoopNormalizer",
attributeType.getName() );
             oidNormalizer = new OidNormalizer( oid, new NoOpNormalizer( attributeType.getOid()
) );
         }
         else
@@ -326,4 +304,30 @@
         
         return copy;
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void clear()
+    {
+        // First clear the shared elements
+        super.clear();
+        
+        // clear the OidNormalizer map
+        oidNormalizerMap.clear();
+        
+        // and clear the descendant
+        for ( String oid : oidToDescendantSet.keySet() )
+        {
+            Set<AttributeType> descendants = oidToDescendantSet.get( oid );
+            
+            if ( descendants != null )
+            {
+                descendants.clear();
+            }
+        }
+        
+        oidToDescendantSet.clear();
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java
Mon Nov 23 06:14:07 2009
@@ -26,7 +26,6 @@
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,41 +57,6 @@
     /**
      * {@inheritDoc}
      */
-    public void register( LdapComparator<?> comparator ) throws NamingException
-    {
-        String oid = comparator.getOid();
-        
-        if ( byName.containsKey( oid ) )
-        {
-            String msg = schemaObjectType.name() + " with OID " + oid + " already registered!";
-            LOG.warn( msg );
-            throw new NamingException( msg );
-        }
-
-        byName.put( oid, comparator );
-        
-        /*
-         * add the aliases/names to the name map along with their toLowerCase
-         * versions of the name: this is used to make sure name lookups work
-         */
-        for ( String name : comparator.getNames() )
-        {
-            byName.put( StringTools.trim( StringTools.toLowerCase( name ) ), comparator );
-        }
-        
-        // Update the ComparatorRegistry OidRegistry
-        oidRegistry.register( comparator );
-
-        if ( LOG.isDebugEnabled() )
-        {
-            LOG.debug( "registered " + comparator.getName() + " for OID {}", oid );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public LdapComparator<?> unregister( String numericOid ) throws NamingException
     {
         if ( !OID.isOID( numericOid ) )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java
Mon Nov 23 06:14:07 2009
@@ -26,7 +26,6 @@
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,41 +57,6 @@
     /**
      * {@inheritDoc}
      */
-    public void register( Normalizer normalizer ) throws NamingException
-    {
-        String oid = normalizer.getOid();
-        
-        if ( byName.containsKey( oid ) )
-        {
-            String msg = schemaObjectType.name() + " with OID " + oid + " already registered!";
-            LOG.warn( msg );
-            throw new NamingException( msg );
-        }
-
-        byName.put( oid, normalizer );
-        
-        /*
-         * add the aliases/names to the name map along with their toLowerCase
-         * versions of the name: this is used to make sure name lookups work
-         */
-        for ( String name : normalizer.getNames() )
-        {
-            byName.put( StringTools.trim( StringTools.toLowerCase( name ) ), normalizer );
-        }
-        
-        // Update the NormalizerRegistry OidRegistry
-        oidRegistry.register( normalizer );
-        
-        if ( LOG.isDebugEnabled() )
-        {
-            LOG.debug( "registered " + normalizer.getName() + " for OID {}", oid );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public Normalizer unregister( String numericOid ) throws NamingException
     {
         if ( !OID.isOID( numericOid ) )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java
Mon Nov 23 06:14:07 2009
@@ -32,6 +32,7 @@
 import javax.naming.directory.NoSuchAttributeException;
 
 import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -191,28 +192,6 @@
     /**
      * {@inheritDoc}
      */
-    public void register( ObjectClass objectClass ) throws NamingException
-    {
-        try
-        {
-            super.register( objectClass );
-            
-            // Internally associate the OID to the registered AttributeType
-            if ( IS_DEBUG )
-            {
-                LOG.debug( "registred objectClass: {}", objectClass );
-            }
-        }
-        catch ( NamingException ne )
-        {
-            throw new NoSuchAttributeException( ne.getMessage() );
-        }
-    }
-    
-    
-    /**
-     * {@inheritDoc}
-     */
     public ObjectClass unregister( String numericOid ) throws NamingException
     {
         try
@@ -248,4 +227,33 @@
         
         return copy;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear()
+    {
+        // Clear the contained SchemaObjects
+        for ( SchemaObject objectClass : oidRegistry )
+        {
+            objectClass.clear();
+        }
+        
+        // First clear the shared elements
+        super.clear();
+        
+        // and clear the descendant
+        for ( String oid : oidToDescendants.keySet() )
+        {
+            Set<ObjectClass> descendants = oidToDescendants.get( oid );
+            
+            if ( descendants != null )
+            {
+                descendants.clear();
+            }
+        }
+        
+        oidToDescendants.clear();
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java
Mon Nov 23 06:14:07 2009
@@ -136,7 +136,7 @@
      */
     public Iterator<T> iterator()
     {
-        return byName.values().iterator();
+        return (Iterator<T>)oidRegistry.iterator(); //byName.values().iterator();
     }
 
     
@@ -190,34 +190,31 @@
     {
         String oid = schemaObject.getOid();
         
-        if ( schemaObject.isEnabled() )
+        if ( byName.containsKey( oid ) )
         {
-            if ( byName.containsKey( oid ) )
-            {
-                String msg = schemaObjectType.name() + " with OID " + oid + " already registered!";
-                LOG.warn( msg );
-                throw new NamingException( msg );
-            }
-    
-            byName.put( oid, schemaObject );
-            
-            /*
-             * add the aliases/names to the name map along with their toLowerCase
-             * versions of the name: this is used to make sure name lookups work
-             */
-            for ( String name : schemaObject.getNames() )
-            {
-            	byName.put( StringTools.trim( StringTools.toLowerCase( name ) ), schemaObject
);
-            }
+            String msg = schemaObjectType.name() + " with OID " + oid + " already registered!";
+            LOG.warn( msg );
+            throw new NamingException( msg );
         }
+
+        byName.put( oid, schemaObject );
         
-        if ( LOG.isDebugEnabled() )
+        /*
+         * add the aliases/names to the name map along with their toLowerCase
+         * versions of the name: this is used to make sure name lookups work
+         */
+        for ( String name : schemaObject.getNames() )
         {
-            LOG.debug( "registered " + schemaObject.getName() + " for OID {}", oid );
+        	byName.put( StringTools.trim( StringTools.toLowerCase( name ) ), schemaObject );
         }
-        
+
         // And register the oid -> schemaObject relation
         oidRegistry.register( schemaObject );
+        
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "registered " + schemaObject.getName() + " for OID {}", oid );
+        }
     }
 
 
@@ -344,8 +341,24 @@
             }
             else
             {
-                // Copy the value
-                T copiedValue = (T)value.copy();
+                T copiedValue = null;
+                
+                // Copy the value if it's not already in the oidRegistry
+                if ( oidRegistry.hasOid( value.getOid() ) )
+                {
+                    try
+                    {
+                        copiedValue = (T)oidRegistry.getSchemaObject( value.getOid() );
+                    }
+                    catch ( NamingException ne )
+                    {
+                        // Can't happen
+                    }
+                }
+                else
+                {
+                    copiedValue = (T)value.copy();
+                }
                 
                 // Update the data structure. 
                 byName.put( key, copiedValue );
@@ -421,4 +434,27 @@
         
         return sb.toString();
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void clear()
+    {
+        // Clear all the schemaObjects
+        for ( SchemaObject schemaObject : oidRegistry )
+        {
+            // Don't clear LoadableSchemaObject
+            if ( ! (schemaObject instanceof LoadableSchemaObject ) )
+            {
+                schemaObject.clear();
+            }
+        }
+        
+        // Remove the byName elements
+        byName.clear();
+        
+        // Clear the OidRegistry
+        oidRegistry.clear();
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java
Mon Nov 23 06:14:07 2009
@@ -26,7 +26,6 @@
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,41 +57,6 @@
     /**
      * {@inheritDoc}
      */
-    public void register( SyntaxChecker syntaxChecker ) throws NamingException
-    {
-        String oid = syntaxChecker.getOid();
-        
-        if ( byName.containsKey( oid ) )
-        {
-            String msg = schemaObjectType.name() + " with OID " + oid + " already registered!";
-            LOG.warn( msg );
-            //throw new NamingException( msg );
-        }
-
-        byName.put( oid, syntaxChecker );
-        
-        /*
-         * add the aliases/names to the name map along with their toLowerCase
-         * versions of the name: this is used to make sure name lookups work
-         */
-        for ( String name : syntaxChecker.getNames() )
-        {
-            byName.put( StringTools.trim( StringTools.toLowerCase( name ) ), syntaxChecker
);
-        }
-        
-        // Update the SyntaxCheckerRegistry OidRegistry
-        oidRegistry.register( syntaxChecker );
-        
-        if ( LOG.isDebugEnabled() )
-        {
-            LOG.debug( "registered " + syntaxChecker.getName() + " for OID {}", oid );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public SyntaxChecker unregister( String numericOid ) throws NamingException
     {
         if ( !OID.isOID( numericOid ) )

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
Mon Nov 23 06:14:07 2009
@@ -252,4 +252,13 @@
     {
         return immutableAttributeTypeRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java
Mon Nov 23 06:14:07 2009
@@ -186,4 +186,13 @@
     {
         return immutableComparatorRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the ComparatorRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java
Mon Nov 23 06:14:07 2009
@@ -148,7 +148,7 @@
      */
     public void register( DITContentRule schemaObject ) throws NamingException
     {
-        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITContentRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
     }
 
 
@@ -157,7 +157,7 @@
      */
     public void renameSchema( String originalSchemaName, String newSchemaName ) throws NamingException
     {
-        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITContentRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
     }
 
 
@@ -166,7 +166,7 @@
      */
     public DITContentRule unregister( String numericOid ) throws NamingException
     {
-        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITContentRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
     }
 
 
@@ -175,7 +175,7 @@
      */
     public void unregisterSchemaElements( String schemaName ) throws NamingException
     {
-        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITContentRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
     }
 
 
@@ -186,4 +186,13 @@
     {
         return immutableDITContentRuleRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITContentRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java
Mon Nov 23 06:14:07 2009
@@ -230,4 +230,13 @@
     {
         return immutableDITStructureRuleRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITStructureRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java
Mon Nov 23 06:14:07 2009
@@ -185,4 +185,13 @@
     {
         return immutableLdapSyntaxRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the LdapSyntaxRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleRegistry.java
Mon Nov 23 06:14:07 2009
@@ -187,4 +187,13 @@
     {
         return immutableMatchingRuleRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the MatchingRuleRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleUseRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleUseRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleUseRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableMatchingRuleUseRegistry.java
Mon Nov 23 06:14:07 2009
@@ -186,4 +186,13 @@
     {
         return immutableMatchingRuleUseRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the MatchingRuleUseRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNameFormRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNameFormRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNameFormRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNameFormRegistry.java
Mon Nov 23 06:14:07 2009
@@ -187,4 +187,13 @@
     {
         return immutableNameFormRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the NameFormRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNormalizerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNormalizerRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNormalizerRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableNormalizerRegistry.java
Mon Nov 23 06:14:07 2009
@@ -187,4 +187,13 @@
     {
         return immutableNormalizerRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the NormalizerRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableObjectClassRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableObjectClassRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableObjectClassRegistry.java
Mon Nov 23 06:14:07 2009
@@ -225,4 +225,13 @@
     {
         return immutableObjectClassRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the ObjectClassRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableSyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableSyntaxCheckerRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableSyntaxCheckerRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableSyntaxCheckerRegistry.java
Mon Nov 23 06:14:07 2009
@@ -186,4 +186,13 @@
     {
         return immutableSyntaxCheckerRegistry.get( oid );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clear() throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the SyntaxCheckerRegistry
copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/OidRegistry.java
Mon Nov 23 06:14:07 2009
@@ -201,7 +201,7 @@
          */
         if ( byOid.containsKey( oid ) )
         {
-            String message = "Therer is already a SchemaObject for OID " + oid;
+            String message = "There is already a SchemaObject for OID " + oid;
             LOG.info( message );
             return;
         }
@@ -273,6 +273,13 @@
     }
     
     
+    public void clear()
+    {
+        // remove all the OID
+        byOid.clear();
+    }
+    
+    
     /**
      * @see Object#toString()
      */

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java?rev=883258&r1=883257&r2=883258&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
Mon Nov 23 06:14:07 2009
@@ -177,4 +177,10 @@
      *  @return The number of AttributeType stored
      */
     int size();
+    
+    
+    /**
+     * Clear the registry from all its content
+     */
+    void clear() throws NamingException;
 }



Mime
View raw message