directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1520568 [1/2] - in /directory/apacheds/trunk: core-annotations/src/main/java/org/apache/directory/server/core/factory/ core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api...
Date Fri, 06 Sep 2013 13:28:00 GMT
Author: elecharny
Date: Fri Sep  6 13:27:59 2013
New Revision: 1520568

URL: http://svn.apache.org/r1520568
Log:
o Made the DnFactory available in AbstractBTreePartition
o The CacheService can be configured with no provided layout
o The Partition constructor now takes the DnFactory as a parameter
o Fixed the tests accordingly
o Minor refactoring (mainly tabs removal)

Modified:
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/PartitionFactory.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
    directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
    directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
    directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
    directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java Fri Sep  6 13:27:59 2013
@@ -25,6 +25,7 @@ import java.util.Set;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.server.xdbm.Index;
@@ -42,11 +43,12 @@ public class AvlPartitionFactory impleme
     /**
      * {@inheritDoc}
      */
-    public AvlPartition createPartition( SchemaManager schemaManager, String id, String suffix, int cacheSize,
+    public AvlPartition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id, String suffix,
+        int cacheSize,
         File workingDirectory )
         throws Exception
     {
-        AvlPartition partition = new AvlPartition( schemaManager );
+        AvlPartition partition = new AvlPartition( schemaManager, dnFactory );
         partition.setId( id );
         partition.setSuffixDn( new Dn( suffix ) );
         partition.setCacheSize( 500 );

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java Fri Sep  6 13:27:59 2013
@@ -44,6 +44,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.annotations.LoadSchema;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
@@ -205,6 +206,7 @@ public class DSAnnotationProcessor
                 PartitionFactory partitionFactory = dsf.getPartitionFactory();
                 partition = partitionFactory.createPartition(
                     schemaManager,
+                    service.getDnFactory(),
                     createPartition.name(),
                     createPartition.suffix(),
                     createPartition.cacheSize(),
@@ -225,10 +227,10 @@ public class DSAnnotationProcessor
                 // The annotation contains a specific partition type, we use
                 // that type.
                 Class<?> partypes[] = new Class[]
-                    { SchemaManager.class };
+                    { SchemaManager.class, DnFactory.class };
                 Constructor<?> constructor = createPartition.type().getConstructor( partypes );
                 partition = ( Partition ) constructor.newInstance( new Object[]
-                    { schemaManager } );
+                    { schemaManager, service.getDnFactory() } );
                 partition.setId( createPartition.name() );
                 partition.setSuffixDn( new Dn( schemaManager, createPartition.suffix() ) );
 

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java Fri Sep  6 13:27:59 2013
@@ -191,7 +191,7 @@ public class DefaultDirectoryServiceFact
         directoryService.setSchemaManager( schemaManager );
 
         // Init the LdifPartition
-        LdifPartition ldifPartition = new LdifPartition( schemaManager );
+        LdifPartition ldifPartition = new LdifPartition( schemaManager, directoryService.getDnFactory() );
         ldifPartition.setPartitionPath( new File( workingDirectory, "schema" ).toURI() );
         SchemaPartition schemaPartition = new SchemaPartition( schemaManager );
         schemaPartition.setWrappedPartition( ldifPartition );
@@ -219,6 +219,7 @@ public class DefaultDirectoryServiceFact
 
         // Inject the System Partition
         Partition systemPartition = partitionFactory.createPartition( directoryService.getSchemaManager(),
+            directoryService.getDnFactory(),
             "system", ServerDNConstants.SYSTEM_DN, 500,
             new File( directoryService.getInstanceLayout().getPartitionsDirectory(), "system" ) );
         systemPartition.setSchemaManager( directoryService.getSchemaManager() );

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java Fri Sep  6 13:27:59 2013
@@ -25,6 +25,7 @@ import java.util.Set;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
@@ -42,11 +43,12 @@ public class JdbmPartitionFactory implem
     /**
      * {@inheritDoc}
      */
-    public JdbmPartition createPartition( SchemaManager schemaManager, String id, String suffix, int cacheSize,
+    public JdbmPartition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id, String suffix,
+        int cacheSize,
         File workingDirectory )
         throws Exception
     {
-        JdbmPartition partition = new JdbmPartition( schemaManager );
+        JdbmPartition partition = new JdbmPartition( schemaManager, dnFactory );
         partition.setId( id );
         partition.setSuffixDn( new Dn( suffix ) );
         partition.setCacheSize( cacheSize );

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java Fri Sep  6 13:27:59 2013
@@ -25,6 +25,7 @@ import java.util.Set;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
 import org.apache.directory.server.xdbm.Index;
@@ -42,11 +43,12 @@ public class LdifPartitionFactory implem
     /**
      * {@inheritDoc}
      */
-    public LdifPartition createPartition( SchemaManager schemaManager, String id, String suffix, int cacheSize,
+    public LdifPartition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id, String suffix,
+        int cacheSize,
         File workingDirectory )
         throws Exception
     {
-        LdifPartition partition = new LdifPartition( schemaManager );
+        LdifPartition partition = new LdifPartition( schemaManager, dnFactory );
         partition.setId( id );
         partition.setSuffixDn( new Dn( suffix ) );
         partition.setCacheSize( 500 );

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java Fri Sep  6 13:27:59 2013
@@ -25,11 +25,12 @@ import java.util.Set;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.mavibot.btree.RecordManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.mavibot.MavibotIndex;
 import org.apache.directory.server.core.partition.impl.btree.mavibot.MavibotPartition;
 import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.mavibot.btree.RecordManager;
 
 
 /**
@@ -43,11 +44,12 @@ public class MavibotPartitionFactory imp
     /**
      * {@inheritDoc}
      */
-    public MavibotPartition createPartition( SchemaManager schemaManager, String id, String suffix, int cacheSize,
+    public MavibotPartition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id,
+        String suffix, int cacheSize,
         File workingDirectory )
         throws Exception
     {
-        MavibotPartition partition = new MavibotPartition( schemaManager );
+        MavibotPartition partition = new MavibotPartition( schemaManager, dnFactory );
         partition.setId( id );
         partition.setSuffixDn( new Dn( suffix ) );
         partition.setCacheSize( 500 );
@@ -71,7 +73,7 @@ public class MavibotPartitionFactory imp
         Set<Index<?, ?, String>> indexedAttributes = mavibotPartition.getIndexedAttributes();
 
         RecordManager recordMan = ( ( MavibotPartition ) partition ).getRecordMan();
-        
+
         MavibotIndex<Object, Entry> index = new MavibotIndex<Object, Entry>( attributeId, false );
         index.setCacheSize( cacheSize );
 

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/PartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/PartitionFactory.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/PartitionFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/PartitionFactory.java Fri Sep  6 13:27:59 2013
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 import java.io.File;
 
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.xdbm.Index;
 
@@ -45,7 +46,8 @@ public interface PartitionFactory
      * @return the partition
      * @throws Exception the exception
      */
-    Partition createPartition( SchemaManager schemaManager, String id, String suffix, int cacheSize,
+    Partition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id, String suffix,
+        int cacheSize,
         File workingDirectory ) throws Exception;
 
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java Fri Sep  6 13:27:59 2013
@@ -29,6 +29,7 @@ import net.sf.ehcache.Status;
 import net.sf.ehcache.config.Configuration;
 import net.sf.ehcache.config.ConfigurationFactory;
 
+import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,11 +56,12 @@ public class CacheService
 
     private boolean initialized;
 
+
     public CacheService()
     {
     }
 
-    
+
     /**
      * Creates a new instance of CacheService with the given cache manager.
      *
@@ -70,11 +72,11 @@ public class CacheService
         this.cacheManager = cachemanager;
         if ( cachemanager != null )
         {
-           initialized = true; 
+            initialized = true;
         }
     }
-    
-    
+
+
     public void initialize( InstanceLayout layout )
     {
         if ( initialized )
@@ -82,7 +84,7 @@ public class CacheService
             LOG.debug( "CacheService was already initialized, returning" );
             return;
         }
-        
+
         if ( ( cacheManager != null ) && ( cacheManager.getStatus() == Status.STATUS_ALIVE ) )
         {
             LOG.warn( "cache service was already initialized and is alive" );
@@ -90,23 +92,38 @@ public class CacheService
             return;
         }
 
-        File configFile = new File( layout.getConfDirectory(), DIRECTORY_CACHESERVICE_XML );
-
         Configuration cc;
-        
-        if ( !configFile.exists() )
+        String cachePath = null;
+
+        if ( layout != null )
         {
-            LOG.info( "no custom cache configuration was set, loading the default cache configuration" );
-            cc = ConfigurationFactory.parseConfiguration( getClass().getClassLoader().getResource( DIRECTORY_CACHESERVICE_XML ) );
+            File configFile = new File( layout.getConfDirectory(), DIRECTORY_CACHESERVICE_XML );
+
+            if ( !configFile.exists() )
+            {
+                LOG.info( "no custom cache configuration was set, loading the default cache configuration" );
+                cc = ConfigurationFactory.parseConfiguration( getClass().getClassLoader().getResource(
+                    DIRECTORY_CACHESERVICE_XML ) );
+            }
+            else
+            {
+                LOG.info( "loading cache configuration from the file {}", configFile );
+
+                cc = ConfigurationFactory.parseConfiguration( configFile );
+            }
+
+            cachePath = layout.getCacheDirectory().getAbsolutePath();
         }
         else
         {
-            LOG.info( "loading cache configuration from the file {}", configFile );
+            LOG.info( "no custom cache configuration was set, loading the default cache configuration" );
+            cc = ConfigurationFactory.parseConfiguration( getClass().getClassLoader().getResource(
+                DIRECTORY_CACHESERVICE_XML ) );
 
-            cc = ConfigurationFactory.parseConfiguration( configFile );
+            cachePath = FileUtils.getTempDirectoryPath();
         }
-        
-        cc.getDiskStoreConfiguration().setPath( layout.getCacheDirectory().getAbsolutePath() );
+
+        cc.getDiskStoreConfiguration().setPath( cachePath );
         cacheManager = new CacheManager( cc );
 
         initialized = true;
@@ -139,13 +156,13 @@ public class CacheService
         LOG.info( "fetching the cache named {}", name );
 
         Cache cache = cacheManager.getCache( name );
-        
-        if( cache == null )
+
+        if ( cache == null )
         {
             cacheManager.addCache( name );
             cache = cacheManager.getCache( name );
         }
-        
+
         return cache;
     }
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/partition/AbstractPartition.java Fri Sep  6 13:27:59 2013
@@ -33,6 +33,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.i18n.I18n;
 
 
@@ -54,6 +55,9 @@ public abstract class AbstractPartition 
     /** The SchemaManager instance */
     protected SchemaManager schemaManager;
 
+    /** The DnFactory to use to create DN */
+    protected DnFactory dnFactory;
+
     /** The partition ID */
     protected String id;
 
@@ -62,7 +66,8 @@ public abstract class AbstractPartition 
 
     /** the cache service */
     protected CacheService cacheService;
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -238,7 +243,7 @@ public abstract class AbstractPartition 
         this.contextEntry = contextEntry;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java Fri Sep  6 13:27:59 2013
@@ -58,7 +58,8 @@ public class PartitionConfigurationIT ex
     {
         DirectoryServiceFactory dsFactory = DefaultDirectoryServiceFactory.class.newInstance();
         PartitionFactory partitionFactory = dsFactory.getPartitionFactory();
-        Partition partition = partitionFactory.createPartition( getService().getSchemaManager(), "removable",
+        Partition partition = partitionFactory.createPartition( getService().getSchemaManager(),
+            getService().getDnFactory(), "removable",
             "ou=removable", 100, getService()
                 .getInstanceLayout().getPartitionsDirectory() );
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Fri Sep  6 13:27:59 2013
@@ -51,6 +51,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.exception.MultiException;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.entry.ClonedServerEntry;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
@@ -106,9 +107,9 @@ public class JdbmPartition extends Abstr
     /**
      * Creates a store based on JDBM B+Trees.
      */
-    public JdbmPartition( SchemaManager schemaManager )
+    public JdbmPartition( SchemaManager schemaManager, DnFactory dnFactory )
     {
-        super( schemaManager );
+        super( schemaManager, dnFactory );
 
         // Initialize the cache size
         if ( cacheSize < 0 )

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Fri Sep  6 13:27:59 2013
@@ -54,13 +54,16 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.CacheService;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.LdapPrincipal;
 import org.apache.directory.server.core.api.MockCoreSession;
 import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexNotFoundException;
 import org.apache.directory.server.xdbm.Store;
@@ -88,6 +91,7 @@ public class JdbmStoreTest
     CoreSession session;
 
     private static SchemaManager schemaManager = null;
+    private static DnFactory dnFactory;
     private static LdifSchemaLoader loader;
     private static Dn EXAMPLE_COM;
 
@@ -135,6 +139,10 @@ public class JdbmStoreTest
         DC_AT = schemaManager.getAttributeType( SchemaConstants.DC_AT );
         SN_AT = schemaManager.getAttributeType( SchemaConstants.SN_AT );
         APACHE_ALIAS_AT = schemaManager.getAttributeType( ApacheSchemaConstants.APACHE_ALIAS_AT );
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -147,7 +155,7 @@ public class JdbmStoreTest
         wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
 
         // initialize the store
-        store = new JdbmPartition( schemaManager );
+        store = new JdbmPartition( schemaManager, dnFactory );
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );
@@ -210,7 +218,7 @@ public class JdbmStoreTest
         wkdir2 = new File( wkdir2.getParentFile(), getClass().getSimpleName() );
 
         // initialize the 2nd store
-        JdbmPartition store2 = new JdbmPartition( schemaManager );
+        JdbmPartition store2 = new JdbmPartition( schemaManager, dnFactory );
         store2.setId( "example2" );
         store2.setCacheSize( 10 );
         store2.setPartitionPath( wkdir2.toURI() );
@@ -244,7 +252,7 @@ public class JdbmStoreTest
     @Test
     public void testSimplePropertiesUnlocked() throws Exception
     {
-        JdbmPartition jdbmPartition = new JdbmPartition( schemaManager );
+        JdbmPartition jdbmPartition = new JdbmPartition( schemaManager, dnFactory );
         jdbmPartition.setSyncOnWrite( true ); // for code coverage
 
         assertNull( jdbmPartition.getAliasIndex() );
@@ -789,7 +797,7 @@ public class JdbmStoreTest
         assertTrue( ouIndexDbFile.exists() );
         assertTrue( ouIndexTxtFile.exists() );
 
-        store = new JdbmPartition( schemaManager );
+        store = new JdbmPartition( schemaManager, dnFactory );
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java Fri Sep  6 13:27:59 2013
@@ -38,9 +38,12 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.apache.directory.api.ldap.util.tree.DnNode;
 import org.apache.directory.api.util.exception.Exceptions;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.DupsContainerCursorTest;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -53,6 +56,7 @@ import org.junit.Test;
 public class PartitionTreeTest
 {
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
 
     @BeforeClass
@@ -79,6 +83,10 @@ public class PartitionTreeTest
         {
             fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -92,7 +100,7 @@ public class PartitionTreeTest
         DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
 
         Dn suffix = new Dn( schemaManager, "dc=example, dc=com" );
-        Partition partition = new JdbmPartition( schemaManager );
+        Partition partition = new JdbmPartition( schemaManager, dnFactory );
         partition.setSuffixDn( suffix );
 
         partitionLookupTree.add( suffix, partition );
@@ -120,13 +128,13 @@ public class PartitionTreeTest
         DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
 
         Dn suffix1 = new Dn( schemaManager, "dc=example, dc=com" );
-        Partition partition1 = new JdbmPartition( schemaManager );
+        Partition partition1 = new JdbmPartition( schemaManager, dnFactory );
         partition1.setSuffixDn( suffix1 );
 
         partitionLookupTree.add( suffix1, partition1 );
 
         Dn suffix2 = new Dn( schemaManager, "ou=system" );
-        Partition partition2 = new JdbmPartition( schemaManager );
+        Partition partition2 = new JdbmPartition( schemaManager, dnFactory );
         partition2.setSuffixDn( suffix2 );
 
         partitionLookupTree.add( suffix2, partition2 );
@@ -160,13 +168,13 @@ public class PartitionTreeTest
         DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
 
         Dn suffix1 = new Dn( schemaManager, "dc=example1, dc=com" );
-        Partition partition1 = new JdbmPartition( schemaManager );
+        Partition partition1 = new JdbmPartition( schemaManager, dnFactory );
         partition1.setSuffixDn( suffix1 );
 
         partitionLookupTree.add( suffix1, partition1 );
 
         Dn suffix2 = new Dn( schemaManager, "dc=example2, dc=com" );
-        Partition partition2 = new JdbmPartition( schemaManager );
+        Partition partition2 = new JdbmPartition( schemaManager, dnFactory );
         partition2.setSuffixDn( suffix2 );
 
         partitionLookupTree.add( suffix2, partition2 );

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java Fri Sep  6 13:27:59 2013
@@ -25,6 +25,7 @@ import java.net.URI;
 
 import org.apache.directory.api.ldap.model.csn.CsnFactory;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 
@@ -43,9 +44,9 @@ public abstract class AbstractLdifPartit
     protected static CsnFactory defaultCSNFactory;
 
 
-    public AbstractLdifPartition( SchemaManager schemaManager )
+    public AbstractLdifPartition( SchemaManager schemaManager, DnFactory dnFactory )
     {
-        super( schemaManager );
+        super( schemaManager, dnFactory );
 
         // Create the CsnFactory with a invalid ReplicaId
         // @TODO : inject a correct ReplicaId

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Fri Sep  6 13:27:59 2013
@@ -47,6 +47,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.Strings;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -126,9 +127,9 @@ public class LdifPartition extends Abstr
     /**
      * Creates a new instance of LdifPartition.
      */
-    public LdifPartition( SchemaManager schemaManager )
+    public LdifPartition( SchemaManager schemaManager, DnFactory dnFactory )
     {
-        super( schemaManager );
+        super( schemaManager, dnFactory );
     }
 
 
@@ -258,7 +259,7 @@ public class LdifPartition extends Abstr
     public void add( AddOperationContext addContext ) throws LdapException
     {
         super.add( addContext );
-        
+
         addEntry( addContext.getEntry() );
     }
 
@@ -288,7 +289,7 @@ public class LdifPartition extends Abstr
                 LOG.debug( "deleted file {} {}", parentFile.getAbsoluteFile(), deleted );
             }
         }
-        
+
         return deletedEntry;
     }
 

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java Fri Sep  6 13:27:59 2013
@@ -43,6 +43,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.Strings;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
@@ -80,9 +81,9 @@ public class SingleFileLdifPartition ext
     /**
      * Creates a new instance of SingleFileLdifPartition.
      */
-    public SingleFileLdifPartition( SchemaManager schemaManager )
+    public SingleFileLdifPartition( SchemaManager schemaManager, DnFactory dnFactory )
     {
-        super( schemaManager );
+        super( schemaManager, dnFactory );
     }
 
 
@@ -138,7 +139,7 @@ public class SingleFileLdifPartition ext
         if ( !itr.hasNext() )
         {
             parser.close();
-            
+
             return;
         }
 
@@ -215,7 +216,7 @@ public class SingleFileLdifPartition ext
                 Entry modifiedEntry = super.modify( modifyContext.getDn(),
                     modifyContext.getModItems().toArray( new Modification[]
                         {} ) );
-                
+
                 // Remove the EntryDN
                 modifiedEntry.removeAttributes( ENTRY_DN_AT );
 
@@ -282,7 +283,7 @@ public class SingleFileLdifPartition ext
             Entry deletedEntry = super.delete( id );
             dirty = true;
             rewritePartitionData();
-            
+
             return deletedEntry;
         }
     }
@@ -320,10 +321,10 @@ public class SingleFileLdifPartition ext
                 if ( suffixEntry != null )
                 {
                     Entry entry = master.get( suffixId );
-                    
+
                     // Don't write the EntryDN attribute
                     entry.removeAttributes( ENTRY_DN_AT );
-                    
+
                     entry.setDn( suffixDn );
 
                     appendLdif( entry );
@@ -360,7 +361,7 @@ public class SingleFileLdifPartition ext
             IndexEntry<ParentIdAndRdn, String> element = cursor.get();
             String childId = element.getId();
             Entry entry = fetch( childId );
-            
+
             // Remove the EntryDn
             entry.removeAttributes( SchemaConstants.ENTRY_DN_AT );
 

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java Fri Sep  6 13:27:59 2013
@@ -52,8 +52,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.apache.directory.api.util.exception.Exceptions;
+import org.apache.directory.server.core.api.CacheService;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.LdapPrincipal;
 import org.apache.directory.server.core.api.MockCoreSession;
 import org.apache.directory.server.core.api.MockDirectoryService;
@@ -66,6 +68,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
@@ -87,6 +90,7 @@ public class LdifPartitionTest
     private static File wkdir;
     private static LdifPartition partition;
     private static SchemaManager schemaManager = null;
+    private static DnFactory dnFactory;
     private static CsnFactory defaultCSNFactory;
 
     @Rule
@@ -119,6 +123,10 @@ public class LdifPartitionTest
         }
 
         defaultCSNFactory = new CsnFactory( 0 );
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -131,7 +139,7 @@ public class LdifPartitionTest
 
         // initialize the store
         // initialize the partition
-        partition = new LdifPartition( schemaManager );
+        partition = new LdifPartition( schemaManager, dnFactory );
         partition.setId( "test-ldif" );
         partition.setSuffixDn( new Dn( "ou=test,ou=system" ) );
         partition.setSchemaManager( schemaManager );

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java Fri Sep  6 13:27:59 2013
@@ -64,8 +64,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.api.util.exception.Exceptions;
+import org.apache.directory.server.core.api.CacheService;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.LdapPrincipal;
 import org.apache.directory.server.core.api.MockCoreSession;
 import org.apache.directory.server.core.api.MockDirectoryService;
@@ -80,6 +82,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -98,6 +101,8 @@ public class SingleFileLdifPartitionTest
 {
     private static SchemaManager schemaManager = null;
 
+    private static DnFactory dnFactory;
+
     private static CsnFactory defaultCSNFactory;
 
     private static CoreSession mockSession;
@@ -158,6 +163,10 @@ public class SingleFileLdifPartitionTest
         LdifEntry ldifEntry = reader.parseLdif( contextEntryStr ).get( 0 );
 
         contextEntry = new ClonedServerEntry( new DefaultEntry( schemaManager, ldifEntry.getEntry() ) );
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -186,9 +195,9 @@ public class SingleFileLdifPartitionTest
         // Remove the entryDn attribute
         Entry copy = entry.clone();
         copy.removeAttributes( "entryDn" );
-        
+
         // while writing to the file 1 extra newline char will be added
-        
+
         String ldif = LdifUtils.convertToLdif( copy ) + "\n";
         byte[] data = Strings.getBytesUtf8( ldif );
 
@@ -222,7 +231,7 @@ public class SingleFileLdifPartitionTest
             rf.close();
         }
 
-        SingleFileLdifPartition partition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition partition = new SingleFileLdifPartition( schemaManager, dnFactory );
         partition.setId( "test-ldif" );
         partition.setPartitionPath( new File( fileName ).toURI() );
         partition.setSuffixDn( new Dn( "ou=test,ou=system" ) );
@@ -247,19 +256,19 @@ public class SingleFileLdifPartitionTest
         Entry fetched = partition.lookup( opCtx );
 
         assertNotNull( fetched );
-        
+
         // Check the EntryDn attribute
         Attribute entryDn = fetched.get( "entryDn" );
-        
+
         assertNotNull( entryDn );
         assertEquals( entryDn.getString(), entry.getDn().getName() );
-        
+
         if ( !entry.contains( entryDn ) )
         {
             // Removed the entryDn attribute to be able to compare the entries
             fetched.removeAttributes( "entryDn" );
         }
-        
+
         assertEquals( entry, fetched );
     }
 
@@ -306,7 +315,7 @@ public class SingleFileLdifPartitionTest
         RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath() ), "r" );
 
         assertEquals( getEntryLdifLen( contextEntry ), file.length() );
-        
+
         file.close();
 
         partition = reloadPartition();
@@ -462,7 +471,7 @@ public class SingleFileLdifPartitionTest
         String ldif = Strings.utf8ToString( entry1Data );
 
         LdifEntry ldifEntry = reader.parseLdif( ldif ).get( 0 );
-        
+
         // Remove the EntryDN
         entry1.removeAttributes( "entryDn" );
 

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java Fri Sep  6 13:27:59 2013
@@ -35,7 +35,9 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.mavibot.btree.RecordManager;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition;
 import org.apache.directory.server.i18n.I18n;
@@ -45,7 +47,6 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.search.impl.DefaultSearchEngine;
 import org.apache.directory.server.xdbm.search.impl.EvaluatorBuilder;
 import org.apache.directory.server.xdbm.search.impl.NoOpOptimizer;
-import org.apache.directory.mavibot.btree.RecordManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,13 +76,14 @@ public class MavibotPartition extends Ab
     };
 
     private RecordManager recordMan;
-    
-    public MavibotPartition( SchemaManager schemaManager )
+
+
+    public MavibotPartition( SchemaManager schemaManager, DnFactory dnFactory )
     {
-        super( schemaManager );
-        
+        super( schemaManager, dnFactory );
+
         MavibotEntrySerializer.setSchemaManager( schemaManager );
-        
+
         // Initialize the cache size
         if ( cacheSize < 0 )
         {
@@ -152,30 +154,30 @@ public class MavibotPartition extends Ab
             // one for collecting all user indices
             // two for finding a new index to be built
             // just to avoid another iteration for determining which is the new index
-/* FIXME the below code needs to be modified to suit Mavibot
-            for ( Index<?, Entry, String> index : userIndices.values() )
-            {
-                String indexOid = index.getAttribute().getOid();
-                allIndices.add( indexOid );
-
-                // take the part after removing .db from the
-                String name = indexOid + MAVIBOT_DB_FILE_EXTN;
+            /* FIXME the below code needs to be modified to suit Mavibot
+                        for ( Index<?, Entry, String> index : userIndices.values() )
+                        {
+                            String indexOid = index.getAttribute().getOid();
+                            allIndices.add( indexOid );
+
+                            // take the part after removing .db from the
+                            String name = indexOid + MAVIBOT_DB_FILE_EXTN;
+
+                            // if the name doesn't exist in the list of index DB files
+                            // this is a new index and we need to build it
+                            if ( !indexDbFileNameList.contains( name ) )
+                            {
+                                indexToBuild.add( index );
+                            }
+                        }
+
+                        if ( indexToBuild.size() > 0 )
+                        {
+                            buildUserIndex( indexToBuild );
+                        }
 
-                // if the name doesn't exist in the list of index DB files
-                // this is a new index and we need to build it
-                if ( !indexDbFileNameList.contains( name ) )
-                {
-                    indexToBuild.add( index );
-                }
-            }
-
-            if ( indexToBuild.size() > 0 )
-            {
-                buildUserIndex( indexToBuild );
-            }
-
-            deleteUnusedIndexFiles( allIndices, allIndexDbFiles );
-*/
+                        deleteUnusedIndexFiles( allIndices, allIndexDbFiles );
+            */
             // We are done !
             initialized = true;
         }
@@ -214,7 +216,7 @@ public class MavibotPartition extends Ab
         }
 
         mavibotIndex.setRecordManager( recordMan );
-        
+
         mavibotIndex.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( index.getAttributeId() ) );
 
         return mavibotIndex;
