elecharny closed pull request #9: Ehcache v3 update
URL: https://github.com/apache/directory-server/pull/9
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/archive/log4j.properties
b/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/archive/log4j.properties
index bf48987b91..ccf5dae341 100644
---
a/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/archive/log4j.properties
+++
b/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/archive/log4j.properties
@@ -38,6 +38,6 @@ log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}]
%p [%c] - %m%n
#log4j.logger.org.apache.directory.CURSOR_LOG=DEBUG
#log4j.logger.org.apache.directory.api=DEBUG
#log4j.logger.org.apache.directory.server=DEBUG
-#log4j.logger.net.sf.ehcache=DEBUG
+#log4j.logger.org.ehcache=DEBUG
#log4j.logger.org.apache.mina=DEBUG
diff --git
a/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/log4j.properties
b/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/log4j.properties
index 253dfbd4e1..28bad8b943 100644
---
a/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/log4j.properties
+++
b/benchmarks/installers-maven-plugin/target/classes/org/apache/directory/server/installers/log4j.properties
@@ -42,6 +42,6 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=WARN
log4j.logger.org.apache.directory.CURSOR_LOG=WARN
log4j.logger.org.apache.directory.api=WARN
log4j.logger.org.apache.directory.server=WARN
-log4j.logger.net.sf.ehcache=WARN
+log4j.logger.org.ehcache=WARN
log4j.logger.org.apache.mina=WARN
diff --git a/core-api/pom.xml b/core-api/pom.xml
index 1eabce9f45..24e2a8efa0 100644
--- a/core-api/pom.xml
+++ b/core-api/pom.xml
@@ -108,7 +108,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
@@ -176,8 +176,8 @@
org.apache.directory.server.core.api.subtree;version=${project.version}
</Export-Package>
<Import-Package>
- net.sf.ehcache;version=${ehcache.version},
- net.sf.ehcache.config;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
+ org.ehcache.config;version=${ehcache.version},
org.apache.commons.lang3;version=${commons.lang.version},
org.apache.directory.api.asn1.util;version=${org.apache.directory.api.version},
org.apache.directory.api.i18n;version=${org.apache.directory.api.version},
diff --git
a/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
b/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
index 7a30d317f9..90bd6b1b8a 100644
---
a/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
+++
b/core-api/src/main/java/org/apache/directory/server/core/api/CacheService.java
@@ -22,15 +22,16 @@
import java.io.File;
-import java.util.UUID;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.ConfigurationFactory;
-
-import org.apache.directory.api.util.FileUtils;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+
+import org.ehcache.Cache;
+import org.ehcache.Cache.Entry;
+import org.ehcache.CacheManager;
+import org.ehcache.Status;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.ehcache.xml.XmlConfiguration;
+import org.ehcache.xml.exceptions.XmlConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,11 +55,29 @@
private static final Logger LOG = LoggerFactory.getLogger(
CacheService.class );
/** the ehcache cache manager */
- private CacheManager cacheManager;
-
- /** A flag telling if the cache Service has been intialized */
- private boolean initialized;
-
+ private CacheManager cacheManager = null;
+
+ /**
+ * Utility method to dump the cache contents to a StringBuffer.
+ * This is needed because ehcache 3.x Cache objects only implements
Iterable
+ *
+ * @return a StringBuffer
+ */
+ public static final StringBuffer dumpCacheContentsToString( Cache< ?, ? >
cache )
+ {
+ Iterator<?> it = cache.iterator();
+ StringBuffer sb = new StringBuffer();
+ while ( it.hasNext() )
+ {
+ Cache.Entry< ?, ? > nextObj = ( Entry<?, ?> ) it.next();
+ sb.append( '\t' )
+ .append( nextObj.getKey().toString() )
+ .append( " -> " )
+ .append( nextObj.getValue().toString() )
+ .append( '\n' );
+ }
+ return sb;
+ }
/**
* Creates a new instance of CacheService.
@@ -67,7 +86,6 @@ public CacheService()
{
}
-
/**
* Creates a new instance of CacheService with the given cache manager.
*
@@ -76,11 +94,6 @@ public CacheService()
public CacheService( CacheManager cachemanager )
{
this.cacheManager = cachemanager;
-
- if ( cachemanager != null )
- {
- initialized = true;
- }
}
@@ -103,24 +116,17 @@ public void initialize( InstanceLayout layout )
*/
public void initialize( InstanceLayout layout, String instanceId )
{
- if ( initialized )
- {
- LOG.debug( "CacheService was already initialized, returning" );
- return;
- }
-
LOG.debug( "CacheService initialization, for instance {}", instanceId
);
- if ( ( cacheManager != null ) && ( cacheManager.getStatus() ==
Status.STATUS_ALIVE ) )
+ if ( ( cacheManager != null ) && ( cacheManager.getStatus() ==
Status.AVAILABLE ) )
{
- LOG.warn( "cache service was already initialized and is alive" );
- initialized = true;
+ LOG.warn( "cache service was already initialized and is available"
);
return;
}
- Configuration cc;
- String cachePath = null;
+ XmlConfiguration cc = null;
+ //String cachePath = null;
if ( layout != null )
{
@@ -129,41 +135,51 @@ public void initialize( InstanceLayout layout, String
instanceId )
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 ) );
+
+ cc = new XmlConfiguration( getClass( ).getClassLoader(
).getResource(
+ DIRECTORY_CACHESERVICE_XML ) );
+ //cc = ConfigurationFactory.parseConfiguration(
getClass().getClassLoader().getResource(
+ // DIRECTORY_CACHESERVICE_XML ) );
}
else
{
LOG.info( "loading cache configuration from the file {}",
configFile );
- cc = ConfigurationFactory.parseConfiguration( configFile );
+ try
+ {
+ cc = new XmlConfiguration( configFile.toURI( ).toURL( ) );
+ }
+ catch ( XmlConfigurationException | MalformedURLException e )
+ {
+ LOG.error( "exception loading cache configuration from the
file {}: {}", configFile, e.toString() );
+ }
+ //cc = ConfigurationFactory.parseConfiguration( configFile );
}
- cachePath = layout.getCacheDirectory().getAbsolutePath();
+ //cachePath = layout.getCacheDirectory().getAbsolutePath();
}
else
{
LOG.info( "no custom cache configuration was set, loading the
default cache configuration" );
- cc = ConfigurationFactory.parseConfiguration(
getClass().getClassLoader().getResource(
- DIRECTORY_CACHESERVICE_XML ) );
+ cc = new XmlConfiguration( getClass( ).getClassLoader(
).getResource(
+ DIRECTORY_CACHESERVICE_XML ) );
- cachePath = FileUtils.getTempDirectoryPath();
+ //cachePath = FileUtils.getTempDirectoryPath();
}
- String confName = UUID.randomUUID().toString();
- cc.setName( confName );
+ //String confName = UUID.randomUUID().toString();
+ //cc.setName( confName );
- if ( cachePath == null )
- {
- cachePath = FileUtils.getTempDirectoryPath();
- }
+ //if ( cachePath == null )
+ //{
+ // cachePath = FileUtils.getTempDirectoryPath();
+ //}
- cachePath += File.separator + confName;
- cc.getDiskStoreConfiguration().setPath( cachePath );
+ //cachePath += File.separator + confName;
+ //cc.getDiskStoreConfiguration().setPath( cachePath );
- cacheManager = new CacheManager( cc );
-
- initialized = true;
+ cacheManager = CacheManagerBuilder.newCacheManager( cc );
+ cacheManager.init();
}
@@ -172,17 +188,17 @@ public void initialize( InstanceLayout layout, String
instanceId )
*/
public void destroy()
{
- if ( !initialized )
+ if ( cacheManager == null )
{
return;
}
LOG.info( "clearing all the caches" );
- initialized = false;
-
- cacheManager.clearAll();
- cacheManager.shutdown();
+ cacheManager.close();
+ cacheManager = null;
+ //cacheManager.clearAll();
+ //cacheManager.shutdown();
}
@@ -192,9 +208,9 @@ public void destroy()
* @param name The Cache name we want to retreive
* @return The found cache. If we don't find it, we create a new one.
*/
- public Cache getCache( String name )
+ public <K, V> Cache<K, V> getCache( String name, Class<K> keyClazz,
Class<V> valueClazz )
{
- if ( !initialized )
+ if ( cacheManager == null )
{
LOG.error( "Cannot fetch the cache named {}, the CacheServcie is
not initialized", name );
throw new IllegalStateException( "CacheService was not
initialized" );
@@ -202,14 +218,7 @@ public Cache getCache( String name )
LOG.info( "fetching the cache named {}", name );
- Cache cache = cacheManager.getCache( name );
-
- if ( cache == null )
- {
- LOG.info( "No cache with name {} exists, creating one", name );
- cacheManager.addCache( name );
- cache = cacheManager.getCache( name );
- }
+ Cache<K, V> cache = cacheManager.getCache( name, keyClazz, valueClazz
);
return cache;
}
@@ -222,15 +231,8 @@ public Cache getCache( String name )
*/
public void remove( String name )
{
- if ( cacheManager.cacheExists( name ) )
- {
- LOG.info( "Removing the cache named {}", name );
+ LOG.info( "Removing the cache named {}", name );
- cacheManager.removeCache( name );
- }
- else
- {
- LOG.info( "Cannot removing the cache named {}, it does not exist",
name );
- }
+ cacheManager.removeCache( name );
}
}
diff --git a/core-api/src/main/resources/directory-cacheservice.xml
b/core-api/src/main/resources/directory-cacheservice.xml
index bd01a1ae67..c8f3ca3e91 100644
--- a/core-api/src/main/resources/directory-cacheservice.xml
+++ b/core-api/src/main/resources/directory-cacheservice.xml
@@ -17,12 +17,11 @@
specific language governing permissions and limitations
under the License.
-->
-<ehcache name="apacheds" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false"
- monitoring="autodetect" dynamicConfig="true">
-
- <diskStore path="java.io.tmpdir" />
-
+<config xmlns="http://www.ehcache.org/v3"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.ehcache.org/v3
http://www.ehcache.org/schema/ehcache-core-3.6.xsd"
+>
+
<!--
Cache configuration
===================
@@ -88,15 +87,7 @@
First In First Out (specified as FIFO) and Less Frequently Used
(specified as LFU)
-->
- <!-- Mandatory Default Cache configuration. These settings will be
applied
- to caches created programmtically using CacheManager.add(String
cacheName).
- The defaultCache has an implicit name "default" which is a
reserved cache
- name. -->
-
- <defaultCache maxElementsInMemory="1" eternal="false"
- overflowToDisk="false" timeToIdleSeconds="1200"
timeToLiveSeconds="1200">
- </defaultCache>
-
+
<!-- Sample cache named sampleCache1 This cache contains a maximum in
memory
of 10000 elements, and will expire an element if it is idle for
more than
5 minutes and lives for more than 10 minutes. If there are more
than 10000
@@ -109,24 +100,53 @@
we need to retain this info forever available in the cache
as long as the server is running, so hinting the cache to store
on disk is needed to swap the data if it is too much to hold in
memory -->
- <cache name="groupCache"
- maxElementsInMemory="10000"
+ <cache alias="groupCache">
+ <key-type>java.lang.String</key-type>
+ <value-type>java.util.Set</value-type>
+
+ <expiry>
+ <ttl unit="seconds">1200</ttl>
+ </expiry>
+
+ <heap>10000</heap>
+
+ <heap-store-settings>
+ <max-object-size>10000</max-object-size>
+ </heap-store-settings>
+
+<!-- unmigrated 2.x settings
eternal="true"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
memoryStoreEvictionPolicy="LFU"
- diskPersistent="false" />
+ diskPersistent="false" /
+-->
+ </cache>
+
+ <cache alias="dnCache">
+ <key-type>java.lang.String</key-type>
+
<value-type>org.apache.directory.api.ldap.model.name.Dn</value-type>
- <cache name="dnCache"
- maxElementsInMemory="10000"
+ <expiry>
+ <ttl unit="seconds">600</ttl>
+ </expiry>
+
+ <heap>10000</heap>
+
+ <heap-store-settings>
+ <max-object-size>10000</max-object-size>
+ </heap-store-settings>
+
+<!-- unmigrated 2.x settings
eternal="false"
overflowToDisk="false"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="300"
- timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
diskPersistent="false" />
-
+ -->
+ </cache>
+
<!-- Kerberos replay cache
NOTE1: keep the maxElementsInMemory as low as possible to avoid wasting
memory
Cause the elements present in the cache won't be removed dynamically
even after their TTL
@@ -139,50 +159,130 @@
So what we do here is enable the overflowToDisk flag and then let the
disk store be cleaned
periodically based on diskExpiryThreadIntervalSeconds
-->
- <cache name="kdcReplayCache"
- maxElementsInMemory="100"
+ <cache alias="kdcReplayCache">
+ <key-type>java.lang.String</key-type>
+
+ <expiry>
+ <ttl unit="seconds">600</ttl>
+ </expiry>
+
+ <heap>100</heap>
+
+ <heap-store-settings>
+ <max-object-size>100</max-object-size>
+ </heap-store-settings>
+
+<!-- unmigrated 2.x settings
eternal="false"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
diskExpiryThreadIntervalSeconds="300"
- timeToLiveSeconds="300"
timeToIdleSeconds="300"
- diskPersistent="false" />
+ diskPersistent="false"
+-->
+ </cache>
<!-- ChangePassword replay cache, this has the same settings as the
Kerberos replay cache -->
- <cache name="changePwdReplayCache"
- maxElementsInMemory="100"
+ <cache alias="changePwdReplayCache">
+ <key-type>java.lang.String</key-type>
+
+ <expiry>
+ <ttl unit="seconds">600</ttl>
+ </expiry>
+
+ <heap>100</heap>
+
+ <heap-store-settings>
+ <max-object-size>100</max-object-size>
+ </heap-store-settings>
+
+<!-- unmigrated 2.x settings
eternal="false"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
diskExpiryThreadIntervalSeconds="300"
- timeToLiveSeconds="300"
timeToIdleSeconds="300"
diskPersistent="false" />
-
+-->
+ </cache>
+
<!-- partition caches
the name format:
name="{partition-suffix}" for partition
name="{partition-suffix}:{index name/OID}" for each
partition's index (currently only RDN index supports cache)
-->
- <cache name="ou=system"
- maxElementsInMemory="1000"
+
+ <cache alias="ou=system">
+ <key-type>java.lang.String</key-type>
+
+ <expiry>
+ <ttl unit="seconds">600</ttl>
+ </expiry>
+
+ <heap>1000</heap>
+
+ <heap-store-settings>
+ <max-object-size>1000</max-object-size>
+ </heap-store-settings>
+
+<!-- unmigrated 2.x settings
eternal="false"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="300"
- timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
diskPersistent="false"/>
+-->
+ </cache>
- <cache name="ou=system:apacheRdn"
- maxElementsInMemory="10000"
+ <cache alias="ou=system:apacheRdn">
+ <key-type>java.lang.String</key-type>
+ <expiry>
+ <ttl unit="seconds">600</ttl>
+ </expiry>
+
+ <heap>10000</heap>
+
+ <heap-store-settings>
+ <max-object-size>10000</max-object-size>
+ </heap-store-settings>
+<!-- unmigrated 2.x settings
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="300"
- timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
diskPersistent="false"/>
+-->
+ </cache>
+
+ <cache alias="alias">
+ <key-type>java.lang.String</key-type>
+
<value-type>org.apache.directory.api.ldap.model.name.Dn</value-type>
+
+ <expiry>
+ <ttl unit="seconds">1200</ttl>
+ </expiry>
+
+ <heap>1000</heap>
+
+ <heap-store-settings>
+ <max-object-size>1000</max-object-size>
+ </heap-store-settings>
+ </cache>
+
+ <cache alias="entryDn">
+ <key-type>java.lang.String</key-type>
+
<value-type>org.apache.directory.api.ldap.model.name.Dn</value-type>
+
+ <expiry>
+ <ttl unit="seconds">1200</ttl>
+ </expiry>
+
+ <heap>1000</heap>
+
+ <heap-store-settings>
+ <max-object-size>1000</max-object-size>
+ </heap-store-settings>
+ </cache>
-
-</ehcache>
\ No newline at end of file
+</config>
\ No newline at end of file
diff --git a/core-integ/src/test/resources/log4j.properties
b/core-integ/src/test/resources/log4j.properties
index 5d3dd4c055..60555c61cb 100644
--- a/core-integ/src/test/resources/log4j.properties
+++ b/core-integ/src/test/resources/log4j.properties
@@ -38,7 +38,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
log4j.logger.org.apache.directory.api=FATAL
log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
log4j.logger.org.apache.mina=FATAL
log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
log4j.logger.org.apache.directory.api.ldap.model.ldif=FATAL
diff --git a/core-shared/pom.xml b/core-shared/pom.xml
index 9e8c303f53..7d1ca28921 100644
--- a/core-shared/pom.xml
+++ b/core-shared/pom.xml
@@ -78,7 +78,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
@@ -147,7 +147,7 @@
jdbm.btree,
jdbm.helper,
jdbm.recman,
- net.sf.ehcache;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
org.apache.directory.api.ldap.codec.api;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.extras.controls.syncrepl.syncState;version=${org.apache.directory.api.version},
diff --git
a/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
b/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
index 606e409c16..9ff17c0712 100644
---
a/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
+++
b/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultDnFactory.java
@@ -21,8 +21,7 @@
package org.apache.directory.server.core.shared;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
+import org.ehcache.Cache;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.name.Dn;
@@ -42,7 +41,7 @@
private static final Logger LOG = LoggerFactory.getLogger(
DefaultDnFactory.class );
/** The cache for DNs */
- private Cache dnCache;
+ private Cache<String, Dn> dnCache;
/** The schema manager */
private SchemaManager schemaManager;
@@ -61,7 +60,7 @@
* @param schemaManager The SchemaManager instance
* @param dnCache The cache used to store DNs
*/
- public DefaultDnFactory( SchemaManager schemaManager, Cache dnCache )
+ public DefaultDnFactory( SchemaManager schemaManager, Cache< String, Dn >
dnCache )
{
this.schemaManager = schemaManager;
this.dnCache = dnCache;
@@ -90,12 +89,7 @@ public Dn create( String dn ) throws LdapInvalidDnException
// for the reason for performing this check
if ( dnCache != null )
{
- Element dnCacheEntry = dnCache.get( dn );
-
- if ( dnCacheEntry != null )
- {
- cachedDn = ( Dn ) dnCacheEntry.getObjectValue();
- }
+ cachedDn = dnCache.get( dn );
}
if ( cachedDn == null )
@@ -106,7 +100,7 @@ public Dn create( String dn ) throws LdapInvalidDnException
if ( dnCache != null )
{
- dnCache.put( new Element( dn, cachedDn ) );
+ dnCache.put( dn, cachedDn );
}
if ( enableStats )
diff --git
a/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
b/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
index 7ded3e7f96..5481c044bf 100644
---
a/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
+++
b/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
@@ -203,7 +203,7 @@
private static final long DEFAULT_SYNC_PERIOD = 15000;
/** */
- private Thread workerThread;
+ //private Thread workerThread;
/** The default timeLimit : 100 entries */
public static final int MAX_SIZE_LIMIT_DEFAULT = 100;
@@ -1966,7 +1966,7 @@ private void initialize() throws LdapException
if ( dnFactory == null )
{
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
// triggers partition to load schema fully from schema partition
diff --git
a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
index bf48987b91..ccf5dae341 100644
---
a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
+++
b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/log4j.properties
@@ -38,6 +38,6 @@ log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}]
%p [%c] - %m%n
#log4j.logger.org.apache.directory.CURSOR_LOG=DEBUG
#log4j.logger.org.apache.directory.api=DEBUG
#log4j.logger.org.apache.directory.server=DEBUG
-#log4j.logger.net.sf.ehcache=DEBUG
+#log4j.logger.org.ehcache=DEBUG
#log4j.logger.org.apache.mina=DEBUG
diff --git
a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
index 253dfbd4e1..28bad8b943 100644
---
a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
+++
b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
@@ -42,6 +42,6 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=WARN
log4j.logger.org.apache.directory.CURSOR_LOG=WARN
log4j.logger.org.apache.directory.api=WARN
log4j.logger.org.apache.directory.server=WARN
-log4j.logger.net.sf.ehcache=WARN
+log4j.logger.org.ehcache=WARN
log4j.logger.org.apache.mina=WARN
diff --git a/interceptors/authz/pom.xml b/interceptors/authz/pom.xml
index fd060b9b9b..48fd89353a 100644
--- a/interceptors/authz/pom.xml
+++ b/interceptors/authz/pom.xml
@@ -73,7 +73,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
</dependencies>
@@ -130,7 +130,7 @@
</Export-Package>
<Import-Package>
javax.naming.directory,
- net.sf.ehcache;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
org.apache.directory.api.ldap.aci;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.aci.protectedItem;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
diff --git
a/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
b/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
index 1564c72599..f235366dec 100644
---
a/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
+++
b/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
@@ -21,13 +21,13 @@
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.naming.directory.SearchControls;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
+import org.ehcache.Cache;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
@@ -45,6 +45,7 @@
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.server.constants.ServerDNConstants;
+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;
@@ -93,7 +94,8 @@
private static final Set<String> EMPTY_GROUPS = new HashSet<>();
/** String key for the Dn of a group to a Set (HashSet) for the Strings of
member DNs */
- private Cache groupCache;
+ @SuppressWarnings("rawtypes")
+ private Cache< String, Set > groupCache;
@@ -113,7 +115,7 @@ public GroupCache( DirectoryService dirService ) throws
LdapException
// stuff for dealing with the admin group
administratorsGroupDn = parseNormalized(
ServerDNConstants.ADMINISTRATORS_GROUP_DN );
- groupCache = dirService.getCacheService().getCache( "groupCache" );
+ groupCache = dirService.getCacheService().getCache( "groupCache",
String.class, Set.class );
initialize( dirService.getAdminSession() );
}
@@ -178,8 +180,7 @@ private void initialize( CoreSession session ) throws
LdapException
Set<String> memberSet = new HashSet<>( members.size()
);
addMembers( memberSet, members );
- Element cacheElement = new Element(
groupDn.getNormName(), memberSet );
- groupCache.put( cacheElement );
+ groupCache.put( groupDn.getNormName(), memberSet );
}
else
{
@@ -200,7 +201,7 @@ private void initialize( CoreSession session ) throws
LdapException
if ( IS_DEBUG )
{
- LOG.debug( "group cache contents on startup:\n {}",
groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+ LOG.debug( "group cache contents on startup:\n {}",
CacheService.dumpCacheContentsToString( groupCache ) );
}
}
@@ -313,13 +314,12 @@ public void groupAdded( String name, Entry entry ) throws
LdapException
Set<String> memberSet = new HashSet<>( members.size() );
addMembers( memberSet, members );
- Element cacheElement = new Element( name, memberSet );
- groupCache.put( cacheElement );
+ groupCache.put( name, memberSet );
if ( IS_DEBUG )
{
LOG.debug( "group cache contents after adding '{}' :\n {}", name,
- groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+ CacheService.dumpCacheContentsToString( groupCache ) );
}
}
@@ -346,7 +346,7 @@ public void groupDeleted( Dn name, Entry entry ) throws
LdapException
if ( IS_DEBUG )
{
LOG.debug( "group cache contents after deleting '{}' :\n {}",
name.getName(),
- groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+ CacheService.dumpCacheContentsToString( groupCache ) );
}
}
@@ -427,11 +427,11 @@ public void groupModified( Dn name, List<Modification>
mods, Entry entry, Schema
{
if ( memberAttr.getOid() == modification.getAttribute().getId() )
{
- Element memSetElement = groupCache.get( name.getNormName() );
+ @SuppressWarnings("unchecked")
+ Set<String> memberSet = groupCache.get( name.getNormName() );
- if ( memSetElement != null )
+ if ( memberSet != null )
{
- Set<String> memberSet = ( Set<String> )
memSetElement.getObjectValue();
modify( memberSet, modification.getOperation(),
modification.getAttribute() );
}
@@ -442,7 +442,7 @@ public void groupModified( Dn name, List<Modification>
mods, Entry entry, Schema
if ( IS_DEBUG )
{
LOG.debug( "group cache contents after modifying '{}' :\n {}",
name.getName(),
- groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+ CacheService.dumpCacheContentsToString( groupCache ) );
}
}
@@ -465,18 +465,18 @@ public void groupModified( Dn name, ModificationOperation
modOp, Entry mods ) th
return;
}
- Element memSetElement = groupCache.get( name.getNormName() );
+ @SuppressWarnings("unchecked")
+ Set<String> memberSet = groupCache.get( name.getNormName() );
- if ( memSetElement != null )
+ if ( memberSet != null )
{
- Set<String> memberSet = ( Set<String> )
memSetElement.getObjectValue();
modify( memberSet, modOp, members );
}
if ( IS_DEBUG )
{
LOG.debug( "group cache contents after modifying '{}' :\n {}",
name.getName(),
- groupCache.getAllWithLoader( groupCache.getKeys(), null ) );
+ CacheService.dumpCacheContentsToString( groupCache ) );
}
}
@@ -495,17 +495,16 @@ public final boolean isPrincipalAnAdministrator( String
principalDn )
return true;
}
- Element cacheElement = groupCache.get(
administratorsGroupDn.getNormName() );
+ @SuppressWarnings("unchecked")
+ Set<String> members = groupCache.get(
administratorsGroupDn.getNormName() );
- if ( cacheElement == null )
+ if ( members == null )
{
LOG.warn( "What do you mean there is no administrators group? This
is bad news." );
return false;
}
else
{
- Set<String> members = ( Set<String> )
cacheElement.getObjectValue();
-
return members.contains( principalDn );
}
}
@@ -523,17 +522,15 @@ public final boolean isPrincipalAnAdministrator( String
principalDn )
{
Set<String> memberGroups = null;
- for ( Object obj : groupCache.getKeys() )
+ @SuppressWarnings("rawtypes")
+ Iterator<Cache.Entry<String, Set>> iterator = groupCache.iterator();
+ while ( iterator.hasNext() )
{
- String group = ( String ) obj;
- Element element = groupCache.get( group );
-
- if ( element == null )
- {
- continue;
- }
-
- Set<String> members = ( Set<String> ) element.getObjectValue();
+ @SuppressWarnings("rawtypes")
+ Cache.Entry<String, Set> next = iterator.next();
+ String group = next.getKey();
+ @SuppressWarnings("unchecked")
+ Set<String> members = next.getValue();
if ( members == null )
{
@@ -562,21 +559,19 @@ public final boolean isPrincipalAnAdministrator( String
principalDn )
public boolean groupRenamed( Dn oldName, Dn newName )
{
- Element membersElement = groupCache.get( oldName.getNormName() );
+ @SuppressWarnings("unchecked")
+ Set<String> members = groupCache.get( oldName.getNormName() );
- if ( membersElement != null )
+ if ( members != null )
{
- Set<String> members = ( Set<String> )
membersElement.getObjectValue();
-
groupCache.remove( oldName.getNormName() );
- Element cacheElement = new Element( newName, members );
- groupCache.put( cacheElement );
+ groupCache.put( newName.getNormName(), members );
if ( IS_DEBUG )
{
LOG.debug( "group cache contents after renaming '{}' :\n{}",
oldName.getName(),
- groupCache.getAllWithLoader( groupCache.getKeys(), null )
);
+ CacheService.dumpCacheContentsToString( groupCache ) );
}
return true;
diff --git a/interceptors/hash/pom.xml b/interceptors/hash/pom.xml
index 802b1528aa..78e494baa1 100644
--- a/interceptors/hash/pom.xml
+++ b/interceptors/hash/pom.xml
@@ -126,7 +126,7 @@
</dependency-->
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
diff --git a/interceptors/logger/pom.xml b/interceptors/logger/pom.xml
index cf881f9bd4..538233a7cc 100644
--- a/interceptors/logger/pom.xml
+++ b/interceptors/logger/pom.xml
@@ -111,7 +111,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
diff --git a/interceptors/subtree/pom.xml b/interceptors/subtree/pom.xml
index 18a418b0db..fce3e2b56b 100644
--- a/interceptors/subtree/pom.xml
+++ b/interceptors/subtree/pom.xml
@@ -78,7 +78,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
</dependencies>
diff --git
a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
index 613f630c41..6ba6bf80fa 100644
---
a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
+++
b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
@@ -28,9 +28,6 @@
import java.util.HashSet;
import java.util.Set;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.filter.ExprNode;
@@ -49,6 +46,11 @@
import
org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
import org.apache.directory.server.core.shared.DefaultDnFactory;
+import org.ehcache.Cache;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -72,6 +74,7 @@
private static SubtreeEvaluator evaluator;
private static FilterNormalizingVisitor visitor;
private static ConcreteNameComponentNormalizer ncn;
+ private static Cache<String, Dn> dnCache;
@BeforeClass
@@ -99,8 +102,9 @@ public static void init() throws Exception
fail( "Schema load failed : " + Exceptions.printErrors(
schemaManager.getErrors() ) );
}
- CacheManager.getInstance().addCacheIfAbsent( "dnCache" );
- Cache dnCache = CacheManager.getInstance().getCache( "dnCache" );
+ CacheManager cm =
CacheManagerBuilder.newCacheManagerBuilder().withCache( "dnCache",
CacheConfigurationBuilder.newCacheConfigurationBuilder( String.class, Dn.class,
ResourcePoolsBuilder.heap(1000)).build()).build();
+ cm.init();
+ dnCache = cm.getCache( "dnCache", String.class, Dn.class );
dnFactory = new DefaultDnFactory( schemaManager, dnCache );
ncn = new ConcreteNameComponentNormalizer( schemaManager );
@@ -115,7 +119,7 @@ public static void destroyTest()
{
visitor = null;
evaluator = null;
- CacheManager.getInstance().getCache( "dnCache" ).removeAll();
+ dnCache.clear();
}
diff --git a/jdbm-partition/pom.xml b/jdbm-partition/pom.xml
index 737c3ac573..25ec529e36 100644
--- a/jdbm-partition/pom.xml
+++ b/jdbm-partition/pom.xml
@@ -150,8 +150,8 @@
jdbm.btree,
jdbm.helper,
jdbm.recman,
- net.sf.ehcache;version=${ehcache.version},
- net.sf.ehcache.config;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
+ org.ehcache.config;version=${ehcache.version},
org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.csn;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.cursor;version=${org.apache.directory.api.version},
diff --git
a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
index f0e941841e..26533c7a2b 100644
---
a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
+++
b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
@@ -29,14 +29,6 @@
import java.util.List;
import java.util.UUID;
-import jdbm.RecordManager;
-import jdbm.helper.MRU;
-import jdbm.recman.BaseRecordManager;
-import jdbm.recman.CacheRecordManager;
-import jdbm.recman.TransactionManager;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.csn.CsnFactory;
import org.apache.directory.api.ldap.model.cursor.Cursor;
@@ -78,9 +70,16 @@
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.ehcache.Cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import jdbm.RecordManager;
+import jdbm.helper.MRU;
+import jdbm.recman.BaseRecordManager;
+import jdbm.recman.CacheRecordManager;
+import jdbm.recman.TransactionManager;
+
/**
* A {@link Partition} that stores entries in
@@ -109,7 +108,7 @@ public boolean accept( File dir, String name )
private RecordManager recMan;
/** the entry cache */
- private Cache entryCache;
+ private Cache< String, Entry > entryCache;
/**
@@ -536,14 +535,14 @@ protected void doInit() throws LdapException
if ( cacheService != null )
{
- entryCache = cacheService.getCache( getId() );
+ entryCache = cacheService.getCache( getId(), String.class,
Entry.class );
- int cacheSizeConfig = ( int )
entryCache.getCacheConfiguration().getMaxEntriesLocalHeap();
+ //int cacheSizeConfig = ( int )
entryCache.getCacheConfiguration().getMaxEntriesLocalHeap();
- if ( cacheSizeConfig < cacheSize )
- {
- entryCache.getCacheConfiguration().setMaxEntriesLocalHeap(
cacheSize );
- }
+ //if ( cacheSizeConfig < cacheSize )
+ //{
+ //
entryCache.getCacheConfiguration().setMaxEntriesLocalHeap( cacheSize );
+ //}
}
// Initialization of the context entry
@@ -885,7 +884,7 @@ protected synchronized void doDestroy( PartitionTxn
partitionTxn ) throws LdapEx
{
if ( entryCache != null )
{
- entryCache.removeAll();
+ entryCache.clear();
}
}
@@ -952,14 +951,14 @@ public void updateCache( OperationContext opCtx )
entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
}
- entryCache.replace( new Element( id, entry ) );
+ entryCache.replace( id, entry );
}
else if ( ( opCtx instanceof MoveOperationContext )
|| ( opCtx instanceof MoveAndRenameOperationContext )
|| ( opCtx instanceof RenameOperationContext ) )
{
// clear the cache it is not worth updating all the children
- entryCache.removeAll();
+ entryCache.clear();
}
else if ( opCtx instanceof DeleteOperationContext )
{
@@ -978,19 +977,7 @@ else if ( opCtx instanceof DeleteOperationContext )
@Override
public Entry lookupCache( String id )
{
- if ( entryCache == null )
- {
- return null;
- }
-
- Element el = entryCache.get( id );
-
- if ( el != null )
- {
- return ( Entry ) el.getObjectValue();
- }
-
- return null;
+ return ( entryCache != null ) ? entryCache.get( id ) : null;
}
@@ -1009,7 +996,7 @@ public void addToCache( String id, Entry entry )
addedEntry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
}
- entryCache.put( new Element( id, addedEntry ) );
+ entryCache.put( id, addedEntry );
}
diff --git
a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
index 87021a5325..a2d80f473f 100644
---
a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
+++
b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
@@ -154,7 +154,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
index ef0407bdc5..65404a563d 100644
---
a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
+++
b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
@@ -86,7 +86,7 @@ public static void init() throws Exception
CacheService cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git a/kerberos-codec/pom.xml b/kerberos-codec/pom.xml
index 8599ba4515..04ffc00ea8 100644
--- a/kerberos-codec/pom.xml
+++ b/kerberos-codec/pom.xml
@@ -69,7 +69,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
</dependencies>
@@ -134,8 +134,8 @@
javax.crypto,
javax.crypto.spec,
javax.security.auth.kerberos,
- net.sf.ehcache;version=${ehcache.version},
- net.sf.ehcache.store;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
+ org.ehcache.store;version=${ehcache.version},
org.apache.directory.api.asn1;version=${org.apache.directory.api.version},
org.apache.directory.api.asn1.actions;version=${org.apache.directory.api.version},
org.apache.directory.api.asn1.ber;version=${org.apache.directory.api.version},
diff --git
a/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
b/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
index a4c4c596da..e835389848 100644
---
a/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
+++
b/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImpl.java
@@ -24,12 +24,8 @@
import javax.security.auth.kerberos.KerberosPrincipal;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.store.AbstractPolicy;
-
import org.apache.directory.shared.kerberos.KerberosTime;
+import org.ehcache.Cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +45,7 @@
private static final Logger LOG = LoggerFactory.getLogger(
ReplayCacheImpl.class );
/** ehcache based storage to store the entries */
- private Cache cache;
+ private Cache< String, Object > cache;
/** default clock skew */
private static final long DEFAULT_CLOCK_SKEW = 5L * KerberosTime.MINUTE;
@@ -140,41 +136,41 @@ private String createKey()
}
}
- /**
- * an expiration policy based on the clockskew
- */
- private class ClockskewExpirationPolicy extends AbstractPolicy
- {
+ ///**
+ // * an expiration policy based on the clockskew
+ // */
+ //private class ClockskewExpirationPolicy extends AbstractPolicy
+ //{
- /**
- * {@inheritDoc}
- */
- public String getName()
- {
- return "CLOCK-SKEW";
- }
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public String getName()
+ // {
+ // return "CLOCK-SKEW";
+ // }
- /**
- * {@inheritDoc}
- */
- public boolean compare( Element element1, Element element2 )
- {
- ReplayCacheEntry entry = ( ReplayCacheEntry )
element2.getObjectValue();
+ // /**
+ // * {@inheritDoc}
+ // */
+ // public boolean compare( Element element1, Element element2 )
+ // {
+ // ReplayCacheEntry entry = ( ReplayCacheEntry )
element2.getObjectValue();
- return entry.isOutsideClockSkew( clockSkew );
- }
- }
+ // return entry.isOutsideClockSkew( clockSkew );
+ // }
+ //}
/**
* Creates a new instance of InMemoryReplayCache. Sets the
* delay between each cleaning run to 5 seconds.
*/
- public ReplayCacheImpl( Cache cache )
+ public ReplayCacheImpl( Cache < String, Object > cache )
{
this.cache = cache;
- this.cache.setMemoryStoreEvictionPolicy( new
ClockskewExpirationPolicy() );
+ //this.cache.setMemoryStoreEvictionPolicy( new
ClockskewExpirationPolicy() );
}
@@ -185,11 +181,11 @@ public ReplayCacheImpl( Cache cache )
*
* @param clockSkew the allowed skew (milliseconds)
*/
- public ReplayCacheImpl( Cache cache, long clockSkew )
+ public ReplayCacheImpl( Cache< String, Object > cache, long clockSkew )
{
this.cache = cache;
this.clockSkew = clockSkew;
- this.cache.setMemoryStoreEvictionPolicy( new
ClockskewExpirationPolicy() );
+ //this.cache.setMemoryStoreEvictionPolicy( new
ClockskewExpirationPolicy() );
}
@@ -213,14 +209,14 @@ public synchronized boolean isReplay( KerberosPrincipal
serverPrincipal, Kerbero
ReplayCacheEntry entry = new ReplayCacheEntry( serverPrincipal,
clientPrincipal, clientTime, clientMicroSeconds );
- Element element = cache.get( entry.createKey() );
+ ReplayCacheEntry found = ( ReplayCacheEntry ) cache.get(
entry.createKey() );
- if ( element == null )
+ if ( found == null )
{
return false;
}
- entry = ( ReplayCacheEntry ) element.getObjectValue();
+ entry = found;
return serverPrincipal.equals( entry.serverPrincipal ) &&
clientTime.equals( entry.clientTime ) &&
@@ -237,8 +233,7 @@ public synchronized void save( KerberosPrincipal
serverPrincipal, KerberosPrinci
{
ReplayCacheEntry entry = new ReplayCacheEntry( serverPrincipal,
clientPrincipal, clientTime, clientMicroSeconds );
- Element element = new Element( entry.createKey(), entry );
- cache.put( element );
+ cache.put( entry.createKey(), entry );
}
@@ -248,8 +243,6 @@ public synchronized void save( KerberosPrincipal
serverPrincipal, KerberosPrinci
public void clear()
{
LOG.debug( "removing all the elements from cache" );
- if (cache.getStatus().equals(Status.STATUS_ALIVE)) {
- cache.removeAll();
- }
+ cache.clear();
}
}
diff --git
a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
index 33d6c2e388..4b56773949 100644
---
a/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
+++
b/kerberos-codec/src/test/java/org/apache/directory/server/kerberos/shared/replay/ReplayCacheImplTest.java
@@ -20,20 +20,29 @@
package org.apache.directory.server.kerberos.shared.replay;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import javax.security.auth.kerberos.KerberosPrincipal;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-
import org.apache.directory.junit.tools.MultiThreadedMultiInvoker;
+import
org.apache.directory.server.kerberos.shared.replay.ReplayCacheImpl.ReplayCacheEntry;
import org.apache.directory.shared.kerberos.KerberosTime;
import org.apache.directory.shared.kerberos.codec.types.PrincipalNameType;
+import org.ehcache.Cache;
+import org.ehcache.Cache.Entry;
+import org.ehcache.CacheManager;
+import org.ehcache.Status;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.ehcache.config.builders.ExpiryPolicyBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -70,14 +79,23 @@ public void testCacheSetting() throws Exception
{
long clockSkew = 1000; // 1 sec
- cacheManager = new CacheManager();
-
- cacheManager.addCache( "kdcReplayCache" );
- Cache ehCache = cacheManager.getCache( "kdcReplayCache" );
- ehCache.getCacheConfiguration().setMaxElementsInMemory( 4 );
- ehCache.getCacheConfiguration().setTimeToLiveSeconds( 1 );
- ehCache.getCacheConfiguration().setTimeToIdleSeconds( 1 );
-
ehCache.getCacheConfiguration().setDiskExpiryThreadIntervalSeconds( 1 );
+ cacheManager =
CacheManagerBuilder.newCacheManagerBuilder().build();
+ cacheManager.init();
+
+ Cache< String, Object > ehCache = cacheManager.createCache(
+ "kdcReplayCache",
+ CacheConfigurationBuilder.newCacheConfigurationBuilder(
+ String.class,
+ Object.class,
+ ResourcePoolsBuilder.heap(4)
+ )
+ .withExpiry(
+ ExpiryPolicyBuilder
+ .timeToIdleExpiration( Duration.ofMillis( 1000
) )
+ )
+ .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(
Duration.ofMillis( 1000 )))
+ );
+
//ehCache.getCacheConfiguration().setDiskExpiryThreadIntervalSeconds( 1 );
ReplayCacheImpl cache = new ReplayCacheImpl( ehCache, clockSkew );
@@ -96,7 +114,10 @@ public void testCacheSetting() throws Exception
i++;
}
- List<?> keys = ehCache.getKeys();
+ List<String> keys = new ArrayList<>();
+ Iterator<Entry<String, Object>> it = ehCache.iterator();
+ while (it.hasNext())
+ keys.add(it.next().getKey());
// We should have 4 entries
assertTrue( keys.size() != 0 );
@@ -105,18 +126,18 @@ public void testCacheSetting() throws Exception
Thread.sleep( 1200 );
// then access the cache so that the objects present in the cache
will be expired
- for ( Object k : keys )
+ for ( String k : keys )
{
assertNull( ehCache.get( k ) );
}
- assertEquals( 0, ehCache.getKeys().size() );
+ assertFalse( ehCache.iterator().hasNext() );
}
finally
{
- if ( cacheManager != null )
+ if ( cacheManager != null && cacheManager.getStatus() !=
Status.UNINITIALIZED)
{
- cacheManager.shutdown();
+ cacheManager.close();
}
}
}
diff --git a/ldap-client-test/src/test/resources/log4j.properties
b/ldap-client-test/src/test/resources/log4j.properties
index 111487335d..00cf0b49ee 100644
--- a/ldap-client-test/src/test/resources/log4j.properties
+++ b/ldap-client-test/src/test/resources/log4j.properties
@@ -31,7 +31,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
log4j.logger.org.apache.directory.api=FATAL
log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
log4j.logger.org.apache.mina=FATAL
log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
log4j.logger.org.apache.directory.ldap.client.api=FATAL
\ No newline at end of file
diff --git
a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
index 6d7eb9e66d..36af0fce12 100644
---
a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
+++
b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
@@ -134,7 +134,7 @@ public static void init() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
index 318946381c..bcfd412caf 100644
---
a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
+++
b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
@@ -178,7 +178,7 @@ public static void init() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
index 28c1353355..f4e8fc2dcf 100644
---
a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
+++
b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
@@ -176,7 +176,7 @@ public static void init() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git a/mavibot-partition/pom.xml b/mavibot-partition/pom.xml
index fb60213084..ea03943694 100644
--- a/mavibot-partition/pom.xml
+++ b/mavibot-partition/pom.xml
@@ -133,7 +133,7 @@
org.apache.directory.server.core.partition.impl.btree.mavibot;version=${project.version}
</Export-Package>
<Import-Package>
- net.sf.ehcache;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.cursor;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.entry;version=${org.apache.directory.api.version},
diff --git
a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
index 324042984d..29fae987e1 100644
---
a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
+++
b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
@@ -30,9 +30,6 @@
import java.util.List;
import java.util.Set;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.cursor.Cursor;
import org.apache.directory.api.ldap.model.cursor.Tuple;
@@ -66,6 +63,7 @@
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.ehcache.Cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,7 +93,7 @@ public boolean accept( File dir, String name )
private RecordManager recordMan;
/** the entry cache */
- private Cache entryCache;
+ private Cache< String, Entry > entryCache;
public MavibotPartition( SchemaManager schemaManager, DnFactory dnFactory )
@@ -176,11 +174,12 @@ protected void doInit() throws LdapException
// First, check if the file storing the data exists
// Create the master table (the table containing all the entries)
- Cache masterTableCache = cacheService.getCache( suffixDn.getName()
);
+ //Cache masterTableCache = cacheService.getCache(
suffixDn.getName() );
try
{
- master = new MavibotMasterTable( recordMan, schemaManager,
"master", masterTableCache.getCacheConfiguration().getMaxElementsInMemory() );
+ //master = new MavibotMasterTable( recordMan, schemaManager,
"master", masterTableCache.getCacheConfiguration().getMaxElementsInMemory() );
+ master = new MavibotMasterTable( recordMan, schemaManager,
"master", cacheSize );
}
catch ( IOException ioe )
{
@@ -234,14 +233,14 @@ protected void doInit() throws LdapException
if ( cacheService != null )
{
- entryCache = cacheService.getCache( getId() );
+ entryCache = cacheService.getCache( getId(), String.class,
Entry.class );
- int cacheSizeConfig =
entryCache.getCacheConfiguration().getMaxElementsInMemory();
+ //int cacheSizeConfig =
entryCache.getCacheConfiguration().getMaxElementsInMemory();
- if ( cacheSizeConfig < cacheSize )
- {
- entryCache.getCacheConfiguration().setMaxElementsInMemory(
cacheSize );
- }
+ //if ( cacheSizeConfig < cacheSize )
+ //{
+ //
entryCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize );
+ //}
}
// We are done !
@@ -333,7 +332,7 @@ protected synchronized void doDestroy( PartitionTxn
partitionTxn ) throws LdapEx
{
if ( entryCache != null )
{
- entryCache.removeAll();
+ entryCache.clear();
}
}
@@ -457,19 +456,7 @@ public RecordManager getRecordMan()
@Override
public Entry lookupCache( String id )
{
- if ( entryCache == null )
- {
- return null;
- }
-
- Element el = entryCache.get( id );
-
- if ( el != null )
- {
- return ( Entry ) el.getObjectValue();
- }
-
- return null;
+ return ( entryCache != null ) ? entryCache.get( id ) : null;
}
@@ -486,7 +473,7 @@ public void addToCache( String id, Entry entry )
entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
}
- entryCache.put( new Element( id, entry ) );
+ entryCache.put( id, entry );
}
@@ -512,13 +499,13 @@ public void updateCache( OperationContext opCtx )
entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
}
- entryCache.replace( new Element( id, entry ) );
+ entryCache.replace( id, entry );
}
else if ( ( opCtx instanceof MoveOperationContext ) || ( opCtx
instanceof MoveAndRenameOperationContext )
|| ( opCtx instanceof RenameOperationContext ) )
{
// clear the cache it is not worth updating all the children
- entryCache.removeAll();
+ entryCache.clear();
}
else if ( opCtx instanceof DeleteOperationContext )
{
diff --git
a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
index a74426dc3e..c907fda8db 100644
---
a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
+++
b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
@@ -162,7 +162,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
b/mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
index af26b5138a..83c6ec3ad6 100644
---
a/mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
+++
b/mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
@@ -30,8 +30,8 @@
import java.util.List;
import java.util.Set;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
+import org.ehcache.Cache;
+import org.ehcache.Element;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.cursor.Cursor;
diff --git a/non-osgi-dependencies/pom.xml b/non-osgi-dependencies/pom.xml
index 119993522b..d1d03ce9dd 100644
--- a/non-osgi-dependencies/pom.xml
+++ b/non-osgi-dependencies/pom.xml
@@ -33,7 +33,7 @@
<dependencies>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
</dependency>
@@ -70,7 +70,7 @@
*
</Import-Package>
<_exportcontents>
- net.sf.ehcache*,
+ org.ehcache*,
org.bouncycastle*,
org.junit*
</_exportcontents>
diff --git a/pom.xml b/pom.xml
index 27c9453855..510ddcb40d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@
<commons.net.version>3.6</commons.net.version>
<commons.pool.version>2.6.0</commons.pool.version>
<dnsjava.version>2.1.8</dnsjava.version>
- <ehcache.version>2.10.4</ehcache.version>
+ <ehcache.version>3.6.1</ehcache.version>
<findbugs.annotations.version>1.0.0</findbugs.annotations.version>
<jetty.version>9.4.5.v20170502</jetty.version>
<!-- The Jetty bundle exports are using version 9.4.5, not
9.4.5.v20170502... -->
@@ -1239,7 +1239,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
</dependency>
diff --git
a/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
b/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
index 78918077e8..348d114540 100644
---
a/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
+++
b/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
@@ -26,7 +26,7 @@
import javax.security.auth.kerberos.KerberosPrincipal;
-import net.sf.ehcache.Cache;
+import org.ehcache.Cache;
import
org.apache.directory.server.changepw.protocol.ChangePasswordProtocolHandler;
import org.apache.directory.server.constants.ServerDNConstants;
diff --git a/protocol-kerberos/pom.xml b/protocol-kerberos/pom.xml
index b81a237788..aed97c0d4f 100644
--- a/protocol-kerberos/pom.xml
+++ b/protocol-kerberos/pom.xml
@@ -73,7 +73,7 @@
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
+ <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
</dependencies>
@@ -139,7 +139,7 @@
javax.naming,
javax.naming.directory,
javax.security.auth.kerberos,
- net.sf.ehcache;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
org.apache.directory.api.asn1;version=${org.apache.directory.api.version},
org.apache.directory.api.asn1.ber;version=${org.apache.directory.api.version},
org.apache.directory.api.asn1.ber.tlv;version=${org.apache.directory.api.version},
diff --git
a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
index 05ff750090..19ee202014 100644
---
a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
+++
b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/changepwd/ChangePasswordServer.java
@@ -22,8 +22,6 @@
import java.io.IOException;
-import net.sf.ehcache.Cache;
-
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.server.kerberos.ChangePasswordConfig;
@@ -39,6 +37,7 @@
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.transport.socket.DatagramSessionConfig;
import org.apache.mina.transport.socket.SocketAcceptor;
+import org.ehcache.Cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,7 +94,7 @@ public void start() throws IOException, LdapInvalidDnException
LOG.debug( "initializing the changepassword replay cache" );
- Cache cache = getDirectoryService().getCacheService().getCache(
"changePwdReplayCache" );
+ Cache< String, Object > cache =
getDirectoryService().getCacheService().getCache( "changePwdReplayCache",
String.class, Object.class );
replayCache = new ReplayCacheImpl( cache );
for ( Transport transport : transports )
diff --git
a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
index b20dcfc657..14eab528c5 100644
---
a/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
+++
b/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
@@ -22,8 +22,6 @@
import java.io.IOException;
-import net.sf.ehcache.Cache;
-
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.server.kerberos.KerberosConfig;
@@ -41,6 +39,7 @@
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.ehcache.Cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -111,7 +110,7 @@ public void start() throws IOException,
LdapInvalidDnException
LOG.debug( "initializing the kerberos replay cache" );
- Cache cache = getDirectoryService().getCacheService().getCache(
"kdcReplayCache" );
+ Cache< String, Object > cache =
getDirectoryService().getCacheService().getCache( "kdcReplayCache",
String.class, Object.class );
replayCache = new ReplayCacheImpl( cache,
config.getAllowableClockSkew() );
// Kerberos can use UDP or TCP
diff --git
a/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
b/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
index 62bde05413..28eeeb5194 100644
---
a/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
+++
b/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
@@ -103,7 +103,7 @@ public static void readConfig() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
b/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
index 45163ae3e3..1ac0c8552f 100644
---
a/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
+++
b/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
@@ -101,7 +101,7 @@ public static void readConfig() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
b/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
index b4462fe6c3..7f2363e57d 100644
---
a/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
+++
b/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
@@ -107,7 +107,7 @@ public static void readConfig() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
b/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
index 8227222597..37676ce386 100644
---
a/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
+++
b/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
@@ -100,7 +100,7 @@ public static void readConfig() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
b/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
index ab9e2a85b5..3d0563a734 100644
---
a/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
+++
b/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
@@ -101,7 +101,7 @@ public static void readConfig() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
b/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
index b71c58bbec..71bbe524e3 100644
---
a/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
+++
b/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
@@ -101,7 +101,7 @@ public static void readConfig() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git a/server-integ/src/test/resources/log4j.properties
b/server-integ/src/test/resources/log4j.properties
index 7586e5c7c4..6a46f095ca 100644
--- a/server-integ/src/test/resources/log4j.properties
+++ b/server-integ/src/test/resources/log4j.properties
@@ -39,7 +39,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
log4j.logger.org.apache.directory.api=FATAL
log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
log4j.logger.org.apache.mina=FATAL
log4j.logger.org.apache.directory.mavibot=FATAL
log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
diff --git a/service-builder/src/test/resources/log4j.properties
b/service-builder/src/test/resources/log4j.properties
index 7586e5c7c4..6a46f095ca 100755
--- a/service-builder/src/test/resources/log4j.properties
+++ b/service-builder/src/test/resources/log4j.properties
@@ -39,7 +39,7 @@ log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
log4j.logger.org.apache.directory.api=FATAL
log4j.logger.org.apache.directory.server=FATAL
-log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.ehcache=FATAL
log4j.logger.org.apache.mina=FATAL
log4j.logger.org.apache.directory.mavibot=FATAL
log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
diff --git a/service/log4j.properties b/service/log4j.properties
index 18eb079447..92626e3502 100644
--- a/service/log4j.properties
+++ b/service/log4j.properties
@@ -35,7 +35,7 @@
log4j.appender.stdout.layout.ConversionPattern=[%d{yyyy-mm-dd'T'HH:mm:ss.sssZ}]
log4j.logger.org.apache.directory.server=WARN
# external lib, you may never need to change this logger's level
-log4j.logger.net.sf.ehcache=WARN
+log4j.logger.org.ehcache=WARN
log4j.logger.org.apache.mina=WARN
# with these we'll not get innundated when switching to DEBUG
diff --git
a/service/src/main/java/org/apache/directory/server/ApacheDsService.java
b/service/src/main/java/org/apache/directory/server/ApacheDsService.java
index 0e60530501..48ea04f477 100644
--- a/service/src/main/java/org/apache/directory/server/ApacheDsService.java
+++ b/service/src/main/java/org/apache/directory/server/ApacheDsService.java
@@ -178,7 +178,7 @@ public void start( InstanceLayout instanceLayout, boolean
startServers ) throws
cacheService.initialize( instanceLayout );
initSchemaManager( instanceLayout );
- DnFactory dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ DnFactory dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
initSchemaLdifPartition( instanceLayout, dnFactory );
initConfigPartition( instanceLayout, dnFactory, cacheService );
diff --git a/xdbm-partition/pom.xml b/xdbm-partition/pom.xml
index 9909a48822..0d1a2a16df 100644
--- a/xdbm-partition/pom.xml
+++ b/xdbm-partition/pom.xml
@@ -121,9 +121,9 @@
</Export-Package>
<Import-Package>
javax.naming,
- net.sf.ehcache;version=${ehcache.version},
- net.sf.ehcache.config;version=${ehcache.version},
- net.sf.ehcache.store;version=${ehcache.version},
+ org.ehcache;version=${ehcache.version},
+ org.ehcache.config;version=${ehcache.version},
+ org.ehcache.store;version=${ehcache.version},
org.apache.directory.api.i18n;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.constants;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.model.cursor;version=${org.apache.directory.api.version},
diff --git
a/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
b/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
index 3adf4cab9c..79852e8414 100644
---
a/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
+++
b/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
@@ -35,10 +35,8 @@
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.store.LruPolicy;
+import org.ehcache.Cache;
+import org.ehcache.config.CacheConfiguration;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.cursor.Cursor;
@@ -131,10 +129,10 @@
protected int cacheSize = DEFAULT_CACHE_SIZE;
/** The alias cache */
- protected Cache aliasCache;
+ protected Cache< String, Dn > aliasCache;
/** The ParentIdAndRdn cache */
- protected Cache piarCache;
+ protected Cache< String, ParentIdAndRdn > piarCache;
/** true if we sync disks on every write operation */
protected AtomicBoolean isSyncOnWrite = new AtomicBoolean( true );
@@ -206,7 +204,7 @@
private ReadWriteLock rwLock;
/** a cache to hold <entryUUID, Dn> pairs, this is used for speeding up
the buildEntryDn() method */
- private Cache entryDnCache;
+ private Cache<String, Dn> entryDnCache;
/** a semaphore to serialize the writes on context entry while updating
contextCSN attribute */
private Semaphore ctxCsnSemaphore = new Semaphore( 1 );
@@ -541,7 +539,7 @@ protected void doDestroy( PartitionTxn partitionTxn )
throws LdapException
// don't reset initialized flag
initialized = false;
- entryDnCache.removeAll();
+ entryDnCache.clear();
MultiException errors = new MultiException( I18n.err( I18n.ERR_577 ) );
@@ -627,29 +625,30 @@ protected void doInit() throws LdapException
if ( cacheService != null )
{
- aliasCache = cacheService.getCache( "alias" );
+ aliasCache = cacheService.getCache( "alias", String.class,
Dn.class );
- CacheConfiguration cacheConfiguration =
aliasCache.getCacheConfiguration();
-
- int cacheSizeConfig = ( int )
cacheConfiguration.getMaxEntriesLocalHeap();
+ CacheConfiguration< String, Dn > aliasCacheConfig =
aliasCache.getRuntimeConfiguration();
+
+ //int cacheSizeConfig = ( int )
aliasCacheConfig.getMaxEntriesLocalHeap();
- if ( cacheSizeConfig < cacheSize )
- {
- aliasCache.getCacheConfiguration().setMaxEntriesLocalHeap(
cacheSize );
- }
+ //if ( cacheSizeConfig < cacheSize )
+ //{
+ // aliasCacheConfig.setMaxEntriesLocalHeap( cacheSize );
+ //}
- piarCache = cacheService.getCache( "piar" );
+ piarCache = cacheService.getCache( "piar", String.class,
ParentIdAndRdn.class );
- cacheSizeConfig = ( int )
piarCache.getCacheConfiguration().getMaxEntriesLocalHeap();
+ //cacheSizeConfig = ( int )
piarCache.getRuntimeConfiguration().getMaxEntriesLocalHeap();
- if ( cacheSizeConfig < cacheSize )
- {
- piarCache.getCacheConfiguration().setMaxEntriesLocalHeap(
cacheSize * 3L );
- }
+ //if ( cacheSizeConfig < cacheSize )
+ //{
+ // piarCache.getRuntimeConfiguration().setMaxEntriesLocalHeap(
cacheSize * 3L );
+ //}
- entryDnCache = cacheService.getCache( "entryDn" );
- entryDnCache.setMemoryStoreEvictionPolicy( new LruPolicy() );
- entryDnCache.getCacheConfiguration().setMaxEntriesLocalHeap(
cacheSize );
+ entryDnCache = cacheService.getCache( "entryDn", String.class,
Dn.class );
+ //CacheRuntimeConfiguration<String, Dn> entryDnCacheConfig =
entryDnCache.getRuntimeConfiguration();
+ //entryDnCache.setMemoryStoreEvictionPolicy( new LruPolicy() );
+ //entryDnCache.getRuntimeConfiguration().setMaxEntriesLocalHeap(
cacheSize );
}
}
@@ -2022,7 +2021,7 @@ public final synchronized void move( PartitionTxn
partitionTxn, Dn oldDn, Dn new
// Remove the EntryDN
modifiedEntry.removeAttributes( entryDnAT );
- entryDnCache.removeAll();
+ entryDnCache.clear();
setContextCsn( modifiedEntry.get( entryCsnAT ).getString() );
@@ -2200,7 +2199,7 @@ public void moveAndRename( PartitionTxn partitionTxn, Dn
oldDn, Dn newSuperiorDn
modifiedEntry.add( ApacheSchemaConstants.ENTRY_PARENT_ID_OID,
newParentId );
// Doom the DN cache now
- entryDnCache.removeAll();
+ entryDnCache.clear();
setContextCsn( modifiedEntry.get( entryCsnAT ).getString() );
@@ -2350,7 +2349,7 @@ private void rename( PartitionTxn partitionTxn, String
oldId, Rdn newRdn, boolea
{
String newNormType = newAtav.getNormType();
Object newNormValue = newAtav.getValue().getValue();
- boolean oldRemoved = false;
+ //boolean oldRemoved = false;
AttributeType newRdnAttrType =
schemaManager.lookupAttributeTypeRegistry( newNormType );
@@ -2533,7 +2532,7 @@ public final synchronized void rename( PartitionTxn
partitionTxn, Dn dn, Rdn new
rdnIdx.add( partitionTxn, parentIdAndRdn, oldId );
- entryDnCache.removeAll();
+ entryDnCache.clear();
if ( isSyncOnWrite.get() )
{
@@ -2631,27 +2630,23 @@ protected Dn buildEntryDn( PartitionTxn partitionTxn,
String id ) throws LdapExc
if ( entryDnCache != null )
{
- Element el = entryDnCache.get( id );
+ Dn cachedDn = entryDnCache.get( id );
- if ( el != null )
+ if ( cachedDn != null )
{
- return ( Dn ) el.getObjectValue();
+ return cachedDn;
}
}
do
{
- ParentIdAndRdn cur;
+ ParentIdAndRdn cur = null;
if ( piarCache != null )
{
- Element piar = piarCache.get( parentId );
+ cur = piarCache.get( parentId );
- if ( piar != null )
- {
- cur = ( ParentIdAndRdn ) piar.getObjectValue();
- }
- else
+ if ( cur == null )
{
cur = rdnIdx.reverseLookup( partitionTxn, parentId );
@@ -2660,7 +2655,7 @@ protected Dn buildEntryDn( PartitionTxn partitionTxn,
String id ) throws LdapExc
return null;
}
- piarCache.put( new Element( parentId, cur ) );
+ piarCache.put( parentId, cur );
}
}
else
@@ -2694,7 +2689,7 @@ protected Dn buildEntryDn( PartitionTxn partitionTxn,
String id ) throws LdapExc
dn = new Dn( schemaManager, Arrays.copyOf( rdnArray, pos ) );
- entryDnCache.put( new Element( id, dn ) );
+ entryDnCache.put( id, dn );
return dn;
}
finally
@@ -3198,7 +3193,7 @@ protected void addAliasIndices( PartitionTxn
partitionTxn, String aliasId, Dn al
if ( aliasCache != null )
{
- aliasCache.put( new Element( aliasId, aliasTarget ) );
+ aliasCache.put( aliasId, aliasTarget );
}
/*
@@ -3589,7 +3584,7 @@ public ReadWriteLock getReadWriteLock()
* {@inheritDoc}
*/
@Override
- public Cache getAliasCache()
+ public Cache<String, Dn> getAliasCache()
{
return aliasCache;
}
diff --git
a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
index f11c217971..595f4abfb0 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
@@ -30,7 +30,7 @@
import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
-import net.sf.ehcache.Cache;
+import org.ehcache.Cache;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
@@ -485,5 +485,5 @@ void moveAndRename( PartitionTxn partitionTxn, Dn oldDn, Dn
newSuperiorDn, Rdn n
* @return the Alias cache
* @return The cache
*/
- Cache getAliasCache();
+ Cache< String, Dn > getAliasCache();
}
diff --git
a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
index 2207570431..67f3bdfe53 100644
---
a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
+++
b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
@@ -20,8 +20,6 @@
package org.apache.directory.server.xdbm.search.evaluator;
-import net.sf.ehcache.Element;
-
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.filter.ScopeNode;
@@ -177,12 +175,10 @@ public boolean evaluate( PartitionTxn partitionTxn,
IndexEntry<?, String> indexE
*/
if ( db.getAliasCache() != null )
{
- Element element = db.getAliasCache().get( id );
+ Dn dn = db.getAliasCache().get( id );
- if ( ( element != null ) && ( element.getObjectValue() != null ) )
+ if ( dn != null )
{
- Dn dn = ( Dn ) element.getObjectValue();
-
return false;
}
}
diff --git
a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
index acf0806fb5..09182414ea 100644
---
a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
+++
b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
@@ -23,8 +23,6 @@
import java.util.HashSet;
import java.util.Set;
-import net.sf.ehcache.Element;
-
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.Entry;
@@ -157,12 +155,7 @@ public PartitionSearchResult computeResult( PartitionTxn
partitionTxn, SchemaMan
if ( db.getAliasCache() != null )
{
- Element aliasBaseElement = db.getAliasCache().get( baseId );
-
- if ( aliasBaseElement != null )
- {
- aliasedBase = ( Dn ) ( aliasBaseElement ).getObjectValue();
- }
+ aliasedBase = db.getAliasCache().get( baseId );
}
else
{
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
index 0125c464d6..11d8617f84 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
@@ -35,8 +35,6 @@
import java.util.List;
import java.util.Map;
-import net.sf.ehcache.store.AbstractStore;
-
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.csn.CsnFactory;
import org.apache.directory.api.ldap.model.entry.Attribute;
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
index 51feb72ade..587bbb19fd 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
@@ -62,12 +62,10 @@
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.ModDnAva;
-import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
import org.apache.directory.server.core.shared.DefaultDnFactory;
import org.apache.directory.server.xdbm.IndexNotFoundException;
-import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.StoreUtils;
import org.junit.After;
import org.junit.Before;
@@ -127,7 +125,7 @@ public static void setup() throws Exception
schemaManager = new DefaultSchemaManager( loader );
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
boolean loaded = schemaManager.loadAllEnabled();
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
index 7e284a1244..0220738286 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
@@ -118,7 +118,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
index fdf01f91f3..cc25a6e69f 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
@@ -129,7 +129,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
index c1ac6e3d9b..50ad947529 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
@@ -128,7 +128,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
index 1b91615922..250b7369bb 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
@@ -129,7 +129,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
index 74c45e4a97..78098d2bda 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
@@ -115,7 +115,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
NORMALIZED_CN_OID = schemaManager.getAttributeType(
ApacheSchemaConstants.APACHE_PRESENCE_AT
).getEquality().getNormalizer().normalize( SchemaConstants.CN_AT_OID );
}
diff --git
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
index 4a75633d8c..1e7d2e210b 100644
---
a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
+++
b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
@@ -109,7 +109,7 @@ public static void setup() throws Exception
cacheService = new CacheService();
cacheService.initialize( null );
- dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache" ) );
+ dnFactory = new DefaultDnFactory( schemaManager,
cacheService.getCache( "dnCache", String.class, Dn.class ) );
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services