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