@@ -271,18 +273,18 @@ public class MavibotPartition extends Ab
 
         ( ( MavibotMasterTable ) master ).sync();
     }
-    
-    
+
+
     /**jdbm
      * removes any unused/removed attribute index files present under the partition's
      * working directory
      */
     private void deleteUnusedIndexFiles( List<String> allIndices, File[] dbFiles )
     {
-        
+
     }
 
-    
+
     /**
      * Builds user defined indexes on a attributes by browsing all the entries present in master db
      * 
@@ -327,7 +329,7 @@ public class MavibotPartition extends Ab
         cursor.close();
     }
 
-    
+
     /**
      * {@inheritDoc}}
      */

Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java Fri Sep  6 13:27:59 2013
@@ -53,19 +53,22 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.apache.directory.api.util.Strings;
 import org.apache.directory.api.util.exception.Exceptions;
+import org.apache.directory.mavibot.btree.RecordManager;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.CacheService;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.LdapPrincipal;
 import org.apache.directory.server.core.api.MockCoreSession;
 import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexNotFoundException;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.StoreUtils;
-import org.apache.directory.mavibot.btree.RecordManager;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -88,12 +91,13 @@ public class MavibotStoreTest
     private static final Logger LOG = LoggerFactory.getLogger( MavibotStoreTest.class );
 
     private File wkdir;
