EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.util]

COVERAGE SUMMARY FOR SOURCE FILE [ImageCache.java]

nameclass, %method, %block, %line, %
ImageCache.java100% (1/1)100% (5/5)76%  (47/62)81%  (13/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImageCache100% (1/1)100% (5/5)76%  (47/62)81%  (13/16)
readCache (): ImageHolder 100% (1/1)50%  (15/30)57%  (4/7)
<static initializer> 100% (1/1)100% (4/4)100% (1/1)
ImageCache (Cache, int): void 100% (1/1)100% (9/9)100% (4/4)
removeCache (): void 100% (1/1)100% (8/8)100% (2/2)
writeCache (ImageHolder): void 100% (1/1)100% (11/11)100% (2/2)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.util;
16 
17import org.apache.commons.logging.Log;
18import org.apache.commons.logging.LogFactory;
19 
20import net.sf.ehcache.Cache;
21import net.sf.ehcache.CacheException;
22import net.sf.ehcache.Element;
23 
24public class ImageCache
25{
26        static private final Log        _logger = LogFactory.getLog(ImageCache.class);
27 
28        public ImageCache(Cache cache, int id)
29        {
30                _cache = cache;
31                _id = id;
32        }
33 
34        synchronized public void        removeCache()
35        {
36                _cache.remove(_id);
37        }
38                
39        synchronized public void        writeCache(ImageHolder image)
40        {
41                _cache.put(new Element(_id, image));
42        }
43        
44        synchronized public ImageHolder        readCache()
45        {
46                try
47                {
48                        Element item = _cache.get(_id);
49                        if (item == null)
50                        {
51                                return null;
52                        }
53                        return (ImageHolder) item.getValue();
54                }
55                catch (CacheException e)
56                {
57                        _logger.error("readCache() id " + _id, e);
58                        return null;
59                }
60        }
61        
62        private final Cache        _cache;
63        private final int        _id;
64}

[all classes][net.sourceforge.hiveboard.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov