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:14 UTC

svn commit: r506982 - in /cocoon/branches/BRANCH_2_1_X: src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java src/java/org/apache/cocoon/components/store/impl/ehcache.xml status.xml

Author: cziegeler
Date: Tue Feb 13 04:07:06 2007
New Revision: 506982

URL: http://svn.apache.org/viewvc?view=rev&rev=506982
Log:
EHCache now uses the configured cache directory instead of using the default of java.io.tempdir
Fixes bug #COCOON-1927

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/ehcache.xml
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java?view=diff&rev=506982&r1=506981&r2=506982
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java Tue Feb 13 04:07:06 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;
@@ -33,6 +33,7 @@
 
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.util.IOUtils;
+import org.apache.commons.lang.StringUtils;
 
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
@@ -243,7 +244,6 @@
             throw new IOException("Directory '" + directoryPath + "' is not readable/writable");
         }
         this.diskStorePath = directoryPath;
-        //System.setProperty("java.io.tmpdir", directoryPath);
     }
 
     /**
@@ -268,8 +268,12 @@
      * Initialize the CacheManager and created the Cache.
      */
     public void initialize() throws Exception {
-        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, MemoryStoreEvictionPolicy.LRU,
                 this.overflowToDisk, this.diskStorePath, this.eternal, this.timeToLiveSeconds,
                 this.timeToIdleSeconds, this.diskPersistent, Cache.DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS,

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/ehcache.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/ehcache.xml?view=diff&rev=506982&r1=506981&r2=506982
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/ehcache.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/ehcache.xml Tue Feb 13 04:07:06 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.

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=506982&r1=506981&r2=506982
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Feb 13 04:07:06 2007
@@ -181,6 +181,9 @@
 
   <changes>
   <release version="2.1.11" date="TBD">
+    <action dev="CZ" type="fix" fixes-bug="COCOON-1927" due-to="Richard Frovarp">
+      Core: EHCache now uses the configured cache directory instead of using the default of java.io.tempdir.
+    </action>
     <action dev="CZ" type="add">
       Core: Update ehcache to 1.2.3.
     </action>