You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/07/24 17:01:37 UTC
svn commit: r978882 - in
/directory/apacheds/branches/apacheds-cache-experiment:
core-api/src/main/java/org/apache/directory/server/core/cache/
core/src/main/java/org/apache/directory/server/core/authz/
Author: kayyagari
Date: Sat Jul 24 15:01:36 2010
New Revision: 978882
URL: http://svn.apache.org/viewvc?rev=978882&view=rev
Log:
o changed the CacheService to not handle the various ADS cache instances
(cause all such cache implementations cannot be moved to a single module e.x InmemoryReplayCache present in kerberos-shared)
o changed the way GroupCache is instantiated
Modified:
directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/CacheService.java
directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/GroupCache.java
directory/apacheds/branches/apacheds-cache-experiment/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Modified: directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/CacheService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/CacheService.java?rev=978882&r1=978881&r2=978882&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/CacheService.java (original)
+++ directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/CacheService.java Sat Jul 24 15:01:36 2010
@@ -49,12 +49,6 @@ public class CacheService
/** the ehcache cache manager */
private CacheManager cacheManager;
- /** directory service */
- private DirectoryService dirService;
-
- /** group cache */
- private GroupCache groupCache;
-
public CacheService()
{
@@ -81,40 +75,27 @@ public class CacheService
cacheManager = new CacheManager( configFile.getAbsolutePath() );
}
-
- this.dirService = dirService;
}
public void destroy()
{
- if( cacheManager.getStatus() == Status.STATUS_ALIVE )
+ if ( cacheManager.getStatus() == Status.STATUS_ALIVE )
{
LOG.info( "destroying the cache service" );
-
- groupCache = null;
-
+
cacheManager.removalAll();
-
+
cacheManager.shutdown();
}
}
- public GroupCache getGroupCache() throws LdapException
+ public Cache getCache( String name )
{
- if ( groupCache != null )
- {
- LOG.info( "returning the old group cache" );
- return groupCache;
- }
-
- Cache ehCache = cacheManager.getCache( "groupCache" );
- LOG.info( "creating a new group cache {}", ehCache.getStatus() );
-
- groupCache = new GroupCache( dirService.getAdminSession(), ehCache );
+ LOG.info( "fetching the cache named {}", name );
- return groupCache;
+ return cacheManager.getCache( name );
}
Modified: directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/GroupCache.java?rev=978882&r1=978881&r2=978882&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/GroupCache.java (original)
+++ directory/apacheds/branches/apacheds-cache-experiment/core-api/src/main/java/org/apache/directory/server/core/cache/GroupCache.java Sat Jul 24 15:01:36 2010
@@ -31,6 +31,7 @@ import net.sf.ehcache.Element;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -68,9 +69,6 @@ public class GroupCache
/** Speedup for logs */
private static final boolean IS_DEBUG = LOG.isDebugEnabled();
- /** String key for the DN of a group to a Set (HashSet) for the Strings of member DNs */
-// private final Map<String, Set<String>> groups = new HashMap<String, Set<String>>();
-
/** a handle on the partition nexus */
private final PartitionNexus nexus;
@@ -93,6 +91,7 @@ public class GroupCache
private static final Set<DN> EMPTY_GROUPS = new HashSet<DN>();
+ /** String key for the DN of a group to a Set (HashSet) for the Strings of member DNs */
private Cache ehCache;
/**
@@ -101,10 +100,10 @@ public class GroupCache
* @param directoryService the directory service core
* @throws LdapException if there are failures on initialization
*/
- protected GroupCache( CoreSession session, Cache ehCache ) throws LdapException
+ public GroupCache( DirectoryService dirService ) throws LdapException
{
- schemaManager = session.getDirectoryService().getSchemaManager();
- nexus = session.getDirectoryService().getPartitionNexus();
+ schemaManager = dirService.getSchemaManager();
+ nexus = dirService.getPartitionNexus();
OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
MEMBER_AT = schemaManager.getAttributeType( SchemaConstants.MEMBER_AT );
UNIQUE_MEMBER_AT = schemaManager.getAttributeType( SchemaConstants.UNIQUE_MEMBER_AT );
@@ -112,9 +111,9 @@ public class GroupCache
// stuff for dealing with the admin group
administratorsGroupDn = parseNormalized( ServerDNConstants.ADMINISTRATORS_GROUP_DN );
- this.ehCache = ehCache;
+ this.ehCache = dirService.getCacheService().getCache( "groupCache" );
- initialize( session );
+ initialize( dirService.getAdminSession() );
}
Modified: directory/apacheds/branches/apacheds-cache-experiment/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-cache-experiment/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=978882&r1=978881&r2=978882&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-cache-experiment/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-cache-experiment/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Sat Jul 24 15:01:36 2010
@@ -198,7 +198,7 @@ public class AciAuthorizationInterceptor
// Create the caches
tupleCache = new TupleCache( adminSession );
- groupCache = directoryService.getCacheService().getGroupCache();
+ groupCache = new GroupCache( directoryService );
// look up some constant information
OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );