[seam-commits] Seam SVN: r8913 - trunk/src/main/org/jboss/seam/cache.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Sep 4 18:34:18 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-09-04 18:34:17 -0400 (Thu, 04 Sep 2008)
New Revision: 8913

Modified:
   trunk/src/main/org/jboss/seam/cache/EhCacheProvider.java
   trunk/src/main/org/jboss/seam/cache/JbossCacheProvider.java
Log:
JBSEAM-3382, and a couple of minor bits, thanks to Przemyslaw Jaskierski

Modified: trunk/src/main/org/jboss/seam/cache/EhCacheProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/cache/EhCacheProvider.java	2008-09-04 16:17:19 UTC (rev 8912)
+++ trunk/src/main/org/jboss/seam/cache/EhCacheProvider.java	2008-09-04 22:34:17 UTC (rev 8913)
@@ -1,7 +1,7 @@
 package org.jboss.seam.cache;
 
 import static org.jboss.seam.annotations.Install.BUILT_IN;
-import static org.jboss.seam.ScopeType.STATELESS;
+import static org.jboss.seam.ScopeType.APPLICATION;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
@@ -24,7 +24,7 @@
  * @author Pete Muir
  */
 @Name("org.jboss.seam.cache.cacheProvider")
- at Scope(STATELESS)
+ at Scope(APPLICATION)
 @BypassInterceptors
 @Install(value = false, precedence = BUILT_IN, classDependencies="net.sf.ehcache.Cache")
 @AutoCreate
@@ -84,7 +84,10 @@
       Cache result = cacheManager.getCache(regionName);
       if (result == null)
       {
-         throw new IllegalArgumentException("Cache region not found");
+          log.warn("Could not find configuration for region [" + regionName + "]; using defaults.");
+          cacheManager.addCache(regionName);
+          result = cacheManager.getCache(regionName);
+          log.debug("EHCache region created: " + regionName); 
       }
       return result;
    }
@@ -100,7 +103,6 @@
    public void create()
    {
       log.debug("Starting EhCacheProvider cache");
-      // TODO validate if there is any common approach to load resources in Seam
       try
       {
          if (getConfiguration() != null)

Modified: trunk/src/main/org/jboss/seam/cache/JbossCacheProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/cache/JbossCacheProvider.java	2008-09-04 16:17:19 UTC (rev 8912)
+++ trunk/src/main/org/jboss/seam/cache/JbossCacheProvider.java	2008-09-04 22:34:17 UTC (rev 8913)
@@ -1,7 +1,7 @@
 package org.jboss.seam.cache;
 
 import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.FRAMEWORK;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Node;
@@ -27,7 +27,7 @@
 @Name("org.jboss.seam.cache.cacheProvider")
 @Scope(APPLICATION)
 @BypassInterceptors
- at Install(precedence = FRAMEWORK, classDependencies={"org.jboss.cache.TreeCache", "org.jgroups.MembershipListener"})
+ at Install(precedence = BUILT_IN, classDependencies={"org.jboss.cache.TreeCache", "org.jgroups.MembershipListener"})
 @AutoCreate
 public class JbossCacheProvider extends AbstractJBossCacheProvider<TreeCache>
 {




More information about the seam-commits mailing list