[jboss-cvs] JBossAS SVN: r82698 - in projects/vfs/trunk/src: test/java/org/jboss/test/virtual/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 8 09:23:45 EST 2009
Author: alesj
Date: 2009-01-08 09:23:45 -0500 (Thu, 08 Jan 2009)
New Revision: 82698
Modified:
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CombinedVFSCacheTestCase.java
Log:
Add EH setting to pre permanent roots.
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java 2009-01-08 14:10:46 UTC (rev 82697)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/cache/CombinedVFSCache.java 2009-01-08 14:23:45 UTC (rev 82698)
@@ -33,6 +33,7 @@
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.ExceptionHandler;
import org.jboss.virtual.spi.cache.CacheStatistics;
import org.jboss.virtual.spi.cache.VFSCache;
import org.jboss.virtual.spi.cache.helpers.NoopVFSCache;
@@ -50,19 +51,22 @@
private VFSCache realCache;
/**
- * Set permanent roots.
+ * Set permanent roots and its exception handlers.
*
- * @param permanentRootUrls the permanent roots urls
+ * @param initializationEntries the initialization entries
* @throws IOException for any error
*/
- public void setPermanentRoots(URL... permanentRootUrls) throws IOException
+ public void setPermanentRoots(Map<URL, ExceptionHandler> initializationEntries) throws IOException
{
- if (permanentRootUrls != null)
+ if (initializationEntries != null && initializationEntries.isEmpty() == false)
{
initializing = true;
- for (URL url : permanentRootUrls)
+ for (Map.Entry<URL, ExceptionHandler> entry : initializationEntries.entrySet())
{
- VFS.getRoot(url);
+ VFS vfs = VFS.getVFS(entry.getKey());
+ ExceptionHandler eh = entry.getValue();
+ if (eh != null)
+ vfs.setExceptionHandler(eh);
}
initializing = false;
}
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CombinedVFSCacheTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CombinedVFSCacheTestCase.java 2009-01-08 14:10:46 UTC (rev 82697)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/CombinedVFSCacheTestCase.java 2009-01-08 14:23:45 UTC (rev 82698)
@@ -21,12 +21,15 @@
*/
package org.jboss.test.virtual.test;
+import java.net.URL;
+import java.util.Collections;
import java.util.Map;
import junit.framework.Test;
import org.jboss.virtual.plugins.cache.CombinedVFSCache;
import org.jboss.virtual.plugins.cache.IterableTimedVFSCache;
import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.ExceptionHandler;
import org.jboss.virtual.spi.cache.VFSCache;
/**
@@ -71,7 +74,9 @@
try
{
CombinedWrapperVFSCache cache = new CombinedWrapperVFSCache();
- cache.setPermanentRoots(getResource("/vfs/test/nested"));
+ URL url = getResource("/vfs/test/nested");
+ Map<URL, ExceptionHandler> map = Collections.singletonMap(url, null);
+ cache.setPermanentRoots(map);
IterableTimedVFSCache realCache = new IterableTimedVFSCache(5);
realCache.start();
More information about the jboss-cvs-commits
mailing list