You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2007/02/13 13:07:41 UTC
svn commit: r506983 - in
/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main:
java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
resources/org/apache/cocoon/components/store/impl/ehcache.xml
Author: cziegeler
Date: Tue Feb 13 04:07:39 2007
New Revision: 506983
URL: http://svn.apache.org/viewvc?view=rev&rev=506983
Log:
EHCache now uses the configured cache directory instead of using the default of java.io.tempdir
Fixes bug #COCOON-1927
Modified:
cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml
Modified: cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java?view=diff&rev=506983&r1=506982&r2=506983
==============================================================================
--- cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java (original)
+++ cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java Tue Feb 13 04:07:39 2007
@@ -16,10 +16,10 @@
*/
package org.apache.cocoon.components.store.impl;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
-import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
@@ -32,6 +32,7 @@
import org.apache.cocoon.configuration.Settings;
import org.apache.cocoon.util.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.excalibur.store.Store;
@@ -151,6 +152,8 @@
private File workDir;
private File cacheDir;
+ private String diskStorePath; // The directory to be used a disk store path. Uses java.io.tmpdir if the argument is null.
+
// ---------------------------------------------------- Lifecycle
public EHDefaultStore() {
@@ -288,7 +291,7 @@
if (!(directory.canRead() && directory.canWrite())) {
throw new IOException("Directory '" + directoryPath + "' is not readable/writable");
}
- System.setProperty("java.io.tmpdir", directoryPath);
+ this.diskStorePath = directoryPath;
}
/**
@@ -346,8 +349,12 @@
throw new Exception("Unable to set directory", e);
}
- URL configFileURL = Thread.currentThread().getContextClassLoader().getResource(CONFIG_FILE);
- this.cacheManager = CacheManager.create(configFileURL);
+ // read configuration - we have to replace the diskstorepath in the configuration
+ // as the diskStorePath argument of the Cache constructor is ignored and set by the
+ // CacheManager! (see bug COCOON-1927)
+ String config = org.apache.commons.io.IOUtils.toString(Thread.currentThread().getContextClassLoader().getResourceAsStream(CONFIG_FILE));
+ config = StringUtils.replace(config, "${diskstorepath}", this.diskStorePath);
+ this.cacheManager = CacheManager.create(new ByteArrayInputStream(config.getBytes("utf-8")));
this.cache = new Cache(this.cacheName, this.maxObjects, this.overflowToDisk, this.eternal,
this.timeToLiveSeconds, this.timeToIdleSeconds, this.diskPersistent, 120);
this.cacheManager.addCache(this.cache);
Modified: cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml?view=diff&rev=506983&r1=506982&r2=506983
==============================================================================
--- cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml (original)
+++ cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml Tue Feb 13 04:07:39 2007
@@ -26,7 +26,7 @@
user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path -->
- <diskStore path="java.io.tmpdir"/>
+ <diskStore path="${diskstorepath}"/>
<!--Default Cache configuration. These will be applied to caches programmatically created through
the CacheManager.