You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2013/09/06 17:35:42 UTC
svn commit: r1520607 - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/api/
core-api/src/test/java/org/apache/directory/server/core/api/
core/src/main/java/org/apache/directory/server/core/
service/src/main/java/or...
Author: elecharny
Date: Fri Sep 6 15:35:42 2013
New Revision: 1520607
URL: http://svn.apache.org/r1520607
Log:
o Added a setDnFactory() method in the DirectoryService interface, as we need to inject the DnFactory into the DS
o The DnFactory instance is nullified when the DS is shutdown so we can restart it with a brand new DnFactory
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java?rev=1520607&r1=1520606&r2=1520607&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java Fri Sep 6 15:35:42 2013
@@ -47,6 +47,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.subtree.SubentryCache;
import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
+
/**
* Provides JNDI service to {@link AbstractContextFactory}.
*
@@ -614,7 +615,13 @@ public interface DirectoryService extend
*/
DnFactory getDnFactory();
-
+
+ /**
+ * Sets the Dn factory.
+ */
+ void setDnFactory( DnFactory dnFactory );
+
+
/**
* Sets the CacheService
*
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java?rev=1520607&r1=1520606&r2=1520607&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java Fri Sep 6 15:35:42 2013
@@ -556,6 +556,14 @@ public class MockDirectoryService implem
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setDnFactory( DnFactory dnFactory )
+ {
+ }
+
+
public LdapApiService getLdapCodecService()
{
return null;
@@ -613,11 +621,12 @@ public class MockDirectoryService implem
// TODO Auto-generated method stub
}
+
/**
* {@inheritDoc}
*/
public void setCacheService( CacheService cacheService )
{
- // nothing
+ // nothing
}
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1520607&r1=1520606&r2=1520607&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Fri Sep 6 15:35:42 2013
@@ -51,7 +51,6 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.csn.Csn;
import org.apache.directory.api.ldap.model.csn.CsnFactory;
import org.apache.directory.api.ldap.model.cursor.Cursor;
-import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
@@ -1333,6 +1332,9 @@ public class DefaultDirectoryService imp
LOG.debug( "--- Deleting the cache service" );
cacheService.destroy();
+ LOG.debug( "---Deleting the DnCache" );
+ dnFactory = null;
+
if ( lockFile != null )
{
try
@@ -1801,7 +1803,10 @@ public class DefaultDirectoryService imp
subschemaAPCache = new DnNode<SubschemaAdministrativePoint>();
triggerExecutionAPCache = new DnNode<TriggerExecutionAdministrativePoint>();
- dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+ if ( dnFactory == null )
+ {
+ dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+ }
// triggers partition to load schema fully from schema partition
schemaPartition.setCacheService( cacheService );
@@ -2290,6 +2295,15 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
+ public void setDnFactory( DnFactory dnFactory )
+ {
+ this.dnFactory = dnFactory;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
public SubentryCache getSubentryCache()
{
return subentryCache;
Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1520607&r1=1520606&r2=1520607&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java (original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java Fri Sep 6 15:35:42 2013
@@ -165,9 +165,9 @@ public class ApacheDsService
CacheService cacheService = new CacheService();
cacheService.initialize( instanceLayout );
- DnFactory dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
initSchemaManager( instanceLayout );
+ DnFactory dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
initSchemaLdifPartition( instanceLayout, dnFactory );
initConfigPartition( instanceLayout, dnFactory, cacheService );
@@ -179,7 +179,8 @@ public class ApacheDsService
DirectoryServiceBean directoryServiceBean = configBean.getDirectoryServiceBean();
// Initialize the DirectoryService now
- DirectoryService directoryService = initDirectoryService( instanceLayout, directoryServiceBean, cacheService );
+ DirectoryService directoryService = initDirectoryService( instanceLayout, directoryServiceBean, cacheService,
+ dnFactory );
// start the LDAP server
startLdap( directoryServiceBean.getLdapServerBean(), directoryService );
@@ -295,7 +296,7 @@ public class ApacheDsService
private DirectoryService initDirectoryService( InstanceLayout instanceLayout,
- DirectoryServiceBean directoryServiceBean, CacheService cacheService ) throws Exception
+ DirectoryServiceBean directoryServiceBean, CacheService cacheService, DnFactory dnFactory ) throws Exception
{
LOG.info( "Initializing the DirectoryService..." );
@@ -304,6 +305,9 @@ public class ApacheDsService
DirectoryService directoryService = ServiceBuilder.createDirectoryService( directoryServiceBean,
instanceLayout, schemaManager );
+ // Inject the DnFactory
+ directoryService.setDnFactory( dnFactory );
+
// The schema partition
SchemaPartition schemaPartition = new SchemaPartition( schemaManager );
schemaPartition.setWrappedPartition( schemaLdifPartition );