KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > loader > FileCacheLoaderConfig


1 package org.jboss.cache.loader;
2
3 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
4 import org.jboss.cache.config.Dynamic;
5
6 import java.util.Properties JavaDoc;
7
8 public class FileCacheLoaderConfig extends IndividualCacheLoaderConfig
9 {
10    private static final long serialVersionUID = 4626734068542420865L;
11
12    private String JavaDoc location;
13    @Dynamic
14    private boolean checkCharacterPortability = true;
15
16    public FileCacheLoaderConfig()
17    {
18       setClassName(FileCacheLoader.class.getName());
19    }
20
21    /**
22     * For use by {@link FileCacheLoader}.
23     *
24     * @param base generic config object created by XML parsing.
25     */

26    FileCacheLoaderConfig(IndividualCacheLoaderConfig base)
27    {
28       setClassName(FileCacheLoader.class.getName());
29       populateFromBaseConfig(base);
30    }
31
32    public String JavaDoc getLocation()
33    {
34       return location;
35    }
36
37    public void setLocation(String JavaDoc location)
38    {
39       testImmutability("location");
40       this.location = location;
41    }
42
43    public boolean isCheckCharacterPortability()
44    {
45       return checkCharacterPortability;
46    }
47
48    public void setCheckCharacterPortability(boolean checkCharacterPortability)
49    {
50       testImmutability("check.character.portability");
51       this.checkCharacterPortability = checkCharacterPortability;
52    }
53
54    public void setProperties(Properties JavaDoc props)
55    {
56       super.setProperties(props);
57
58       if (props != null)
59       {
60          setLocation(props.getProperty("location"));
61          String JavaDoc prop = props.getProperty("check.character.portability");
62          setCheckCharacterPortability((prop == null || Boolean.valueOf(prop)));
63       }
64    }
65
66    public boolean equals(Object JavaDoc obj)
67    {
68       if (obj instanceof FileCacheLoaderConfig && equalsExcludingProperties(obj))
69       {
70          return safeEquals(location, ((FileCacheLoaderConfig) obj).location);
71       }
72       return false;
73    }
74
75    public int hashCode()
76    {
77       return 31 * hashCodeExcludingProperties() + (location == null ? 0 : location.hashCode());
78    }
79
80 }
Popular Tags