1 package org.apache.jcs.auxiliary.lateral.socket.tcp;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
23 import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
24 import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
25
26 /***
27 * This interface defines functions that are particular to the TCP Lateral Cache
28 * plugin. It extends the generic LateralCacheAttributes interface which in turn
29 * extends the AuxiliaryCache interface.
30 *
31 * @author Aaron Smuts
32 *
33 */
34 public class TCPLateralCacheAttributes
35 extends LateralCacheAttributes
36 implements ITCPLateralCacheAttributes
37 {
38
39 private static final long serialVersionUID = 1077889204513905220L;
40
41 private static final String DEFAULT_UDP_DISCOVERY_ADDRESS = "228.5.6.7";
42
43 private static final int DEFAULT_UDP_DISCOVERY_PORT = 6789;
44
45 private static final boolean DEFAULT_UDP_DISCOVERY_ENABLED = true;
46
47 private static final boolean DEFAULT_ALLOW_GET = true;
48
49 private static final boolean DEFAULT_ALLOW_PUT = true;
50
51 private static final boolean DEFAULT_ISSUE_REMOVE_FOR_PUT = false;
52
53 private static final boolean DEFAULT_FILTER_REMOVE_BY_HASH_CODE = true;
54
55
56 private String tcpServers = "";
57
58
59
60 private String tcpServer = "";
61
62 private int tcpListenerPort = 0;
63
64
65 private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS;
66
67 private int udpDiscoveryPort = DEFAULT_UDP_DISCOVERY_PORT;
68
69 private boolean udpDiscoveryEnabled = DEFAULT_UDP_DISCOVERY_ENABLED;
70
71 private boolean allowPut = DEFAULT_ALLOW_GET;
72
73 private boolean allowGet = DEFAULT_ALLOW_PUT;
74
75 private boolean issueRemoveOnPut = DEFAULT_ISSUE_REMOVE_FOR_PUT;
76
77 private boolean filterRemoveByHashCode = DEFAULT_FILTER_REMOVE_BY_HASH_CODE;
78
79
80
81
82
83
84 public void setTcpServer( String val )
85 {
86 this.tcpServer = val;
87 }
88
89
90
91
92
93
94 public String getTcpServer()
95 {
96 return this.tcpServer;
97 }
98
99
100
101
102
103
104 public void setTcpServers( String val )
105 {
106 this.tcpServers = val;
107 }
108
109
110
111
112
113
114 public String getTcpServers()
115 {
116 return this.tcpServers;
117 }
118
119
120
121
122
123
124 public void setTcpListenerPort( int val )
125 {
126 this.tcpListenerPort = val;
127 }
128
129
130
131
132
133
134 public int getTcpListenerPort()
135 {
136 return this.tcpListenerPort;
137 }
138
139
140
141
142
143
144 public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled )
145 {
146 this.udpDiscoveryEnabled = udpDiscoveryEnabled;
147 }
148
149
150
151
152
153
154 public boolean isUdpDiscoveryEnabled()
155 {
156 return this.udpDiscoveryEnabled;
157 }
158
159
160
161
162
163
164 public int getUdpDiscoveryPort()
165 {
166 return this.udpDiscoveryPort;
167 }
168
169
170
171
172
173
174 public void setUdpDiscoveryPort( int udpDiscoveryPort )
175 {
176 this.udpDiscoveryPort = udpDiscoveryPort;
177 }
178
179
180
181
182
183
184 public String getUdpDiscoveryAddr()
185 {
186 return this.udpDiscoveryAddr;
187 }
188
189
190
191
192
193
194 public void setUdpDiscoveryAddr( String udpDiscoveryAddr )
195 {
196 this.udpDiscoveryAddr = udpDiscoveryAddr;
197 }
198
199
200
201
202
203
204 public void setAllowGet( boolean allowGet )
205 {
206 this.allowGet = allowGet;
207 }
208
209
210
211
212
213
214 public boolean isAllowGet()
215 {
216 return this.allowGet;
217 }
218
219
220
221
222
223
224 public void setAllowPut( boolean allowPut )
225 {
226 this.allowPut = allowPut;
227 }
228
229
230
231
232
233
234 public boolean isAllowPut()
235 {
236 return this.allowPut;
237 }
238
239
240
241
242
243
244 public void setIssueRemoveOnPut( boolean issueRemoveOnPut )
245 {
246 this.issueRemoveOnPut = issueRemoveOnPut;
247 }
248
249
250
251
252
253
254 public boolean isIssueRemoveOnPut()
255 {
256 return this.issueRemoveOnPut;
257 }
258
259
260
261
262
263
264 public AuxiliaryCacheAttributes copy()
265 {
266 try
267 {
268 return (AuxiliaryCacheAttributes) this.clone();
269 }
270 catch ( Exception e )
271 {
272
273 }
274 return this;
275 }
276
277
278
279
280
281
282 public boolean isFilterRemoveByHashCode()
283 {
284 return this.filterRemoveByHashCode;
285 }
286
287
288
289
290
291
292 public void setFilterRemoveByHashCode( boolean filter )
293 {
294 this.filterRemoveByHashCode = filter;
295 }
296
297 /***
298 * Used to key the instance TODO create another method for this and use
299 * toString for debugging only.
300 *
301 * @return String
302 */
303 public String toString()
304 {
305 return this.getTcpServer() + ":" + this.getTcpListenerPort();
306 }
307
308 }