1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.config.beans;
21
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
27 import org.apache.directory.server.config.ConfigurationElement;
28
29
30
31
32
33
34
35 public class ReplConsumerBean extends AdsBaseBean
36 {
37
38 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_CONSUMER_ID, isRdn = true)
39 private String replConsumerId;
40
41
42 @ConfigurationElement(attributeType = SchemaConstants.ADS_SEARCH_BASE_DN)
43 private String searchBaseDn;
44
45
46 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_PROV_HOST_NAME)
47 private String replProvHostName;
48
49
50 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_PROV_PORT)
51 private int replProvPort;
52
53
54 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_ALIAS_DEREF_MODE)
55 private String replAliasDerefMode;
56
57
58 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_ATTRIBUTES)
59 private List<String> replAttributes = new ArrayList<>();
60
61
62 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_REFRESH_INTERVAL)
63 private long replRefreshInterval;
64
65
66 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_REFRESH_N_PERSIST)
67 private boolean replRefreshNPersist;
68
69
70 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_SEARCH_SCOPE)
71 private String replSearchScope;
72
73
74 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_SEARCH_FILTER)
75 private String replSearchFilter;
76
77
78 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_SEARCH_SIZE_LIMIT)
79 private int replSearchSizeLimit;
80
81
82 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_SEARCH_TIMEOUT)
83 private int replSearchTimeout;
84
85
86 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_USER_DN)
87 private String replUserDn;
88
89
90 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_USER_PASSWORD)
91 private byte[] replUserPassword;
92
93
94 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_COOKIE, isOptional = true)
95 private String replCookie;
96
97
98 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_USE_TLS, isOptional = true)
99 private boolean replUseTls;
100
101
102 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_STRICT_CERT_VALIDATION, isOptional = true)
103 private boolean replStrictCertValidation;
104
105
106 @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_CONSUMER_IMPL, isOptional = true)
107 private String replConsumerImpl;
108
109
110
111
112
113 public ReplConsumerBean()
114 {
115 super();
116
117
118 setEnabled( true );
119 }
120
121
122
123
124
125 public String getReplConsumerId()
126 {
127 return replConsumerId;
128 }
129
130
131
132
133
134 public void setReplConsumerId( String replConsumerId )
135 {
136 this.replConsumerId = replConsumerId;
137 }
138
139
140
141
142
143 public String getSearchBaseDn()
144 {
145 return searchBaseDn;
146 }
147
148
149
150
151
152 public void setSearchBaseDn( String searchBaseDn )
153 {
154 this.searchBaseDn = searchBaseDn;
155 }
156
157
158
159
160
161 public String getReplProvHostName()
162 {
163 return replProvHostName;
164 }
165
166
167
168
169
170 public void setReplProvHostName( String replProvHostName )
171 {
172 this.replProvHostName = replProvHostName;
173 }
174
175
176
177
178
179 public int getReplProvPort()
180 {
181 return replProvPort;
182 }
183
184
185
186
187
188 public void setReplProvPort( int replProvPort )
189 {
190 this.replProvPort = replProvPort;
191 }
192
193
194
195
196
197 public String getReplAliasDerefMode()
198 {
199 return replAliasDerefMode;
200 }
201
202
203
204
205
206 public void setReplAliasDerefMode( String replAliasDerefMode )
207 {
208 this.replAliasDerefMode = replAliasDerefMode;
209 }
210
211
212
213
214
215 public List<String> getReplAttributes()
216 {
217 return replAttributes;
218 }
219
220
221
222
223
224 public void setReplAttributes( List<String> replAttributes )
225 {
226 this.replAttributes = replAttributes;
227 }
228
229
230
231
232
233 public void addReplAttributes( String... replAttributes )
234 {
235 for ( String at : replAttributes )
236 {
237 this.replAttributes.add( at );
238 }
239 }
240
241
242
243
244
245 public long getReplRefreshInterval()
246 {
247 return replRefreshInterval;
248 }
249
250
251
252
253
254 public void setReplRefreshInterval( long replRefreshInterval )
255 {
256 this.replRefreshInterval = replRefreshInterval;
257 }
258
259
260
261
262
263 public boolean isReplRefreshNPersist()
264 {
265 return replRefreshNPersist;
266 }
267
268
269
270
271
272 public void setReplRefreshNPersist( boolean replRefreshNPersist )
273 {
274 this.replRefreshNPersist = replRefreshNPersist;
275 }
276
277
278
279
280
281 public String getReplSearchScope()
282 {
283 return replSearchScope;
284 }
285
286
287
288
289
290 public void setReplSearchScope( String replSearchScope )
291 {
292 this.replSearchScope = replSearchScope;
293 }
294
295
296
297
298
299 public String getReplSearchFilter()
300 {
301 return replSearchFilter;
302 }
303
304
305
306
307
308 public void setReplSearchFilter( String replSearchFilter )
309 {
310 this.replSearchFilter = replSearchFilter;
311 }
312
313
314
315
316
317 public int getReplSearchSizeLimit()
318 {
319 return replSearchSizeLimit;
320 }
321
322
323
324
325
326 public void setReplSearchSizeLimit( int replSearchSizeLimit )
327 {
328 this.replSearchSizeLimit = replSearchSizeLimit;
329 }
330
331
332
333
334
335 public int getReplSearchTimeout()
336 {
337 return replSearchTimeout;
338 }
339
340
341
342
343
344 public void setReplSearchTimeout( int replSearchTimeout )
345 {
346 this.replSearchTimeout = replSearchTimeout;
347 }
348
349
350
351
352
353 public String getReplUserDn()
354 {
355 return replUserDn;
356 }
357
358
359
360
361
362 public void setReplUserDn( String replUserDn )
363 {
364 this.replUserDn = replUserDn;
365 }
366
367
368
369
370
371 public byte[] getReplUserPassword()
372 {
373 return replUserPassword;
374 }
375
376
377
378
379
380 public void setReplUserPassword( byte[] replUserPassword )
381 {
382 this.replUserPassword = replUserPassword;
383 }
384
385
386
387
388
389 public String getReplCookie()
390 {
391 return replCookie;
392 }
393
394
395
396
397
398 public void setReplCookie( String replCookie )
399 {
400 this.replCookie = replCookie;
401 }
402
403
404
405
406
407 public boolean isReplUseTls()
408 {
409 return replUseTls;
410 }
411
412
413
414
415
416 public void setReplUseTls( boolean replUseTls )
417 {
418 this.replUseTls = replUseTls;
419 }
420
421
422
423
424
425 public boolean isReplStrictCertValidation()
426 {
427 return replStrictCertValidation;
428 }
429
430
431
432
433
434 public void setReplStrictCertValidation( boolean replStrictCertValidation )
435 {
436 this.replStrictCertValidation = replStrictCertValidation;
437 }
438
439
440
441
442
443 public String getReplConsumerImpl()
444 {
445 return replConsumerImpl;
446 }
447
448
449
450
451
452 public void setReplConsumerImpl( String replConsumerImpl )
453 {
454 this.replConsumerImpl = replConsumerImpl;
455 }
456
457
458
459
460
461 @Override
462 public String toString( String tabs )
463 {
464 StringBuilder sb = new StringBuilder();
465
466 sb.append( tabs ).append( "Replication provider :\n" );
467 sb.append( super.toString( tabs + " " ) );
468
469 sb.append( tabs ).append( " provider ID : " ).append( replConsumerId ).append( '\n' );
470 sb.append( tabs ).append( " search base Dn : " ).append( searchBaseDn ).append( '\n' );
471 sb.append( tabs ).append( " provider host name : " ).append( replProvHostName ).append( '\n' );
472 sb.append( tabs ).append( " provider port : " ).append( replProvPort ).append( '\n' );
473 sb.append( toString( tabs, " alias dereferencing mode", replAliasDerefMode ) );
474 sb.append( toString( tabs, " attributes", String.valueOf( replAttributes ) ) );
475 sb.append( tabs ).append( " refresh interval : " ).append( replRefreshInterval ).append( '\n' );
476 sb.append( toString( tabs, " refresh and persist mode", replRefreshNPersist ) );
477 sb.append( toString( tabs, " search scope", replSearchScope ) );
478 sb.append( toString( tabs, " search filter", replSearchFilter ) );
479 sb.append( tabs ).append( " search size limit : " ).append( replSearchSizeLimit ).append( '\n' );
480 sb.append( tabs ).append( " search time limit : " ).append( replSearchTimeout ).append( '\n' );
481 sb.append( toString( tabs, " user Dn", replUserDn ) );
482 sb.append( toString( tabs, " user password", String.valueOf( replUserPassword ) ) );
483 sb.append( toString( tabs, " cookie", replCookie ) );
484 sb.append( tabs ).append( " consumer implementation's FQCN : " ).append( replConsumerImpl ).append( '\n' );
485
486 sb.append( toString( tabs, " struct certivicate validation", replStrictCertValidation ) );
487 sb.append( toString( tabs, " use TLS", replUseTls ) );
488
489 return sb.toString();
490 }
491
492
493
494
495
496 @Override
497 public String toString()
498 {
499 return toString( "" );
500 }
501 }