1
2
3
4
5
6
7
8 package fr.in2p3.jsaga.adaptor.schema.job.emulator.config;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.ArrayList;
19 import java.util.Enumeration;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26
27
28
29
30
31 public class Server implements java.io.Serializable {
32
33
34
35
36
37
38
39
40
41 private java.lang.String _host;
42
43
44
45
46 private int _port;
47
48
49
50
51 private boolean _has_port;
52
53
54
55
56 private float _cancelledJobs;
57
58
59
60
61 private boolean _has_cancelledJobs;
62
63
64
65
66 private float _failedJobs;
67
68
69
70
71 private boolean _has_failedJobs;
72
73
74
75
76 private float _completedJobs;
77
78
79
80
81 private boolean _has_completedJobs;
82
83
84
85
86 private float _lostJobs;
87
88
89
90
91 private boolean _has_lostJobs;
92
93
94
95
96 private java.util.ArrayList _queuingList;
97
98
99
100
101 private java.util.ArrayList _runningList;
102
103
104
105
106
107
108 public Server()
109 {
110 super();
111 _queuingList = new ArrayList();
112 _runningList = new ArrayList();
113 }
114
115
116
117
118
119
120
121
122
123
124
125
126
127 public void addQueuing(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing vQueuing)
128 throws java.lang.IndexOutOfBoundsException
129 {
130 _queuingList.add(vQueuing);
131 }
132
133
134
135
136
137
138
139
140
141 public void addQueuing(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing vQueuing)
142 throws java.lang.IndexOutOfBoundsException
143 {
144 _queuingList.add(index, vQueuing);
145 }
146
147
148
149
150
151
152
153
154 public void addRunning(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running vRunning)
155 throws java.lang.IndexOutOfBoundsException
156 {
157 _runningList.add(vRunning);
158 }
159
160
161
162
163
164
165
166
167
168 public void addRunning(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running vRunning)
169 throws java.lang.IndexOutOfBoundsException
170 {
171 _runningList.add(index, vRunning);
172 }
173
174
175
176
177
178 public void clearQueuing()
179 {
180 _queuingList.clear();
181 }
182
183
184
185
186
187 public void clearRunning()
188 {
189 _runningList.clear();
190 }
191
192
193
194
195
196 public void deleteCancelledJobs()
197 {
198 this._has_cancelledJobs= false;
199 }
200
201
202
203
204
205 public void deleteCompletedJobs()
206 {
207 this._has_completedJobs= false;
208 }
209
210
211
212
213
214 public void deleteFailedJobs()
215 {
216 this._has_failedJobs= false;
217 }
218
219
220
221
222
223 public void deleteLostJobs()
224 {
225 this._has_lostJobs= false;
226 }
227
228
229
230
231
232 public void deletePort()
233 {
234 this._has_port= false;
235 }
236
237
238
239
240
241
242
243
244 public java.util.Enumeration enumerateQueuing()
245 {
246 return new org.exolab.castor.util.IteratorEnumeration(_queuingList.iterator());
247 }
248
249
250
251
252
253
254
255
256 public java.util.Enumeration enumerateRunning()
257 {
258 return new org.exolab.castor.util.IteratorEnumeration(_runningList.iterator());
259 }
260
261
262
263
264
265
266
267 public float getCancelledJobs()
268 {
269 return this._cancelledJobs;
270 }
271
272
273
274
275
276
277
278 public float getCompletedJobs()
279 {
280 return this._completedJobs;
281 }
282
283
284
285
286
287
288
289 public float getFailedJobs()
290 {
291 return this._failedJobs;
292 }
293
294
295
296
297
298
299
300 public java.lang.String getHost()
301 {
302 return this._host;
303 }
304
305
306
307
308
309
310
311 public float getLostJobs()
312 {
313 return this._lostJobs;
314 }
315
316
317
318
319
320
321
322 public int getPort()
323 {
324 return this._port;
325 }
326
327
328
329
330
331
332
333
334
335 public fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing getQueuing(int index)
336 throws java.lang.IndexOutOfBoundsException
337 {
338
339 if ((index < 0) || (index > _queuingList.size())) {
340 throw new IndexOutOfBoundsException();
341 }
342
343 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing) _queuingList.get(index);
344 }
345
346
347
348
349
350
351
352
353 public fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing[] getQueuing()
354 {
355 int size = _queuingList.size();
356 fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing[] mArray = new fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing[size];
357 for (int index = 0; index < size; index++) {
358 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing) _queuingList.get(index);
359 }
360 return mArray;
361 }
362
363
364
365
366
367
368
369
370 public int getQueuingCount()
371 {
372 return _queuingList.size();
373 }
374
375
376
377
378
379
380
381
382
383 public fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running getRunning(int index)
384 throws java.lang.IndexOutOfBoundsException
385 {
386
387 if ((index < 0) || (index > _runningList.size())) {
388 throw new IndexOutOfBoundsException();
389 }
390
391 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running) _runningList.get(index);
392 }
393
394
395
396
397
398
399
400
401 public fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running[] getRunning()
402 {
403 int size = _runningList.size();
404 fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running[] mArray = new fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running[size];
405 for (int index = 0; index < size; index++) {
406 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running) _runningList.get(index);
407 }
408 return mArray;
409 }
410
411
412
413
414
415
416
417
418 public int getRunningCount()
419 {
420 return _runningList.size();
421 }
422
423
424
425
426
427
428
429
430 public boolean hasCancelledJobs()
431 {
432 return this._has_cancelledJobs;
433 }
434
435
436
437
438
439
440
441
442 public boolean hasCompletedJobs()
443 {
444 return this._has_completedJobs;
445 }
446
447
448
449
450
451
452
453
454 public boolean hasFailedJobs()
455 {
456 return this._has_failedJobs;
457 }
458
459
460
461
462
463
464
465
466 public boolean hasLostJobs()
467 {
468 return this._has_lostJobs;
469 }
470
471
472
473
474
475
476
477
478 public boolean hasPort()
479 {
480 return this._has_port;
481 }
482
483
484
485
486
487
488
489
490 public boolean isValid()
491 {
492 try {
493 validate();
494 }
495 catch (org.exolab.castor.xml.ValidationException vex) {
496 return false;
497 }
498 return true;
499 }
500
501
502
503
504
505
506
507
508 public void marshal(java.io.Writer out)
509 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
510 {
511
512 Marshaller.marshal(this, out);
513 }
514
515
516
517
518
519
520
521
522 public void marshal(org.xml.sax.ContentHandler handler)
523 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
524 {
525
526 Marshaller.marshal(this, handler);
527 }
528
529
530
531
532
533
534
535
536
537 public boolean removeQueuing(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing vQueuing)
538 {
539 boolean removed = _queuingList.remove(vQueuing);
540 return removed;
541 }
542
543
544
545
546
547
548
549
550
551 public boolean removeRunning(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running vRunning)
552 {
553 boolean removed = _runningList.remove(vRunning);
554 return removed;
555 }
556
557
558
559
560
561
562 public void setCancelledJobs(float cancelledJobs)
563 {
564 this._cancelledJobs = cancelledJobs;
565 this._has_cancelledJobs = true;
566 }
567
568
569
570
571
572
573 public void setCompletedJobs(float completedJobs)
574 {
575 this._completedJobs = completedJobs;
576 this._has_completedJobs = true;
577 }
578
579
580
581
582
583
584 public void setFailedJobs(float failedJobs)
585 {
586 this._failedJobs = failedJobs;
587 this._has_failedJobs = true;
588 }
589
590
591
592
593
594
595 public void setHost(java.lang.String host)
596 {
597 this._host = host;
598 }
599
600
601
602
603
604
605 public void setLostJobs(float lostJobs)
606 {
607 this._lostJobs = lostJobs;
608 this._has_lostJobs = true;
609 }
610
611
612
613
614
615
616 public void setPort(int port)
617 {
618 this._port = port;
619 this._has_port = true;
620 }
621
622
623
624
625
626
627
628
629
630 public void setQueuing(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing vQueuing)
631 throws java.lang.IndexOutOfBoundsException
632 {
633
634 if ((index < 0) || (index > _queuingList.size())) {
635 throw new IndexOutOfBoundsException();
636 }
637 _queuingList.set(index, vQueuing);
638 }
639
640
641
642
643
644
645
646
647 public void setQueuing(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Queuing[] queuingArray)
648 {
649
650 _queuingList.clear();
651 for (int i = 0; i < queuingArray.length; i++) {
652 _queuingList.add(queuingArray[i]);
653 }
654 }
655
656
657
658
659
660
661
662
663
664 public void setRunning(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running vRunning)
665 throws java.lang.IndexOutOfBoundsException
666 {
667
668 if ((index < 0) || (index > _runningList.size())) {
669 throw new IndexOutOfBoundsException();
670 }
671 _runningList.set(index, vRunning);
672 }
673
674
675
676
677
678
679
680
681 public void setRunning(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Running[] runningArray)
682 {
683
684 _runningList.clear();
685 for (int i = 0; i < runningArray.length; i++) {
686 _runningList.add(runningArray[i]);
687 }
688 }
689
690
691
692
693
694
695
696
697
698 public static java.lang.Object unmarshal(java.io.Reader reader)
699 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
700 {
701 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server.class, reader);
702 }
703
704
705
706
707
708 public void validate()
709 throws org.exolab.castor.xml.ValidationException
710 {
711 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
712 validator.validate(this);
713 }
714
715 }