directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1057522 - in /directory/shared/trunk: ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/ ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/
Date Tue, 11 Jan 2011 08:46:08 GMT
Author: kayyagari
Date: Tue Jan 11 08:46:08 2011
New Revision: 1057522

URL: http://svn.apache.org/viewvc?rev=1057522&view=rev
Log:
o fixed an issue with deleting schema objects present in a schema having a upper/mixed case
name
  This issue pops up only after restarting the server after injecting a schema(with upper/mixed
case name)
  (see DIRSHARED-75 for an earlier fix for loading such schema)

Modified:
    directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
    directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java

Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java?rev=1057522&r1=1057521&r2=1057522&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
Tue Jan 11 08:46:08 2011
@@ -39,6 +39,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.ResourceMap;
 import org.apache.directory.shared.ldap.schema.registries.AbstractSchemaLoader;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -159,7 +160,7 @@ public class JarLdifSchemaLoader extends
     private String getSchemaDirectory( Schema schema )
     {
         return "schema" + SEPARATOR_PATTERN + "ou=schema" + SEPARATOR_PATTERN
-                        + "cn=" + schema.getSchemaName() + SEPARATOR_PATTERN;
+                        + "cn=" + StringTools.lowerCase( schema.getSchemaName() ) + SEPARATOR_PATTERN;
     }
 
 

Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java?rev=1057522&r1=1057521&r2=1057522&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
Tue Jan 11 08:46:08 2011
@@ -35,6 +35,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.schema.registries.AbstractSchemaLoader;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -242,7 +243,7 @@ public class LdifSchemaLoader extends Ab
      */
     private File getSchemaDirectory( Schema schema )
     {
-        return new File( new File( baseDirectory, SchemaConstants.OU_SCHEMA ), "cn=" + schema.getSchemaName()
);
+        return new File( new File( baseDirectory, SchemaConstants.OU_SCHEMA ), "cn=" + StringTools.lowerCase(
schema.getSchemaName() ) );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java?rev=1057522&r1=1057521&r2=1057522&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
Tue Jan 11 08:46:08 2011
@@ -53,8 +53,30 @@ public abstract class AbstractSchemaLoad
      * populated when this class is created with all the schemas present in
      * the LDIF based schema repository.
      */
-    protected final Map<String, Schema> schemaMap = new HashMap<String, Schema>();
+    protected final Map<String, Schema> schemaMap = new LowerCaseKeyMap();
 
+    /**
+     * a map implementation which converts the keys to lower case before inserting
+     */
+    private class LowerCaseKeyMap extends HashMap<String,Schema>
+    {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public Schema put( String key, Schema value )
+        {
+            return super.put( StringTools.lowerCase( key ), value );
+        }
+
+        @Override
+        public void putAll( Map<? extends String, ? extends Schema> map )
+        {
+            for( Map.Entry<? extends String, ? extends Schema> e : map.entrySet() )
+            {
+                put( e.getKey(), e.getValue() );
+            }
+        }
+    }
 
     /**
      * {@inheritDoc}
@@ -127,7 +149,7 @@ public abstract class AbstractSchemaLoad
      */
     public void addSchema( Schema schema )
     {
-        schemaMap.put( StringTools.toLowerCase( schema.getSchemaName() ), schema );
+        schemaMap.put( schema.getSchemaName(), schema );
     }
     
     



Mime
View raw message