1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.cache.config

File CacheConfiguration.java

 

Coverage histogram

../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

0
7
7
1
118
36
7
1
1
7
1

Classes

Class Line # Actions
CacheConfiguration 40 7 0% 7 2
0.8571428785.7%
 

Contributing tests

This file is covered by 153 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.cache.config;
21   
22    import java.util.HashMap;
23   
24    import org.xwiki.cache.eviction.EntryEvictionConfiguration;
25   
26    /**
27    * Contains all informations used to create the cache.
28    * <p>
29    * A configuration identifier can be defined.
30    * <p>
31    * It can be used to be the cache unique identifier for clustering process.
32    * <p>
33    * This is also used by implementations to associate the cache with a configuration file which overwrite the
34    * configuration it contains. This way any cache can be tuned in a particular installation with option specifics to
35    * chosen cache implementation.
36    *
37    * @version $Id: 15a2f06d4864cc3bd18c207da40ee904c43c3804 $
38    * @see org.xwiki.cache.eviction.EntryEvictionConfiguration
39    */
 
40    public class CacheConfiguration extends HashMap<String, Object>
41    {
42    /**
43    * Since this class is a Map it needs to be serializable and thus have a unique id for Serialization.
44    */
45    private static final long serialVersionUID = -7298684313672163845L;
46   
47    /**
48    * The configuration identifier.
49    */
50    private String configurationId;
51   
52    /**
53    * The default constructor.
54    */
 
55  271 toggle public CacheConfiguration()
56    {
57   
58    }
59   
60    /**
61    * @param configurationId the configuration identifier
62    * @since 4.3M1
63    */
 
64  1246 toggle public CacheConfiguration(String configurationId)
65    {
66  1246 this(configurationId, null);
67    }
68   
69    /**
70    * Creates CacheConfiguration instance with given eviction configuration.
71    *
72    * @param evictionConfiguration describes details of entry eviction method.
73    * @since 4.3M1
74    */
 
75  0 toggle public CacheConfiguration(EntryEvictionConfiguration evictionConfiguration)
76    {
77  0 this(null, evictionConfiguration);
78    }
79   
80    /**
81    * Creates CacheConfiguration instance with given eviction configuration and id.
82    *
83    * @param evictionConfiguration describes details of entry eviction method.
84    * @param configurationId the configuration identifier.
85    * @since 4.3M1
86    */
 
87  1246 toggle public CacheConfiguration(String configurationId, EntryEvictionConfiguration evictionConfiguration)
88    {
89  1246 setEvictionConfiguration(evictionConfiguration);
90  1246 setConfigurationId(configurationId);
91    }
92   
93    /**
94    * Sets details of entry eviction method.
95    *
96    * @param evictionConfiguration describes details of entry eviction method.
97    */
 
98  1246 toggle private void setEvictionConfiguration(EntryEvictionConfiguration evictionConfiguration)
99    {
100  1246 put(EntryEvictionConfiguration.CONFIGURATIONID, evictionConfiguration);
101    }
102   
103    /**
104    * @param configurationId the configuration identifier.
105    */
 
106  1521 toggle public void setConfigurationId(String configurationId)
107    {
108  1521 this.configurationId = configurationId;
109    }
110   
111    /**
112    * @return the configuration identifier.
113    */
 
114  2719 toggle public String getConfigurationId()
115    {
116  2719 return this.configurationId;
117    }
118    }