Author: lektran
Date: Fri Dec 26 05:21:03 2014
New Revision: 1647934

URL: http://svn.apache.org/r1647934
Log:
OFBIZ-4098 Extract interfaces for CacheManager and Cache, add basic abstract 
and concrete factories and move the current cache implementation into a 
separate package. 


Added:
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/META-INF/services/org.ofbiz.base.util.cache.CacheManagerFactory
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
   (with props)
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
   (with props)
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
   (with props)
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheLine.java
      - copied, changed from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheSoftReference.java
      - copied, changed from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheSoftReference.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/HardRefCacheLine.java
      - copied, changed from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/HardRefCacheLine.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmRecordManager.java
      - copied, changed from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmRecordManager.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmSerializer.java
      - copied, changed from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmSerializer.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCache.java
      - copied, changed from r1647483, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCacheManager.java
      - copied, changed from r1647483, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCacheManager.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCacheManagerFactory.java
   (with props)
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/SoftRefCacheLine.java
      - copied, changed from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/SoftRefCacheLine.java
Removed:
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheSoftReference.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/HardRefCacheLine.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmRecordManager.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmSerializer.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCacheManager.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/SoftRefCacheLine.java
Modified:
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/content/src/org/ofbiz/content/ContentManagementServices.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/config/ResourceLoader.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/BshUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/PatternFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/UtilProperties.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheListener.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/template/XslTransform.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/common/src/org/ofbiz/common/CommonEvents.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entity/src/org/ofbiz/entity/cache/EntityCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/minilang/src/org/ofbiz/minilang/SimpleMapProcessor.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/security/src/org/ofbiz/security/SecurityFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/service/src/org/ofbiz/service/engine/BSFEngine.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/webapp/src/org/ofbiz/webapp/WebAppUtil.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCacheStorage.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/webtools/src/org/ofbiz/webtools/UtilCacheEvents.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/cache/ScreenCache.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/specialpurpose/pos/src/org/ofbiz/pos/config/ButtonEventConfig.java
    
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/specialpurpose/pos/src/org/ofbiz/pos/screen/PosDialog.java

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/content/src/org/ofbiz/content/ContentManagementServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/content/src/org/ofbiz/content/ContentManagementServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/content/src/org/ofbiz/content/ContentManagementServices.java
 Fri Dec 26 05:21:03 2014
@@ -37,7 +37,7 @@ import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.content.content.ContentServices;
 import org.ofbiz.content.content.ContentWorker;