-    
+
     private MavibotPartition store;
-    
+
     private CoreSession session;
 
     private static SchemaManager schemaManager = null;
+    private static DnFactory dnFactory;
     private static LdifSchemaLoader loader;
     private static Dn EXAMPLE_COM;
 
@@ -113,7 +117,8 @@ public class MavibotStoreTest
 
     @Rule
     public TemporaryFolder tmpDir = new TemporaryFolder();
-    
+
+
     @BeforeClass
     public static void setup() throws Exception
     {
@@ -145,6 +150,10 @@ public class MavibotStoreTest
         DC_AT = schemaManager.getAttributeType( SchemaConstants.DC_AT );
         SN_AT = schemaManager.getAttributeType( SchemaConstants.SN_AT );
         APACHE_ALIAS_AT = schemaManager.getAttributeType( ApacheSchemaConstants.APACHE_ALIAS_AT );
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -155,7 +164,7 @@ public class MavibotStoreTest
         wkdir = tmpDir.newFolder( getClass().getSimpleName() );
 
         // initialize the store
-        store = new MavibotPartition( schemaManager );
+        store = new MavibotPartition( schemaManager, dnFactory );
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );
@@ -175,7 +184,7 @@ public class MavibotStoreTest
         store.initialize();
 
         recordMan = store.getRecordMan();
