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