%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory |
|
|
1 | package org.apache.jcs.auxiliary.disk.indexed; |
|
2 | ||
3 | /* |
|
4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
5 | * or more contributor license agreements. See the NOTICE file |
|
6 | * distributed with this work for additional information |
|
7 | * regarding copyright ownership. The ASF licenses this file |
|
8 | * to you under the Apache License, Version 2.0 (the |
|
9 | * "License"); you may not use this file except in compliance |
|
10 | * with the License. You may obtain a copy of the License at |
|
11 | * |
|
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
13 | * |
|
14 | * Unless required by applicable law or agreed to in writing, |
|
15 | * software distributed under the License is distributed on an |
|
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
17 | * KIND, either express or implied. See the License for the |
|
18 | * specific language governing permissions and limitations |
|
19 | * under the License. |
|
20 | */ |
|
21 | ||
22 | import org.apache.commons.logging.Log; |
|
23 | import org.apache.commons.logging.LogFactory; |
|
24 | import org.apache.jcs.auxiliary.AuxiliaryCache; |
|
25 | import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes; |
|
26 | import org.apache.jcs.auxiliary.AuxiliaryCacheFactory; |
|
27 | import org.apache.jcs.engine.behavior.ICompositeCacheManager; |
|
28 | ||
29 | /** |
|
30 | * Creates disk cache instances. |
|
31 | */ |
|
32 | 79 | public class IndexedDiskCacheFactory |
33 | implements AuxiliaryCacheFactory |
|
34 | { |
|
35 | 116 | private final static Log log = LogFactory.getLog( IndexedDiskCacheFactory.class ); |
36 | ||
37 | private String name; |
|
38 | ||
39 | /** |
|
40 | * Get an instance of the IndexDiskCacheManager for the attributes and then |
|
41 | * get an IndexedDiskCache from the manager. |
|
42 | * <p> |
|
43 | * The manager is a singleton. |
|
44 | * <p> |
|
45 | * One disk cache is returned per region fromt he maanger. |
|
46 | * <p> |
|
47 | * @param iaca |
|
48 | * @param cacheMgr |
|
49 | * This allows auxiliaries to reference the manager without |
|
50 | * assuming that it is a singleton. This will allow JCS to be a |
|
51 | * nonsingleton. Also, it makes it easier to test. |
|
52 | * @return AuxiliaryCache |
|
53 | */ |
|
54 | public AuxiliaryCache createCache( AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr ) |
|
55 | { |
|
56 | 209 | IndexedDiskCacheAttributes idca = (IndexedDiskCacheAttributes) iaca; |
57 | 209 | if ( log.isDebugEnabled() ) |
58 | { |
|
59 | 0 | log.debug( "Creating DiskCache for attributes = " + idca ); |
60 | } |
|
61 | 209 | IndexedDiskCacheManager dcm = IndexedDiskCacheManager.getInstance( idca ); |
62 | 209 | return dcm.getCache( idca ); |
63 | } |
|
64 | ||
65 | /** |
|
66 | * Gets the name attribute of the DiskCacheFactory object |
|
67 | * <p> |
|
68 | * @return The name value |
|
69 | */ |
|
70 | public String getName() |
|
71 | { |
|
72 | 79 | return this.name; |
73 | } |
|
74 | ||
75 | /** |
|
76 | * Sets the name attribute of the DiskCacheFactory object |
|
77 | * <p> |
|
78 | * @param name |
|
79 | * The new name value |
|
80 | */ |
|
81 | public void setName( String name ) |
|
82 | { |
|
83 | 79 | this.name = name; |
84 | 79 | } |
85 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |