Clover coverage report - JFox Service-Oriented Application Framework - 1.0-M3 Coverage timestamp: 星期日 五月 22 2005 15:41:44 CST FRAMES NO FRAMES |
file stats: | LOC: | 72 |  | Methods: | 1
| NCLOC: | 27 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
OSCacheServiceProvider.java | 0% | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Created on 2005-5-8
3 |  |
      *
4 |  |
      * TODO To change the template for this generated file go to
5 |  |
      * Window - Preferences - Java - Code Style - Code Templates
6 |  |
      */
7 |  |
     package org.huihoo.jfox.soaf.services.cache;
8 |  |
9 |  |
     import java.util.Properties;
10 |  |
11 |  |
     import org.huihoo.jfox.soaf.exception.CacheServiceException;
12 |  |
     import org.huihoo.jfox.soaf.util.resource.PropertiesHelper;
13 |  |
     import org.huihoo.jfox.soaf.util.resource.StringHelper;
14 |  |
15 |  |
     import com.opensymphony.oscache.base.CacheEntry;
16 |  |
     import com.opensymphony.oscache.base.Config;
17 |  |
18 |  |
     /**
19 |  |
      * <p>
20 |  |
      * OSCacheService for pluggable cache.
21 |  |
      * </p>
22 |  |
      *
23 |  |
      * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
24 |  |
      * @author <a href="mailto:m.bogaert@intrasoft.be">Mathias Bogaert </a>
25 |  |
      * @version $Revision: 1.1 $ $Date: 2005/05/22 06:48:52 $
26 |  |
      * @version Revision: 1.0
27 |  |
      */
28 |  |
29 |  |
     public class OSCacheServiceProvider implements CacheServiceProvider {
30 |  |
31 |  |
         /**
32 |  |
          * The OSCache refresh period property suffix.
33 |  |
          */
34 |  |
         public static final String OSCACHE_REFRESH_PERIOD = "refresh.period";
35 |  |
36 |  |
         /**
37 |  |
          * The OSCache CRON expression property suffix.
38 |  |
          */
39 |  |
         public static final String OSCACHE_CRON = "cron";
40 |  |
41 |  |
         /**
42 |  |
          * The OSCache cache capacity property suffix.
43 |  |
          */
44 |  |
         public static final String OSCACHE_CAPACITY = "capacity";
45 |  |
46 |  |
         private static final Properties OSCACHE_PROPERTIES = new Config()
47 |  |
                 .getProperties();
48 |  |
49 |  |
         /**
50 |  |
          * @see org.huihoo.jfox.soaf.services.cache.CacheServiceProvider#buildCache(java.lang.String,
51 |  |
          *      java.util.Properties)
52 |  |
          */
53 | 0 |
         public CacheService buildCacheService(String regionName,
54 |  |
                 Properties properties) throws CacheServiceException {
55 | 0 |
             int refreshPeriod = PropertiesHelper.getInt(StringHelper.qualify(
56 |  |
                     regionName, OSCACHE_REFRESH_PERIOD), OSCACHE_PROPERTIES,
57 |  |
                     CacheEntry.INDEFINITE_EXPIRY);
58 | 0 |
             String cron = OSCACHE_PROPERTIES.getProperty(StringHelper.qualify(
59 |  |
                     regionName, OSCACHE_CRON));
60 |  |
61 |  |
             // construct the cache
62 | 0 |
             OSCacheServiceImpl cache = new OSCacheServiceImpl(refreshPeriod, cron);
63 |  |
64 | 0 |
             Integer capacity = PropertiesHelper.getInteger(StringHelper.qualify(
65 |  |
                     regionName, OSCACHE_CAPACITY), OSCACHE_PROPERTIES);
66 | 0 |
             if (capacity != null)
67 | 0 |
                 cache.setCacheCapacity(capacity.intValue());
68 |  |
69 | 0 |
             return cache;
70 |  |
         }
71 |  |
72 |  |
     }