directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r806879 - /directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/
Date Sat, 22 Aug 2009 18:44:33 GMT
Author: elecharny
Date: Sat Aug 22 18:44:32 2009
New Revision: 806879

URL: http://svn.apache.org/viewvc?rev=806879&view=rev
Log:
Some more fixes for C,N and SC registries

Added:
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultLdapSyntaxRegistry.java
      - copied, changed from r806865, directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxRegistry.java
Removed:
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxRegistry.java
Modified:
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java
    directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java

Modified: directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java?rev=806879&r1=806878&r2=806879&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
Sat Aug 22 18:44:32 2009
@@ -279,7 +279,7 @@
         if ( matchingRule == null )
         {
             LOG.debug( "Attribute {} does not have normalizer : using NoopNormalizer", type.getName()
);
-            oidNormalizer = new OidNormalizer( oid, new NoOpNormalizer() );
+            oidNormalizer = new OidNormalizer( oid, new NoOpNormalizer( matchingRule.getOid()
) );
         }
         else
         {

Modified: directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java?rev=806879&r1=806878&r2=806879&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java
Sat Aug 22 18:44:32 2009
@@ -21,7 +21,6 @@
 
 
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -100,6 +99,29 @@
 
     
     /**
+     * {@inheritDoc}
+     */
+    public void register( LdapComparator<?> comparator ) throws NamingException
+    {
+        String oid = comparator.getOid();
+        
+        if ( byOidComparator.containsKey( oid ) )
+        {
+            String msg = "Comparator '" + comparator + "' with OID " + oid + " already registered!";
+            LOG.warn( msg );
+            throw new NamingException( msg );
+        }
+
+        byOidComparator.put( oid, comparator );
+        
+        if ( DEBUG )
+        {
+            LOG.debug( "registed comparator with OID: {}", oid );
+        }
+    }
+
+    
+    /**
      * Return the schema, contained in the first position of the extensions
      */
     private static String getSchema( LdapComparatorDescription desc )
@@ -118,9 +140,9 @@
     /**
      * {@inheritDoc}
      */
-    public Comparator<?> lookup( String oid ) throws NamingException
+    public LdapComparator<?> lookup( String oid ) throws NamingException
     {
-        Comparator<?> c = byOidComparator.get( oid );
+        LdapComparator<?> c = byOidComparator.get( oid );
         
         if ( c == null )
         {
@@ -141,7 +163,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasComparator( String oid )
+    public boolean contains( String oid )
     {
         return byOidComparator.containsKey( oid );
     }
@@ -175,7 +197,7 @@
     /**
      * {@inheritDoc}
      */
-    public Iterator<String> iterator()
+    public Iterator<String> oidsIterator()
     {
         return byOidComparator.keySet().iterator();
     }
@@ -184,6 +206,15 @@
     /**
      * {@inheritDoc}
      */
+    public Iterator<LdapComparator<?>> iterator()
+    {
+        return byOidComparator.values().iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void unregister( String oid ) throws NamingException
     {
         if ( ! OID.isOID( oid ) )

Copied: directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultLdapSyntaxRegistry.java
(from r806865, directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxRegistry.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultLdapSyntaxRegistry.java?p2=directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultLdapSyntaxRegistry.java&p1=directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxRegistry.java&r1=806865&r2=806879&rev=806879&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxRegistry.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultLdapSyntaxRegistry.java
Sat Aug 22 18:44:32 2009
@@ -40,10 +40,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DefaultSyntaxRegistry implements LdapSyntaxRegistry
+public class DefaultLdapSyntaxRegistry implements LdapSyntaxRegistry
 {
     /** static class logger */
-    private static final Logger LOG = LoggerFactory.getLogger( DefaultSyntaxRegistry.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( DefaultLdapSyntaxRegistry.class
);
     
     /** Speedup for DEBUG mode */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
@@ -65,7 +65,7 @@
      * @param registry used by this registry for OID to name resolution of
      * dependencies and to automatically register and unregister it's aliases and OIDs
      */
-    public DefaultSyntaxRegistry( OidRegistry registry )
+    public DefaultLdapSyntaxRegistry( OidRegistry registry )
     {
         this.oidRegistry = registry;
         byOidSyntax = new ConcurrentHashMap<String,LdapSyntax>();
@@ -98,7 +98,6 @@
         throw new NamingException( msg );
     }
 
-
     /**
      * {@inheritDoc}
      */
@@ -134,7 +133,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasSyntax( String id )
+    public boolean contains( String id )
     {
         try
         {
@@ -171,7 +170,7 @@
        
         if ( syntax != null )
         {
-            return syntax.getSchema();
+            return syntax.getSchemaName();
         }
 
         String msg = "OID " + oid + " not found in oid to Syntax map!";
@@ -192,6 +191,15 @@
     /**
      * {@inheritDoc}
      */
+    public Iterator<String> oidsIterator()
+    {
+        return byOidSyntax.keySet().iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void unregister( String numericOid ) throws NamingException
     {
         if ( !OID.isOID(numericOid ) )

Modified: directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java?rev=806879&r1=806878&r2=806879&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java
Sat Aug 22 18:44:32 2009
@@ -81,7 +81,7 @@
      */
     public void register( NormalizerDescription description, Normalizer normalizer ) throws
NamingException
     {
-        String oid = description.getNumericOid();
+        String oid = description.getOid();
         
         if ( byOidNormalizer.containsKey( oid ) )
         {
@@ -103,6 +103,29 @@
     /**
      * {@inheritDoc}
      */
+    public void register( Normalizer normalizer ) throws NamingException
+    {
+        String oid = normalizer.getOid();
+        
+        if ( byOidNormalizer.containsKey( oid ) )
+        {
+            String msg = "Normalizer already registered for OID " + oid;
+            LOG.warn( msg );
+            throw new NamingException( msg );
+        }
+
+        byOidNormalizer.put( oid, normalizer );
+        
+        if ( DEBUG )
+        {
+            LOG.debug( "registered normalizer with oid: {}", oid );
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
     public Normalizer lookup( String oid ) throws NamingException
     {
         if ( !byOidNormalizer.containsKey( oid ) )
@@ -126,7 +149,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasNormalizer( String oid )
+    public boolean contains( String oid )
     {
         return byOidNormalizer.containsKey( oid );
     }
@@ -173,7 +196,7 @@
     /**
      * {@inheritDoc}
      */
-    public Iterator<String> iterator()
+    public Iterator<String> oidsIterator()
     {
         return byOidNormalizer.keySet().iterator();
     }
@@ -182,6 +205,15 @@
     /**
      * {@inheritDoc}
      */
+    public Iterator<Normalizer> iterator()
+    {
+        return byOidNormalizer.values().iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void unregister( String oid ) throws NamingException
     {
         if ( !OID.isOID( oid ) )

Modified: directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java?rev=806879&r1=806878&r2=806879&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java
Sat Aug 22 18:44:32 2009
@@ -70,7 +70,7 @@
     private DefaultNormalizerRegistry normalizerRegistry;
     private OidRegistry oidRegistry;
     private DefaultSyntaxCheckerRegistry syntaxCheckerRegistry;
-    private DefaultSyntaxRegistry syntaxRegistry;
+    private DefaultLdapSyntaxRegistry syntaxRegistry;
     private Map<String,Schema> loadedByName = new HashMap<String, Schema>();
     private final SchemaLoader schemaLoader;
     private final String name;
@@ -92,7 +92,7 @@
         normalizerRegistry = new DefaultNormalizerRegistry();
         comparatorRegistry = new DefaultComparatorRegistry();
         syntaxCheckerRegistry = new DefaultSyntaxCheckerRegistry();
-        syntaxRegistry = new DefaultSyntaxRegistry( oidRegistry );
+        syntaxRegistry = new DefaultLdapSyntaxRegistry( oidRegistry );
         matchingRuleRegistry = new DefaultMatchingRuleRegistry( oidRegistry );
         attributeTypeRegistry = new DefaultAttributeTypeRegistry( oidRegistry );
         objectClassRegistry = new DefaultObjectClassRegistry( oidRegistry );

Modified: directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java?rev=806879&r1=806878&r2=806879&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultSyntaxCheckerRegistry.java
Sat Aug 22 18:44:32 2009
@@ -97,6 +97,29 @@
     /**
      * {@inheritDoc}
      */
+    public void register( SyntaxChecker syntaxChecker ) throws NamingException
+    {
+        String oid = syntaxChecker.getOid();
+        
+        if ( byOidSyntaxChecker.containsKey( oid ) )
+        {
+            String msg = "SyntaxChecker with OID " + oid + " already registered!";
+            LOG.warn( msg );
+            throw new NamingException( msg );
+        }
+
+        byOidSyntaxChecker.put( oid, syntaxChecker );
+        
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "registered syntaxChecher for OID {}", oid );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public SyntaxChecker lookup( String oid ) throws NamingException
     {
         SyntaxChecker syntaxChecker = byOidSyntaxChecker.get( oid );
@@ -120,7 +143,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasSyntaxChecker( String oid )
+    public boolean contains( String oid )
     {
         return byOidSyntaxChecker.containsKey( oid );
     }
@@ -167,6 +190,15 @@
     /**
      * {@inheritDoc}
      */
+    public Iterator<String> oidsIterator()
+    {
+        return byOidSyntaxChecker.keySet().iterator();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public Iterator<SyntaxChecker> iterator()
     {
         return byOidSyntaxChecker.values().iterator();



Mime
View raw message