-        
+
         StoreUtils.loadExampleData( store, schemaManager );
 
         DirectoryService directoryService = new MockDirectoryService();
@@ -212,7 +221,7 @@ public class MavibotStoreTest
         File wkdir2 = tmpDir.newFolder( getClass().getSimpleName() + "-store2" );
 
         // initialize the 2nd store
-        MavibotPartition store2 = new MavibotPartition( schemaManager );
+        MavibotPartition store2 = new MavibotPartition( schemaManager, dnFactory );
         store2.setId( "example2" );
         store2.setCacheSize( 10 );
         store2.setPartitionPath( wkdir2.toURI() );
@@ -247,7 +256,7 @@ public class MavibotStoreTest
     @Test
     public void testSimplePropertiesUnlocked() throws Exception
     {
-        MavibotPartition MavibotPartition = new MavibotPartition( schemaManager );
+        MavibotPartition MavibotPartition = new MavibotPartition( schemaManager, dnFactory );
         MavibotPartition.setSyncOnWrite( true ); // for code coverage
 
         assertNull( MavibotPartition.getAliasIndex() );
@@ -261,7 +270,8 @@ public class MavibotStoreTest
         assertEquals( 24, MavibotPartition.getCacheSize() );
 
         assertNull( MavibotPartition.getPresenceIndex() );
-        MavibotPartition.addIndex( new MavibotIndex<String, Entry>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID, false ) );
+        MavibotPartition
+            .addIndex( new MavibotIndex<String, Entry>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID, false ) );
         assertNotNull( MavibotPartition.getPresenceIndex() );
 
         assertNull( MavibotPartition.getId() );
