1 package org.apache.jcs.auxiliary.lateral;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.Serializable;
23
24 import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
25 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
26 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
27
28 /***
29 * This class stores attributes for all of the available lateral cache
30 * auxiliaries.
31 *
32 */
33 public class LateralCacheAttributes
34 extends AbstractAuxiliaryCacheAttributes
35 implements Serializable, ILateralCacheAttributes
36 {
37
38 private static final long serialVersionUID = -3408449508837393660L;
39
40 private static final boolean DEFAULT_RECEIVE = true;
41
42 String transmissionTypeName = "UDP";
43
44 int transmissionType = UDP;
45
46 String httpServers;
47
48
49
50 String httpServer = "";
51
52 String httpReceiveServlet = "";
53
54 String httpDeleteServlet = "";
55
56 String udpMulticastAddr = "228.5.6.7";
57
58 int udpMulticastPort = 6789;
59
60 int httpListenerPort = 8080;
61
62
63
64 private String jgChannelProperties = null;
65
66
67
68 boolean putOnlyMode = true;
69
70
71
72 private boolean receive = DEFAULT_RECEIVE;
73
74 /***
75 * Sets the httpServer attribute of the LateralCacheAttributes object
76 *
77 * @param val
78 * The new httpServer value
79 */
80 public void setHttpServer( String val )
81 {
82 httpServer = val;
83 }
84
85 /***
86 * Gets the httpServer attribute of the LateralCacheAttributes object
87 *
88 * @return The httpServer value
89 */
90 public String getHttpServer()
91 {
92 return httpServer;
93 }
94
95
96
97 /***
98 * Sets the httpServers attribute of the LateralCacheAttributes object
99 *
100 * @param val
101 * The new httpServers value
102 */
103 public void setHttpServers( String val )
104 {
105 httpServers = val;
106 }
107
108 /***
109 * Gets the httpSrvers attribute of the LateralCacheAttributes object
110 *
111 * @return The httpServers value
112 */
113 public String getHttpServers()
114 {
115 return httpServers;
116 }
117
118
119
120 /***
121 * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
122 *
123 * @param val
124 * The new tcpListenerPort value
125 */
126 public void setHttpListenerPort( int val )
127 {
128 this.httpListenerPort = val;
129 }
130
131 /***
132 * Gets the httpListenerPort attribute of the ILateralCacheAttributes object
133 *
134 * @return The httpListenerPort value
135 */
136 public int getHttpListenerPort()
137 {
138 return this.httpListenerPort;
139 }
140
141 /***
142 * Sets the udpMulticastAddr attribute of the LateralCacheAttributes object
143 *
144 * @param val
145 * The new udpMulticastAddr value
146 */
147 public void setUdpMulticastAddr( String val )
148 {
149 udpMulticastAddr = val;
150 }
151
152 /***
153 * Gets the udpMulticastAddr attribute of the LateralCacheAttributes object
154 *
155 * @return The udpMulticastAddr value
156 */
157 public String getUdpMulticastAddr()
158 {
159 return udpMulticastAddr;
160 }
161
162 /***
163 * Sets the udpMulticastPort attribute of the LateralCacheAttributes object
164 *
165 * @param val
166 * The new udpMulticastPort value
167 */
168 public void setUdpMulticastPort( int val )
169 {
170 udpMulticastPort = val;
171 }
172
173 /***
174 * Gets the udpMulticastPort attribute of the LateralCacheAttributes object
175 *
176 * @return The udpMulticastPort value
177 */
178 public int getUdpMulticastPort()
179 {
180 return udpMulticastPort;
181 }
182
183 /***
184 * Sets the transmissionType attribute of the LateralCacheAttributes object
185 *
186 * @param val
187 * The new transmissionType value
188 */
189 public void setTransmissionType( int val )
190 {
191 this.transmissionType = val;
192 if ( val == UDP )
193 {
194 transmissionTypeName = "UDP";
195 }
196 else if ( val == HTTP )
197 {
198 transmissionTypeName = "HTTP";
199 }
200 else if ( val == TCP )
201 {
202 transmissionTypeName = "TCP";
203 }
204 else if ( val == XMLRPC )
205 {
206 transmissionTypeName = "XMLRPC";
207 }
208 else if ( val == JAVAGROUPS )
209 {
210 transmissionTypeName = "JAVAGROUPS";
211 }
212 }
213
214 /***
215 * Gets the transmissionType attribute of the LateralCacheAttributes object
216 *
217 * @return The transmissionType value
218 */
219 public int getTransmissionType()
220 {
221 return this.transmissionType;
222 }
223
224 /***
225 * Sets the transmissionTypeName attribute of the LateralCacheAttributes
226 * object
227 *
228 * @param val
229 * The new transmissionTypeName value
230 */
231 public void setTransmissionTypeName( String val )
232 {
233 this.transmissionTypeName = val;
234 if ( val.equals( "UDP" ) )
235 {
236 transmissionType = UDP;
237 }
238 else if ( val.equals( "HTTP" ) )
239 {
240 transmissionType = HTTP;
241 }
242 else if ( val.equals( "TCP" ) )
243 {
244 transmissionType = TCP;
245 }
246 else if ( val.equals( "XMLRPC" ) )
247 {
248 transmissionType = XMLRPC;
249 }
250 else if ( val.equals( "JAVAGROUPS" ) )
251 {
252 transmissionType = JAVAGROUPS;
253 }
254
255 }
256
257 /***
258 * Gets the transmissionTypeName attribute of the LateralCacheAttributes
259 * object
260 *
261 * @return The transmissionTypeName value
262 */
263 public String getTransmissionTypeName()
264 {
265 return this.transmissionTypeName;
266 }
267
268 /***
269 * Sets the outgoingOnlyMode attribute of the ILateralCacheAttributes. When
270 * this is true the lateral cache will only issue put and remove order and
271 * will not try to retrieve elements from other lateral caches.
272 *
273 * @param val
274 * The new transmissionTypeName value
275 */
276 public void setPutOnlyMode( boolean val )
277 {
278 this.putOnlyMode = val;
279 }
280
281 /***
282 * @return The outgoingOnlyMode value. Stops gets from going remote.
283 */
284 public boolean getPutOnlyMode()
285 {
286 return putOnlyMode;
287 }
288
289 public String getJGChannelProperties()
290 {
291 return jgChannelProperties;
292 }
293
294 public void setJGChannelProperties( String channelProperties )
295 {
296 this.jgChannelProperties = channelProperties;
297 }
298
299 /***
300 * Returns a clone of the attributes.
301 *
302 * @return Self
303 */
304 public AuxiliaryCacheAttributes copy()
305 {
306 try
307 {
308 return (AuxiliaryCacheAttributes) this.clone();
309 }
310 catch ( Exception e )
311 {
312
313 }
314 return this;
315 }
316
317
318
319 /***
320 * @param receive
321 * The receive to set.
322 */
323 public void setReceive( boolean receive )
324 {
325 this.receive = receive;
326 }
327
328 /***
329 * @return Returns the receive.
330 */
331 public boolean isReceive()
332 {
333 return receive;
334 }
335
336
337
338
339
340
341
342
343 public String toString()
344 {
345 StringBuffer buf = new StringBuffer();
346
347
348
349
350
351 buf.append( transmissionTypeName + httpServer + udpMulticastAddr + String.valueOf( udpMulticastPort ) );
352 return buf.toString();
353 }
354
355 }