1 package org.apache.commons.jcs3.auxiliary.remote;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheAttributes;
23 import org.apache.commons.jcs3.auxiliary.remote.behavior.ICommonRemoteCacheAttributes;
24 import org.apache.commons.jcs3.auxiliary.remote.behavior.IRemoteCacheConstants;
25 import org.apache.commons.jcs3.auxiliary.remote.server.behavior.RemoteType;
26
27
28
29
30 public class CommonRemoteCacheAttributes
31 extends AbstractAuxiliaryCacheAttributes
32 implements ICommonRemoteCacheAttributes
33 {
34
35 private static final long serialVersionUID = -1555143736942374000L;
36
37
38 private String remoteServiceName = IRemoteCacheConstants.REMOTE_CACHE_SERVICE_VAL;
39
40
41 private RemoteLocation location;
42
43
44 private String clusterServers = "";
45
46
47 private RemoteType remoteType = RemoteType.LOCAL;
48
49
50 private boolean removeUponRemotePut = true;
51
52
53 private boolean getOnly;
54
55
56 private boolean localClusterConsistency;
57
58
59 private int rmiSocketFactoryTimeoutMillis = DEFAULT_RMI_SOCKET_FACTORY_TIMEOUT_MILLIS;
60
61
62 public CommonRemoteCacheAttributes()
63 {
64 }
65
66
67
68
69
70
71 @Override
72 public String getRemoteTypeName()
73 {
74 return remoteType != null ? remoteType.toString() : RemoteType.LOCAL.toString();
75 }
76
77
78
79
80
81
82 @Override
83 public void setRemoteTypeName( final String s )
84 {
85 this.remoteType = RemoteType.valueOf(s);
86 }
87
88
89
90
91
92
93 @Override
94 public RemoteType getRemoteType()
95 {
96 return remoteType;
97 }
98
99
100
101
102
103
104 @Override
105 public void setRemoteType( final RemoteType p )
106 {
107 this.remoteType = p;
108 }
109
110
111
112
113
114
115 @Override
116 public String getRemoteServiceName()
117 {
118 return this.remoteServiceName;
119 }
120
121
122
123
124
125
126 @Override
127 public void setRemoteServiceName( final String s )
128 {
129 this.remoteServiceName = s;
130 }
131
132
133
134
135
136
137 @Override
138 public void setRemoteLocation( final RemoteLocation location )
139 {
140 this.location = location;
141 }
142
143
144
145
146
147
148
149 @Override
150 public void setRemoteLocation( final String host, final int port )
151 {
152 this.location = new RemoteLocation(host, port);
153 }
154
155
156
157
158
159
160 @Override
161 public RemoteLocation getRemoteLocation()
162 {
163 return this.location;
164 }
165
166
167
168
169
170
171 @Override
172 public String getClusterServers()
173 {
174 return this.clusterServers;
175 }
176
177
178
179
180
181
182 @Override
183 public void setClusterServers( final String s )
184 {
185 this.clusterServers = s;
186 }
187
188
189
190
191
192
193 @Override
194 public boolean getRemoveUponRemotePut()
195 {
196 return this.removeUponRemotePut;
197 }
198
199
200
201
202
203
204 @Override
205 public void setRemoveUponRemotePut( final boolean r )
206 {
207 this.removeUponRemotePut = r;
208 }
209
210
211
212
213
214
215 @Override
216 public boolean getGetOnly()
217 {
218 return this.getOnly;
219 }
220
221
222
223
224
225 @Override
226 public void setGetOnly( final boolean r )
227 {
228 this.getOnly = r;
229 }
230
231
232
233
234
235
236 @Override
237 public boolean isLocalClusterConsistency()
238 {
239 return localClusterConsistency;
240 }
241
242
243
244
245
246
247 @Override
248 public void setLocalClusterConsistency( final boolean r )
249 {
250 this.localClusterConsistency = r;
251 }
252
253
254
255
256 @Override
257 public void setRmiSocketFactoryTimeoutMillis( final int rmiSocketFactoryTimeoutMillis )
258 {
259 this.rmiSocketFactoryTimeoutMillis = rmiSocketFactoryTimeoutMillis;
260 }
261
262
263
264
265 @Override
266 public int getRmiSocketFactoryTimeoutMillis()
267 {
268 return rmiSocketFactoryTimeoutMillis;
269 }
270
271
272
273
274 @Override
275 public String toString()
276 {
277 final StringBuilder buf = new StringBuilder();
278 buf.append( "\n RemoteCacheAttributes " );
279 if (this.location != null)
280 {
281 buf.append( "\n remoteHost = [" + this.location.getHost() + "]" );
282 buf.append( "\n remotePort = [" + this.location.getPort() + "]" );
283 }
284 buf.append( "\n cacheName = [" + getCacheName() + "]" );
285 buf.append( "\n remoteType = [" + remoteType + "]" );
286 buf.append( "\n removeUponRemotePut = [" + this.removeUponRemotePut + "]" );
287 buf.append( "\n getOnly = [" + getOnly + "]" );
288 return buf.toString();
289 }
290 }