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 JobEmulator implements java.io.Serializable {
32
33
34
35
36
37
38
39
40
41 private java.util.ArrayList _serverList;
42
43
44
45
46
47
48 public JobEmulator()
49 {
50 super();
51 _serverList = new ArrayList();
52 }
53
54
55
56
57
58
59
60
61
62
63
64
65
66 public void addServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.Server vServer)
67 throws java.lang.IndexOutOfBoundsException
68 {
69 _serverList.add(vServer);
70 }
71
72
73
74
75
76
77
78
79
80 public void addServer(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.Server vServer)
81 throws java.lang.IndexOutOfBoundsException
82 {
83 _serverList.add(index, vServer);
84 }
85
86
87
88
89
90 public void clearServer()
91 {
92 _serverList.clear();
93 }
94
95
96
97
98
99
100
101
102 public java.util.Enumeration enumerateServer()
103 {
104 return new org.exolab.castor.util.IteratorEnumeration(_serverList.iterator());
105 }
106
107
108
109
110
111
112
113
114
115 public fr.in2p3.jsaga.adaptor.schema.job.emulator.Server getServer(int index)
116 throws java.lang.IndexOutOfBoundsException
117 {
118
119 if ((index < 0) || (index > _serverList.size())) {
120 throw new IndexOutOfBoundsException();
121 }
122
123 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.Server) _serverList.get(index);
124 }
125
126
127
128
129
130
131
132
133 public fr.in2p3.jsaga.adaptor.schema.job.emulator.Server[] getServer()
134 {
135 int size = _serverList.size();
136 fr.in2p3.jsaga.adaptor.schema.job.emulator.Server[] mArray = new fr.in2p3.jsaga.adaptor.schema.job.emulator.Server[size];
137 for (int index = 0; index < size; index++) {
138 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.job.emulator.Server) _serverList.get(index);
139 }
140 return mArray;
141 }
142
143
144
145
146
147
148
149
150 public int getServerCount()
151 {
152 return _serverList.size();
153 }
154
155
156
157
158
159
160
161
162 public boolean isValid()
163 {
164 try {
165 validate();
166 }
167 catch (org.exolab.castor.xml.ValidationException vex) {
168 return false;
169 }
170 return true;
171 }
172
173
174
175
176
177
178
179
180 public void marshal(java.io.Writer out)
181 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
182 {
183
184 Marshaller.marshal(this, out);
185 }
186
187
188
189
190
191
192
193
194 public void marshal(org.xml.sax.ContentHandler handler)
195 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
196 {
197
198 Marshaller.marshal(this, handler);
199 }
200
201
202
203
204
205
206
207
208
209 public boolean removeServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.Server vServer)
210 {
211 boolean removed = _serverList.remove(vServer);
212 return removed;
213 }
214
215
216
217
218
219
220
221
222
223 public void setServer(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.Server vServer)
224 throws java.lang.IndexOutOfBoundsException
225 {
226
227 if ((index < 0) || (index > _serverList.size())) {
228 throw new IndexOutOfBoundsException();
229 }
230 _serverList.set(index, vServer);
231 }
232
233
234
235
236
237
238
239
240 public void setServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.Server[] serverArray)
241 {
242
243 _serverList.clear();
244 for (int i = 0; i < serverArray.length; i++) {
245 _serverList.add(serverArray[i]);
246 }
247 }
248
249
250
251
252
253
254
255
256
257 public static java.lang.Object unmarshal(java.io.Reader reader)
258 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
259 {
260 return (fr.in2p3.jsaga.adaptor.schema.job.emulator.JobEmulator) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.job.emulator.JobEmulator.class, reader);
261 }
262
263
264
265
266
267 public void validate()
268 throws org.exolab.castor.xml.ValidationException
269 {
270 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
271 validator.validate(this);
272 }
273
274 }