Clover coverage report - JFox Service-Oriented Application Framework - 1.0 Coverage timestamp: 星期一 八月 21 2006 22:56:01 CST FRAMES NO FRAMES |
file stats: | LOC: | 89 |  | 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 |  |
      * @(#)OSCacheServiceProvider.java
3 |  |
      *
4 |  |
      * JFoxSOAF, Service-Oriented Application Framework
5 |  |
      *
6 |  |
      * Copyright(c) JFoxSOAF Team
7 |  |
      *
8 |  |
      * Licensed under the GNU LGPL, Version 2.1 (the "License");
9 |  |
      * you may not use this file except in compliance with the License.
10 |  |
      * You may obtain a copy of the License at
11 |  |
      *
12 |  |
      * http://www.gnu.org/copyleft/lesser.html
13 |  |
      *
14 |  |
      * Unless required by applicable law or agreed to in writing, software
15 |  |
      * distributed under the License is distributed on an "AS IS" BASIS,
16 |  |
      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 |  |
      * See the License for the specific language governing permissions and
18 |  |
      * limitations under the License.
19 |  |
      *
20 |  |
      * For more information, please visit:
21 |  |
      * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22 |  |
      * http://www.huihoo.org/jfox/jfoxsoaf
23 |  |
      */
24 |  |
     package org.huihoo.jfox.soaf.services.cache;
25 |  |
26 |  |
     import java.util.Properties;
27 |  |
28 |  |
     import org.huihoo.jfox.soaf.exception.CacheServiceException;
29 |  |
     import org.huihoo.jfox.soaf.util.resource.PropertiesHelper;
30 |  |
     import org.huihoo.jfox.soaf.util.resource.StringHelper;
31 |  |
32 |  |
     import com.opensymphony.oscache.base.CacheEntry;
33 |  |
     import com.opensymphony.oscache.base.Config;
34 |  |
35 |  |
     /**
36 |  |
      * <p>
37 |  |
      * OSCacheService for pluggable cache.
38 |  |
      * </p>
39 |  |
      *
40 |  |
      * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
41 |  |
      * @author <a href="mailto:m.bogaert@intrasoft.be">Mathias Bogaert </a>
42 |  |
      * @version $Revision: 1.1 $ $Date: 2005/05/22 06:48:52 $
43 |  |
      * @version Revision: 1.0
44 |  |
      */
45 |  |
46 |  |
     public class OSCacheServiceProvider implements CacheServiceProvider {
47 |  |
48 |  |
         /**
49 |  |
          * The OSCache refresh period property suffix.
50 |  |
          */
51 |  |
         public static final String OSCACHE_REFRESH_PERIOD = "refresh.period";
52 |  |
53 |  |
         /**
54 |  |
          * The OSCache CRON expression property suffix.
55 |  |
          */
56 |  |
         public static final String OSCACHE_CRON = "cron";
57 |  |
58 |  |
         /**
59 |  |
          * The OSCache cache capacity property suffix.
60 |  |
          */
61 |  |
         public static final String OSCACHE_CAPACITY = "capacity";
62 |  |
63 |  |
         private static final Properties OSCACHE_PROPERTIES = new Config()
64 |  |
                 .getProperties();
65 |  |
66 |  |
         /**
67 |  |
          * @see org.huihoo.jfox.soaf.services.cache.CacheServiceProvider#buildCache(java.lang.String,
68 |  |
          *      java.util.Properties)
69 |  |
          */
70 | 0 |
         public CacheService buildCacheService(String regionName,
71 |  |
                 Properties properties) throws CacheServiceException {
72 | 0 |
             int refreshPeriod = PropertiesHelper.getInt(StringHelper.qualify(
73 |  |
                     regionName, OSCACHE_REFRESH_PERIOD), OSCACHE_PROPERTIES,
74 |  |
                     CacheEntry.INDEFINITE_EXPIRY);
75 | 0 |
             String cron = OSCACHE_PROPERTIES.getProperty(StringHelper.qualify(
76 |  |
                     regionName, OSCACHE_CRON));
77 |  |
78 |  |
             // construct the cache
79 | 0 |
             OSCacheServiceImpl cache = new OSCacheServiceImpl(refreshPeriod, cron);
80 |  |
81 | 0 |
             Integer capacity = PropertiesHelper.getInteger(StringHelper.qualify(
82 |  |
                     regionName, OSCACHE_CAPACITY), OSCACHE_PROPERTIES);
83 | 0 |
             if (capacity != null)
84 | 0 |
                 cache.setCacheCapacity(capacity.intValue());
85 |  |
86 | 0 |
             return cache;
87 |  |
         }
88 |  |
89 |  |
     }