Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 43467 invoked from network); 30 Sep 2007 01:27:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Sep 2007 01:27:47 -0000 Received: (qmail 77944 invoked by uid 500); 30 Sep 2007 01:27:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 77903 invoked by uid 500); 30 Sep 2007 01:27:34 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 77892 invoked by uid 99); 30 Sep 2007 01:27:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Sep 2007 18:27:34 -0700 X-ASF-Spam-Status: No, hits=-98.4 required=10.0 tests=ALL_TRUSTED,DNS_FROM_DOB,RCVD_IN_DOB,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Sep 2007 01:27:35 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C6DC81A9832; Sat, 29 Sep 2007 18:27:14 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r580666 [1/2] - in /directory/apacheds/branches/bigbang: bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/ btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ core-unit/src/m... Date: Sun, 30 Sep 2007 01:27:11 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070930012714.C6DC81A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: akarasulu Date: Sat Sep 29 18:27:08 2007 New Revision: 580666 URL: http://svn.apache.org/viewvc?rev=580666&view=rev Log: prep refactoring to be able to remove IndexConfiguration Modified: directory/apacheds/branches/bigbang/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java directory/apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractPerformanceTest.java directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/MutablePartitionConfiguration.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/PartitionConfiguration.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java Modified: directory/apacheds/branches/bigbang/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java (original) +++ directory/apacheds/branches/bigbang/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileListing.java Sat Sep 29 18:27:08 2007 @@ -177,9 +177,9 @@ * * @return set of user index names */ - public Set getIndexedAttributes() + public Set getIndexedAttributes() { - Set attributes = new HashSet(); + Set attributes = new HashSet(); Iterator ii = iterator(); while( ii.hasNext() ) { Modified: directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java (original) +++ directory/apacheds/branches/bigbang/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java Sat Sep 29 18:27:08 2007 @@ -21,6 +21,7 @@ import java.util.regex.Pattern; +import java.io.File; import javax.naming.NamingException; import javax.naming.directory.Attribute; @@ -37,6 +38,68 @@ */ public interface Index { + // ----------------------------------------------------------------------- + // C O N F I G U R A T I O N M E T H O D S + // ----------------------------------------------------------------------- + + + /** + * Gets the attribute identifier set at configuration time for this index which may not + * be the OID but an alias name for the attributeType associated with this Index + * + * @return configured attribute oid or alias name + */ + String getAttributeId(); + + + /** + * Sets the attribute identifier set at configuration time for this index which may not + * be the OID but an alias name for the attributeType associated with this Index + * + * @param attributeId configured attribute oid or alias name + */ + void setAttributeId( String attributeId ); + + + /** + * Gets the size of the index cache in terms of the number of index entries to be cached. + * + * @return the size of the index cache + */ + int getCacheSize(); + + + /** + * Sets the size of the index cache in terms of the number of index entries to be cached. + * + * @param cacheSize the size of the index cache + */ + void setCacheSize( int cacheSize ); + + + /** + * Sets the working directory path to something other than the default. Sometimes more + * performance is gained by locating indices on separate disk spindles. + * + * @param wkDirPath optional working directory path + */ + void setWkDirPath( File wkDirPath ); + + + /** + * Gets the working directory path to something other than the default. Sometimes more + * performance is gained by locating indices on separate disk spindles. + * + * @return optional working directory path + */ + File getWkDirPath(); + + + // ----------------------------------------------------------------------- + // E N D C O N F I G U R A T I O N M E T H O D S + // ----------------------------------------------------------------------- + + /** * Gets the attribute this Index is built upon. * Modified: directory/apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractPerformanceTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractPerformanceTest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractPerformanceTest.java (original) +++ directory/apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractPerformanceTest.java Sat Sep 29 18:27:08 2007 @@ -20,32 +20,29 @@ package org.apache.directory.server.core.unit; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.util.Collections; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; - -import javax.naming.Context; -import javax.naming.directory.Attributes; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; import org.apache.directory.server.core.configuration.PartitionConfiguration; import org.apache.directory.server.core.partition.PartitionNexus; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.shared.ldap.constants.SchemaConstants; -import org.apache.directory.shared.ldap.ldif.Entry; import org.apache.directory.shared.ldap.ldif.ChangeType; +import org.apache.directory.shared.ldap.ldif.Entry; import org.apache.directory.shared.ldap.ldif.LdifReader; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.util.NamespaceTools; +import javax.naming.Context; +import javax.naming.directory.Attributes; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; +import java.io.*; +import java.util.Collections; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; + /** * A base testcase is used to create test harnesses for running performance @@ -138,10 +135,10 @@ if ( ! isExternal ) { // Add indices for ou, uid, and objectClass - HashSet indexedAttributes = new HashSet(); - indexedAttributes.add( "ou" ); - indexedAttributes.add( "uid" ); - indexedAttributes.add( SchemaConstants.OBJECT_CLASS_AT ); + HashSet indexedAttributes = new HashSet(); + indexedAttributes.add( new JdbmIndex( "ou" ) ); + indexedAttributes.add( new JdbmIndex( "uid" ) ); + indexedAttributes.add( new JdbmIndex( SchemaConstants.OBJECT_CLASS_AT ) ); // Build the root entry for the new partition Attributes attributes = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, "top", true ); @@ -149,7 +146,7 @@ attributes.put( "ou", "test" ); // Add apache.org paritition since all work will be done here - MutablePartitionConfiguration partConfig = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration partConfig = new MutableBTreePartitionConfiguration(); partConfig.setIndexedAttributes( indexedAttributes ); partConfig.setName( "test" ); partConfig.setSuffix( "ou=test" ); Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java (original) +++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java Sat Sep 29 18:27:08 2007 @@ -20,24 +20,21 @@ package org.apache.directory.server.core; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; import org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.unit.AbstractAdminTestCase; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.*; +import java.util.HashSet; +import java.util.Set; + /** * Tests various search scenarios. @@ -66,7 +63,7 @@ if ( getName().indexOf( "WithIndices" ) != -1 ) { - MutablePartitionConfiguration sysConf = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration sysConf = new MutableBTreePartitionConfiguration(); sysConf.setName( "system" ); Attributes attrs = new AttributesImpl( "objectClass", "top", true ); attrs.get( "objectClass" ).add( "organizationalUnit" ); @@ -74,15 +71,10 @@ sysConf.setContextEntry( attrs ); sysConf.setSuffix( "ou=system" ); - Set indices = new HashSet(); + Set indices = new HashSet(); indices.addAll( sysConf.getIndexedAttributes() ); - - MutableIndexConfiguration idxConfig = new MutableIndexConfiguration(); - idxConfig.setAttributeId( "gidNumber" ); - indices.add( "gidNumber" ); - + indices.add( new JdbmIndex( "gidNumber" ) ); sysConf.setIndexedAttributes( indices ); - configuration.setSystemPartitionConfiguration( sysConf ); } Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java (original) +++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java Sat Sep 29 18:27:08 2007 @@ -20,22 +20,20 @@ package org.apache.directory.server.core.jndi; -import javax.naming.NamingException; -import javax.naming.Context; -import javax.naming.NamingEnumeration; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; - import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.unit.AbstractAdminTestCase; import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; +import javax.naming.Context; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.*; import java.util.HashSet; import java.util.Set; @@ -54,14 +52,14 @@ public void setUp() throws Exception { - MutablePartitionConfiguration partition = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration partition = new MutableBTreePartitionConfiguration(); partition.setName( "apache" ); partition.setSuffix( suffix ); - Set indexedAttributes = new HashSet(); - indexedAttributes.add( "objectClass" ); - indexedAttributes.add( "ou" ); - indexedAttributes.add( "uid" ); + HashSet indexedAttributes = new HashSet(); + indexedAttributes.add( new JdbmIndex( "objectClass" ) ); + indexedAttributes.add( new JdbmIndex( "ou" ) ); + indexedAttributes.add( new JdbmIndex( "uid" ) ); partition.setIndexedAttributes( indexedAttributes ); Attributes attrs = new AttributesImpl( true ); @@ -74,7 +72,7 @@ partition.setContextEntry( attrs ); - Set partitions = new HashSet(); + Set partitions = new HashSet(); partitions.add( partition ); configuration.setPartitionConfigurations( partitions ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sat Sep 29 18:27:08 2007 @@ -20,24 +20,9 @@ package org.apache.directory.server.core; -import java.io.File; -import java.io.IOException; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; - import org.apache.directory.server.core.authz.AuthorizationService; import org.apache.directory.server.core.configuration.Configuration; import org.apache.directory.server.core.configuration.ConfigurationException; -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; import org.apache.directory.server.core.configuration.PartitionConfiguration; import org.apache.directory.server.core.configuration.StartupConfiguration; import org.apache.directory.server.core.interceptor.Interceptor; @@ -51,24 +36,19 @@ import org.apache.directory.server.core.jndi.ServerLdapContext; import org.apache.directory.server.core.partition.DefaultPartitionNexus; import org.apache.directory.server.core.partition.PartitionNexus; +import org.apache.directory.server.core.partition.impl.btree.BTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition; import org.apache.directory.server.core.schema.PartitionSchemaLoader; import org.apache.directory.server.core.schema.SchemaManager; import org.apache.directory.server.core.schema.SchemaPartitionDao; import org.apache.directory.server.schema.SerializableComparator; -import org.apache.directory.server.schema.bootstrap.ApacheSchema; -import org.apache.directory.server.schema.bootstrap.ApachemetaSchema; -import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader; -import org.apache.directory.server.schema.bootstrap.CoreSchema; -import org.apache.directory.server.schema.bootstrap.Schema; -import org.apache.directory.server.schema.bootstrap.SystemSchema; +import org.apache.directory.server.schema.bootstrap.*; import org.apache.directory.server.schema.bootstrap.partition.DbFileListing; import org.apache.directory.server.schema.bootstrap.partition.SchemaPartitionExtractor; -import org.apache.directory.server.schema.registries.AttributeTypeRegistry; -import org.apache.directory.server.schema.registries.DefaultOidRegistry; -import org.apache.directory.server.schema.registries.DefaultRegistries; -import org.apache.directory.server.schema.registries.OidRegistry; -import org.apache.directory.server.schema.registries.Registries; +import org.apache.directory.server.schema.registries.*; import org.apache.directory.shared.ldap.constants.JndiPropertyConstants; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.constants.ServerDNConstants; @@ -88,6 +68,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import java.io.File; +import java.io.IOException; +import java.util.*; + /** * Default implementation of {@link DirectoryService}. @@ -290,7 +278,7 @@ { if ( !started ) { - return; + throw new IllegalStateException( "Attempt to shutdown server before it has started!" ); } serviceListener.beforeShutdown( this ); @@ -846,7 +834,7 @@ // Initialize schema partition // -------------------------------------------------------------------- - MutablePartitionConfiguration schemaPartitionConfig = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration schemaPartitionConfig = new MutableBTreePartitionConfiguration(); schemaPartitionConfig.setName( "schema" ); schemaPartitionConfig.setCacheSize( 1000 ); @@ -860,8 +848,14 @@ throw new LdapNamingException( "Got IOException while trying to read DBFileListing: " + e.getMessage(), ResultCodeEnum.OTHER ); } - - schemaPartitionConfig.setIndexedAttributes( listing.getIndexedAttributes() ); + + Set indexedAttributes = new HashSet(); + for ( String attributeId : listing.getIndexedAttributes() ) + { + indexedAttributes.add( new JdbmIndex( attributeId ) ); + } + + schemaPartitionConfig.setIndexedAttributes( indexedAttributes ); schemaPartitionConfig.setSuffix( "ou=schema" ); Attributes entry = new AttributesImpl(); @@ -901,20 +895,24 @@ for ( PartitionConfiguration pconf : pcs ) { - Iterator indices = pconf.getIndexedAttributes().iterator(); - while ( indices.hasNext() ) + if ( pconf instanceof BTreePartitionConfiguration ) { - Object indexedAttr = indices.next(); - String schemaName = dao.findSchema( indexedAttr.toString() ); - if ( schemaName == null ) - { - throw new NamingException( "Index on unidentified attribute: " + indexedAttr.toString() ); - } - - Schema schema = schemaMap.get( schemaName ); - if ( schema.isDisabled() ) + BTreePartitionConfiguration btpconf = ( BTreePartitionConfiguration ) pconf; + Iterator indices = btpconf.getIndexedAttributes().iterator(); + while ( indices.hasNext() ) { - dao.enableSchema( schemaName ); + Index indexedAttr = indices.next(); + String schemaName = dao.findSchema( indexedAttr.getAttributeId() ); + if ( schemaName == null ) + { + throw new NamingException( "Index on unidentified attribute: " + indexedAttr.toString() ); + } + + Schema schema = schemaMap.get( schemaName ); + if ( schema.isDisabled() ) + { + dao.enableSchema( schemaName ); + } } } } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/MutablePartitionConfiguration.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/MutablePartitionConfiguration.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/MutablePartitionConfiguration.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/MutablePartitionConfiguration.java Sat Sep 29 18:27:08 2007 @@ -48,12 +48,6 @@ } - public void setIndexedAttributes( Set indexedAttributes ) - { - super.setIndexedAttributes( indexedAttributes ); - } - - public void setPartitionClassName( String partitionClassName ) { super.setPartitionClassName( partitionClassName ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/PartitionConfiguration.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/PartitionConfiguration.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/PartitionConfiguration.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/PartitionConfiguration.java Sat Sep 29 18:27:08 2007 @@ -20,21 +20,21 @@ package org.apache.directory.server.core.configuration; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.Name; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - +import org.apache.directory.server.core.partition.Partition; import org.apache.directory.shared.ldap.exception.LdapConfigurationException; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.schema.Normalizer; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import java.util.HashSet; +import java.util.Set; + /** - * A configuration for {@link Partition}. + * A configuration for {@link PartitionConfiguration}. * * @author Apache Directory Project * @version $Rev$, $Date$ @@ -50,7 +50,6 @@ private String name; private int cacheSize = -1; private String suffix; - private Set indexedAttributes; // Set or private Attributes contextEntry = new AttributesImpl( true ); private String partitionClassName = DEFAULT_PARTITION_IMPLEMENTATION; @@ -60,7 +59,6 @@ */ protected PartitionConfiguration() { - setIndexedAttributes( new HashSet() ); } @@ -82,27 +80,6 @@ { name = name.trim(); this.name = name; - } - - - /** - * Returns the set of attribute type strings to create an index on. - */ - @SuppressWarnings("unchecked") - public Set getIndexedAttributes() - { - Set newSet = new HashSet(); - newSet.addAll( indexedAttributes ); - return newSet; - } - - - /** - * Sets the set of attribute type strings to create an index on. - */ - protected void setIndexedAttributes( Set indexedAttributes ) - { - this.indexedAttributes = indexedAttributes; } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java Sat Sep 29 18:27:08 2007 @@ -186,7 +186,7 @@ /** * Returns {@link PartitionConfiguration}s to configure context partitions. */ - public Set getPartitionConfigurations() + public Set getPartitionConfigurations() { Set cloned = new HashSet(); cloned.addAll( partitionConfigurations ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Sat Sep 29 18:27:08 2007 @@ -20,55 +20,16 @@ package org.apache.directory.server.core.partition; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import javax.naming.ConfigurationException; -import javax.naming.NameNotFoundException; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; -import javax.naming.ldap.LdapContext; - import org.apache.directory.server.core.DirectoryServiceConfiguration; import org.apache.directory.server.core.configuration.PartitionConfiguration; -import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext; -import org.apache.directory.server.core.interceptor.context.AddOperationContext; -import org.apache.directory.server.core.interceptor.context.BindOperationContext; -import org.apache.directory.server.core.interceptor.context.CompareOperationContext; -import org.apache.directory.server.core.interceptor.context.DeleteOperationContext; -import org.apache.directory.server.core.interceptor.context.EntryOperationContext; -import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext; -import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext; -import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext; -import org.apache.directory.server.core.interceptor.context.ListOperationContext; -import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext; -import org.apache.directory.server.core.interceptor.context.LookupOperationContext; -import org.apache.directory.server.core.interceptor.context.ModifyOperationContext; -import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext; -import org.apache.directory.server.core.interceptor.context.MoveOperationContext; -import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext; -import org.apache.directory.server.core.interceptor.context.RenameOperationContext; -import org.apache.directory.server.core.interceptor.context.SearchOperationContext; -import org.apache.directory.server.core.interceptor.context.UnbindOperationContext; +import org.apache.directory.server.core.interceptor.context.*; +import org.apache.directory.server.core.partition.impl.btree.Index; import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition; +import org.apache.directory.server.core.partition.tree.BranchNode; import org.apache.directory.server.core.partition.tree.LeafNode; import org.apache.directory.server.core.partition.tree.Node; -import org.apache.directory.server.core.partition.tree.BranchNode; import org.apache.directory.server.ldap.constants.SupportedSASLMechanisms; import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.OidRegistry; @@ -80,14 +41,7 @@ import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException; import org.apache.directory.shared.ldap.filter.ExprNode; import org.apache.directory.shared.ldap.filter.PresenceNode; -import org.apache.directory.shared.ldap.message.CascadeControl; -import org.apache.directory.shared.ldap.message.EntryChangeControl; -import org.apache.directory.shared.ldap.message.AttributeImpl; -import org.apache.directory.shared.ldap.message.AttributesImpl; -import org.apache.directory.shared.ldap.message.ManageDsaITControl; -import org.apache.directory.shared.ldap.message.PersistentSearchControl; -import org.apache.directory.shared.ldap.message.ServerSearchResult; -import org.apache.directory.shared.ldap.message.SubentriesControl; +import org.apache.directory.shared.ldap.message.*; import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.schema.AttributeType; @@ -97,10 +51,21 @@ import org.apache.directory.shared.ldap.util.NamespaceTools; import org.apache.directory.shared.ldap.util.SingletonEnumeration; import org.apache.directory.shared.ldap.util.StringTools; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.naming.ConfigurationException; +import javax.naming.NameNotFoundException; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; +import javax.naming.ldap.LdapContext; +import java.io.IOException; +import java.util.*; + /** * A nexus for partitions dedicated for storing entries specific to a naming @@ -231,6 +196,7 @@ { return "NEXUS"; } + public void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg ) throws NamingException @@ -249,8 +215,8 @@ List initializedPartitions = new ArrayList(); initializedPartitions.add( 0, this.system ); - Iterator partitionConfigurations = - factoryCfg.getStartupConfiguration().getPartitionConfigurations().iterator(); + Iterator partitionConfigurations = + ( Iterator ) factoryCfg.getStartupConfiguration().getPartitionConfigurations().iterator(); try { while ( partitionConfigurations.hasNext() ) @@ -329,56 +295,23 @@ } // add all attribute oids of index configs to a hashset - Set indices = systemCfg.getIndexedAttributes(); + Set indices = systemCfg.getIndexedAttributes(); Set indexOids = new HashSet(); OidRegistry registry = factoryCfg.getRegistries().getOidRegistry(); - for ( Object index : indices ) - { - indexOids.add( registry.getOid( index.toString() ) ); - } - - if ( ! indexOids.contains( Oid.ALIAS ) ) - { - indices.add( Oid.ALIAS ); - } - - if ( ! indexOids.contains( Oid.EXISTANCE ) ) - { - indices.add( Oid.EXISTANCE ); - } - - if ( ! indexOids.contains( Oid.HIERARCHY ) ) - { - indices.add( Oid.HIERARCHY ); - } - - if ( ! indexOids.contains( Oid.NDN ) ) + for ( Index index : indices ) { - indices.add( Oid.NDN ); + indexOids.add( registry.getOid( index.getAttributeId() ) ); } - - if ( ! indexOids.contains( Oid.ONEALIAS ) ) - { - indices.add( Oid.ONEALIAS ); - } - - if ( ! indexOids.contains( Oid.SUBALIAS ) ) - { - indices.add( Oid.SUBALIAS ); - } - - if ( ! indexOids.contains( Oid.UPDN ) ) - { - indices.add( Oid.UPDN ); - } - + if ( ! indexOids.contains( registry.getOid( SchemaConstants.OBJECT_CLASS_AT ) ) ) { log.warn( "CAUTION: You have not included objectClass as an indexed attribute" + "in the system partition configuration. This will lead to poor " + "performance. The server is automatically adding this index for you." ); - indices.add( SchemaConstants.OBJECT_CLASS_AT ); + JdbmIndex index = new JdbmIndex(); + index.setAttributeId( SchemaConstants.OBJECT_CLASS_AT ); + indices.add( index ); } } else @@ -392,16 +325,9 @@ systemCfg.setSuffix( PartitionNexus.SYSTEM_PARTITION_SUFFIX ); // Add indexed attributes for system partition - Set indexedSystemAttrs = new HashSet(); - indexedSystemAttrs.add( Oid.ALIAS ); - indexedSystemAttrs.add( Oid.EXISTANCE ); - indexedSystemAttrs.add( Oid.HIERARCHY ); - indexedSystemAttrs.add( Oid.NDN ); - indexedSystemAttrs.add( Oid.ONEALIAS ); - indexedSystemAttrs.add( Oid.SUBALIAS ); - indexedSystemAttrs.add( Oid.UPDN ); - indexedSystemAttrs.add( SchemaConstants.OBJECT_CLASS_AT ); - systemCfg.setIndexedAttributes( indexedSystemAttrs ); + Set indexedAttrs = new HashSet(); + indexedAttrs.add( new JdbmIndex( SchemaConstants.OBJECT_CLASS_AT ) ); + systemCfg.setIndexedAttributes( indexedAttrs ); // Add context entry for system partition Attributes systemEntry = new AttributesImpl(); @@ -650,13 +576,12 @@ // This is easier to create a new structure from scratch than to reorganize // the current structure. As this strcuture is not modified often // this is an acceptable solution. - synchronized (partitionLookupTree) + synchronized ( partitionLookupTree ) { partitions.remove( key ); - partitionLookupTree = new BranchNode(); - for ( Partition part:partitions.values() ) + for ( Partition part : partitions.values() ) { partitionLookupTree.recursivelyAddPartition( partitionLookupTree, part.getSuffix(), 0, partition ); } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Sat Sep 29 18:27:08 2007 @@ -143,7 +143,7 @@ * @param indices * @throws NamingException */ - protected void initIndices2(Set indices ) throws NamingException + protected void initIndices2( Set indices ) throws NamingException { Set sysOidSet = new HashSet(); sysOidSet.add( Oid.EXISTANCE ); @@ -384,7 +384,11 @@ { initOptimizerAndConfiguration0( cfg ); initRegistries1( factoryCfg.getRegistries() ); - initIndices2( cfg.getIndexedAttributes() ); + if ( cfg instanceof BTreePartitionConfiguration ) + { + BTreePartitionConfiguration btpconf = ( BTreePartitionConfiguration ) cfg; + initIndices2( btpconf.getIndexedAttributes() ); + } initSuffixEntry3( cfg.getSuffix(), cfg.getContextEntry() ); } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java Sat Sep 29 18:27:08 2007 @@ -24,6 +24,9 @@ import org.apache.directory.server.core.configuration.PartitionConfiguration; +import java.util.Set; +import java.util.HashSet; + /** * A partition configuration containing parameters specific to the BTree @@ -41,6 +44,34 @@ */ private boolean synchOnWrite = false; private boolean optimizerEnabled = true; + private Set indexedAttributes; + + + public BTreePartitionConfiguration() + { + setIndexedAttributes( new HashSet() ); + } + + + /** + * Returns the set of attribute type strings to create an index on. + */ + @SuppressWarnings("unchecked") + public Set getIndexedAttributes() + { + Set newSet = new HashSet(); + newSet.addAll( indexedAttributes ); + return newSet; + } + + + /** + * Sets the set of attribute type strings to create an index on. + */ + protected void setIndexedAttributes( Set indexedAttributes ) + { + this.indexedAttributes = indexedAttributes; + } protected void setOptimizerEnabled( boolean optimizerEnabled ) @@ -78,7 +109,6 @@ newConfig.setCacheSize( config.getCacheSize() ); newConfig.setContextEntry( config.getContextEntry() ); newConfig.setPartitionClassName( config.getPartitionClassName() ); - newConfig.setIndexedAttributes( config.getIndexedAttributes() ); newConfig.setName( config.getName() ); newConfig.setSuffix( config.getSuffix() ); return newConfig; Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/MutableBTreePartitionConfiguration.java Sat Sep 29 18:27:08 2007 @@ -54,7 +54,7 @@ * * @param indexedAttributes */ - public void setIndexedAttributes( Set indexedAttributes ) + public void setIndexedAttributes( Set indexedAttributes ) { super.setIndexedAttributes( indexedAttributes ); } @@ -96,7 +96,13 @@ MutableBTreePartitionConfiguration newConfig = new MutableBTreePartitionConfiguration(); newConfig.setCacheSize( config.getCacheSize() ); newConfig.setContextEntry( config.getContextEntry() ); - newConfig.setIndexedAttributes( config.getIndexedAttributes() ); + + if ( config instanceof BTreePartitionConfiguration ) + { + BTreePartitionConfiguration btpconf = ( BTreePartitionConfiguration ) config; + newConfig.setIndexedAttributes( btpconf.getIndexedAttributes() ); + } + newConfig.setName( config.getName() ); newConfig.setSuffix( config.getSuffix() ); newConfig.setSynchOnWrite( false ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Sat Sep 29 18:27:08 2007 @@ -89,35 +89,32 @@ + File.separator + cfg.getName() ) ); Set userIndices = new HashSet(); - for ( Object obj : cfg.getIndexedAttributes() ) + if ( cfg instanceof BTreePartitionConfiguration ) { - JdbmIndex index = new JdbmIndex(); - userIndices.add( index ); - - if ( obj instanceof String ) - { - index.setAttributeId( ( String ) obj ); - } - else if ( obj instanceof IndexConfiguration ) + BTreePartitionConfiguration btpconf = ( BTreePartitionConfiguration ) cfg; + for ( Index obj : btpconf.getIndexedAttributes() ) { - IndexConfiguration indexConfiguration = ( IndexConfiguration ) obj; - index.setAttributeId( indexConfiguration.getAttributeId() ); - index.setCacheSize( indexConfiguration.getCacheSize() ); - index.setNumDupLimit( indexConfiguration.getDuplicateLimit() ); - } - } - store.setUserIndices( userIndices ); + JdbmIndex index; - if ( cfg instanceof BTreePartitionConfiguration ) - { + if ( obj instanceof JdbmIndex ) + { + index = ( JdbmIndex ) obj; + } + else + { + index = new JdbmIndex(); + index.setAttributeId( obj.getAttributeId() ); + index.setCacheSize( obj.getCacheSize() ); + index.setWkDirPath( obj.getWkDirPath() ); + } + + userIndices.add( index ); + } + store.setUserIndices( userIndices ); store.setSyncOnWrite( ( ( BTreePartitionConfiguration ) cfg ).isSynchOnWrite() ); - } - - if ( cfg instanceof BTreePartitionConfiguration ) - { store.setEnableOptimizer( ( ( BTreePartitionConfiguration ) cfg ).isOptimizerEnabled() ); } - + store.init( oidRegistry, attributeTypeRegistry ); } Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original) +++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Sat Sep 29 18:27:08 2007 @@ -20,39 +20,34 @@ package org.apache.directory.server.core.schema; -import java.io.File; -import java.io.IOException; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Map; -import java.util.Set; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - +import junit.framework.TestCase; import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.DirectoryServiceConfiguration; import org.apache.directory.server.core.DirectoryServiceListener; -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; import org.apache.directory.server.core.configuration.MutableStartupConfiguration; import org.apache.directory.server.core.configuration.StartupConfiguration; import org.apache.directory.server.core.interceptor.InterceptorChain; import org.apache.directory.server.core.partition.PartitionNexus; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition; import org.apache.directory.server.schema.SerializableComparator; -import org.apache.directory.server.schema.bootstrap.ApacheSchema; -import org.apache.directory.server.schema.bootstrap.ApachemetaSchema; -import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader; -import org.apache.directory.server.schema.bootstrap.CoreSchema; -import org.apache.directory.server.schema.bootstrap.Schema; -import org.apache.directory.server.schema.bootstrap.SystemSchema; +import org.apache.directory.server.schema.bootstrap.*; import org.apache.directory.server.schema.bootstrap.partition.SchemaPartitionExtractor; import org.apache.directory.server.schema.registries.DefaultOidRegistry; import org.apache.directory.server.schema.registries.DefaultRegistries; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.message.AttributesImpl; -import junit.framework.TestCase; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; /** @@ -130,11 +125,18 @@ // Initialize schema partition // -------------------------------------------------------------------- - MutablePartitionConfiguration pc = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration pc = new MutableBTreePartitionConfiguration(); pc.setName( "schema" ); pc.setCacheSize( 1000 ); pc.setPartitionClassName( JdbmPartition.class.getName() ); - pc.setIndexedAttributes( extractor.getDbFileListing().getIndexedAttributes() ); + + Set indexedAttributes = new HashSet(); + for ( String attributeId : extractor.getDbFileListing().getIndexedAttributes() ) + { + indexedAttributes.add( new JdbmIndex( attributeId ) ); + } + + pc.setIndexedAttributes( indexedAttributes ); pc.setSuffix( "ou=schema" ); Attributes entry = new AttributesImpl(); Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original) +++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Sat Sep 29 18:27:08 2007 @@ -134,6 +134,13 @@ } + public JdbmIndex( String attributeId ) + { + initialized = false; + setAttributeId( attributeId ); + } + + public void init( AttributeType attributeType, File wkDirPath ) throws NamingException { this.keyCache = new SynchronizedLRUMap( cacheSize ); Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original) +++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Sat Sep 29 18:27:08 2007 @@ -445,6 +445,8 @@ */ public synchronized void destroy() { + LOG.debug( "destroy() called on store for {}", this.suffixDn ); + if ( !initialized ) { return; @@ -493,6 +495,7 @@ try { index.close(); + LOG.debug( "Closed {} index for {} partition.", index.getAttributeId(), suffixDn ); } catch ( Throwable t ) { @@ -503,6 +506,7 @@ try { master.close(); + LOG.debug( "Closed master table for {} partition.", suffixDn ); } catch ( Throwable t ) { @@ -512,6 +516,7 @@ try { recMan.close(); + LOG.debug( "Cloased record manager for {} partition.", suffixDn ); } catch ( Throwable t ) { Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original) +++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Sat Sep 29 18:27:08 2007 @@ -20,39 +20,22 @@ package org.apache.directory.server.core.partition.impl.btree.jdbm; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Set; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; - import jdbm.RecordManager; import jdbm.btree.BTree; import jdbm.helper.Serializer; import jdbm.helper.TupleBrowser; - import org.apache.commons.collections.iterators.ArrayIterator; -import org.apache.directory.server.core.partition.impl.btree.IndexConfiguration; -import org.apache.directory.server.core.partition.impl.btree.KeyOnlyComparator; -import org.apache.directory.server.core.partition.impl.btree.NoDupsEnumeration; -import org.apache.directory.server.core.partition.impl.btree.Table; -import org.apache.directory.server.core.partition.impl.btree.Tuple; -import org.apache.directory.server.core.partition.impl.btree.TupleComparator; -import org.apache.directory.server.core.partition.impl.btree.TupleEnumeration; -import org.apache.directory.server.core.partition.impl.btree.TupleRenderer; +import org.apache.directory.server.core.partition.impl.btree.*; import org.apache.directory.server.schema.SerializableComparator; - import org.apache.directory.shared.ldap.exception.LdapNamingException; import org.apache.directory.shared.ldap.message.ResultCodeEnum; import org.apache.directory.shared.ldap.util.EmptyEnumeration; import org.apache.directory.shared.ldap.util.SingletonEnumeration; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import java.io.IOException; +import java.util.*; /** Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java (original) +++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java Sat Sep 29 18:27:08 2007 @@ -75,7 +75,7 @@ /** * Creates a new instance of BindHandler. - */ + */ public BindHandler() { saslBindHandler = new BindHandlerChain(); Modified: directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java (original) +++ directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java Sat Sep 29 18:27:08 2007 @@ -149,7 +149,8 @@ } - public void afterShutdown( DirectoryService service ) + // @todo this was afterShutdown but perhaps it's best this occurs before shutdown + public void beforeShutdown( DirectoryService service ) { ServerStartupConfiguration cfg = ( ServerStartupConfiguration ) service.getConfiguration() .getStartupConfiguration(); Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java (original) +++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java Sat Sep 29 18:27:08 2007 @@ -18,31 +18,11 @@ * */ package org.apache.directory.server.tools.commands.dumpcmd; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; import jdbm.helper.MRU; import jdbm.recman.BaseRecordManager; import jdbm.recman.CacheRecordManager; - import org.apache.directory.server.configuration.MutableServerStartupConfiguration; import org.apache.directory.server.configuration.ServerStartupConfiguration; import org.apache.directory.server.core.DirectoryService; @@ -52,6 +32,8 @@ import org.apache.directory.server.core.configuration.StartupConfiguration; import org.apache.directory.server.core.interceptor.InterceptorChain; import org.apache.directory.server.core.partition.PartitionNexus; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; import org.apache.directory.server.core.partition.impl.btree.Tuple; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmMasterTable; @@ -59,18 +41,9 @@ import org.apache.directory.server.core.schema.PartitionSchemaLoader; import org.apache.directory.server.core.schema.SchemaManager; import org.apache.directory.server.schema.SerializableComparator; -import org.apache.directory.server.schema.bootstrap.ApacheSchema; -import org.apache.directory.server.schema.bootstrap.ApachemetaSchema; -import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader; -import org.apache.directory.server.schema.bootstrap.CoreSchema; -import org.apache.directory.server.schema.bootstrap.Schema; -import org.apache.directory.server.schema.bootstrap.SystemSchema; +import org.apache.directory.server.schema.bootstrap.*; import org.apache.directory.server.schema.bootstrap.partition.DbFileListing; -import org.apache.directory.server.schema.registries.AttributeTypeRegistry; -import org.apache.directory.server.schema.registries.DefaultOidRegistry; -import org.apache.directory.server.schema.registries.DefaultRegistries; -import org.apache.directory.server.schema.registries.OidRegistry; -import org.apache.directory.server.schema.registries.Registries; +import org.apache.directory.server.schema.registries.*; import org.apache.directory.server.tools.ToolCommandListener; import org.apache.directory.server.tools.execution.BaseToolCommandExecutor; import org.apache.directory.server.tools.util.ListenerParameter; @@ -88,6 +61,18 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.*; + /** * This is the Executor Class of the Dump Command. @@ -206,7 +191,7 @@ "the installation layout could not be found:\n\t" + schemaDirectory ); } - MutablePartitionConfiguration schemaPartitionConfig = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration schemaPartitionConfig = new MutableBTreePartitionConfiguration(); schemaPartitionConfig.setName( "schema" ); schemaPartitionConfig.setCacheSize( 1000 ); @@ -220,8 +205,13 @@ throw new LdapNamingException( "Got IOException while trying to read DBFileListing: " + e.getMessage(), ResultCodeEnum.OTHER ); } - - schemaPartitionConfig.setIndexedAttributes( listing.getIndexedAttributes() ); + + Set indexedAttributes = new HashSet(); + for ( String attributeId : listing.getIndexedAttributes() ) + { + indexedAttributes.add( new JdbmIndex( attributeId ) ); + } + schemaPartitionConfig.setIndexedAttributes( indexedAttributes ); schemaPartitionConfig.setSuffix( "ou=schema" ); Attributes entry = new AttributesImpl(); Modified: directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Sat Sep 29 18:27:08 2007 @@ -20,31 +20,12 @@ package org.apache.directory.server.unit; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import javax.naming.ConfigurationException; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - import junit.framework.AssertionFailedError; import junit.framework.TestCase; - import org.apache.commons.io.FileUtils; import org.apache.directory.server.configuration.MutableServerStartupConfiguration; import org.apache.directory.server.core.configuration.ShutdownConfiguration; +import org.apache.directory.server.core.configuration.SyncConfiguration; import org.apache.directory.server.jndi.ServerContextFactory; import org.apache.directory.shared.ldap.exception.LdapConfigurationException; import org.apache.directory.shared.ldap.ldif.Entry; @@ -54,6 +35,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.naming.*; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; + /** * A simple testcase for testing JNDI provider functionality. @@ -268,6 +259,7 @@ { FileUtils.deleteDirectory( wkdir ); } + if ( wkdir.exists() ) { throw new IOException( "Failed to delete: " + wkdir ); @@ -331,6 +323,9 @@ env.putAll( new ShutdownConfiguration().toJndiEnvironment() ); env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" ); env.put( Context.SECURITY_CREDENTIALS, "secret" ); + env.put( Context.SECURITY_AUTHENTICATION, "simple" ); + + try { new InitialContext( env ); @@ -338,10 +333,10 @@ } catch ( Exception e ) { + e.printStackTrace(); } sysRoot = null; - doDelete( configuration.getWorkingDirectory() ); configuration = new MutableServerStartupConfiguration(); if ( start >= nbTests ) Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java Sat Sep 29 18:27:08 2007 @@ -20,26 +20,27 @@ package org.apache.directory.server; -import java.util.HashSet; -import java.util.Set; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; -import javax.naming.ldap.LdapContext; - import org.apache.directory.server.core.partition.Oid; import org.apache.directory.server.core.partition.PartitionNexus; +import org.apache.directory.server.core.partition.impl.btree.Index; import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.unit.AbstractServerTest; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.util.DateUtils; import org.apache.directory.shared.ldap.util.NamespaceTools; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; +import javax.naming.ldap.LdapContext; +import java.util.HashSet; +import java.util.Set; + /** * A set of tests to make sure the negation operator is working @@ -69,16 +70,16 @@ systemCfg.setSuffix( PartitionNexus.SYSTEM_PARTITION_SUFFIX ); // Add indexed attributes for system partition - Set indexedAttrs = new HashSet(); - indexedAttrs.add( Oid.ALIAS ); - indexedAttrs.add( Oid.EXISTANCE ); - indexedAttrs.add( Oid.HIERARCHY ); - indexedAttrs.add( Oid.NDN ); - indexedAttrs.add( Oid.ONEALIAS ); - indexedAttrs.add( Oid.SUBALIAS ); - indexedAttrs.add( Oid.UPDN ); - indexedAttrs.add( "objectClass" ); - indexedAttrs.add( "ou" ); + Set indexedAttrs = new HashSet(); + indexedAttrs.add( new JdbmIndex( Oid.ALIAS ) ); + indexedAttrs.add( new JdbmIndex( Oid.EXISTANCE ) ); + indexedAttrs.add( new JdbmIndex( Oid.HIERARCHY ) ); + indexedAttrs.add( new JdbmIndex( Oid.NDN ) ); + indexedAttrs.add( new JdbmIndex( Oid.ONEALIAS ) ); + indexedAttrs.add( new JdbmIndex( Oid.SUBALIAS ) ); + indexedAttrs.add( new JdbmIndex( Oid.UPDN ) ); + indexedAttrs.add( new JdbmIndex( "objectClass" ) ); + indexedAttrs.add( new JdbmIndex( "ou" ) ); systemCfg.setIndexedAttributes( indexedAttrs ); // Add context entry for system partition Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java Sat Sep 29 18:27:08 2007 @@ -20,28 +20,13 @@ package org.apache.directory.server; -import java.io.IOException; -import java.security.InvalidKeyException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.crypto.spec.DESKeySpec; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; - import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; import org.apache.directory.server.core.configuration.PartitionConfiguration; import org.apache.directory.server.core.interceptor.Interceptor; import org.apache.directory.server.core.kerberos.KeyDerivationService; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType; import org.apache.directory.server.kerberos.shared.io.decoder.EncryptionKeyDecoder; import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey; @@ -52,6 +37,17 @@ import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.apache.mina.util.AvailablePortFinder; +import javax.crypto.spec.DESKeySpec; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; +import java.io.IOException; +import java.security.InvalidKeyException; +import java.util.*; + /** * An {@link AbstractServerTest} testing the (@link {@link KeyDerivationService}'s @@ -79,17 +75,17 @@ Attributes attrs; Set pcfgs = new HashSet(); - MutablePartitionConfiguration pcfg; + MutableBTreePartitionConfiguration pcfg; // Add partition 'example' - pcfg = new MutablePartitionConfiguration(); + pcfg = new MutableBTreePartitionConfiguration(); pcfg.setName( "example" ); pcfg.setSuffix( "dc=example,dc=com" ); - Set indexedAttrs = new HashSet(); - indexedAttrs.add( "ou" ); - indexedAttrs.add( "dc" ); - indexedAttrs.add( "objectClass" ); + Set indexedAttrs = new HashSet(); + indexedAttrs.add( new JdbmIndex( "ou" ) ); + indexedAttrs.add( new JdbmIndex( "dc" ) ); + indexedAttrs.add( new JdbmIndex( "objectClass" ) ); pcfg.setIndexedAttributes( indexedAttrs ); attrs = new AttributesImpl( true ); Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java Sat Sep 29 18:27:08 2007 @@ -23,9 +23,11 @@ import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPConnection; import netscape.ldap.LDAPException; - import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; import org.apache.directory.server.core.configuration.PartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.unit.AbstractServerTest; import org.apache.directory.shared.asn1.util.Asn1StringUtils; import org.apache.directory.shared.ldap.message.AttributeImpl; @@ -34,22 +36,16 @@ import org.apache.directory.shared.ldap.util.ArrayUtils; import org.apache.directory.shared.ldap.util.EmptyEnumeration; -import java.util.Hashtable; -import java.util.Set; -import java.util.HashSet; -import java.util.Collections; - import javax.naming.Context; -import javax.naming.NoPermissionException; import javax.naming.NamingEnumeration; +import javax.naming.NoPermissionException; import javax.naming.OperationNotSupportedException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; +import javax.naming.directory.*; import javax.naming.ldap.InitialLdapContext; +import java.util.Collections; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; /** @@ -88,7 +84,7 @@ { Set partitions = new HashSet(); partitions.addAll( configuration.getPartitionConfigurations() ); - MutablePartitionConfiguration partition = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration partition = new MutableBTreePartitionConfiguration(); partition.setSuffix( "dc=aPache,dc=org" ); Attributes entry = new AttributesImpl( "dc", "aPache", true ); Attribute oc = new AttributeImpl( "objectClass" ); @@ -97,7 +93,9 @@ oc.add( "domain" ); partition.setName( "apache" ); partition.setContextEntry( entry ); - partition.setIndexedAttributes( Collections.singleton( ( Object ) "dc" ) ); + Set indexedAttributes = new HashSet(); + indexedAttributes.add( new JdbmIndex( "dc" ) ); + partition.setIndexedAttributes( indexedAttributes ); partitions.add( partition ); configuration.setPartitionConfigurations( partitions ); } @@ -109,7 +107,7 @@ // create a partition to search Set partitions = new HashSet(); partitions.addAll( configuration.getPartitionConfigurations() ); - MutablePartitionConfiguration partition = new MutablePartitionConfiguration(); + MutableBTreePartitionConfiguration partition = new MutableBTreePartitionConfiguration(); partition.setSuffix( "dc=apache,dc=org" ); Attributes entry = new AttributesImpl( "dc", "apache", true ); Attribute oc = new AttributeImpl( "objectClass" ); @@ -118,7 +116,9 @@ oc.add( "domain" ); partition.setName( "apache" ); partition.setContextEntry( entry ); - partition.setIndexedAttributes( Collections.singleton( ( Object ) "dc" ) ); + Set indexedAttributes = new HashSet(); + indexedAttributes.add( new JdbmIndex( "dc" ) ); + partition.setIndexedAttributes( indexedAttributes ); partitions.add( partition ); configuration.setPartitionConfigurations( partitions ); } Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java Sat Sep 29 18:27:08 2007 @@ -20,21 +20,11 @@ package org.apache.directory.server; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.SearchControls; -import javax.naming.directory.SearchResult; -import javax.naming.ldap.LdapContext; - import org.apache.directory.server.core.partition.Oid; import org.apache.directory.server.core.partition.PartitionNexus; +import org.apache.directory.server.core.partition.impl.btree.Index; import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.unit.AbstractServerTest; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.ldif.Entry; @@ -43,6 +33,17 @@ import org.apache.directory.shared.ldap.util.DateUtils; import org.apache.directory.shared.ldap.util.NamespaceTools; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; +import javax.naming.ldap.LdapContext; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + /** * A set of tests to make sure the negation operator is working @@ -75,16 +76,16 @@ systemCfg.setSuffix( PartitionNexus.SYSTEM_PARTITION_SUFFIX ); // Add indexed attributes for system partition - Set indexedAttrs = new HashSet(); - indexedAttrs.add( Oid.ALIAS ); - indexedAttrs.add( Oid.EXISTANCE ); - indexedAttrs.add( Oid.HIERARCHY ); - indexedAttrs.add( Oid.NDN ); - indexedAttrs.add( Oid.ONEALIAS ); - indexedAttrs.add( Oid.SUBALIAS ); - indexedAttrs.add( Oid.UPDN ); - indexedAttrs.add( SchemaConstants.OBJECT_CLASS_AT ); - indexedAttrs.add( SchemaConstants.OU_AT ); + Set indexedAttrs = new HashSet(); + indexedAttrs.add( new JdbmIndex( Oid.ALIAS ) ); + indexedAttrs.add( new JdbmIndex( Oid.EXISTANCE ) ); + indexedAttrs.add( new JdbmIndex( Oid.HIERARCHY ) ); + indexedAttrs.add( new JdbmIndex( Oid.NDN ) ); + indexedAttrs.add( new JdbmIndex( Oid.ONEALIAS ) ); + indexedAttrs.add( new JdbmIndex( Oid.SUBALIAS ) ); + indexedAttrs.add( new JdbmIndex( Oid.UPDN ) ); + indexedAttrs.add( new JdbmIndex( SchemaConstants.OBJECT_CLASS_AT ) ); + indexedAttrs.add( new JdbmIndex( SchemaConstants.OU_AT ) ); systemCfg.setIndexedAttributes( indexedAttrs ); // Add context entry for system partition Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java?rev=580666&r1=580665&r2=580666&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java (original) +++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java Sat Sep 29 18:27:08 2007 @@ -20,21 +20,13 @@ package org.apache.directory.server; -import java.net.InetAddress; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; - import org.apache.commons.net.ntp.NTPUDPClient; import org.apache.commons.net.ntp.TimeInfo; import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; import org.apache.directory.server.core.configuration.PartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.Index; +import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration; +import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.ldap.LdapConfiguration; import org.apache.directory.server.ntp.NtpConfiguration; import org.apache.directory.server.unit.AbstractServerTest; @@ -42,6 +34,16 @@ import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.mina.util.AvailablePortFinder; +import javax.naming.Context; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; +import java.net.InetAddress; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; + /** * An {@link AbstractServerTest} testing the Network Time Protocol (NTP). @@ -73,17 +75,17 @@ Attributes attrs; Set pcfgs = new HashSet(); - MutablePartitionConfiguration pcfg; + MutableBTreePartitionConfiguration pcfg; // Add partition 'example' - pcfg = new MutablePartitionConfiguration(); + pcfg = new MutableBTreePartitionConfiguration(); pcfg.setName( "example" ); pcfg.setSuffix( "dc=example,dc=com" ); - Set indexedAttrs = new HashSet(); - indexedAttrs.add( "ou" ); - indexedAttrs.add( "dc" ); - indexedAttrs.add( "objectClass" ); + Set indexedAttrs = new HashSet(); + indexedAttrs.add( new JdbmIndex( "ou" ) ); + indexedAttrs.add( new JdbmIndex( "dc" ) ); + indexedAttrs.add( new JdbmIndex( "objectClass" ) ); pcfg.setIndexedAttributes( indexedAttrs ); attrs = new AttributesImpl( true );