directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r833647 [16/17] - in /directory: apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/pa...
Date Sat, 07 Nov 2009 07:57:42 GMT
Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultComparatorRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.asn1.primitives.OID;
+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;
+
+
+/**
+ * A Comparator registry service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultComparatorRegistry extends DefaultSchemaObjectRegistry<LdapComparator<?>>
+    implements ComparatorRegistry
+{
+    /** static class logger */
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultComparatorRegistry.class );
+
+    /** A speedup for debug */
+    private static final boolean DEBUG = LOG.isDebugEnabled();
+    
+    /**
+     * Creates a new default ComparatorRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultComparatorRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.COMPARATOR, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( LdapComparator<?> comparator ) throws NamingException
+    {
+        String oid = comparator.getOid();
+        
+        if ( byName.containsKey( oid ) )
+        {
+            String msg = type.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 );
+        }
+        
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "registered " + comparator.getName() + " for OID {}", oid );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapComparator<?> unregister( String numericOid ) throws NamingException
+    {
+        if ( !OID.isOID( numericOid ) )
+        {
+            String msg = "OID " + numericOid + " is not a numeric OID";
+            LOG.error( msg );
+            throw new NamingException( msg );
+        }
+
+        LdapComparator<?> comparator = byName.remove( numericOid );
+        
+        for ( String name : comparator.getNames() )
+        {
+            byName.remove( name );
+        }
+        
+        if ( DEBUG )
+        {
+            LOG.debug( "Removed {} with oid {} from the registry", comparator, numericOid );
+        }
+        
+        return comparator;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        if ( schemaName == null )
+        {
+            return;
+        }
+        
+        // Loop on all the SchemaObjects stored and remove those associated
+        // with the give schemaName
+        for ( LdapComparator<?> comparator : this )
+        {
+            if ( schemaName.equalsIgnoreCase( comparator.getSchemaName() ) )
+            {
+                String oid = comparator.getOid();
+                SchemaObject removed = unregister( oid );
+                
+                if ( DEBUG )
+                {
+                    LOG.debug( "Removed {} with oid {} from the registry", removed, oid );
+                }
+            }
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultComparatorRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultComparatorRegistry clone = (DefaultComparatorRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return byName.values().size();
+    }
+}

Added: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITContentRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITContentRuleRegistry.java?rev=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITContentRuleRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITContentRuleRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * An DITContentRule registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultDITContentRuleRegistry extends DefaultSchemaObjectRegistry<DITContentRule>
+    implements DITContentRuleRegistry
+{
+    /**
+     * Creates a new default DITContentRuleRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultDITContentRuleRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.DIT_CONTENT_RULE, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultDITContentRuleRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultDITContentRuleRegistry clone = (DefaultDITContentRuleRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return oidRegistry.size();
+    }
+}

Added: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITStructureRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITStructureRuleRegistry.java?rev=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITStructureRuleRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultDITStructureRuleRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,242 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A DITStructureRule registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultDITStructureRuleRegistry extends DefaultSchemaObjectRegistry<DITStructureRule>
+    implements DITStructureRuleRegistry
+{
+    /** static class logger */
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultDITStructureRuleRegistry.class );
+
+    /** A speedup for debug */
+    private static final boolean DEBUG = LOG.isDebugEnabled();
+    
+    /** a map of DITStructureRule looked up by RuleId */
+    protected Map<Integer, DITStructureRule> byRuleId;
+    
+    /**
+     * Creates a new default NormalizerRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultDITStructureRuleRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.DIT_STRUCTURE_RULE, oidRegistry );
+        byRuleId = new HashMap<Integer, DITStructureRule>();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( int ruleId )
+    {
+        return byRuleId.containsKey( ruleId );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<DITStructureRule> iterator()
+    {
+        return byRuleId.values().iterator();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Integer> ruleIdIterator()
+    {
+        return byRuleId.keySet().iterator();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( int ruleId ) throws NamingException
+    {
+        DITStructureRule ditStructureRule = byRuleId.get( ruleId );
+
+        if ( ditStructureRule != null )
+        {
+            return ditStructureRule.getSchemaName();
+        }
+        
+        String msg = "RuleId " + ruleId + " not found in ruleId to schema name map!";
+        LOG.warn( msg );
+        throw new NamingException( msg );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( DITStructureRule ditStructureRule ) throws NamingException
+    {
+        int ruleId = ditStructureRule.getRuleId();
+        
+        if ( byRuleId.containsKey( ruleId ) )
+        {
+            String msg = "DITStructureRule with RuleId " + ruleId + " already registered!";
+            LOG.warn( msg );
+            throw new NamingException( msg );
+        }
+
+        byRuleId.put( ruleId, ditStructureRule );
+        
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "registered {} for OID {}", ditStructureRule, ruleId );
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DITStructureRule lookup( int ruleId ) throws NamingException
+    {
+        DITStructureRule ditStructureRule = byRuleId.get( ruleId );
+
+        if ( ditStructureRule == null )
+        {
+            String msg = "DITStructureRule for ruleId " + ruleId + " does not exist!";
+            LOG.debug( msg );
+            throw new NamingException( msg );
+        }
+
+        if ( DEBUG )
+        {
+            LOG.debug( "Found {} with ruleId: {}", ditStructureRule, ruleId );
+        }
+        
+        return ditStructureRule;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unregister( int ruleId ) throws NamingException
+    {
+        DITStructureRule ditStructureRule = byRuleId.remove( ruleId );
+        
+        if ( DEBUG )
+        {
+            LOG.debug( "Removed {} with ruleId {} from the registry", ditStructureRule, ruleId );
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName )
+    {
+        if ( schemaName == null )
+        {
+            return;
+        }
+        
+        // Loop on all the SchemaObjects stored and remove those associated
+        // with the give schemaName
+        for ( DITStructureRule ditStructureRule : this )
+        {
+            if ( schemaName.equalsIgnoreCase( ditStructureRule.getSchemaName() ) )
+            {
+                int ruleId = ditStructureRule.getRuleId();
+                SchemaObject removed = byRuleId.remove( ruleId );
+                
+                if ( DEBUG )
+                {
+                    LOG.debug( "Removed {} with ruleId {} from the registry", removed, ruleId );
+                }
+            }
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void renameSchema( String originalSchemaName, String newSchemaName )
+    {
+        // Loop on all the SchemaObjects stored and remove those associated
+        // with the give schemaName
+        for ( DITStructureRule ditStructureRule : this )
+        {
+            if ( originalSchemaName.equalsIgnoreCase( ditStructureRule.getSchemaName() ) )
+            {
+                ditStructureRule.setSchemaName( newSchemaName );
+
+                if ( DEBUG )
+                {
+                    LOG.debug( "Renamed {} schemaName to {}", ditStructureRule, newSchemaName );
+                }
+            }
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultDITStructureRuleRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultDITStructureRuleRegistry clone = (DefaultDITStructureRuleRegistry)super.clone();
+        
+        // Clone the RuleId map
+        clone.byRuleId = new HashMap<Integer, DITStructureRule>();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return byRuleId.values().size();
+    }
+}

Added: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultLdapSyntaxRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultLdapSyntaxRegistry.java?rev=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultLdapSyntaxRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultLdapSyntaxRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * A LdapSyntax registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultLdapSyntaxRegistry extends DefaultSchemaObjectRegistry<LdapSyntax>
+    implements LdapSyntaxRegistry
+{
+    /**
+     * Creates a new default LdapSyntaxRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultLdapSyntaxRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.LDAP_SYNTAX, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultLdapSyntaxRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultLdapSyntaxRegistry clone = (DefaultLdapSyntaxRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return oidRegistry.size();
+    }
+}

Added: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleRegistry.java?rev=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * A MatchingRule registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultMatchingRuleRegistry extends DefaultSchemaObjectRegistry<MatchingRule>
+    implements MatchingRuleRegistry
+{
+    /**
+     * Creates a new default MatchingRuleRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultMatchingRuleRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.MATCHING_RULE, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultMatchingRuleRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultMatchingRuleRegistry clone = (DefaultMatchingRuleRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return oidRegistry.size();
+    }
+}

Added: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleUseRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleUseRegistry.java?rev=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleUseRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultMatchingRuleUseRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * A MatchingRuleUse registry service default implementation. 
+ * MatchingRuleUse objects are special in that they do not have unique OID's 
+ * specifically assigned to them. Their OID is really the OID of the MatchingRule 
+ * they refer to.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultMatchingRuleUseRegistry extends DefaultSchemaObjectRegistry<MatchingRuleUse>
+    implements MatchingRuleUseRegistry
+{
+    /**
+     * Creates a new default MatchingRuleUseRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultMatchingRuleUseRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.MATCHING_RULE_USE, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultMatchingRuleUseRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultMatchingRuleUseRegistry clone = (DefaultMatchingRuleUseRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return oidRegistry.size();
+    }
+}

Added: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNameFormRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNameFormRegistry.java?rev=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNameFormRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNameFormRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import org.apache.directory.shared.ldap.schema.NameForm;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * An NameForm registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultNameFormRegistry extends DefaultSchemaObjectRegistry<NameForm>
+    implements NameFormRegistry
+{
+    /**
+     * Creates a new default NameFormRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultNameFormRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.NAME_FORM, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultNameFormRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultNameFormRegistry clone = (DefaultNameFormRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return oidRegistry.size();
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultNormalizerRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.asn1.primitives.OID;
+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;
+
+
+/**
+ * A Normalizer registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 831344 $
+ */
+public class DefaultNormalizerRegistry extends DefaultSchemaObjectRegistry<Normalizer>
+    implements NormalizerRegistry
+{
+    /** static class logger */
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultNormalizerRegistry.class );
+
+    /** A speedup for debug */
+    private static final boolean DEBUG = LOG.isDebugEnabled();
+    
+    /**
+     * Creates a new default NormalizerRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultNormalizerRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.NORMALIZER, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( Normalizer normalizer ) throws NamingException
+    {
+        String oid = normalizer.getOid();
+        
+        if ( byName.containsKey( oid ) )
+        {
+            String msg = type.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 );
+        }
+        
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "registered " + normalizer.getName() + " for OID {}", oid );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Normalizer unregister( String numericOid ) throws NamingException
+    {
+        if ( !OID.isOID( numericOid ) )
+        {
+            String msg = "OID " + numericOid + " is not a numeric OID";
+            LOG.error( msg );
+            throw new NamingException( msg );
+        }
+
+        Normalizer normalizer = byName.remove( numericOid );
+        
+        for ( String name : normalizer.getNames() )
+        {
+            byName.remove( name );
+        }
+        
+        if ( DEBUG )
+        {
+            LOG.debug( "Removed {} with oid {} from the registry", normalizer, numericOid );
+        }
+        
+        return normalizer;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        if ( schemaName == null )
+        {
+            return;
+        }
+        
+        // Loop on all the SchemaObjects stored and remove those associated
+        // with the give schemaName
+        for ( Normalizer normalizer : this )
+        {
+            if ( schemaName.equalsIgnoreCase( normalizer.getSchemaName() ) )
+            {
+                String oid = normalizer.getOid();
+                SchemaObject removed = unregister( oid );
+                
+                if ( DEBUG )
+                {
+                    LOG.debug( "Removed {} with oid {} from the registry", removed, oid );
+                }
+            }
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultNormalizerRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultNormalizerRegistry clone = (DefaultNormalizerRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return byName.values().size();
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultObjectClassRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,265 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.directory.NoSuchAttributeException;
+
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * An ObjectClass registry's service default implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class DefaultObjectClassRegistry extends DefaultSchemaObjectRegistry<ObjectClass> 
+    implements ObjectClassRegistry
+{
+    /** static class logger */
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultObjectClassRegistry.class );
+
+    /** Speedup for DEBUG mode */
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+    /** maps OIDs to a Set of descendants for that OID */
+    private Map<String,Set<ObjectClass>> oidToDescendants;
+
+    /**
+     * Creates a new default ObjectClassRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultObjectClassRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.OBJECT_CLASS, oidRegistry );
+        oidToDescendants = new HashMap<String,Set<ObjectClass>>();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasDescendants( String ancestorId ) throws NamingException
+    {
+        try
+        {
+            String oid = getOidByName( ancestorId );
+            Set<ObjectClass> descendants = oidToDescendants.get( oid );
+            return (descendants != null) && !descendants.isEmpty();
+        }
+        catch ( NamingException ne )
+        {
+            throw new NoSuchAttributeException( ne.getMessage() );
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Iterator<ObjectClass> descendants( String ancestorId ) throws NamingException
+    {
+        try
+        {
+            String oid = getOidByName( ancestorId );
+            Set<ObjectClass> descendants = oidToDescendants.get( oid );
+            
+            if ( descendants == null )
+            {
+                return Collections.EMPTY_SET.iterator();
+            }
+            
+            return descendants.iterator();
+        }
+        catch ( NamingException ne )
+        {
+            throw new NoSuchAttributeException( ne.getMessage() );
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void registerDescendants( ObjectClass objectClass, List<ObjectClass> ancestors ) 
+        throws NamingException
+    {
+        // add this attribute to descendant list of other attributes in superior chain
+        if ( ( ancestors == null ) || ( ancestors.size() == 0 ) ) 
+        {
+            return;
+        }
+        
+        for ( ObjectClass ancestor : ancestors )
+        {
+            // Get the ancestor's descendant, if any
+            Set<ObjectClass> descendants = oidToDescendants.get( ancestor.getOid() );
+    
+            // Initialize the descendant Set to store the descendants for the attributeType
+            if ( descendants == null )
+            {
+                descendants = new HashSet<ObjectClass>( 1 );
+                oidToDescendants.put( ancestor.getOid(), descendants );
+            }
+            
+            // Add the current ObjectClass as a descendant
+            descendants.add( objectClass );
+            
+            try
+            {
+                // And recurse until we reach the top of the hierarchy
+                registerDescendants( objectClass, ancestor.getSuperiors() );
+            }
+            catch ( NamingException ne )
+            {
+                throw new NoSuchAttributeException( ne.getMessage() );
+            }
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterDescendants( ObjectClass attributeType, List<ObjectClass> ancestors ) 
+        throws NamingException
+    {
+        // add this attribute to descendant list of other attributes in superior chain
+        if ( ( ancestors == null ) || ( ancestors.size() == 0 ) ) 
+        {
+            return;
+        }
+        
+        for ( ObjectClass ancestor : ancestors )
+        {
+            // Get the ancestor's descendant, if any
+            Set<ObjectClass> descendants = oidToDescendants.get( ancestor.getOid() );
+    
+            if ( descendants != null )
+            {
+                descendants.remove( attributeType );
+                
+                if ( descendants.size() == 0 )
+                {
+                    oidToDescendants.remove( descendants );
+                }
+            }
+            
+            try
+            {
+                // And recurse until we reach the top of the hierarchy
+                unregisterDescendants( attributeType, ancestor.getSuperiors() );
+            }
+            catch ( NamingException ne )
+            {
+                throw new NoSuchAttributeException( ne.getMessage() );
+            }
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( ObjectClass objectClass ) throws NamingException
+    {
+        try
+        {
+            super.register( objectClass );
+            
+            // Register this ObjectClass into the Descendant map
+            registerDescendants( objectClass, objectClass.getSuperiors() );
+            
+            // 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
+        {
+            ObjectClass removed = super.unregister( numericOid );
+    
+            // Deleting an ObjectClass which might be used as a superior means we have
+            // to recursively update the descendant map. We also have to remove
+            // the at.oid -> descendant relation
+            oidToDescendants.remove( numericOid );
+            
+            // Now recurse if needed
+            unregisterDescendants( removed, removed.getSuperiors() );
+            
+            return removed;
+        }
+        catch ( NamingException ne )
+        {
+            throw new NoSuchAttributeException( ne.getMessage() );
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultObjectClassRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultObjectClassRegistry clone = (DefaultObjectClassRegistry)super.clone();
+        
+        // Clone the oidToDescendantSet (will be empty)
+        clone.oidToDescendants = new HashMap<String, Set<ObjectClass>>();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return oidRegistry.size();
+    }
+}

Copied: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java (from r831344, 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/DefaultSchemaObjectRegistry.java?p2=directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java&p1=directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java&r1=831344&r2=833647&rev=833647&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/DefaultSchemaObjectRegistry.java Sat Nov  7 07:57:34 2009
@@ -40,10 +40,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class SchemaObjectRegistry<T extends SchemaObject> implements Iterable<T>, Cloneable
+public class DefaultSchemaObjectRegistry<T extends SchemaObject> implements SchemaObjectRegistry<T>, Iterable<T>, Cloneable
 {
     /** static class logger */
