directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r729629 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Date Sat, 27 Dec 2008 12:52:06 GMT
Author: elecharny
Date: Sat Dec 27 04:52:05 2008
New Revision: 729629

URL: http://svn.apache.org/viewvc?rev=729629&view=rev
Log:
Added some code to allow the server.xml file to use names instead of OIDs for index attributes
(useful for the technical attributes)

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=729629&r1=729628&r2=729629&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Sat Dec 27 04:52:05 2008
@@ -92,6 +92,7 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.DateUtils;
@@ -1350,7 +1351,20 @@
                 JdbmPartition btpconf = ( JdbmPartition ) partition;
                 for ( Index<?,ServerEntry> index : btpconf.getIndexedAttributes() )
                 {
-                    String schemaName = dao.findSchema( index.getAttributeId() );
+                    String schemaName = null;
+                    
+                    try
+                    {
+                        // Try to retrieve the AT in the registries
+                        AttributeType at = registries.getAttributeTypeRegistry().lookup(
index.getAttributeId() );
+                        schemaName = dao.findSchema( at.getOid() );
+                    }
+                    catch ( Exception e )
+                    {
+                        // It does not exists: just use the attribute ID
+                        schemaName = dao.findSchema( index.getAttributeId() );
+                    }
+                    
                     if ( schemaName == null )
                     {
                         throw new NamingException( "Index on unidentified attribute: " +
index.toString() );



Mime
View raw message