1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| package org.jboss.cache.config; |
23 |
| |
24 |
| import org.jboss.cache.buddyreplication.NextMemberBuddyLocator; |
25 |
| |
26 |
| import java.util.Properties; |
27 |
| |
28 |
| |
29 |
| public class BuddyReplicationConfig extends ConfigurationComponent |
30 |
| { |
31 |
| private static final long serialVersionUID = -4826380823985089339L; |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| private boolean enabled; |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| private String buddyPoolName; |
42 |
| |
43 |
| private boolean autoDataGravitation = true; |
44 |
| private boolean dataGravitationRemoveOnFind = true; |
45 |
| private boolean dataGravitationSearchBackupTrees = true; |
46 |
| @Dynamic |
47 |
| private int buddyCommunicationTimeout = 10000; |
48 |
| private BuddyLocatorConfig buddyLocatorConfig; |
49 |
| |
50 |
176
| public BuddyReplicationConfig()
|
51 |
| { |
52 |
| } |
53 |
| |
54 |
469
| public boolean isAutoDataGravitation()
|
55 |
| { |
56 |
469
| return autoDataGravitation;
|
57 |
| } |
58 |
| |
59 |
176
| public void setAutoDataGravitation(boolean autoDataGravitation)
|
60 |
| { |
61 |
176
| testImmutability("autoDataGravitation");
|
62 |
176
| this.autoDataGravitation = autoDataGravitation;
|
63 |
| } |
64 |
| |
65 |
664
| public int getBuddyCommunicationTimeout()
|
66 |
| { |
67 |
664
| return buddyCommunicationTimeout;
|
68 |
| } |
69 |
| |
70 |
143
| public void setBuddyCommunicationTimeout(int buddyCommunicationTimeout)
|
71 |
| { |
72 |
143
| testImmutability("buddyCommunicationTimeout");
|
73 |
143
| this.buddyCommunicationTimeout = buddyCommunicationTimeout;
|
74 |
| } |
75 |
| |
76 |
750
| public String getBuddyPoolName()
|
77 |
| { |
78 |
750
| return buddyPoolName;
|
79 |
| } |
80 |
| |
81 |
176
| public void setBuddyPoolName(String buddyPoolName)
|
82 |
| { |
83 |
176
| testImmutability("buddyPoolName");
|
84 |
176
| this.buddyPoolName = buddyPoolName;
|
85 |
| } |
86 |
| |
87 |
67
| public boolean isDataGravitationRemoveOnFind()
|
88 |
| { |
89 |
67
| return dataGravitationRemoveOnFind;
|
90 |
| } |
91 |
| |
92 |
168
| public void setDataGravitationRemoveOnFind(boolean dataGravitationRemoveOnFind)
|
93 |
| { |
94 |
168
| testImmutability("dataGravitationRemoveOnFind");
|
95 |
168
| this.dataGravitationRemoveOnFind = dataGravitationRemoveOnFind;
|
96 |
| } |
97 |
| |
98 |
37
| public boolean isDataGravitationSearchBackupTrees()
|
99 |
| { |
100 |
37
| return dataGravitationSearchBackupTrees;
|
101 |
| } |
102 |
| |
103 |
168
| public void setDataGravitationSearchBackupTrees(boolean dataGravitationSearchBackupTrees)
|
104 |
| { |
105 |
168
| testImmutability("dataGravitationSearchBackupTrees");
|
106 |
168
| this.dataGravitationSearchBackupTrees = dataGravitationSearchBackupTrees;
|
107 |
| } |
108 |
| |
109 |
1242
| public boolean isEnabled()
|
110 |
| { |
111 |
1242
| return enabled;
|
112 |
| } |
113 |
| |
114 |
176
| public void setEnabled(boolean enabled)
|
115 |
| { |
116 |
176
| testImmutability("enabled");
|
117 |
176
| this.enabled = enabled;
|
118 |
| } |
119 |
| |
120 |
175
| public BuddyLocatorConfig getBuddyLocatorConfig()
|
121 |
| { |
122 |
175
| return buddyLocatorConfig;
|
123 |
| } |
124 |
| |
125 |
341
| public void setBuddyLocatorConfig(BuddyLocatorConfig buddyLocatorConfig)
|
126 |
| { |
127 |
341
| testImmutability("buddyLocatorConfig");
|
128 |
341
| replaceChildConfig(this.buddyLocatorConfig, buddyLocatorConfig);
|
129 |
341
| this.buddyLocatorConfig = buddyLocatorConfig;
|
130 |
| } |
131 |
| |
132 |
0
| public boolean equals(Object obj)
|
133 |
| { |
134 |
0
| if (this == obj)
|
135 |
0
| return true;
|
136 |
| |
137 |
0
| if (obj instanceof BuddyReplicationConfig)
|
138 |
| { |
139 |
0
| BuddyReplicationConfig other = (BuddyReplicationConfig) obj;
|
140 |
0
| return (this.autoDataGravitation == other.autoDataGravitation)
|
141 |
| && (this.dataGravitationRemoveOnFind == other.dataGravitationRemoveOnFind) |
142 |
| && (this.dataGravitationSearchBackupTrees == other.dataGravitationSearchBackupTrees) |
143 |
| && (this.enabled == other.enabled) |
144 |
| && (this.buddyCommunicationTimeout == other.buddyCommunicationTimeout) |
145 |
| && safeEquals(this.buddyPoolName, other.buddyPoolName) |
146 |
| && safeEquals(this.buddyLocatorConfig, other.buddyLocatorConfig); |
147 |
| } |
148 |
| |
149 |
0
| return false;
|
150 |
| } |
151 |
| |
152 |
169
| public int hashCode()
|
153 |
| { |
154 |
169
| int result = 11;
|
155 |
169
| result = 29 * result + (autoDataGravitation ? 0 : 1);
|
156 |
169
| result = 29 * result + (dataGravitationRemoveOnFind ? 0 : 1);
|
157 |
169
| result = 29 * result + (dataGravitationSearchBackupTrees ? 0 : 1);
|
158 |
169
| result = 29 * result + (enabled ? 0 : 1);
|
159 |
169
| result = 29 * result + buddyCommunicationTimeout;
|
160 |
169
| result = 29 * result + (buddyPoolName == null ? 0 : buddyPoolName.hashCode());
|
161 |
169
| result = 29 * result + (buddyLocatorConfig == null ? 0 : buddyLocatorConfig.hashCode());
|
162 |
169
| return result;
|
163 |
| } |
164 |
| |
165 |
| public static class BuddyLocatorConfig extends ConfigurationComponent |
166 |
| { |
167 |
| private static final long serialVersionUID = -8003634097931826091L; |
168 |
| |
169 |
| private String buddyLocatorClass = NextMemberBuddyLocator.class.getName(); |
170 |
| ; |
171 |
| private Properties buddyLocatorProperties; |
172 |
| |
173 |
546
| public BuddyLocatorConfig()
|
174 |
| { |
175 |
| } |
176 |
| |
177 |
167
| public String getBuddyLocatorClass()
|
178 |
| { |
179 |
167
| return buddyLocatorClass;
|
180 |
| } |
181 |
| |
182 |
168
| public void setBuddyLocatorClass(String buddyLocatorClass)
|
183 |
| { |
184 |
168
| testImmutability("buddyLocatorClass");
|
185 |
168
| this.buddyLocatorClass = buddyLocatorClass;
|
186 |
168
| if (buddyLocatorClass == null)
|
187 |
0
| this.buddyLocatorClass = NextMemberBuddyLocator.class.getName();
|
188 |
| } |
189 |
| |
190 |
166
| public Properties getBuddyLocatorProperties()
|
191 |
| { |
192 |
166
| return buddyLocatorProperties;
|
193 |
| } |
194 |
| |
195 |
332
| public void setBuddyLocatorProperties(Properties buddyLocatorProperties)
|
196 |
| { |
197 |
332
| testImmutability("buddyLocatorProperties");
|
198 |
332
| this.buddyLocatorProperties = buddyLocatorProperties;
|
199 |
| } |
200 |
| |
201 |
0
| public boolean equals(Object obj)
|
202 |
| { |
203 |
0
| if (this == obj)
|
204 |
0
| return true;
|
205 |
| |
206 |
0
| if (obj instanceof BuddyLocatorConfig)
|
207 |
| { |
208 |
0
| BuddyLocatorConfig other = (BuddyLocatorConfig) obj;
|
209 |
0
| return (safeEquals(this.buddyLocatorClass, other.buddyLocatorClass)
|
210 |
| && safeEquals(this.buddyLocatorProperties, other.buddyLocatorProperties)); |
211 |
| } |
212 |
0
| return false;
|
213 |
| } |
214 |
| |
215 |
495
| public int hashCode()
|
216 |
| { |
217 |
495
| int result = 19;
|
218 |
495
| result = 41 * result + (buddyLocatorClass == null ? 0 : buddyLocatorClass.hashCode());
|
219 |
495
| result = 41 * result + (buddyLocatorProperties == null ? 0 : buddyLocatorProperties.hashCode());
|
220 |
495
| return result;
|
221 |
| } |
222 |
| |
223 |
1
| public String toString()
|
224 |
| { |
225 |
1
| return super.toString() + " class=" + buddyLocatorClass +
|
226 |
| " properties=" + buddyLocatorProperties; |
227 |
| } |
228 |
| |
229 |
| } |
230 |
| } |