Clover coverage report - JFox Service-Oriented Application Framework - 1.0-RC1
Coverage timestamp: 星期五 八月 19 2005 13:21:55 CST
file stats: LOC: 105   Methods: 5
NCLOC: 44   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
JCSCacheServiceImpl.java - 0% 0% 0%
coverage
 1   
 /**
 2   
  * @(#)JCSCacheServiceImpl.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   
 
 25   
 package org.huihoo.jfox.soaf.services.cache;
 26   
 
 27   
 import org.apache.commons.logging.Log;
 28   
 import org.apache.commons.logging.LogFactory;
 29   
 import org.apache.jcs.JCS;
 30   
 import org.apache.jcs.access.exception.CacheException;
 31   
 import org.huihoo.jfox.soaf.exception.CacheServiceException;
 32   
 
 33   
 /**
 34   
  * <p>
 35   
  * Support for Apache Turbine's JCS
 36   
  * </p>
 37   
  * 
 38   
  * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
 39   
  * @author <a href="mailto:m.bogaert@intrasoft.be">Mathias Bogaert </a>
 40   
  * @version $Revision: 1.1 $ $Date: 2005/05/22 06:48:52 $
 41   
  * @version Revision: 1.0
 42   
  */
 43   
 
 44   
 public class JCSCacheServiceImpl implements CacheService {
 45   
 
 46   
     private static final Log log = LogFactory.getLog(JCSCacheServiceImpl.class);
 47   
 
 48   
     private JCS cache;
 49   
 
 50   
     /**
 51   
      * Constructor with given param.
 52   
      */
 53  0
     public JCSCacheServiceImpl(String regionName) throws CacheServiceException {
 54  0
         try {
 55  0
             cache = JCS.getInstance(regionName);
 56   
         } catch (CacheException e) {
 57  0
             log.error("could not create JCS region", e);
 58  0
             throw new CacheServiceException(e);
 59   
         }
 60   
     }
 61   
 
 62   
     /**
 63   
      * @see org.huihoo.jfox.soaf.services.cache.CacheService#get(java.lang.Object)
 64   
      */
 65  0
     public Object get(Object key) throws CacheServiceException {
 66  0
         return cache.get(key);
 67   
     }
 68   
 
 69   
     /**
 70   
      * @see org.huihoo.jfox.soaf.services.cache.CacheService#put(java.lang.Object,
 71   
      *      java.lang.Object)
 72   
      */
 73  0
     public void put(Object key, Object value) throws CacheServiceException {
 74  0
         try {
 75  0
             cache.put(key, value);
 76   
         } catch (CacheException e) {
 77  0
             log.error("could not add to JCS region", e);
 78  0
             throw new CacheServiceException(e);
 79   
         }
 80   
     }
 81   
 
 82   
     /**
 83   
      * @see org.huihoo.jfox.soaf.services.cache.CacheService#remove(java.lang.Object)
 84   
      */
 85  0
     public void remove(Object key) throws CacheServiceException {
 86  0
         try {
 87  0
             cache.remove(key);
 88   
         } catch (CacheException e) {
 89  0
             log.error("could not remove from JCS region", e);
 90  0
             throw new CacheServiceException(e);
 91   
         }
 92   
     }
 93   
 
 94   
     /**
 95   
      * @see org.huihoo.jfox.soaf.services.cache.CacheService#clear()
 96   
      */
 97  0
     public void clear() throws CacheServiceException {
 98  0
         try {
 99  0
             cache.remove();
 100   
         } catch (CacheException e) {
 101  0
             log.error("could not remove from JCS region", e);
 102  0
             throw new CacheServiceException(e);
 103   
         }
 104   
     }
 105   
 }