@@ -273,11 +283,13 @@ public class MavibotStoreTest
         assertNotNull( MavibotPartition.getRdnIndex() );
 
         assertNull( MavibotPartition.getOneAliasIndex() );
-        ( ( Store ) MavibotPartition ).addIndex( new MavibotIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID, true ) );
+        ( ( Store ) MavibotPartition ).addIndex( new MavibotIndex<Long, Entry>(
+            ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID, true ) );
         assertNotNull( MavibotPartition.getOneAliasIndex() );
 
         assertNull( MavibotPartition.getSubAliasIndex() );
-        MavibotPartition.addIndex( new MavibotIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID, true ) );
+        MavibotPartition
+            .addIndex( new MavibotIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID, true ) );
         assertNotNull( MavibotPartition.getSubAliasIndex() );
 
         assertNull( MavibotPartition.getSuffixDn() );
@@ -774,7 +786,7 @@ public class MavibotStoreTest
 
 
     @Test
-    @Ignore( "Ignore till mavibot file nam extensions are frozen" )
+    @Ignore("Ignore till mavibot file nam extensions are frozen")
     public void testDeleteUnusedIndexFiles() throws Exception
     {
         File ouIndexDbFile = new File( wkdir, SchemaConstants.OU_AT_OID + ".db" );
@@ -792,7 +804,7 @@ public class MavibotStoreTest
         assertTrue( ouIndexDbFile.exists() );
         assertTrue( ouIndexTxtFile.exists() );
 
-        store = new MavibotPartition( schemaManager );
+        store = new MavibotPartition( schemaManager, dnFactory );
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java Fri Sep  6 13:27:59 2013
@@ -35,6 +35,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.ldif.LdifReader;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
@@ -62,9 +63,9 @@ public class ReadOnlyConfigurationPartit
      * @param schemaManager
      *      the schema manager
      */
-    public ReadOnlyConfigurationPartition( InputStream inputStream, SchemaManager schemaManager )
+    public ReadOnlyConfigurationPartition( InputStream inputStream, SchemaManager schemaManager, DnFactory dnFactory )
     {
-        super( schemaManager );
+        super( schemaManager, dnFactory );
         this.inputStream = inputStream;
         id = "config";
 
@@ -112,7 +113,7 @@ public class ReadOnlyConfigurationPartit
             if ( !itr.hasNext() )
             {
                 reader.close();
-                
+
                 return;
             }
 

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java (original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java Fri Sep  6 13:27:59 2013
@@ -37,7 +37,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.config.beans.ChangePasswordServerBean;
 import org.apache.directory.server.config.beans.ConfigBean;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -59,6 +62,7 @@ public class ChangePasswordConfigReaderT
     private static File workDir;
 
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
 
     @BeforeClass
@@ -95,6 +99,10 @@ public class ChangePasswordConfigReaderT
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors( errors ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -111,7 +119,7 @@ public class ChangePasswordConfigReaderT
         File configDir = new File( workDir, "changePasswordServer" ); // could be any directory, cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "changePasswordServer.ldif", true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffixDn( new Dn( "ou=config" ) );

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java (original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java Fri Sep  6 13:27:59 2013
@@ -37,7 +37,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.config.beans.ConfigBean;
 import org.apache.directory.server.config.beans.DirectoryServiceBean;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -56,6 +59,7 @@ import com.mycila.junit.concurrent.Concu
 public class ConfigPartitionReaderTest
 {
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
     private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work" );
 
@@ -93,6 +97,10 @@ public class ConfigPartitionReaderTest
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors( errors ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -103,7 +111,7 @@ public class ConfigPartitionReaderTest
 
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif", true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffixDn( new Dn( "ou=config" ) );

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java (original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java Fri Sep  6 13:27:59 2013
@@ -44,7 +44,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.config.beans.ConfigBean;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -63,6 +66,7 @@ import com.mycila.junit.concurrent.Concu
 public class ConfigWriterTest
 {
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
     private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work" );
 
@@ -99,6 +103,10 @@ public class ConfigWriterTest
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors( errors ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -110,7 +118,7 @@ public class ConfigWriterTest
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif", true );
 
         // Creating of the config partition
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffixDn( new Dn( "ou=config" ) );

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java (original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java Fri Sep  6 13:27:59 2013
@@ -37,7 +37,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.config.beans.ConfigBean;
 import org.apache.directory.server.config.beans.HttpServerBean;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -56,6 +59,7 @@ import com.mycila.junit.concurrent.Concu
 public class HttpServerConfigReaderTest
 {
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
     private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work" );
 
@@ -92,6 +96,10 @@ public class HttpServerConfigReaderTest
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors( errors ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -101,7 +109,7 @@ public class HttpServerConfigReaderTest
         File configDir = new File( workDir, "httpServer" ); // could be any directory, cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "httpServer.ldif", true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffixDn( new Dn( "ou=config" ) );

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java (original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java Fri Sep  6 13:27:59 2013
@@ -37,7 +37,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.config.beans.ConfigBean;
 import org.apache.directory.server.config.beans.KdcServerBean;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,6 +61,7 @@ public class KerberosServerConfigReaderT
     private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work" );
 
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
 
     @BeforeClass
@@ -93,6 +97,10 @@ public class KerberosServerConfigReaderT
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors( errors ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -102,7 +110,7 @@ public class KerberosServerConfigReaderT
         File configDir = new File( workDir, "kerberosServer" ); // could be any directory, cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "kerberosServer.ldif", true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffixDn( new Dn( "ou=config" ) );

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java (original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java Fri Sep  6 13:27:59 2013
@@ -37,7 +37,10 @@ import org.apache.directory.api.ldap.sch
 import org.apache.directory.api.util.exception.Exceptions;
 import org.apache.directory.server.config.beans.ConfigBean;
 import org.apache.directory.server.config.beans.LdapServerBean;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,6 +61,7 @@ public class LdapServerConfigReaderTest
     private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work" );
 
     private static SchemaManager schemaManager;
+    private static DnFactory dnFactory;
 
 
     @BeforeClass
@@ -93,6 +97,10 @@ public class LdapServerConfigReaderTest
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors( errors ) );
         }
+
+        CacheService cacheService = new CacheService();
+        cacheService.initialize( null );
+        dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
     }
 
 
@@ -102,7 +110,7 @@ public class LdapServerConfigReaderTest
         File configDir = new File( workDir, "ldapServer" ); // could be any directory, cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ldapServer.ldif", true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager );
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( schemaManager, dnFactory );
         configPartition.setId( "config" );
         configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffixDn( new Dn( "ou=config" ) );

Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Fri Sep  6 13:27:59 2013
@@ -495,7 +495,7 @@ public class ApacheDS
         directoryService.setSchemaManager( schemaManager );
 
         // Init the LdifPartition
-        LdifPartition ldifPartition = new LdifPartition( schemaManager );
+        LdifPartition ldifPartition = new LdifPartition( schemaManager, directoryService.getDnFactory() );
         ldifPartition.setPartitionPath( new File( workingDirectory, "schema" ).toURI() );
 
         schemaPartition.setWrappedPartition( ldifPartition );

Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java?rev=1520568&r1=1520567&r2=1520568&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java (original)
+++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java Fri Sep  6 13:27:59 2013
@@ -267,31 +267,33 @@ public class ServiceBuilder
         passwordPolicy.setPwdMinLength( passwordPolicyBean.getPwdMinLength() );
         passwordPolicy.setPwdMustChange( passwordPolicyBean.isPwdMustChange() );
         passwordPolicy.setPwdSafeModify( passwordPolicyBean.isPwdSafeModify() );
-        
+
         PasswordValidator validator = null;
-        
+
         try
         {
-        	String className = passwordPolicyBean.getPwdValidator();
-        	
-        	if ( className != null )
-        	{
-        		Class<?> cls = Class.forName( className );
-        		validator = ( PasswordValidator ) cls.newInstance();
-        	}
+            String className = passwordPolicyBean.getPwdValidator();
+
+            if ( className != null )
+            {
+                Class<?> cls = Class.forName( className );
+                validator = ( PasswordValidator ) cls.newInstance();
+            }
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
-        	LOG.warn( "Failed to load and instantiate the custom password validator for password policy config {}, using the default validator", passwordPolicyBean.getDn(), e );
+            LOG.warn(
+                "Failed to load and instantiate the custom password validator for password policy config {}, using the default validator",
+                passwordPolicyBean.getDn(), e );
         }
-        
+
         if ( validator == null )
         {
-        	validator = new DefaultPasswordValidator();
+            validator = new DefaultPasswordValidator();
         }
-        	
-        passwordPolicy.setPwdValidator(validator);
-        
+
+        passwordPolicy.setPwdValidator( validator );
+
         return passwordPolicy;
     }
 
@@ -1275,7 +1277,8 @@ public class ServiceBuilder
             return null;
         }
 
-        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager() );
+        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager(),
+            directoryService.getDnFactory() );
 
         jdbmPartition.setCacheSize( jdbmPartitionBean.getPartitionCacheSize() );
         jdbmPartition.setId( jdbmPartitionBean.getPartitionId() );
@@ -1460,8 +1463,8 @@ public class ServiceBuilder
 
         return directoryService;
     }
-    
-    
+
+
     public static MavibotPartition createMavibotPartition( DirectoryService directoryService,
         MavibotPartitionBean mvbtPartitionBean ) throws ConfigurationException
     {
@@ -1470,7 +1473,8 @@ public class ServiceBuilder
             return null;
         }
 
-        MavibotPartition mvbtPartition = new MavibotPartition( directoryService.getSchemaManager() );
+        MavibotPartition mvbtPartition = new MavibotPartition( directoryService.getSchemaManager(),
+            directoryService.getDnFactory() );
 
         mvbtPartition.setId( mvbtPartitionBean.getPartitionId() );
         //mvbtPartition.setOptimizerEnabled( mvbtPartitionBean.isJdbmPartitionOptimizerEnabled() );
@@ -1497,8 +1501,8 @@ public class ServiceBuilder
 
         return mvbtPartition;
     }
- 
-    
+
+
     /**
      * Create the list of MavibotIndex from the configuration
      */
@@ -1519,7 +1523,7 @@ public class ServiceBuilder
         return indexes;
     }
 
-    
+
     /**
      * Create a new instance of a MavibotIndex from an instance of MavibotIndexBean
      * 
@@ -1555,7 +1559,7 @@ public class ServiceBuilder
         }
 
         index.setWkDirPath( partition.getPartitionPath() );
-        
+
         return index;
     }
 
@@ -1567,7 +1571,8 @@ public class ServiceBuilder
      * @param partition the partition instance
      * @throws ConfigurationException
      */
-    private static void setContextEntry(PartitionBean bean, AbstractPartition partition) throws ConfigurationException
+    private static void setContextEntry( PartitionBean bean, AbstractPartition partition )
+        throws ConfigurationException
     {
         String contextEntry = bean.getContextEntry();
 



Mime
View raw message