-    private static final Logger LOG = LoggerFactory.getLogger( SchemaObjectRegistry.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultSchemaObjectRegistry.class );
 
     /** A speedup for debug */
     private static final boolean DEBUG = LOG.isDebugEnabled();
@@ -57,11 +57,11 @@
     /** the global OID Registry */
     protected OidRegistry oidRegistry;
     
-
+    
     /**
-     * Creates a new SchemaObjectRegistry instance.
+     * Creates a new DefaultSchemaObjectRegistry instance.
      */
-    protected SchemaObjectRegistry( SchemaObjectType schemaObjectType, OidRegistry oidRegistry )
+    protected DefaultSchemaObjectRegistry( SchemaObjectType schemaObjectType, OidRegistry oidRegistry )
     {
         byName = new HashMap<String, T>();
         type = schemaObjectType;
@@ -70,12 +70,7 @@
     
     
     /**
-     * Checks to see if an SchemaObject exists in the registry, by its
-     * OID or name. 
-     * 
-     * @param oid the object identifier or name of the SchemaObject
-     * @return true if a SchemaObject definition exists for the oid, false
-     * otherwise
+     * {@inheritDoc}
      */
     public boolean contains( String oid )
     {
@@ -89,11 +84,7 @@
     
     
     /**
-     * Gets the name of the schema this schema object is associated with.
-     *
-     * @param id the object identifier or the name
-     * @return the schema name
-     * @throws NamingException if the schema object does not exist
+     * {@inheritDoc}
      */
     public String getSchemaName( String oid ) throws NamingException
     {
@@ -118,10 +109,7 @@
 
     
     /**
-     * Modify all the SchemaObject using a schemaName when this name changes.
-     *
-     * @param originalSchemaName The original Schema name
-     * @param newSchemaName The new Schema name
+     * {@inheritDoc}
      */
     public void renameSchema( String originalSchemaName, String newSchemaName )
     {
@@ -143,9 +131,7 @@
     
     
     /**
-     * Gets an iterator over the registered schema objects in the registry.
-     *
-     * @return an Iterator of homogeneous schema objects
+     * {@inheritDoc}
      */
     public Iterator<T> iterator()
     {
@@ -154,9 +140,7 @@
 
     
     /**
-     * Gets an iterator over the registered schema objects'OID in the registry.
-     *
-     * @return an Iterator of OIDs
+     * {@inheritDoc}
      */
     public Iterator<String> oidsIterator()
     {
@@ -165,11 +149,7 @@
 
     
     /**
-     * Looks up a SchemaObject by its unique Object Identifier or by name.
-     *
-     * @param oid the object identifier or name
-     * @return the SchemaObject instance for the id
-     * @throws NamingException if the SchemaObject does not exist
+     * {@inheritDoc}
      */
     public T lookup( String oid ) throws NamingException
     {
@@ -203,11 +183,7 @@
     
     
     /**
-     * Registers a new SchemaObject with this registry.
-     *
-     * @param schemaObject the SchemaObject to register
-     * @throws NamingException if the SchemaObject is already registered or
-     * the registration operation is not supported
+     * {@inheritDoc}
      */
     public void register( T schemaObject ) throws NamingException
     {
@@ -245,11 +221,7 @@
 
 
     /**
-     * Removes the SchemaObject registered with this registry, using its
-     * numeric OID.
-     * 
-     * @param numericOid the numeric identifier
-     * @throws NamingException if the numeric identifier is invalid
+     * {@inheritDoc}
      */
     public T unregister( String numericOid ) throws NamingException
     {
@@ -280,10 +252,7 @@
     
     
     /**
-     * Unregisters all SchemaObjects defined for a specific schema from
-     * this registry.
-     * 
-     * @param schemaName the name of the schema whose SchemaObjects will be removed from
+     * {@inheritDoc}
      */
     public void unregisterSchemaElements( String schemaName ) throws NamingException
     {
@@ -312,15 +281,7 @@
     
     
     /**
-     * Gets the numericOid for a name/alias if one is associated.  To prevent
-     * lookup failures due to case variance in the name, a failure to lookup the
-     * OID, will trigger a lookup using a lower cased version of the name and 
-     * the name that failed to match will automatically be associated with the
-     * OID.
-     * 
-     * @param name The name we are looking the oid for
-     * @return The numericOID associated with this name
-     * @throws NamingException If the OID can't be found
+     * {@inheritDoc}
      */
     public String getOidByName( String name ) throws NamingException
     {
@@ -346,14 +307,7 @@
 
 
     /**
-     * Checks to see if an alias/name is associated with an OID and it's 
-     * respective schema object in this registry.  Unlike the getOidByName()
-     * method this method does not throw an exception when the name is not
-     * found.
-     * 
-     * @param name The name we are looking for
-     * @return true if the name or it's cannonical form is mapped to a 
-     * schemaObject in this registry, false otherwise.
+     * {@inheritDoc}
      */
     public boolean containsName( String name )
     {
@@ -368,12 +322,12 @@
     
 
     /**
-     * Clone a SchemaObjectRegistry
+     * {@inheritDoc}
      */
-    protected SchemaObjectRegistry<T> clone() throws CloneNotSupportedException
+    public DefaultSchemaObjectRegistry<T> clone() throws CloneNotSupportedException
     {
         // Clone the base object
-        SchemaObjectRegistry<T> clone = (SchemaObjectRegistry<T>)super.clone();
+        DefaultSchemaObjectRegistry<T> clone = (DefaultSchemaObjectRegistry<T>)super.clone();
         
         // Clone the byName Map
         clone.byName = new HashMap<String, T>();
@@ -393,10 +347,20 @@
 
 
     /**
-     * @return the type
+     * {@inheritDoc}
      */
     public SchemaObjectType getType()
     {
         return type;
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return 0;
+    }
+
 }

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSyntaxCheckerRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.asn1.primitives.OID;
+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;
+
+
+/**
+ * SyntaxChecker registry component's service interface.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 831344 $
+ */
+public class DefaultSyntaxCheckerRegistry extends  DefaultSchemaObjectRegistry<SyntaxChecker>
+    implements SyntaxCheckerRegistry
+{
+    /** static class logger */
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultSyntaxCheckerRegistry.class );
+
+    /** A speedup for debug */
+    private static final boolean DEBUG = LOG.isDebugEnabled();
+    
+    /**
+     * Creates a new default SyntaxCheckerRegistry instance.
+     * 
+     * @param oidRegistry The global OID registry 
+     */
+    public DefaultSyntaxCheckerRegistry( OidRegistry oidRegistry )
+    {
+        super( SchemaObjectType.SYNTAX_CHECKER, oidRegistry );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( SyntaxChecker syntaxChecker ) throws NamingException
+    {
+        String oid = syntaxChecker.getOid();
+        
+        if ( byName.containsKey( oid ) )
+        {
+            String msg = type.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 );
+        }
+        
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "registered " + syntaxChecker.getName() + " for OID {}", oid );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SyntaxChecker unregister( String numericOid ) throws NamingException
+    {
+        if ( !OID.isOID( numericOid ) )
+        {
+            String msg = "OID " + numericOid + " is not a numeric OID";
+            LOG.error( msg );
+            throw new NamingException( msg );
+        }
+
+        SyntaxChecker syntaxChecker = byName.remove( numericOid );
+        
+        for ( String name : syntaxChecker.getNames() )
+        {
+            byName.remove( name );
+        }
+        
+        if ( DEBUG )
+        {
+            LOG.debug( "Removed {} with oid {} from the registry", syntaxChecker, numericOid );
+        }
+        
+        return syntaxChecker;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        if ( schemaName == null )
+        {
+            return;
+        }
+        
+        // Loop on all the SchemaObjects stored and remove those associated
+        // with the give schemaName
+        for ( SyntaxChecker syntaxChecker : this )
+        {
+            if ( schemaName.equalsIgnoreCase( syntaxChecker.getSchemaName() ) )
+            {
+                String oid = syntaxChecker.getOid();
+                SchemaObject removed = unregister( oid );
+                
+                if ( DEBUG )
+                {
+                    LOG.debug( "Removed {} with oid {} from the registry", removed, oid );
+                }
+            }
+        }
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DefaultSyntaxCheckerRegistry clone() throws CloneNotSupportedException
+    {
+        DefaultSyntaxCheckerRegistry clone = (DefaultSyntaxCheckerRegistry)super.clone();
+        
+        return clone;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return byName.values().size();
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,245 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
+
+
+/**
+ * An immutable wrapper of the AttributeType registry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class ImmutableAttributeTypeRegistry implements AttributeTypeRegistry
+{
+    /** The wrapped AttributeType registry */
+    AttributeTypeRegistry immutableAttributeTypeRegistry;
+    
+    /**
+     * Creates a new instance of ImmutableAttributeTypeRegistry.
+     *
+     * @param attributeTypeRegistry The wrapped AttributeType registry
+     */
+    public ImmutableAttributeTypeRegistry( AttributeTypeRegistry attributeTypeRegistry )
+    {
+        immutableAttributeTypeRegistry = attributeTypeRegistry;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Map<String, OidNormalizer> getNormalizerMapping()
+    {
+        return immutableAttributeTypeRegistry.getNormalizerMapping();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasDescendants( String ancestorId ) throws NamingException
+    {
+        return immutableAttributeTypeRegistry.hasDescendants( ancestorId );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<AttributeType> descendants( String ancestorId ) throws NamingException
+    {
+        return immutableAttributeTypeRegistry.descendants( ancestorId );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( AttributeType attributeType ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void registerDescendants( AttributeType attributeType, AttributeType ancestor ) 
+        throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterDescendants( AttributeType attributeType, AttributeType ancestor ) 
+        throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeType unregister( String numericOid ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addMappingFor( AttributeType attributeType ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeType lookup( String oid ) throws NamingException
+    {
+        return immutableAttributeTypeRegistry.lookup( oid );
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return immutableAttributeTypeRegistry.toString();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeTypeRegistry clone() throws CloneNotSupportedException
+    {
+        return (AttributeTypeRegistry)immutableAttributeTypeRegistry.clone();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return immutableAttributeTypeRegistry.size();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<AttributeType> iterator()
+    {
+        return immutableAttributeTypeRegistry.iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> oidsIterator()
+    {
+        return immutableAttributeTypeRegistry.oidsIterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( String oid )
+    {
+        return immutableAttributeTypeRegistry.contains( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsName( String name )
+    {
+        return immutableAttributeTypeRegistry.containsName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOidByName( String name ) throws NamingException
+    {
+        return immutableAttributeTypeRegistry.getOidByName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( String oid ) throws NamingException
+    {
+        return immutableAttributeTypeRegistry.getSchemaName( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SchemaObjectType getType()
+    {
+        return immutableAttributeTypeRegistry.getType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void renameSchema( String originalSchemaName, String newSchemaName )
+    {        
+        // Do nothing
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableComparatorRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,179 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import java.util.Iterator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.LdapComparator;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * An immutable wrapper of the Comparator registry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class ImmutableComparatorRegistry implements ComparatorRegistry
+{
+    /** The wrapped LdapComparator registry */
+    ComparatorRegistry immutableComparatorRegistry;
+    
+    /**
+     * Creates a new immutable ComparatorRegistry instance.
+     * 
+     * @param The wrapped LdapComparator registry 
+     */
+    public ImmutableComparatorRegistry( ComparatorRegistry comparatorRegistry )
+    {
+        immutableComparatorRegistry = comparatorRegistry;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( LdapComparator<?> comparator ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the ComparatorRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapComparator<?> unregister( String numericOid ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the ComparatorRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the ComparatorRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ImmutableComparatorRegistry clone() throws CloneNotSupportedException
+    {
+        return (ImmutableComparatorRegistry)immutableComparatorRegistry.clone();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return immutableComparatorRegistry.size();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( String oid )
+    {
+        return immutableComparatorRegistry.contains( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsName( String name )
+    {
+        return immutableComparatorRegistry.containsName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOidByName( String name ) throws NamingException
+    {
+        return immutableComparatorRegistry.getOidByName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( String oid ) throws NamingException
+    {
+        return immutableComparatorRegistry.getSchemaName( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SchemaObjectType getType()
+    {
+        return immutableComparatorRegistry.getType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<LdapComparator<?>> iterator()
+    {
+        return immutableComparatorRegistry.iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapComparator<?> lookup( String oid ) throws NamingException
+    {
+        return immutableComparatorRegistry.lookup( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> oidsIterator()
+    {
+        return immutableComparatorRegistry.oidsIterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void renameSchema( String originalSchemaName, String newSchemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the ComparatorRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITContentRuleRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,179 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import java.util.Iterator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * An immutable wrapper of the DITContentRule registry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class ImmutableDITContentRuleRegistry implements DITContentRuleRegistry
+{
+    /** The wrapped DITContentRule registry */
+    DITContentRuleRegistry immutableDITContentRuleRegistry;
+    
+    /**
+     * Creates a new instance of ImmutableDITContentRuleRegistry.
+     *
+     * @param ditContentRuleRegistry The wrapped DITContentRule registry
+     */
+    public ImmutableDITContentRuleRegistry( DITContentRuleRegistry ditContentRuleRegistry )
+    {
+        immutableDITContentRuleRegistry = ditContentRuleRegistry;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ImmutableDITContentRuleRegistry clone() throws CloneNotSupportedException
+    {
+        return (ImmutableDITContentRuleRegistry)immutableDITContentRuleRegistry.clone();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return immutableDITContentRuleRegistry.size();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( String oid )
+    {
+        return immutableDITContentRuleRegistry.contains( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsName( String name )
+    {
+        return immutableDITContentRuleRegistry.containsName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOidByName( String name ) throws NamingException
+    {
+        return immutableDITContentRuleRegistry.getOidByName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( String oid ) throws NamingException
+    {
+        return immutableDITContentRuleRegistry.getSchemaName( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SchemaObjectType getType()
+    {
+        return immutableDITContentRuleRegistry.getType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<DITContentRule> iterator()
+    {
+        return immutableDITContentRuleRegistry.iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public DITContentRule lookup( String oid ) throws NamingException
+    {
+        return immutableDITContentRuleRegistry.lookup( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> oidsIterator()
+    {
+        return immutableDITContentRuleRegistry.oidsIterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void register( DITContentRule schemaObject ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void renameSchema( String originalSchemaName, String newSchemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public DITContentRule unregister( String numericOid ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the AttributeTypeRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableDITStructureRuleRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,223 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+
+import java.util.Iterator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * An immutable wrapper of the DITStructureRule registry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class ImmutableDITStructureRuleRegistry implements DITStructureRuleRegistry
+{
+    /** The wrapped DITStructureRule registry */
+    DITStructureRuleRegistry immutableDITStructureRuleRegistry;
+    
+    /**
+     * Creates a new instance of ImmutableDITStructureRuleRegistry.
+     *
+     * @param ditStructureRuleRegistry The wrapped DITStructureRule registry
+     */
+    public ImmutableDITStructureRuleRegistry( DITStructureRuleRegistry ditStructureRuleRegistry )
+    {
+        immutableDITStructureRuleRegistry = ditStructureRuleRegistry;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( int ruleId )
+    {
+        return immutableDITStructureRuleRegistry.contains( ruleId );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<DITStructureRule> iterator()
+    {
+        return immutableDITStructureRuleRegistry.iterator();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Integer> ruleIdIterator()
+    {
+        return immutableDITStructureRuleRegistry.ruleIdIterator();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( int ruleId ) throws NamingException
+    {
+        return immutableDITStructureRuleRegistry.getSchemaName( ruleId );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void register( DITStructureRule ditStructureRule ) throws NamingException
+    {
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public DITStructureRule lookup( int ruleId ) throws NamingException
+    {
+        return immutableDITStructureRuleRegistry.lookup( ruleId );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unregister( int ruleId ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITStructureRuleRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITStructureRuleRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void renameSchema( String originalSchemaName, String newSchemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITStructureRuleRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ImmutableDITStructureRuleRegistry clone() throws CloneNotSupportedException
+    {
+        return (ImmutableDITStructureRuleRegistry)immutableDITStructureRuleRegistry.clone();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return immutableDITStructureRuleRegistry.size();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( String oid )
+    {
+        return immutableDITStructureRuleRegistry.contains( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsName( String name )
+    {
+        return immutableDITStructureRuleRegistry.containsName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOidByName( String name ) throws NamingException
+    {
+        return immutableDITStructureRuleRegistry.getOidByName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( String oid ) throws NamingException
+    {
+        return immutableDITStructureRuleRegistry.getSchemaName( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SchemaObjectType getType()
+    {
+        return immutableDITStructureRuleRegistry.getType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public DITStructureRule lookup( String oid ) throws NamingException
+    {
+        return immutableDITStructureRuleRegistry.lookup( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> oidsIterator()
+    {
+        return immutableDITStructureRuleRegistry.oidsIterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public DITStructureRule unregister( String numericOid ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the DITStructureRuleRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+}

Added: 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=833647&view=auto
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java (added)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableLdapSyntaxRegistry.java Sat Nov  7 07:57:34 2009
@@ -0,0 +1,178 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.registries;
+
+import java.util.Iterator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+
+
+/**
+ * An immutable wrapper of the Syntax registry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 828111 $
+ */
+public class ImmutableLdapSyntaxRegistry implements LdapSyntaxRegistry
+{
+    /** The wrapped LdapSyntax registry */
+    LdapSyntaxRegistry immutableLdapSyntaxRegistry;
+
+    /**
+     * Creates a new instance of ImmutableLdapSyntaxRegistry.
+     *
+     * @param ldapSyntaxRegistry The wrapped LdapSyntax registry
+     */
+    public ImmutableLdapSyntaxRegistry( LdapSyntaxRegistry ldapSyntaxRegistry )
+    {
+        immutableLdapSyntaxRegistry = ldapSyntaxRegistry;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ImmutableLdapSyntaxRegistry clone() throws CloneNotSupportedException
+    {
+        return (ImmutableLdapSyntaxRegistry)immutableLdapSyntaxRegistry.clone();
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int size()
+    {
+        return immutableLdapSyntaxRegistry.size();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean contains( String oid )
+    {
+        return immutableLdapSyntaxRegistry.contains( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean containsName( String name )
+    {
+        return immutableLdapSyntaxRegistry.containsName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getOidByName( String name ) throws NamingException
+    {
+        return immutableLdapSyntaxRegistry.getOidByName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSchemaName( String oid ) throws NamingException
+    {
+        return immutableLdapSyntaxRegistry.getSchemaName( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SchemaObjectType getType()
+    {
+        return immutableLdapSyntaxRegistry.getType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<LdapSyntax> iterator()
+    {
+        return immutableLdapSyntaxRegistry.iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapSyntax lookup( String oid ) throws NamingException
+    {
+        return immutableLdapSyntaxRegistry.lookup( oid );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> oidsIterator()
+    {
+        return immutableLdapSyntaxRegistry.oidsIterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void register( LdapSyntax schemaObject ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the LdapSyntaxRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void renameSchema( String originalSchemaName, String newSchemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the LdapSyntaxRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapSyntax unregister( String numericOid ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the LdapSyntaxRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unregisterSchemaElements( String schemaName ) throws NamingException
+    {
+        throw new LdapOperationNotSupportedException( "Cannot modify the LdapSyntaxRegistry copy", ResultCodeEnum.NO_SUCH_OPERATION );
+    }
+}



Mime
View raw message