1
2
3
4
5
6
7
8 package fr.in2p3.jsaga.adaptor.schema.job.emulator;
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 java.util.ArrayList _jobList;
57
58
59
60
61
62
63 public Server()
64 {
65 super();
66 _jobList = new ArrayList();
67 }
68
69
70
71
72
73
74
75
76
77
78
79
80
81 public void addJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
82 throws java.lang.IndexOutOfBoundsException
83 {
84 _jobList.add(vJob);
85 }
86
87
88
89
90
91
92
93
94
95 public void addJob(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
96 throws java.lang.IndexOutOfBoundsException
97 {
98 _jobList.add(index, vJob);
99 }
100
101
102
103
104
105 public void clearJob()
106 {
107 _jobList.clear();
108 }
109
110
111
112
113
114 public void deletePort()
115 {
116 this._has_port= false;
117 }
118
119
120
121
122
123
124
125
126 public java.util.Enumeration enumerateJob()
127 {
128 return new org.exolab.castor.util.IteratorEnumeration(_jobList.iterator());
129 }
130
131
132
133
134
135
136
137 public java.lang.String getHost()
138 {
139 return this._host;
140 }
141
142
143
144
145
146
147
148
149
150 public fr.in2p3.jsaga.adaptor.schema.job.emulator.Job getJob(int index)
151 throws java.lang.IndexOutOfBoundsException
152 {
153
154 if ((index < 0) || (index > _jobList.size())) {
155 throw new IndexOutOfBoundsException();
156 }
157
158 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) _jobList.get(index);
159 }
160
161
162
163
164
165
166
167
168 public fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] getJob()
169 {
170 int size = _jobList.size();
171 fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] mArray = new fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[size];
172 for (int index = 0; index < size; index++) {
173 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) _jobList.get(index);
174 }
175 return mArray;
176 }
177
178
179
180
181
182
183
184
185 public int getJobCount()
186 {
187 return _jobList.size();
188 }
189
190
191
192
193
194
195
196 public int getPort()
197 {
198 return this._port;
199 }
200
201
202
203
204
205
206
207
208 public boolean hasPort()
209 {
210 return this._has_port;
211 }
212
213
214
215
216
217
218
219
220 public boolean isValid()
221 {
222 try {
223 validate();
224 }
225 catch (org.exolab.castor.xml.ValidationException vex) {
226 return false;
227 }
228 return true;
229 }
230
231
232
233
234
235
236
237
238 public void marshal(java.io.Writer out)
239 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
240 {
241
242 Marshaller.marshal(this, out);
243 }
244
245
246
247
248
249
250
251
252 public void marshal(org.xml.sax.ContentHandler handler)
253 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
254 {
255
256 Marshaller.marshal(this, handler);
257 }
258
259
260
261
262
263
264
265
266
267 public boolean removeJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
268 {
269 boolean removed = _jobList.remove(vJob);
270 return removed;
271 }
272
273
274
275
276
277
278 public void setHost(java.lang.String host)
279 {
280 this._host = host;
281 }
282
283
284
285
286
287
288
289
290
291 public void setJob(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
292 throws java.lang.IndexOutOfBoundsException
293 {
294
295 if ((index < 0) || (index > _jobList.size())) {
296 throw new IndexOutOfBoundsException();
297 }
298 _jobList.set(index, vJob);
299 }
300
301
302
303
304
305
306
307
308 public void setJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] jobArray)
309 {
310
311 _jobList.clear();
312 for (int i = 0; i < jobArray.length; i++) {
313 _jobList.add(jobArray[i]);
314 }
315 }
316
317
318
319
320
321
322 public void setPort(int port)
323 {
324 this._port = port;
325 this._has_port = true;
326 }
327
328
329
330
331
332
333
334
335
336 public static java.lang.Object unmarshal(java.io.Reader reader)
337 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
338 {
339 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.Server) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.job.emulator.Server.class, reader);
340 }
341
342
343
344
345
346 public void validate()
347 throws org.exolab.castor.xml.ValidationException
348 {
349 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
350 validator.validate(this);
351 }
352
353 }