@@ -1175,7 +1175,7 @@ public class ContentManagementServices {
 
     public static Map<String, Object> 
clearContentAssocViewCache(DispatchContext dctx, Map<String, ? extends Object> 
context) throws GenericServiceException{
         Map<String, Object> results = FastMap.newInstance();
-        OFBizCache<?, ?> utilCache = 
UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom");
+        Cache<?, ?> utilCache = 
UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom");
 
         if (utilCache != null) {
             utilCache.clear();
@@ -1192,7 +1192,7 @@ public class ContentManagementServices {
     public static Map<String, Object> 
clearContentAssocDataResourceViewCache(DispatchContext dctx, Map<String, ? 
extends Object> context) throws GenericServiceException{
         Map<String, Object> results = FastMap.newInstance();
 
-        OFBizCache<?, ?> utilCache = 
UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom");
+        Cache<?, ?> utilCache = 
UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom");
         if (utilCache != null) {
             utilCache.clear();
         }

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java
 Fri Dec 26 05:21:03 2014
@@ -32,7 +32,7 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.content.content.ContentWorker;
 import org.ofbiz.entity.Delegator;
@@ -49,7 +49,7 @@ public class OrderContentWrapper {
     public static final String module = OrderContentWrapper.class.getName();
     public static final String SEPARATOR = "::";    // cache key separator
 
-    private static final OFBizCache<String, String> orderContentCache = 
UtilCache.createUtilCache("order.content", true); // use soft reference to free 
up memory if needed
+    private static final Cache<String, String> orderContentCache = 
UtilCache.createUtilCache("order.content", true); // use soft reference to free 
up memory if needed
 
     public static OrderContentWrapper makeOrderContentWrapper(GenericValue 
order, HttpServletRequest request) {
         return new OrderContentWrapper(order, request);

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
 Fri Dec 26 05:21:03 2014
@@ -21,7 +21,7 @@ package org.ofbiz.party.content;
 
 import org.ofbiz.content.content.ContentWrapper;
 import org.ofbiz.content.content.ContentWorker;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.GenericValue;
@@ -49,7 +49,7 @@ public class PartyContentWrapper impleme
     public static final String module = PartyContentWrapper.class.getName();
     public static final String CACHE_KEY_SEPARATOR = "::";
 
-    private static final OFBizCache<String, String> partyContentCache = 
UtilCache.createUtilCache("party.content.rendered", true);
+    private static final Cache<String, String> partyContentCache = 
UtilCache.createUtilCache("party.content.rendered", true);
 
     protected LocalDispatcher dispatcher;
     protected GenericValue party;

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
 Fri Dec 26 05:21:03 2014
@@ -44,7 +44,7 @@ import org.ofbiz.product.product.Product
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.webapp.website.WebSiteWorker;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 /**
@@ -56,7 +56,7 @@ public class ProductConfigWorker {
     public static final String resource = "ProductUiLabels";
     public static final String SEPARATOR = "::";    // cache key separator
 
-    private static final OFBizCache<String, ProductConfigWrapper> 
productConfigCache = UtilCache.createUtilCache("product.config", true);     // 
use soft reference to free up memory if needed
+    private static final Cache<String, ProductConfigWrapper> 
productConfigCache = UtilCache.createUtilCache("product.config", true);     // 
use soft reference to free up memory if needed
 
     public static ProductConfigWrapper getProductConfigWrapper(String 
productId, String currencyUomId, HttpServletRequest request) {
         ProductConfigWrapper configWrapper = null;

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
 Fri Dec 26 05:21:03 2014
@@ -35,7 +35,7 @@ import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.GeneralRuntimeException;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.content.content.ContentWorker;
 import org.ofbiz.content.content.ContentWrapper;
@@ -55,7 +55,7 @@ public class ProductContentWrapper imple
     public static final String module = ProductContentWrapper.class.getName();
     public static final String SEPARATOR = "::";    // cache key separator
 
-    private static final OFBizCache<String, String> productContentCache = 
UtilCache.createUtilCache("product.content.rendered", true);
+    private static final Cache<String, String> productContentCache = 
UtilCache.createUtilCache("product.content.rendered", true);
 
     public static ProductContentWrapper makeProductContentWrapper(GenericValue 
product, HttpServletRequest request) {
         return new ProductContentWrapper(product, request);

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
 Fri Dec 26 05:21:03 2014
@@ -37,7 +37,7 @@ import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.content.content.ContentWorker;
 import org.ofbiz.content.content.ContentWrapper;
@@ -60,7 +60,7 @@ public class ProductPromoContentWrapper
     public static final String module = 
ProductPromoContentWrapper.class.getName();
     public static final String SEPARATOR = "::";    // cache key separator
 
-    private static final OFBizCache<String, String> productPromoContentCache = 
UtilCache.createUtilCache("product.promo.content.rendered", true);
+    private static final Cache<String, String> productPromoContentCache = 
UtilCache.createUtilCache("product.promo.content.rendered", true);
 
     public static ProductPromoContentWrapper 
makeProductPromoContentWrapper(GenericValue productPromo, HttpServletRequest 
request) {
         return new ProductPromoContentWrapper(productPromo, request);

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
 Fri Dec 26 05:21:03 2014
@@ -38,7 +38,7 @@ import org.ofbiz.base.util.GeneralExcept
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.GeneralRuntimeException;
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.service.LocalDispatcher;
 import javolution.util.FastMap;
@@ -52,7 +52,7 @@ public class WorkEffortContentWrapper im
     public static final String module = 
WorkEffortContentWrapper.class.getName();
     public static final String CACHE_KEY_SEPARATOR = "::";
 
-    private static final OFBizCache<String, String> workEffortContentCache = 
UtilCache.createUtilCache("workeffort.content.rendered", true);
+    private static final Cache<String, String> workEffortContentCache = 
UtilCache.createUtilCache("workeffort.content.rendered", true);
 
     protected LocalDispatcher dispatcher;
     protected GenericValue workEffort;

Added: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/META-INF/services/org.ofbiz.base.util.cache.CacheManagerFactory
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/META-INF/services/org.ofbiz.base.util.cache.CacheManagerFactory?rev=1647934&view=auto
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/META-INF/services/org.ofbiz.base.util.cache.CacheManagerFactory
 (added)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/META-INF/services/org.ofbiz.base.util.cache.CacheManagerFactory
 Fri Dec 26 05:21:03 2014
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.ofbiz.base.util.cache.impl.OFBizCacheManagerFactory

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/config/ResourceLoader.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/config/ResourceLoader.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/config/ResourceLoader.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/config/ResourceLoader.java
 Fri Dec 26 05:21:03 2014
@@ -24,7 +24,7 @@ import java.net.URL;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilURL;
 import org.ofbiz.base.util.UtilXml;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -35,9 +35,9 @@ import org.w3c.dom.Element;
 public abstract class ResourceLoader {
 
     public static final String module = ResourceLoader.class.getName();
-    private static final OFBizCache<String, ResourceLoader> loaderCache = 
UtilCache.createUtilCache("resource.ResourceLoaders", 0, 0);
+    private static final Cache<String, ResourceLoader> loaderCache = 
UtilCache.createUtilCache("resource.ResourceLoaders", 0, 0);
     // This cache is temporary - we will use it until the framework has been 
refactored to eliminate DOM tree caching, then it can be removed.
-    private static final OFBizCache<String, Document> domCache = 
UtilCache.createUtilCache("resource.DomTrees", 0, 0);
+    private static final Cache<String, Document> domCache = 
UtilCache.createUtilCache("resource.DomTrees", 0, 0);
 
     public static InputStream loadResource(String xmlFilename, String 
location, String loaderName) throws GenericConfigException {
         ResourceLoader loader = getLoader(xmlFilename, loaderName);

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
 Fri Dec 26 05:21:03 2014
@@ -35,7 +35,7 @@ import org.ofbiz.base.lang.LockedBy;
 import org.ofbiz.base.lang.ThreadSafe;
 import org.ofbiz.base.util.Assert;
 import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.w3c.dom.Element;
 
@@ -44,7 +44,7 @@ import org.w3c.dom.Element;
  */
 @ThreadSafe
 public final class MetricsFactory {
-    private static final OFBizCache<String, Metrics> METRICS_CACHE = 
UtilCache.createUtilCache("base.metrics", 0, 0);
+    private static final Cache<String, Metrics> METRICS_CACHE = 
UtilCache.createUtilCache("base.metrics", 0, 0);
     /**
      * A "do-nothing" <code>Metrics</code> instance.
      */

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/BshUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/BshUtil.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/BshUtil.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/BshUtil.java
 Fri Dec 26 05:21:03 2014
@@ -28,12 +28,13 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.ofbiz.base.location.FlexibleLocation;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 import bsh.BshClassManager;
 import bsh.EvalError;
 import bsh.Interpreter;
+import bsh.Interpreter.ParsedScript;
 import bsh.NameSpace;
 import bsh.ParseException;
 
@@ -46,7 +47,7 @@ public final class BshUtil {
     public static final String module = BshUtil.class.getName();
 
     protected static ConcurrentHashMap<ClassLoader, BshClassManager> 
masterClassManagers = new ConcurrentHashMap<ClassLoader, BshClassManager>();
-    private static final OFBizCache<String, Interpreter.ParsedScript> 
parsedScripts = UtilCache.createUtilCache("script.BshLocationParsedCache", 0, 
0, false);
+    private static final Cache<String, ParsedScript> parsedScripts = 
UtilCache.createUtilCache("script.BshLocationParsedCache", 0, 0, false);
 
     /**
      * Evaluate a BSH condition or expression

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
 Fri Dec 26 05:21:03 2014
@@ -35,7 +35,7 @@ import org.codehaus.groovy.control.Compi
 import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.runtime.InvokerHelper;
 import org.ofbiz.base.location.FlexibleLocation;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 /**
@@ -46,7 +46,7 @@ public class GroovyUtil {
 
     public static final String module = GroovyUtil.class.getName();
 
-    private static final OFBizCache<String, Class<?>> parsedScripts = 
UtilCache.createUtilCache("script.GroovyLocationParsedCache", 0, 0, false);
+    private static final Cache<String, Class<?>> parsedScripts = 
UtilCache.createUtilCache("script.GroovyLocationParsedCache", 0, 0, false);
 
     private static final GroovyClassLoader groovyScriptClassLoader;
     static {

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java
 Fri Dec 26 05:21:03 2014
@@ -25,7 +25,7 @@ import javax.naming.InitialContext;
 
 import org.ofbiz.base.config.GenericConfigException;
 import org.ofbiz.base.config.JNDIConfigUtil;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 /**
@@ -35,7 +35,7 @@ import org.ofbiz.base.util.cache.UtilCac
 public class JNDIContextFactory {
 
     public static final String module = JNDIContextFactory.class.getName();
-    private static final OFBizCache<String, InitialContext> contexts = 
UtilCache.createUtilCache("entity.JNDIContexts", 0, 0);
+    private static final Cache<String, InitialContext> contexts = 
UtilCache.createUtilCache("entity.JNDIContexts", 0, 0);
 
     /**
      * Return the initial context according to the entityengine.xml parameters 
that correspond to the given prefix

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java
 Fri Dec 26 05:21:03 2014
@@ -33,6 +33,7 @@ import java.util.Vector;
 
 import bsh.EvalError;
 import bsh.Interpreter;
+import bsh.Interpreter.ParsedScript;
 import bsh.InterpreterError;
 import bsh.TargetError;
 
@@ -41,7 +42,7 @@ import org.apache.bsf.BSFException;
 import org.apache.bsf.BSFManager;
 import org.apache.bsf.util.BSFEngineImpl;
 
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 /**
@@ -62,7 +63,7 @@ public class OfbizBshBsfEngine extends B
     protected Interpreter interpreter;
     protected boolean installedApplyMethod;
 
-    private static final OFBizCache<String, Interpreter.ParsedScript> 
parsedScripts = UtilCache.createUtilCache("script.BshBsfParsedCache", 0, 0, 
false);
+    private static final Cache<String, ParsedScript> parsedScripts = 
UtilCache.createUtilCache("script.BshBsfParsedCache", 0, 0, false);
 
     @SuppressWarnings("unchecked")
     @Override

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/PatternFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/PatternFactory.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/PatternFactory.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/PatternFactory.java
 Fri Dec 26 05:21:03 2014
@@ -21,7 +21,7 @@ package org.ofbiz.base.util;
 import org.apache.oro.text.regex.MalformedPatternException;
 import org.apache.oro.text.regex.Pattern;
 import org.apache.oro.text.regex.Perl5Compiler;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 /**
@@ -31,7 +31,7 @@ import org.ofbiz.base.util.cache.UtilCac
 public class PatternFactory {
 
     public static final String module = PatternFactory.class.getName();
-    private static final OFBizCache<String, Pattern> compiledPerl5Patterns = 
UtilCache.createUtilCache("regularExpression.compiledPerl5Patterns", false);
+    private static final Cache<String, Pattern> compiledPerl5Patterns = 
UtilCache.createUtilCache("regularExpression.compiledPerl5Patterns", false);
 
     /**
      * Compiles and caches a Perl5 regexp pattern for the given string pattern.

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/ScriptUtil.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
 Fri Dec 26 05:21:03 2014
@@ -48,7 +48,7 @@ import javax.script.SimpleScriptContext;
 
 import org.codehaus.groovy.runtime.InvokerHelper;
 import org.ofbiz.base.location.FlexibleLocation;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 
 /**
@@ -70,7 +70,7 @@ public final class ScriptUtil {
     public static final String RESULT_KEY = "result";
     /** The <code>ScriptHelper</code> key. */
     public static final String SCRIPT_HELPER_KEY = "ofbiz";
-    private static final OFBizCache<String, CompiledScript> parsedScripts = 
UtilCache.createUtilCache("script.ParsedScripts", 0, 0, false);
+    private static final Cache<String, CompiledScript> parsedScripts = 
UtilCache.createUtilCache("script.ParsedScripts", 0, 0, false);
     private static final Object[] EMPTY_ARGS = {};
     private static ScriptHelperFactory helperFactory = null;
     /** A set of script names - derived from the JSR-223 scripting engines. */

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/UtilProperties.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/UtilProperties.java
 Fri Dec 26 05:21:03 2014
@@ -45,7 +45,8 @@ import java.util.ResourceBundle;
 import java.util.Set;
 
 import org.ofbiz.base.location.FlexibleLocation;
-import org.ofbiz.base.util.cache.OFBizCache;
+import org.ofbiz.base.util.UtilProperties.UtilResourceBundle;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.base.util.collections.ResourceBundleMapWrapper;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
@@ -71,12 +72,12 @@ public class UtilProperties implements S
     /** An instance of the generic cache for storing the non-locale-specific 
properties.
      *  Each Properties instance is keyed by the resource String.
      */
-    private static final OFBizCache<String, Properties> resourceCache = 
UtilCache.createUtilCache("properties.UtilPropertiesResourceCache");
+    private static final Cache<String, Properties> resourceCache = 
UtilCache.createUtilCache("properties.UtilPropertiesResourceCache");
 
     /** An instance of the generic cache for storing the non-locale-specific 
properties.
      *  Each Properties instance is keyed by the file's URL.
      */
-    private static final OFBizCache<String, Properties> urlCache = 
UtilCache.createUtilCache("properties.UtilPropertiesUrlCache");
+    private static final Cache<String, Properties> urlCache = 
UtilCache.createUtilCache("properties.UtilPropertiesUrlCache");
 
     protected static Locale fallbackLocale = null;
     protected static Set<Locale> defaultCandidateLocales = null;
@@ -1013,7 +1014,7 @@ public class UtilProperties implements S
      * properties file format.
      */
     public static class UtilResourceBundle extends ResourceBundle {
-        private static final OFBizCache<String, UtilResourceBundle> 
bundleCache = UtilCache.createUtilCache("properties.UtilPropertiesBundleCache");
+        private static final Cache<String, UtilResourceBundle> bundleCache = 
UtilCache.createUtilCache("properties.UtilPropertiesBundleCache");
         protected Properties properties = null;
         protected Locale locale = null;
         protected int hashCode = hashCode();

Added: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java?rev=1647934&view=auto
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
 (added)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
 Fri Dec 26 05:21:03 2014
@@ -0,0 +1,133 @@
+package org.ofbiz.base.util.cache;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+public interface Cache<K, V> {
+
+    /** Getter for the name of the Cache instance.
+     * @return The name of the instance
+     */
+    public String getName();
+
+    public void setMaxInMemory(int newInMemory);
+
+    public int getMaxInMemory();
+
+    public void setSizeLimit(int newSizeLimit);
+
+    public int getSizeLimit();
+
+    /** Sets the expire time for the cache elements.
+     * If 0, elements never expire.
+     * @param expireTimeMillis The expire time for the cache elements
+     */
+    public void setExpireTime(long expireTimeMillis);
+
+    /** return the current expire time for the cache elements
+     * @return The expire time for the cache elements
+     */
+    public long getExpireTime();
+
+    /** Set whether or not the cache lines should use a soft reference to the 
data */
+    public void setUseSoftReference(boolean useSoftReference);
+
+    /** Return whether or not the cache lines should use a soft reference to 
the data */
+    public boolean getUseSoftReference();
+
+    public boolean getUseFileSystemStore();
+
+    /** Returns the number of elements currently in the cache
+     * @return The number of elements currently in the cache
+     */
+    public long size();
+
+    /** Returns a boolean specifying whether or not an element with the 
specified key is in the cache.
+     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
+     * @return True is the cache contains an element corresponding to the 
specified key, otherwise false
+     */
+    public boolean containsKey(Object key);
+
+    /**
+     * NOTE: this returns an unmodifiable copy of the keySet, so removing from 
here won't have an effect,
+     * and calling a remove while iterating through the set will not cause a 
concurrent modification exception.
+     * This behavior is necessary for now for the persisted cache feature.
+     */
+    public Set<? extends K> getCacheLineKeys();
+
+    public Collection<? extends Map<String, Object>> getLineInfos();
+
+    /** Adds an event listener for key removals */
+    public void addListener(CacheListener<K, V> listener);
+
+    /** Removes an event listener for key removals */
+    public void removeListener(CacheListener<K, V> listener);
+
+    /** Puts or loads the passed element into the cache
+     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
+     * @param value The value of the element
+     */
+    public V put(K key, V value);
+
+    public V putIfAbsent(K key, V value);
+
+    public V putIfAbsentAndGet(K key, V value);
+
+    /** Gets an element from the cache according to the specified key.
+     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
+     * @return The value of the element specified by the key
+     */
+    public V get(Object key);
+
+    /** Removes an element from the cache according to the specified key
+     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
+     * @return The value of the removed element specified by the key
+     */
+    public V remove(Object key);
+
+    public Collection<V> values();
+
+    public void clear();
+
+    /** Removes all elements from this cache */
+    public void erase();
+
+    public boolean isEmpty();
+
+    /** Returns the number of successful hits on the cache
+     * @return The number of successful cache hits
+     */
+    public long getHitCount();
+
+    public long getSizeInBytes();
+
+    /** Returns the number of cache misses from entries that are not found in 
the cache
+     * @return The number of cache misses
+     */
+    public long getMissCountNotFound();
+
+    /** Returns the number of cache misses from entries that are expired
+     * @return The number of cache misses
+     */
+    public long getMissCountExpired();
+
+    /** Returns the number of cache misses from entries that are have had the 
soft reference cleared out (by garbage collector and such)
+     * @return The number of cache misses
+     */
+    public long getMissCountSoftRef();
+
+    /** Returns the number of cache misses caused by any reason
+     * @return The number of cache misses
+     */
+    public long getMissCountTotal();
+
+    public long getRemoveHitCount();
+
+    public long getRemoveMissCount();
+
+    /** Clears the hit and miss counters
+     */
+    public void clearCounters();
+
+}
\ No newline at end of file

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/Cache.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheListener.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheListener.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheListener.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheListener.java
 Fri Dec 26 05:21:03 2014
@@ -20,9 +20,9 @@ package org.ofbiz.base.util.cache;
 
 public interface CacheListener<K, V> {
 
-    public void noteKeyRemoval(OFBizCache<K, V> cache, K key, V oldValue);
+    public void noteKeyRemoval(Cache<K, V> cache, K key, V oldValue);
 
-    public void noteKeyAddition(OFBizCache<K, V> cache, K key, V newValue);
+    public void noteKeyAddition(Cache<K, V> cache, K key, V newValue);
 
-    public void noteKeyUpdate(OFBizCache<K, V> cache, K key, V newValue, V 
oldValue);
+    public void noteKeyUpdate(Cache<K, V> cache, K key, V newValue, V 
oldValue);
 }

Added: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java?rev=1647934&view=auto
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
 (added)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
 Fri Dec 26 05:21:03 2014
@@ -0,0 +1,44 @@
+package org.ofbiz.base.util.cache;
+
+import java.util.Set;
+
+public interface CacheManager {
+
+    /** Removes all elements from this cache */
+    public void clearAllCaches();
+
+    public Set<String> getUtilCacheTableKeySet();
+
+    /** Getter for the name of the UtilCache instance.
+     * @return The name of the instance
+     */
+    public String getName();
+
+    /** Checks for a non-expired key in a specific cache */
+    public boolean validKey(String cacheName, Object key);
+
+    public void clearCachesThatStartWith(String startsWith);
+
+    public void clearCache(String cacheName);
+
+    public <K, V> Cache<K, V> getOrCreateCache(String name, int sizeLimit, int 
maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore, String... names);
+
+    public <K, V> Cache<K, V> createCache(String name, int sizeLimit, int 
maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore, String... names);
+
+    public <K, V> Cache<K, V> createCache(String name, int sizeLimit, int 
maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore);
+
+    public <K, V> Cache<K, V> createCache(String name, int sizeLimit, long 
expireTime, boolean useSoftReference);
+
+    public <K, V> Cache<K, V> createCache(String name, int sizeLimit, long 
expireTime);
+
+    public <K, V> Cache<K, V> createCache(int sizeLimit, long expireTime);
+
+    public <K, V> Cache<K, V> createCache(String name, boolean 
useSoftReference);
+
+    public <K, V> Cache<K, V> createCache(String name);
+
+    public <K, V> Cache<K, V> createCache();
+
+    public <K, V> Cache<K, V> findCache(String cacheName);
+
+}
\ No newline at end of file

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java?rev=1647934&view=auto
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
 (added)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
 Fri Dec 26 05:21:03 2014
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.ofbiz.base.util.cache;
+
+import org.ofbiz.base.lang.Factory;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilObject;
+
+public abstract class CacheManagerFactory implements Factory<CacheManager, 
String> {
+
+    public static final String module = CacheManagerFactory.class.getName();
+
+    public static CacheManager getCacheManager(String cacheManagerName) {
+        CacheManager cacheManager = null;
+        try {
+            cacheManager = 
UtilObject.getObjectFromFactory(CacheManagerFactory.class, cacheManagerName);
+        } catch (ClassNotFoundException e) {
+            Debug.logError(e, module);
+        }
+        return cacheManager;
+    }
+}

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheManagerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=1647934&r1=1647933&r2=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
 Fri Dec 26 05:21:03 2014
@@ -20,6 +20,8 @@ package org.ofbiz.base.util.cache;
 
 import java.util.Set;
 
+import org.ofbiz.base.util.cache.impl.OFBizCacheManager;
+
 /**
  * Generalized caching utility. Provides a number of caching features:
  * <ul>
@@ -36,7 +38,7 @@ public class UtilCache<K, V> {
 
     public static final String module = UtilCache.class.getName();
 
-    private static final OFBizCacheManager cacheManager = new 
OFBizCacheManager("cache");
+    private static final CacheManager cacheManager = 
CacheManagerFactory.getCacheManager("cache");
 
     public static Set<String> getUtilCacheTableKeySet() {
         return cacheManager.getUtilCacheTableKeySet();
@@ -44,7 +46,7 @@ public class UtilCache<K, V> {
 
     /** Checks for a non-expired key in a specific cache */
     public static boolean validKey(String cacheName, Object key) {
-        OFBizCache<?, ?> cache = findCache(cacheName);
+        Cache<?, ?> cache = findCache(cacheName);
         if (cache != null) {
             if (cache.containsKey(key))
                 return true;
@@ -65,43 +67,43 @@ public class UtilCache<K, V> {
         cacheManager.clearCachesThatStartWith(startsWith);
     }
 
-    public static <K, V> OFBizCache<K, V> getOrCreateUtilCache(String name, 
int sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, 
boolean useFileSystemStore, String... names) {
-        return cacheManager.getOrCreateUtilCache(name, sizeLimit, maxInMemory, 
expireTime, useSoftReference, useFileSystemStore, names);
+    public static <K, V> Cache<K, V> getOrCreateUtilCache(String name, int 
sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore, String... names) {
+        return cacheManager.getOrCreateCache(name, sizeLimit, maxInMemory, 
expireTime, useSoftReference, useFileSystemStore, names);
     }
 
-    public static <K, V> OFBizCache<K, V> createUtilCache(String name, int 
sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore, String... names) {
-        return cacheManager.createUtilCache(name, sizeLimit, maxInMemory, 
expireTime, useSoftReference, useFileSystemStore, names);
+    public static <K, V> Cache<K, V> createUtilCache(String name, int 
sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore, String... names) {
+        return cacheManager.createCache(name, sizeLimit, maxInMemory, 
expireTime, useSoftReference, useFileSystemStore, names);
     }
 
-    public static <K, V> OFBizCache<K, V> createUtilCache(String name, int 
sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore) {
-        return cacheManager.createUtilCache(name, sizeLimit, maxInMemory, 
expireTime, useSoftReference, useFileSystemStore);
+    public static <K, V> Cache<K, V> createUtilCache(String name, int 
sizeLimit, int maxInMemory, long expireTime, boolean useSoftReference, boolean 
useFileSystemStore) {
+        return cacheManager.createCache(name, sizeLimit, maxInMemory, 
expireTime, useSoftReference, useFileSystemStore);
     }
 
-    public static <K,V> OFBizCache<K, V> createUtilCache(String name, int 
sizeLimit, long expireTime, boolean useSoftReference) {
-        return cacheManager.createUtilCache(name, sizeLimit, expireTime, 
useSoftReference);
+    public static <K,V> Cache<K, V> createUtilCache(String name, int 
sizeLimit, long expireTime, boolean useSoftReference) {
+        return cacheManager.createCache(name, sizeLimit, expireTime, 
useSoftReference);
     }
 
-    public static <K,V> OFBizCache<K, V> createUtilCache(String name, int 
sizeLimit, long expireTime) {
-        return cacheManager.createUtilCache(name, sizeLimit, expireTime);
+    public static <K,V> Cache<K, V> createUtilCache(String name, int 
sizeLimit, long expireTime) {
+        return cacheManager.createCache(name, sizeLimit, expireTime);
     }
 
-    public static <K,V> OFBizCache<K, V> createUtilCache(int sizeLimit, long 
expireTime) {
-        return cacheManager.createUtilCache(sizeLimit, expireTime);
+    public static <K,V> Cache<K, V> createUtilCache(int sizeLimit, long 
expireTime) {
+        return cacheManager.createCache(sizeLimit, expireTime);
     }
 
-    public static <K,V> OFBizCache<K, V> createUtilCache(String name, boolean 
useSoftReference) {
-        return cacheManager.createUtilCache(name, useSoftReference);
+    public static <K,V> Cache<K, V> createUtilCache(String name, boolean 
useSoftReference) {
+        return cacheManager.createCache(name, useSoftReference);
     }
 
-    public static <K,V> OFBizCache<K, V> createUtilCache(String name) {
-        return cacheManager.createUtilCache(name);
+    public static <K,V> Cache<K, V> createUtilCache(String name) {
+        return cacheManager.createCache(name);
     }
 
-    public static <K,V> OFBizCache<K, V> createUtilCache() {
-        return cacheManager.createUtilCache();
+    public static <K,V> Cache<K, V> createUtilCache() {
+        return cacheManager.createCache();
     }
 
-    public static <K, V> OFBizCache<K, V> findCache(String cacheName) {
+    public static <K, V> Cache<K, V> findCache(String cacheName) {
         return cacheManager.findCache(cacheName);
     }
 

Copied: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheLine.java
 (from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java)
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheLine.java?p2=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheLine.java&p1=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java&r1=1647466&r2=1647934&rev=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheLine.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheLine.java
 Fri Dec 26 05:21:03 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  
*******************************************************************************/
-package org.ofbiz.base.util.cache;
+package org.ofbiz.base.util.cache.impl;
 
 import org.ofbiz.base.concurrent.ExecutionPool;
 

Copied: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheSoftReference.java
 (from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheSoftReference.java)
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheSoftReference.java?p2=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheSoftReference.java&p1=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheSoftReference.java&r1=1647466&r2=1647934&rev=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/CacheSoftReference.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/CacheSoftReference.java
 Fri Dec 26 05:21:03 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  
*******************************************************************************/
-package org.ofbiz.base.util.cache;
+package org.ofbiz.base.util.cache.impl;
 
 import java.io.Serializable;
 

Copied: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/HardRefCacheLine.java
 (from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/HardRefCacheLine.java)
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/HardRefCacheLine.java?p2=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/HardRefCacheLine.java&p1=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/HardRefCacheLine.java&r1=1647466&r2=1647934&rev=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/HardRefCacheLine.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/HardRefCacheLine.java
 Fri Dec 26 05:21:03 2014
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  
*******************************************************************************/
-package org.ofbiz.base.util.cache;
+package org.ofbiz.base.util.cache.impl;
+
 
 public abstract class HardRefCacheLine<V> extends CacheLine<V> {
     public final V value;

Copied: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmRecordManager.java
 (from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmRecordManager.java)
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmRecordManager.java?p2=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmRecordManager.java&p1=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmRecordManager.java&r1=1647466&r2=1647934&rev=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmRecordManager.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmRecordManager.java
 Fri Dec 26 05:21:03 2014
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  
*******************************************************************************/
-package org.ofbiz.base.util.cache;
+package org.ofbiz.base.util.cache.impl;
 
 import java.io.IOException;
 
+
 import jdbm.RecordManager;
 import jdbm.helper.ISerializationHandler;
 import jdbm.helper.Serializer;

Copied: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmSerializer.java
 (from r1647466, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmSerializer.java)
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmSerializer.java?p2=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmSerializer.java&p1=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmSerializer.java&r1=1647466&r2=1647934&rev=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/JdbmSerializer.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/JdbmSerializer.java
 Fri Dec 26 05:21:03 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  
*******************************************************************************/
-package org.ofbiz.base.util.cache;
+package org.ofbiz.base.util.cache.impl;
 
 import java.io.IOException;
 

Copied: 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCache.java
 (from r1647483, 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCache.java)
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCache.java?p2=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCache.java&p1=ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCache.java&r1=1647483&r2=1647934&rev=1647934&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/OFBizCache.java
 (original)
+++ 
ofbiz/branches/OFBIZ-4098-make-cache-pluggable/framework/base/src/org/ofbiz/base/util/cache/impl/OFBizCache.java
 Fri Dec 26 05:21:03 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  
*******************************************************************************/
-package org.ofbiz.base.util.cache;
+package org.ofbiz.base.util.cache.impl;
 
 import java.io.IOException;
 import java.io.NotSerializableException;
@@ -47,6 +47,7 @@ import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilObject;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.cache.Cache;
 import org.ofbiz.base.util.cache.CacheListener;
 
 import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
@@ -65,7 +66,7 @@ import com.googlecode.concurrentlinkedha
  *
  */
 @SuppressWarnings("serial")
-public class OFBizCache<K, V> implements Serializable, 
EvictionListener<Object, CacheLine<V>> {
+public class OFBizCache<K, V> implements Serializable, 
EvictionListener<Object, CacheLine<V>>, Cache<K, V> {
 
     public static final String module = OFBizCache.class.getName();
 
@@ -229,10 +230,10 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    public Object getCacheLineTable() {
-        throw new UnsupportedOperationException();
-    }
-
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#isEmpty()
+     */
+    @Override
     public boolean isEmpty() {
         if (fileTable != null) {
             try {
@@ -248,18 +249,26 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /** Puts or loads the passed element into the cache
-     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
-     * @param value The value of the element
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#put(K, V)
      */
+    @Override
     public V put(K key, V value) {
         return putInternal(key, value, expireTimeNanos);
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#putIfAbsent(K, V)
+     */
+    @Override
     public V putIfAbsent(K key, V value) {
         return putIfAbsentInternal(key, value, expireTimeNanos);
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#putIfAbsentAndGet(K, V)
+     */
+    @Override
     public V putIfAbsentAndGet(K key, V value) {
         V cachedValue = putIfAbsent(key, value);
         return (cachedValue != null? cachedValue: value);
@@ -405,10 +414,10 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /** Gets an element from the cache according to the specified key.
-     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
-     * @return The value of the element specified by the key
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#get(java.lang.Object)
      */
+    @Override
     public V get(Object key) {
         boolean countGet = true;
         Object nulledKey = fromKey(key);
@@ -441,6 +450,10 @@ public class OFBizCache<K, V> implements
         return line != null ? line.getValue() : null;
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#values()
+     */
+    @Override
     public Collection<V> values() {
         if (fileTable != null) {
             List<V> values = new LinkedList<V>();
@@ -491,6 +504,10 @@ public class OFBizCache<K, V> implements
         }
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getSizeInBytes()
+     */
+    @Override
     public long getSizeInBytes() {
         long totalSize = 0;
         if (fileTable != null) {
@@ -515,10 +532,10 @@ public class OFBizCache<K, V> implements
         return totalSize;
     }
 
-    /** Removes an element from the cache according to the specified key
-     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
-     * @return The value of the removed element specified by the key
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#remove(java.lang.Object)
      */
+    @Override
     public V remove(Object key) {
         return this.removeInternal(key, true);
     }
@@ -585,7 +602,10 @@ public class OFBizCache<K, V> implements
         noteRemoval(UtilGenerics.<K>cast(key), existingCacheLine.getValue());
     }
 
-    /** Removes all elements from this cache */
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#erase()
+     */
+    @Override
     public synchronized void erase() {
         if (fileTable != null) {
             // FIXME: erase from memory too
@@ -620,63 +640,83 @@ public class OFBizCache<K, V> implements
         }
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#clear()
+     */
+    @Override
     public void clear() {
         erase();
         clearCounters();
     }
 
-    /** Getter for the name of the UtilCache instance.
-     * @return The name of the instance
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getName()
      */
+    @Override
     public String getName() {
         return this.name;
     }
 
-    /** Returns the number of successful hits on the cache
-     * @return The number of successful cache hits
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getHitCount()
      */
+    @Override
     public long getHitCount() {
         return this.hitCount.get();
     }
 
-    /** Returns the number of cache misses from entries that are not found in 
the cache
-     * @return The number of cache misses
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getMissCountNotFound()
      */
+    @Override
     public long getMissCountNotFound() {
         return this.missCountNotFound.get();
     }
 
-    /** Returns the number of cache misses from entries that are expired
-     * @return The number of cache misses
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getMissCountExpired()
      */
+    @Override
     public long getMissCountExpired() {
         return this.missCountExpired.get();
     }
 
-    /** Returns the number of cache misses from entries that are have had the 
soft reference cleared out (by garbage collector and such)
-     * @return The number of cache misses
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getMissCountSoftRef()
      */
+    @Override
     public long getMissCountSoftRef() {
         return this.missCountSoftRef.get();
     }
 
-    /** Returns the number of cache misses caused by any reason
-     * @return The number of cache misses
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getMissCountTotal()
      */
+    @Override
     public long getMissCountTotal() {
         return getMissCountSoftRef() + getMissCountNotFound() + 
getMissCountExpired();
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getRemoveHitCount()
+     */
+    @Override
     public long getRemoveHitCount() {
         return this.removeHitCount.get();
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getRemoveMissCount()
+     */
+    @Override
     public long getRemoveMissCount() {
         return this.removeMissCount.get();
     }
 
-    /** Clears the hit and miss counters
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#clearCounters()
      */
+    @Override
     public void clearCounters() {
         this.hitCount.set(0);
         this.missCountNotFound.set(0);
@@ -686,6 +726,10 @@ public class OFBizCache<K, V> implements
         this.removeMissCount.set(0);
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#setMaxInMemory(int)
+     */
+    @Override
     public void setMaxInMemory(int newInMemory) {
         this.maxInMemory = newInMemory;
         Map<Object, CacheLine<V>> oldmap = this.memoryTable;
@@ -706,22 +750,34 @@ public class OFBizCache<K, V> implements
         this.memoryTable.putAll(oldmap);
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getMaxInMemory()
+     */
+    @Override
     public int getMaxInMemory() {
         return maxInMemory;
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#setSizeLimit(int)
+     */
+    @Override
     public void setSizeLimit(int newSizeLimit) {
         this.sizeLimit = newSizeLimit;
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getSizeLimit()
+     */
+    @Override
     public int getSizeLimit() {
         return sizeLimit;
     }
 
-    /** Sets the expire time for the cache elements.
-     * If 0, elements never expire.
-     * @param expireTimeMillis The expire time for the cache elements
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#setExpireTime(long)
      */
+    @Override
     public void setExpireTime(long expireTimeMillis) {
         // if expire time was <= 0 and is now greater, fill expire table now
         if (expireTimeMillis > 0) {
@@ -735,14 +791,18 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /** return the current expire time for the cache elements
-     * @return The expire time for the cache elements
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getExpireTime()
      */
+    @Override
     public long getExpireTime() {
         return TimeUnit.MILLISECONDS.convert(expireTimeNanos, 
TimeUnit.NANOSECONDS);
     }
 
-    /** Set whether or not the cache lines should use a soft reference to the 
data */
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#setUseSoftReference(boolean)
+     */
+    @Override
     public void setUseSoftReference(boolean useSoftReference) {
         if (this.useSoftReference != useSoftReference) {
             this.useSoftReference = useSoftReference;
@@ -752,18 +812,26 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /** Return whether or not the cache lines should use a soft reference to 
the data */
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getUseSoftReference()
+     */
+    @Override
     public boolean getUseSoftReference() {
         return this.useSoftReference;
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getUseFileSystemStore()
+     */
+    @Override
     public boolean getUseFileSystemStore() {
         return this.useFileSystemStore;
     }
 
-    /** Returns the number of elements currently in the cache
-     * @return The number of elements currently in the cache
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#size()
      */
+    @Override
     public long size() {
         if (fileTable != null) {
             int size = 0;
@@ -783,10 +851,10 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /** Returns a boolean specifying whether or not an element with the 
specified key is in the cache.
-     * @param key The key for the element, used to reference it in the 
hashtables and LRU linked list
-     * @return True is the cache contains an element corresponding to the 
specified key, otherwise false
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#containsKey(java.lang.Object)
      */
+    @Override
     public boolean containsKey(Object key) {
         Object nulledKey = fromKey(key);
         CacheLine<V> line = memoryTable.get(nulledKey);
@@ -812,11 +880,10 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /**
-     * NOTE: this returns an unmodifiable copy of the keySet, so removing from 
here won't have an effect,
-     * and calling a remove while iterating through the set will not cause a 
concurrent modification exception.
-     * This behavior is necessary for now for the persisted cache feature.
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getCacheLineKeys()
      */
+    @Override
     public Set<? extends K> getCacheLineKeys() {
         // note that this must be a HashSet and not a FastSet in order to have 
a null value
         Set<Object> keys;
@@ -869,6 +936,10 @@ public class OFBizCache<K, V> implements
         return lineInfo;
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#getLineInfos()
+     */
+    @Override
     public Collection<? extends Map<String, Object>> getLineInfos() {
         List<Map<String, Object>> lineInfos = new LinkedList<Map<String, 
Object>>();
         int keyIndex = 0;
@@ -914,16 +985,25 @@ public class OFBizCache<K, V> implements
         }
     }
 
-    /** Adds an event listener for key removals */
+    /* (non-Javadoc)
+     * @see 
org.ofbiz.base.util.cache.Cache#addListener(org.ofbiz.base.util.cache.CacheListener)
+     */
+    @Override
     public void addListener(CacheListener<K, V> listener) {
         listeners.add(listener);
     }
 
-    /** Removes an event listener for key removals */
+    /* (non-Javadoc)
+     * @see 
org.ofbiz.base.util.cache.Cache#removeListener(org.ofbiz.base.util.cache.CacheListener)
+     */
+    @Override
     public void removeListener(CacheListener<K, V> listener) {
         listeners.remove(listener);
     }
 
+    /* (non-Javadoc)
+     * @see org.ofbiz.base.util.cache.Cache#onEviction(java.lang.Object, 
org.ofbiz.base.util.cache.CacheLine)
+     */
     @Override
     public void onEviction(Object key, CacheLine<V> value) {
         ExecutionPool.removePulse(value);


Reply via email to