1
2
3
4
5
6
7
8 package fr.in2p3.jsaga.adaptor.schema.data.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 DataEmulator implements java.io.Serializable {
32
33
34
35
36
37
38
39
40
41 private java.util.ArrayList _serverList;
42
43
44
45
46 private java.util.ArrayList _secureServerList;
47
48
49
50
51
52
53 public DataEmulator()
54 {
55 super();
56 _serverList = new ArrayList();
57 _secureServerList = new ArrayList();
58 }
59
60
61
62
63
64
65
66
67
68
69
70
71
72 public void addSecureServer(fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer vSecureServer)
73 throws java.lang.IndexOutOfBoundsException
74 {
75 _secureServerList.add(vSecureServer);
76 }
77
78
79
80
81
82
83
84
85
86 public void addSecureServer(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer vSecureServer)
87 throws java.lang.IndexOutOfBoundsException
88 {
89 _secureServerList.add(index, vSecureServer);
90 }
91
92
93
94
95
96
97
98
99 public void addServer(fr.in2p3.jsaga.adaptor.schema.data.emulator.Server vServer)
100 throws java.lang.IndexOutOfBoundsException
101 {
102 _serverList.add(vServer);
103 }
104
105
106
107
108
109
110
111
112
113 public void addServer(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.Server vServer)
114 throws java.lang.IndexOutOfBoundsException
115 {
116 _serverList.add(index, vServer);
117 }
118
119
120
121
122
123 public void clearSecureServer()
124 {
125 _secureServerList.clear();
126 }
127
128
129
130
131
132 public void clearServer()
133 {
134 _serverList.clear();
135 }
136
137
138
139
140
141
142
143
144 public java.util.Enumeration enumerateSecureServer()
145 {
146 return new org.exolab.castor.util.IteratorEnumeration(_secureServerList.iterator());
147 }
148
149
150
151
152
153
154
155
156 public java.util.Enumeration enumerateServer()
157 {
158 return new org.exolab.castor.util.IteratorEnumeration(_serverList.iterator());
159 }
160
161
162
163
164
165
166
167
168
169 public fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer getSecureServer(int index)
170 throws java.lang.IndexOutOfBoundsException
171 {
172
173 if ((index < 0) || (index > _secureServerList.size())) {
174 throw new IndexOutOfBoundsException();
175 }
176
177 return (fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer) _secureServerList.get(index);
178 }
179
180
181
182
183
184
185
186
187 public fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer[] getSecureServer()
188 {
189 int size = _secureServerList.size();
190 fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer[] mArray = new fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer[size];
191 for (int index = 0; index < size; index++) {
192 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer) _secureServerList.get(index);
193 }
194 return mArray;
195 }
196
197
198
199
200
201
202
203
204 public int getSecureServerCount()
205 {
206 return _secureServerList.size();
207 }
208
209
210
211
212
213
214
215
216
217 public fr.in2p3.jsaga.adaptor.schema.data.emulator.Server getServer(int index)
218 throws java.lang.IndexOutOfBoundsException
219 {
220
221 if ((index < 0) || (index > _serverList.size())) {
222 throw new IndexOutOfBoundsException();
223 }
224
225 return (fr.in2p3.jsaga.adaptor.schema.data.emulator.Server) _serverList.get(index);
226 }
227
228
229
230
231
232
233
234
235 public fr.in2p3.jsaga.adaptor.schema.data.emulator.Server[] getServer()
236 {
237 int size = _serverList.size();
238 fr.in2p3.jsaga.adaptor.schema.data.emulator.Server[] mArray = new fr.in2p3.jsaga.adaptor.schema.data.emulator.Server[size];
239 for (int index = 0; index < size; index++) {
240 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.data.emulator.Server) _serverList.get(index);
241 }
242 return mArray;
243 }
244
245
246
247
248
249
250
251
252 public int getServerCount()
253 {
254 return _serverList.size();
255 }
256
257
258
259
260
261
262
263
264 public boolean isValid()
265 {
266 try {
267 validate();
268 }
269 catch (org.exolab.castor.xml.ValidationException vex) {
270 return false;
271 }
272 return true;
273 }
274
275
276
277
278
279
280
281
282 public void marshal(java.io.Writer out)
283 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
284 {
285
286 Marshaller.marshal(this, out);
287 }
288
289
290
291
292
293
294
295
296 public void marshal(org.xml.sax.ContentHandler handler)
297 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
298 {
299
300 Marshaller.marshal(this, handler);
301 }
302
303
304
305
306
307
308
309
310
311 public boolean removeSecureServer(fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer vSecureServer)
312 {
313 boolean removed = _secureServerList.remove(vSecureServer);
314 return removed;
315 }
316
317
318
319
320
321
322
323
324
325 public boolean removeServer(fr.in2p3.jsaga.adaptor.schema.data.emulator.Server vServer)
326 {
327 boolean removed = _serverList.remove(vServer);
328 return removed;
329 }
330
331
332
333
334
335
336
337
338
339 public void setSecureServer(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer vSecureServer)
340 throws java.lang.IndexOutOfBoundsException
341 {
342
343 if ((index < 0) || (index > _secureServerList.size())) {
344 throw new IndexOutOfBoundsException();
345 }
346 _secureServerList.set(index, vSecureServer);
347 }
348
349
350
351
352
353
354
355
356 public void setSecureServer(fr.in2p3.jsaga.adaptor.schema.data.emulator.SecureServer[] secureServerArray)
357 {
358
359 _secureServerList.clear();
360 for (int i = 0; i < secureServerArray.length; i++) {
361 _secureServerList.add(secureServerArray[i]);
362 }
363 }
364
365
366
367
368
369
370
371
372
373 public void setServer(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.Server vServer)
374 throws java.lang.IndexOutOfBoundsException
375 {
376
377 if ((index < 0) || (index > _serverList.size())) {
378 throw new IndexOutOfBoundsException();
379 }
380 _serverList.set(index, vServer);
381 }
382
383
384
385
386
387
388
389
390 public void setServer(fr.in2p3.jsaga.adaptor.schema.data.emulator.Server[] serverArray)
391 {
392
393 _serverList.clear();
394 for (int i = 0; i < serverArray.length; i++) {
395 _serverList.add(serverArray[i]);
396 }
397 }
398
399
400
401
402
403
404
405
406
407 public static java.lang.Object unmarshal(java.io.Reader reader)
408 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
409 {
410 return (fr.in2p3.jsaga.adaptor.schema.data.emulator.DataEmulator) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.data.emulator.DataEmulator.class, reader);
411 }
412
413
414
415
416
417 public void validate()
418 throws org.exolab.castor.xml.ValidationException
419 {
420 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
421 validator.validate(this);
422 }
423
424 }