1
2
3
4
5
6
7
8 package org.sourceforge.mbeanmonitoring.report.castor;
9
10
11
12
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17
18
19
20
21
22 public class ServerParam implements java.io.Serializable {
23
24
25
26
27
28
29
30
31
32 private java.lang.String _host = "localhost";
33
34
35
36
37 private short _port = 1099;
38
39
40
41
42 private boolean _has_port;
43
44
45
46
47 private java.lang.String _genereTo;
48
49
50
51
52 private java.lang.String _extension = "csv";
53
54
55
56
57 private java.lang.String _maxFileSize = "1024KB";
58
59
60
61
62 private int _maxBackupIndex = 10;
63
64
65
66
67 private boolean _has_maxBackupIndex;
68
69
70
71
72 private int _delay = 30;
73
74
75
76
77 private boolean _has_delay;
78
79
80
81
82 private int _nbThreads = 10;
83
84
85
86
87 private boolean _has_nbThreads;
88
89
90
91
92 private java.lang.String _separateur = ";";
93
94
95
96
97 private java.util.Vector _mbeanList;
98
99
100
101
102
103
104 public ServerParam() {
105 super();
106 setHost("localhost");
107 setExtension("csv");
108 setMaxFileSize("1024KB");
109 setSeparateur(";");
110 this._mbeanList = new java.util.Vector();
111 }
112
113
114
115
116
117
118
119
120
121
122
123
124
125 public void addMbean(
126 final org.sourceforge.mbeanmonitoring.report.castor.Mbean vMbean)
127 throws java.lang.IndexOutOfBoundsException {
128 this._mbeanList.addElement(vMbean);
129 }
130
131
132
133
134
135
136
137
138
139 public void addMbean(
140 final int index,
141 final org.sourceforge.mbeanmonitoring.report.castor.Mbean vMbean)
142 throws java.lang.IndexOutOfBoundsException {
143 this._mbeanList.add(index, vMbean);
144 }
145
146
147
148 public void deleteDelay(
149 ) {
150 this._has_delay= false;
151 }
152
153
154
155 public void deleteMaxBackupIndex(
156 ) {
157 this._has_maxBackupIndex= false;
158 }
159
160
161
162 public void deleteNbThreads(
163 ) {
164 this._has_nbThreads= false;
165 }
166
167
168
169 public void deletePort(
170 ) {
171 this._has_port= false;
172 }
173
174
175
176
177
178
179
180 public java.util.Enumeration enumerateMbean(
181 ) {
182 return this._mbeanList.elements();
183 }
184
185
186
187
188
189
190 public int getDelay(
191 ) {
192 return this._delay;
193 }
194
195
196
197
198
199
200 public java.lang.String getExtension(
201 ) {
202 return this._extension;
203 }
204
205
206
207
208
209
210 public java.lang.String getGenereTo(
211 ) {
212 return this._genereTo;
213 }
214
215
216
217
218
219
220 public java.lang.String getHost(
221 ) {
222 return this._host;
223 }
224
225
226
227
228
229
230 public int getMaxBackupIndex(
231 ) {
232 return this._maxBackupIndex;
233 }
234
235
236
237
238
239
240 public java.lang.String getMaxFileSize(
241 ) {
242 return this._maxFileSize;
243 }
244
245
246
247
248
249
250
251
252
253
254
255 public org.sourceforge.mbeanmonitoring.report.castor.Mbean getMbean(
256 final int index)
257 throws java.lang.IndexOutOfBoundsException {
258
259 if (index < 0 || index >= this._mbeanList.size()) {
260 throw new IndexOutOfBoundsException("getMbean: Index value '" + index + "' not in range [0.." + (this._mbeanList.size() - 1) + "]");
261 }
262
263 return (org.sourceforge.mbeanmonitoring.report.castor.Mbean) _mbeanList.get(index);
264 }
265
266
267
268
269
270
271
272
273
274
275 public org.sourceforge.mbeanmonitoring.report.castor.Mbean[] getMbean(
276 ) {
277 org.sourceforge.mbeanmonitoring.report.castor.Mbean[] array = new org.sourceforge.mbeanmonitoring.report.castor.Mbean[0];
278 return (org.sourceforge.mbeanmonitoring.report.castor.Mbean[]) this._mbeanList.toArray(array);
279 }
280
281
282
283
284
285
286 public int getMbeanCount(
287 ) {
288 return this._mbeanList.size();
289 }
290
291
292
293
294
295
296 public int getNbThreads(
297 ) {
298 return this._nbThreads;
299 }
300
301
302
303
304
305
306 public short getPort(
307 ) {
308 return this._port;
309 }
310
311
312
313
314
315
316 public java.lang.String getSeparateur(
317 ) {
318 return this._separateur;
319 }
320
321
322
323
324
325
326 public boolean hasDelay(
327 ) {
328 return this._has_delay;
329 }
330
331
332
333
334
335
336 public boolean hasMaxBackupIndex(
337 ) {
338 return this._has_maxBackupIndex;
339 }
340
341
342
343
344
345
346 public boolean hasNbThreads(
347 ) {
348 return this._has_nbThreads;
349 }
350
351
352
353
354
355
356 public boolean hasPort(
357 ) {
358 return this._has_port;
359 }
360
361
362
363
364
365
366 public boolean isValid(
367 ) {
368 try {
369 validate();
370 } catch (org.exolab.castor.xml.ValidationException vex) {
371 return false;
372 }
373 return true;
374 }
375
376
377
378
379
380
381
382
383
384
385 public void marshal(
386 final java.io.Writer out)
387 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
388 Marshaller.marshal(this, out);
389 }
390
391
392
393
394
395
396
397
398
399
400
401
402 public void marshal(
403 final org.xml.sax.ContentHandler handler)
404 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
405 Marshaller.marshal(this, handler);
406 }
407
408
409
410 public void removeAllMbean(
411 ) {
412 this._mbeanList.clear();
413 }
414
415
416
417
418
419
420
421 public boolean removeMbean(
422 final org.sourceforge.mbeanmonitoring.report.castor.Mbean vMbean) {
423 boolean removed = _mbeanList.remove(vMbean);
424 return removed;
425 }
426
427
428
429
430
431
432
433 public org.sourceforge.mbeanmonitoring.report.castor.Mbean removeMbeanAt(
434 final int index) {
435 java.lang.Object obj = this._mbeanList.remove(index);
436 return (org.sourceforge.mbeanmonitoring.report.castor.Mbean) obj;
437 }
438
439
440
441
442
443
444 public void setDelay(
445 final int delay) {
446 this._delay = delay;
447 this._has_delay = true;
448 }
449
450
451
452
453
454
455 public void setExtension(
456 final java.lang.String extension) {
457 this._extension = extension;
458 }
459
460
461
462
463
464
465 public void setGenereTo(
466 final java.lang.String genereTo) {
467 this._genereTo = genereTo;
468 }
469
470
471
472
473
474
475 public void setHost(
476 final java.lang.String host) {
477 this._host = host;
478 }
479
480
481
482
483
484
485 public void setMaxBackupIndex(
486 final int maxBackupIndex) {
487 this._maxBackupIndex = maxBackupIndex;
488 this._has_maxBackupIndex = true;
489 }
490
491
492
493
494
495
496 public void setMaxFileSize(
497 final java.lang.String maxFileSize) {
498 this._maxFileSize = maxFileSize;
499 }
500
501
502
503
504
505
506
507
508
509 public void setMbean(
510 final int index,
511 final org.sourceforge.mbeanmonitoring.report.castor.Mbean vMbean)
512 throws java.lang.IndexOutOfBoundsException {
513
514 if (index < 0 || index >= this._mbeanList.size()) {
515 throw new IndexOutOfBoundsException("setMbean: Index value '" + index + "' not in range [0.." + (this._mbeanList.size() - 1) + "]");
516 }
517
518 this._mbeanList.set(index, vMbean);
519 }
520
521
522
523
524
525
526 public void setMbean(
527 final org.sourceforge.mbeanmonitoring.report.castor.Mbean[] vMbeanArray) {
528
529 _mbeanList.clear();
530
531 for (int i = 0; i < vMbeanArray.length; i++) {
532 this._mbeanList.add(vMbeanArray[i]);
533 }
534 }
535
536
537
538
539
540
541 public void setNbThreads(
542 final int nbThreads) {
543 this._nbThreads = nbThreads;
544 this._has_nbThreads = true;
545 }
546
547
548
549
550
551
552 public void setPort(
553 final short port) {
554 this._port = port;
555 this._has_port = true;
556 }
557
558
559
560
561
562
563 public void setSeparateur(
564 final java.lang.String separateur) {
565 this._separateur = separateur;
566 }
567
568
569
570
571
572
573
574
575
576
577
578
579 public static org.sourceforge.mbeanmonitoring.report.castor.ServerParam unmarshal(
580 final java.io.Reader reader)
581 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
582 return (org.sourceforge.mbeanmonitoring.report.castor.ServerParam) Unmarshaller.unmarshal(org.sourceforge.mbeanmonitoring.report.castor.ServerParam.class, reader);
583 }
584
585
586
587
588
589
590
591 public void validate(
592 )
593 throws org.exolab.castor.xml.ValidationException {
594 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
595 validator.validate(this);
596 }
597
598 }