[cvs] expresso commit by lhamel: in getCacheSystem, pass in null to use the

JCorporate Ltd jcorp at jcorporate.com
Mon Feb 21 01:08:24 UTC 2005


Log Message:
-----------
in getCacheSystem, pass in null to use the RequestRegistry context.

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache:
        CacheManager.java

Revision Data
-------------
Index: CacheManager.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheManager.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheManager.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheManager.java -u -r1.33 -r1.34
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheManager.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheManager.java
@@ -65,6 +65,7 @@
 package com.jcorporate.expresso.core.cache;
 
 import com.jcorporate.expresso.core.misc.ConfigManager;
+import com.jcorporate.expresso.core.registry.RequestRegistry;
 import com.jcorporate.expresso.kernel.ComponentLifecycle;
 import com.jcorporate.expresso.kernel.management.ExpressoRuntimeMap;
 import com.jcorporate.expresso.kernel.util.LocatorUtils;
@@ -166,15 +167,17 @@
     }
 
     /**
-     * Retrieve the cache system appropriate for the data context
+     * Retrieve the cache system appropriate for the data context.
      *
-     * @param dataContext the data context to retrieve the cache system for
+     * @param dataContext the data context to use to retrieve the cache system. Pass in null to use the RequestRegistry context.
      * @return Cache system or null in the Component system when caching is
      *         not enabled.
      */
     public final static CacheSystem getCacheSystem(String dataContext) {
         if (dataContext == null || dataContext.length() == 0) {
-            dataContext = "default";
+            dataContext = RequestRegistry.getDataContext();
+            if ( dataContext == null )
+                dataContext = "default";
         }
 
         getInstance(); // make sure initialized
@@ -427,7 +430,6 @@
             } else {
                 continue;
             }
-//            ((DefaultCacheManager)getCacheSystem(oneConfigKey)).displayStatus();
         } /* for each config key */
 
     } /* displayStatus() */
@@ -448,7 +450,6 @@
         } else {
             return cs.existsCache(cacheName);
         }
-//        return getCacheSystem(dataContext).existsCache(cacheName);
     } /* existsCache(String, String) */
 
     /**
@@ -483,8 +484,6 @@
         } else {
             return cs.getItem(cacheName, valueKey);
         }
-
-//        return getCacheSystem(dataContext).getItem(cacheName,valueKey);
     } /* getItem(String, String, String) */
 
     /**
@@ -513,14 +512,6 @@
                 }
             }
         }
-
-//        java.util.List l = getCacheSystem(dataContext).getItems(cacheName);
-//        if (l == null) {
-//            return null;
-//        } else {
-//            return new Vector(l);
-//        }
-//        return new Vector(getCacheSystem(dataContext).getItems(cacheName));
     } /* getItems(String, String) */
 
     /**
@@ -538,8 +529,6 @@
         } else {
             return cs.getItemCount(cacheName);
         }
-
-//        return getCacheSystem(dataContext).getItemCount(cacheName);
     } /* getItemCount(String, String) */
 
 
@@ -559,8 +548,6 @@
         } else {
             cs.removeItem(cacheName, itemToRemove);
         }
-//        getCacheSystem(dataContext).removeItem(cacheName,itemToRemove);
-
     } /* removeItem(String, String, Cacheable) */
 
 
@@ -581,8 +568,6 @@
         } else {
             cs.removeItemNoNotify(cacheName, itemToRemove);
         }
-
-//        getCacheSystem(dataContext).removeItemNoNotify(cacheName,itemToRemove);
     } /* removeItemNoNotify(String, String, Cacheable) */
 
 
@@ -603,8 +588,6 @@
         } else {
             cs.setItems(cacheName, itemList);
         }
-
-//        getCacheSystem(dataContext).setItems(cacheName,itemList);
     } /* setItems(String, String, Vector) */
 }
 


More information about the cvs mailing list