KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.jboss.cache.loader;
2
3 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
4
5 import java.util.Properties JavaDoc;
6
7 public class RmiDelegatingCacheLoaderConfig extends IndividualCacheLoaderConfig
8 {
9    /**
10     * The serialVersionUID
11     */

12    private static final long serialVersionUID = 4578924632178739084L;
13
14    private String JavaDoc host = "localhost";
15    private String JavaDoc port = "1098";
16    private String JavaDoc bindName;
17
18    public RmiDelegatingCacheLoaderConfig()
19    {
20       setClassName(RmiDelegatingCacheLoader.class.getName());
21    }
22
23    /**
24     * For use by {@link RmiDelegatingCacheLoader}.
25     *
26     * @param base generic config object created by XML parsing.
27     */

28    RmiDelegatingCacheLoaderConfig(IndividualCacheLoaderConfig base)
29    {
30       setClassName(RmiDelegatingCacheLoader.class.getName());
31       populateFromBaseConfig(base);
32    }
33
34    public String JavaDoc getBindName()
35    {
36       return bindName;
37    }
38
39    public void setBindName(String JavaDoc bindName)
40    {
41       testImmutability("bindName");
42       this.bindName = bindName;
43    }
44
45    public String JavaDoc getHost()
46    {
47       return host;
48    }
49
50    public void setHost(String JavaDoc host)
51    {
52       testImmutability("host");
53       this.host = host;
54    }
55
56    public String JavaDoc getPort()
57    {
58       return port;
59    }
60
61    public void setPort(String JavaDoc port)
62    {
63       testImmutability("port");
64       this.port = port;
65    }
66
67    public void setProperties(Properties JavaDoc props)
68    {
69       super.setProperties(props);
70       String JavaDoc s = props.getProperty("host");
71       if (s != null && s.length() > 0)
72       {
73          this.host = s;
74       }
75       s = props.getProperty("port");
76       if (s != null && s.length() > 00)
77       {
78          this.port = s;
79       }
80       this.bindName = props.getProperty("bindName");
81    }
82
83    public boolean equals(Object JavaDoc obj)
84    {
85       if (obj instanceof RmiDelegatingCacheLoaderConfig && equalsExcludingProperties(obj))
86       {
87          RmiDelegatingCacheLoaderConfig other = (RmiDelegatingCacheLoaderConfig) obj;
88
89          return safeEquals(host, other.host)
90                  && safeEquals(port, other.port)
91                  && safeEquals(bindName, other.bindName);
92       }
93       return false;
94    }
95
96    public int hashCode()
97    {
98       int result = hashCodeExcludingProperties();
99       result = 31 * result + (host == null ? 0 : host.hashCode());
100       result = 31 * result + (port == null ? 0 : port.hashCode());
101       result = 31 * result + (bindName == null ? 0 : bindName.hashCode());
102
103       return result;
104    }
105
106
107 }
Popular Tags