View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package fr.in2p3.jsaga.adaptor.schema.data.catalog;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
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   * Class FileType.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class FileType extends fr.in2p3.jsaga.adaptor.schema.data.catalog.EntryType 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /**
41       * Field _replicaList
42       */
43      private java.util.ArrayList _replicaList;
44  
45  
46        //----------------/
47       //- Constructors -/
48      //----------------/
49  
50      public FileType() 
51       {
52          super();
53          _replicaList = new ArrayList();
54      } //-- fr.in2p3.jsaga.adaptor.schema.data.catalog.FileType()
55  
56  
57        //-----------/
58       //- Methods -/
59      //-----------/
60  
61      /**
62       * Method addReplica
63       * 
64       * 
65       * 
66       * @param vReplica
67       */
68      public void addReplica(java.lang.String vReplica)
69          throws java.lang.IndexOutOfBoundsException
70      {
71          _replicaList.add(vReplica);
72      } //-- void addReplica(java.lang.String) 
73  
74      /**
75       * Method addReplica
76       * 
77       * 
78       * 
79       * @param index
80       * @param vReplica
81       */
82      public void addReplica(int index, java.lang.String vReplica)
83          throws java.lang.IndexOutOfBoundsException
84      {
85          _replicaList.add(index, vReplica);
86      } //-- void addReplica(int, java.lang.String) 
87  
88      /**
89       * Method clearReplica
90       * 
91       */
92      public void clearReplica()
93      {
94          _replicaList.clear();
95      } //-- void clearReplica() 
96  
97      /**
98       * Method enumerateReplica
99       * 
100      * 
101      * 
102      * @return Enumeration
103      */
104     public java.util.Enumeration enumerateReplica()
105     {
106         return new org.exolab.castor.util.IteratorEnumeration(_replicaList.iterator());
107     } //-- java.util.Enumeration enumerateReplica() 
108 
109     /**
110      * Method getReplica
111      * 
112      * 
113      * 
114      * @param index
115      * @return String
116      */
117     public java.lang.String getReplica(int index)
118         throws java.lang.IndexOutOfBoundsException
119     {
120         //-- check bounds for index
121         if ((index < 0) || (index > _replicaList.size())) {
122             throw new IndexOutOfBoundsException();
123         }
124         
125         return (String)_replicaList.get(index);
126     } //-- java.lang.String getReplica(int) 
127 
128     /**
129      * Method getReplica
130      * 
131      * 
132      * 
133      * @return String
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     } //-- java.lang.String[] getReplica() 
144 
145     /**
146      * Method getReplicaCount
147      * 
148      * 
149      * 
150      * @return int
151      */
152     public int getReplicaCount()
153     {
154         return _replicaList.size();
155     } //-- int getReplicaCount() 
156 
157     /**
158      * Method isValid
159      * 
160      * 
161      * 
162      * @return boolean
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     } //-- boolean isValid() 
174 
175     /**
176      * Method marshal
177      * 
178      * 
179      * 
180      * @param out
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     } //-- void marshal(java.io.Writer) 
188 
189     /**
190      * Method marshal
191      * 
192      * 
193      * 
194      * @param handler
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     } //-- void marshal(org.xml.sax.ContentHandler) 
202 
203     /**
204      * Method removeReplica
205      * 
206      * 
207      * 
208      * @param vReplica
209      * @return boolean
210      */
211     public boolean removeReplica(java.lang.String vReplica)
212     {
213         boolean removed = _replicaList.remove(vReplica);
214         return removed;
215     } //-- boolean removeReplica(java.lang.String) 
216 
217     /**
218      * Method setReplica
219      * 
220      * 
221      * 
222      * @param index
223      * @param vReplica
224      */
225     public void setReplica(int index, java.lang.String vReplica)
226         throws java.lang.IndexOutOfBoundsException
227     {
228         //-- check bounds for index
229         if ((index < 0) || (index > _replicaList.size())) {
230             throw new IndexOutOfBoundsException();
231         }
232         _replicaList.set(index, vReplica);
233     } //-- void setReplica(int, java.lang.String) 
234 
235     /**
236      * Method setReplica
237      * 
238      * 
239      * 
240      * @param replicaArray
241      */
242     public void setReplica(java.lang.String[] replicaArray)
243     {
244         //-- copy array
245         _replicaList.clear();
246         for (int i = 0; i < replicaArray.length; i++) {
247             _replicaList.add(replicaArray[i]);
248         }
249     } //-- void setReplica(java.lang.String) 
250 
251     /**
252      * Method unmarshal
253      * 
254      * 
255      * 
256      * @param reader
257      * @return Object
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     } //-- java.lang.Object unmarshal(java.io.Reader) 
264 
265     /**
266      * Method validate
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     } //-- void validate() 
275 
276 }