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