directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r807406 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/
Date Mon, 24 Aug 2009 22:08:31 GMT
Author: elecharny
Date: Mon Aug 24 22:08:30 2009
New Revision: 807406

URL: http://svn.apache.org/viewvc?rev=807406&view=rev
Log:
Registries are nut using anymore two different object XXX and XXXDescription)

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ComparatorRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITContentRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITStructureRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/LdapSyntaxRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleUseRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NameFormRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NormalizerRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ObjectClassRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SyntaxCheckerRegistry.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AttributeTypeRegistry.java
Mon Aug 24 22:08:30 2009
@@ -21,7 +21,11 @@
 
 
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
+import org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription;
+import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
 
 import javax.naming.NamingException;
 import java.util.Iterator;
@@ -34,39 +38,17 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface AttributeTypeRegistry extends SchemaObjectRegistry<AttributeType>
+public class AttributeTypeRegistry extends SchemaObjectRegistry<AttributeType>
 {
     /**
-     * Registers a new AttributeType with this registry.
-     *
-     * @param attributeType the AttributeType to register
-     * @throws NamingException if the AttributeType is already registered or
-     * the registration operation is not supported
-     */
-    void register( AttributeType attributeType ) throws NamingException;
-
-
-    /**
-     * Looks up an AttributeType by its unique Object Identifier or by its
-     * unique name.
-     * 
-     * @param id the object identifier or name of the AttributeType
-     * @return the AttributeType instance for the oid
-     * @throws NamingException if the AttributeType does not exist
+     * Creates a new default AttributeTypeRegistry instance.
      */
-    AttributeType lookup( String id ) throws NamingException;
-
-
-    /**
-     * Checks to see if an AttributeType exists.
-     * 
-     * @param id the object identifier or name of the AttributeType
-     * @return true if an AttributeType definition exists for the oid, false
-     * otherwise
-     */
-    boolean hasAttributeType( String id );
-
-
+    public AttributeTypeRegistry()
+    {
+        super( SchemaObjectType.ATTRIBUTE_TYPE );
+    }
+    
+    
     /**
      * Gets an oid/name to normalizer mapping used to normalize distinguished 
      * names.

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ComparatorRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ComparatorRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ComparatorRegistry.java
Mon Aug 24 22:08:30 2009
@@ -22,7 +22,6 @@
 
 import org.apache.directory.shared.ldap.schema.LdapComparator;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
 
 
 /**
@@ -31,7 +30,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ComparatorRegistry extends SchemaObjectRegistry<LdapComparator<?>,
LdapComparatorDescription>
+public class ComparatorRegistry extends SchemaObjectRegistry<LdapComparator<?>>
 {
     /**
      * Creates a new default ComparatorRegistry instance.

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITContentRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITContentRuleRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITContentRuleRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITContentRuleRegistry.java
Mon Aug 24 22:08:30 2009
@@ -25,6 +25,10 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.DITContentRule;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+import org.apache.directory.shared.ldap.schema.parsers.DITContentRuleDescription;
+import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
 
 
 /**
@@ -33,34 +37,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface DITContentRuleRegistry extends SchemaObjectRegistry<DITContentRule>
+public class DITContentRuleRegistry extends SchemaObjectRegistry<DITContentRule>
 {
     /**
-     * Registers a DITContentRule with this registry.
-     * 
-     * @param dITContentRule the DITContentRule to register
-     * @throws NamingException if the DITContentRule is already registered or
-     * the registration operation is not supported
+     * Creates a new default NormalizerRegistry instance.
      */
-    void register( DITContentRule dITContentRule ) throws NamingException;
-
-
-    /**
-     * Looks up a DITContentRule by its object identifier or by its name.
-     * 
-     * @param id the object identifier or name of the DITContentRule
-     * @return the DITContentRule instance for the id
-     * @throws NamingException if the DITContentRule does not exist
-     */
-    DITContentRule lookup( String id ) throws NamingException;
-
-
-    /**
-     * Checks to see if a DITContentRule exists.
-     * 
-     * @param id the object identifier or name of the DITContentRule
-     * @return true if a DITContentRule definition exists for the id, false
-     * otherwise
-     */
-    boolean hasDITContentRule( String id );
+    public DITContentRuleRegistry()
+    {
+        super( SchemaObjectType.DIT_CONTENT_RULE );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITStructureRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITStructureRuleRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITStructureRuleRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DITStructureRuleRegistry.java
Mon Aug 24 22:08:30 2009
@@ -29,7 +29,6 @@
 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.apache.directory.shared.ldap.schema.parsers.DITStructureRuleDescription;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,7 +39,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DITStructureRuleRegistry extends SchemaObjectRegistry<DITStructureRule, DITStructureRuleDescription>
+public class DITStructureRuleRegistry extends SchemaObjectRegistry<DITStructureRule>
 {
     /** static class logger */
     private static final Logger LOG = LoggerFactory.getLogger( DITStructureRuleRegistry.class
);
@@ -51,9 +50,6 @@
     /** a map of DITStructureRule looked up by RuleId */
     protected final Map<Integer, DITStructureRule> byRuleId;
     
-    /** maps an RuleId to a DITStructureRuleDescription Description */
-    private final Map<Integer, DITStructureRuleDescription> ruleIdToDescription;
-    
     /**
      * Creates a new default NormalizerRegistry instance.
      */
@@ -61,7 +57,6 @@
     {
         super( SchemaObjectType.DIT_STRUCTURE_RULE );
         byRuleId = new ConcurrentHashMap<Integer, DITStructureRule>();
-        ruleIdToDescription = new ConcurrentHashMap<Integer, DITStructureRuleDescription>();
     }
 
 
@@ -84,17 +79,6 @@
      *
      * @return an Iterator of descriptions
      */
-    public Iterator<DITStructureRuleDescription> descriptionsIterator()
-    {
-        return ruleIdToDescription.values().iterator();
-    }
-
-    
-    /**
-     * Gets an iterator over the registered descriptions in the registry.
-     *
-     * @return an Iterator of descriptions
-     */
     public Iterator<DITStructureRule> iterator()
     {
         return byRuleId.values().iterator();
@@ -162,44 +146,6 @@
 
     
     /**
-     * Registers a new DITStructureRule with this registry.
-     *
-     * @param ditStructureRuleDescription the DITStructureRuleDescription to register
-     * @param ditStructureRule the DITStructureRule to register
-     * @throws NamingException if the DITStructureRule is already registered or
-     * the registration operation is not supported
-     */
-    public void register( DITStructureRuleDescription ditStructureRuleDescription, 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 );
-        
-        // Stores the description
-        ruleIdToDescription.put( ruleId, ditStructureRuleDescription );
-
-        if ( LOG.isDebugEnabled() )
-        {
-            LOG.debug( "registered {} with ruleId {}", ditStructureRuleDescription, ruleId
);
-        }
-    }
-
-
-    
-    
-    
-    
-    
-    
-    
-    /**
      * Looks up an dITStructureRule by its unique Object IDentifier or by its
      * name.
      * 
@@ -237,8 +183,6 @@
     {
         DITStructureRule ditStructureRule = byRuleId.remove( ruleId );
         
-        ruleIdToDescription.remove( ruleId );
-
         if ( DEBUG )
         {
             LOG.debug( "Removed {} with ruleId {} from the registry", ditStructureRule, ruleId
);
@@ -268,9 +212,6 @@
                 int ruleId = ditStructureRule.getRuleId();
                 SchemaObject removed = byRuleId.remove( ruleId );
                 
-                // Also remove the description if any
-                ruleIdToDescription.remove( ruleId );
-
                 if ( DEBUG )
                 {
                     LOG.debug( "Removed {} with ruleId {} from the registry", removed, ruleId
);
@@ -295,12 +236,6 @@
             if ( originalSchemaName.equalsIgnoreCase( ditStructureRule.getSchemaName() )
)
             {
                 ditStructureRule.setSchemaName( newSchemaName );
-                SchemaObject description = ruleIdToDescription.get( ditStructureRule.getRuleId()
);
-                
-                if ( description != null )
-                {
-                    description.setSchemaName( newSchemaName );
-                }
 
                 if ( DEBUG )
                 {

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/LdapSyntaxRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/LdapSyntaxRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/LdapSyntaxRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/LdapSyntaxRegistry.java
Mon Aug 24 22:08:30 2009
@@ -21,7 +21,6 @@
 
 import org.apache.directory.shared.ldap.schema.LdapSyntax;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.schema.parsers.LdapSyntaxDescription;
 
 
 /**
@@ -30,7 +29,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class LdapSyntaxRegistry extends SchemaObjectRegistry<LdapSyntax, LdapSyntaxDescription>
+public class LdapSyntaxRegistry extends SchemaObjectRegistry<LdapSyntax>
 {
     /**
      * Creates a new default LdapSyntaxRegistry instance.

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleRegistry.java
Mon Aug 24 22:08:30 2009
@@ -22,7 +22,6 @@
 
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.schema.parsers.MatchingRuleDescription;
 
 
 /**
@@ -31,7 +30,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class MatchingRuleRegistry extends SchemaObjectRegistry<MatchingRule, MatchingRuleDescription>
+public class MatchingRuleRegistry extends SchemaObjectRegistry<MatchingRule>
 {
     /**
      * Creates a new default MatchingRuleRegistry instance.

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleUseRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleUseRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleUseRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/MatchingRuleUseRegistry.java
Mon Aug 24 22:08:30 2009
@@ -22,7 +22,6 @@
 
 import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.schema.parsers.MatchingRuleUseDescription;
 
 
 /**
@@ -33,7 +32,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class MatchingRuleUseRegistry extends SchemaObjectRegistry<MatchingRuleUse, MatchingRuleUseDescription>
+public class MatchingRuleUseRegistry extends SchemaObjectRegistry<MatchingRuleUse>
 {
     /**
      * Creates a new default MatchingRuleUseRegistry instance.

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NameFormRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NameFormRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NameFormRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NameFormRegistry.java
Mon Aug 24 22:08:30 2009
@@ -20,11 +20,8 @@
 package org.apache.directory.shared.ldap.schema.registries;
 
 
-import java.util.Iterator;
-
-import javax.naming.NamingException;
-
 import org.apache.directory.shared.ldap.schema.NameForm;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
 
 
 /**
@@ -33,42 +30,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface NameFormRegistry extends SchemaObjectRegistry<NameForm>
+public class NameFormRegistry extends SchemaObjectRegistry<NameForm>
 {
     /**
-     * Registers a NameForm with this registry.
-     * 
-     * @param nameForm the nameForm to register
-     * @throws NamingException if the NameForm is already registered or the
-     * registration operation is not supported
-     */
-    void register( NameForm nameForm ) throws NamingException;
-
-
-    /**
-     * Looks up a nameForm by its unique Object Identifier or by name.
-     * 
-     * @param id the object identifier or name
-     * @return the NameForm instance for the id
-     * @throws NamingException if the NameForm does not exist
-     */
-    NameForm lookup( String id ) throws NamingException;
-
-
-    /**
-     * Checks to see if an nameForm exists.
-     * 
-     * @param id the object identifier or name
-     * @return true if an nameForm definition exists for the oid, false
-     * otherwise
-     */
-    boolean hasNameForm( String id );
-
-
-    /**
-     * Lists all the NameForms within this registry.
-     *
-     * @return an Iterator over all the NameForms within this registry
+     * Creates a new default NameFormRegistry instance.
      */
-    Iterator<NameForm> iterator();
+    public NameFormRegistry()
+    {
+        super( SchemaObjectType.NAME_FORM );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NormalizerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NormalizerRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NormalizerRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/NormalizerRegistry.java
Mon Aug 24 22:08:30 2009
@@ -22,7 +22,6 @@
 
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
-import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
 
 
 /**
@@ -31,7 +30,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class NormalizerRegistry extends SchemaObjectRegistry<Normalizer, NormalizerDescription>
+public class NormalizerRegistry extends SchemaObjectRegistry<Normalizer>
 {
     /**
      * Creates a new default NormalizerRegistry instance.

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ObjectClassRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ObjectClassRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ObjectClassRegistry.java
Mon Aug 24 22:08:30 2009
@@ -24,7 +24,11 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
+import org.apache.directory.shared.ldap.schema.parsers.ObjectClassDescription;
 
 
 /**
@@ -33,42 +37,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface ObjectClassRegistry extends SchemaObjectRegistry<ObjectClass>
+public class ObjectClassRegistry extends SchemaObjectRegistry<ObjectClass, ObjectClassDescription>
 {
     /**
-     * Registers an ObjectClass with this registry.
-     *
-     * @param objectClass the objectClass to register
-     * @throws NamingException if the ObjectClass is already registered or the
-     * registration operation is not supported
+     * Creates a new default ObjectClassRegistry instance.
      */
-    void register( ObjectClass objectClass ) throws NamingException;
-
-
-    /**
-     * Looks up an objectClass by its unique Object Identifier or by name.
-     *
-     * @param id the object identifier or name
-     * @return the ObjectClass instance for the id
-     * @throws NamingException if the ObjectClass does not exist
-     */
-    ObjectClass lookup( String id ) throws NamingException;
-
-
-    /**
-     * Checks to see if an objectClass exists.
-     *
-     * @param id the object identifier or name
-     * @return true if an objectClass definition exists for the id, false
-     * otherwise
-     */
-    boolean hasObjectClass( String id );
-
-
-    /**
-     * Gets an Iterator over the ObjectClasses within this ObjectClassRegistry.
-     *
-     * @return an iterator over all ObjectClasses in registry
-     */
-    Iterator<ObjectClass> iterator();
+    public ObjectClassRegistry()
+    {
+        super( SchemaObjectType.OBJECT_CLASS );
+    }
 }

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=807406&r1=807405&r2=807406&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 Aug 24 22:08:30 2009
@@ -39,7 +39,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class SchemaObjectRegistry<T extends SchemaObject, U extends SchemaObject> implements
Iterable<T>
+public class SchemaObjectRegistry<T extends SchemaObject> implements Iterable<T>
 {
     /** static class logger */
     private static final Logger LOG = LoggerFactory.getLogger( SchemaObjectRegistry.class
);
@@ -50,9 +50,6 @@
     /** a map of SchemaObject looked up by OID or Name */
     protected final Map<String, T> byOid;
     
-    /** maps an OID to a SchemaObject specification */
-    private final Map<String, U> oidToSpecification;
-    
     /** The SchemaObject type */
     protected SchemaObjectType type;
 
@@ -63,7 +60,6 @@
     protected SchemaObjectRegistry( SchemaObjectType schemaObjectType )
     {
         byOid = new ConcurrentHashMap<String, T>();
-        oidToSpecification = new ConcurrentHashMap<String, U>();
         type = schemaObjectType;
     }
     
@@ -126,13 +122,7 @@
             if ( originalSchemaName.equalsIgnoreCase( schemaObject.getSchemaName() ) )
             {
                 schemaObject.setSchemaName( newSchemaName );
-                SchemaObject description = oidToSpecification.get( schemaObject.getOid()
);
                 
-                if ( description != null )
-                {
-                    description.setSchemaName( newSchemaName );
-                }
-
                 if ( DEBUG )
                 {
                     LOG.debug( "Renamed {} schemaName to {}", schemaObject, newSchemaName
);
@@ -165,17 +155,6 @@
 
     
     /**
-     * Gets an iterator over the registered descriptions in the registry.
-     *
-     * @return an Iterator of descriptions
-     */
-    public Iterator<U> specificationsIterator()
-    {
-        return oidToSpecification.values().iterator();
-    }
-
-    
-    /**
      * Looks up a SchemaObject by its unique Object Identifier or by name.
      *
      * @param oid the object identifier or name
@@ -230,47 +209,6 @@
 
 
     /**
-     * Registers a new SchemaObject with this registry.
-     *
-     * @param schemaObjectSpecification The SchemaObject description to register
-     * @param schemaObject the SchemaObject to register
-     * @throws NamingException if the SchemaObject is already registered or
-     * the registration operation is not supported
-     */
-    public void register( U schemaObjectSpecification, T schemaObject ) throws NamingException
-    {
-        String oid = schemaObject.getOid();
-        
-        if ( byOid.containsKey( oid ) )
-        {
-            String msg = type.name() + " already registered for OID " + oid;
-            LOG.warn( msg );
-            throw new NamingException( msg );
-        }
-
-        byOid.put( oid, schemaObject );
-        
-        // Register the name -> schemaObject couples.
-        // We will also add the oid -> schemaObject into this map
-        if ( schemaObject.getNames() != null )
-        {
-            for ( String name : schemaObject.getNames() )
-            {
-                byOid.put( name, schemaObject );
-            }
-        }
-        
-        // And register the description too
-        oidToSpecification.put( oid, schemaObjectSpecification );
-        
-        if ( DEBUG )
-        {
-            LOG.debug( "registered {} with oid: {}", type.name(), oid );
-        }
-    }
-
-
-    /**
      * Removes the SchemaObject registered with this registry, using its
      * numeric OID.
      * 
@@ -288,9 +226,6 @@
 
         SchemaObject schemaObject = byOid.remove( numericOid );
         
-        // Also remove the description, if any
-        oidToSpecification.remove( numericOid );
-
         if ( DEBUG )
         {
             LOG.debug( "Removed {} with oid {} from the registry", schemaObject, numericOid
);
@@ -320,9 +255,6 @@
                 String oid = schemaObject.getOid();
                 SchemaObject removed = byOid.remove( oid );
                 
-                // Also remove the description if any
-                oidToSpecification.remove( oid );
-
                 if ( DEBUG )
                 {
                     LOG.debug( "Removed {} with oid {} from the registry", removed, oid );

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SyntaxCheckerRegistry.java?rev=807406&r1=807405&r2=807406&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SyntaxCheckerRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SyntaxCheckerRegistry.java
Mon Aug 24 22:08:30 2009
@@ -22,7 +22,6 @@
 
 import org.apache.directory.shared.ldap.schema.SchemaObjectType;
 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 
 
 /**
@@ -31,7 +30,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SyntaxCheckerRegistry extends  SchemaObjectRegistry<SyntaxChecker, SyntaxCheckerDescription>
+public class SyntaxCheckerRegistry extends  SchemaObjectRegistry<SyntaxChecker>
 {
     /**
      * Creates a new default SyntaxCheckerRegistry instance.



Mime
View raw message