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