1 |
| package org.jboss.cache.loader; |
2 |
| |
3 |
| import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig; |
4 |
| |
5 |
| import java.util.Properties; |
6 |
| |
7 |
| public class TcpDelegatingCacheLoaderConfig extends IndividualCacheLoaderConfig |
8 |
| { |
9 |
| |
10 |
| |
11 |
| |
12 |
| private static final long serialVersionUID = -3138555335000168505L; |
13 |
| |
14 |
| private String host = "localhost"; |
15 |
| private int port = 7500; |
16 |
| |
17 |
0
| public TcpDelegatingCacheLoaderConfig()
|
18 |
| { |
19 |
0
| setClassName(TcpDelegatingCacheLoader.class.getName());
|
20 |
| } |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
64
| TcpDelegatingCacheLoaderConfig(IndividualCacheLoaderConfig base)
|
28 |
| { |
29 |
64
| setClassName(TcpDelegatingCacheLoader.class.getName());
|
30 |
64
| populateFromBaseConfig(base);
|
31 |
| } |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
0
| TcpDelegatingCacheLoaderConfig(String host, int port)
|
40 |
| { |
41 |
0
| setClassName(TcpDelegatingCacheLoader.class.getName());
|
42 |
0
| this.host = host;
|
43 |
0
| this.port = port;
|
44 |
| } |
45 |
| |
46 |
64
| public String getHost()
|
47 |
| { |
48 |
64
| return host;
|
49 |
| } |
50 |
| |
51 |
0
| public void setHost(String host)
|
52 |
| { |
53 |
0
| testImmutability("host");
|
54 |
0
| this.host = host;
|
55 |
| } |
56 |
| |
57 |
64
| public int getPort()
|
58 |
| { |
59 |
64
| return port;
|
60 |
| } |
61 |
| |
62 |
0
| public void setPort(int port)
|
63 |
| { |
64 |
0
| testImmutability("port");
|
65 |
0
| this.port = port;
|
66 |
| } |
67 |
| |
68 |
64
| public void setProperties(Properties props)
|
69 |
| { |
70 |
64
| super.setProperties(props);
|
71 |
64
| String s = props.getProperty("host");
|
72 |
64
| if (s != null && s.length() > 0)
|
73 |
| { |
74 |
64
| this.host = s;
|
75 |
| } |
76 |
64
| s = props.getProperty("port");
|
77 |
64
| if (s != null && s.length() > 0)
|
78 |
| { |
79 |
64
| this.port = Integer.parseInt(s);
|
80 |
| } |
81 |
| } |
82 |
| |
83 |
0
| public boolean equals(Object obj)
|
84 |
| { |
85 |
0
| if (obj instanceof TcpDelegatingCacheLoaderConfig && equalsExcludingProperties(obj))
|
86 |
| { |
87 |
0
| TcpDelegatingCacheLoaderConfig other = (TcpDelegatingCacheLoaderConfig) obj;
|
88 |
| |
89 |
0
| return safeEquals(host, other.host)
|
90 |
| && (port == other.port); |
91 |
| } |
92 |
0
| return false;
|
93 |
| } |
94 |
| |
95 |
64
| public int hashCode()
|
96 |
| { |
97 |
64
| int result = hashCodeExcludingProperties();
|
98 |
64
| result = 31 * result + (host == null ? 0 : host.hashCode());
|
99 |
64
| result = 31 * result + port;
|
100 |
| |
101 |
64
| return result;
|
102 |
| } |
103 |
| |
104 |
| |
105 |
| } |