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 EntryType.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class EntryType implements java.io.Serializable {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /**
39       * Field _name
40       */
41      private java.lang.String _name;
42  
43      /**
44       * Field _link
45       */
46      private java.lang.String _link;
47  
48      /**
49       * Field _metadataList
50       */
51      private java.util.ArrayList _metadataList;
52  
53  
54        //----------------/
55       //- Constructors -/
56      //----------------/
57  
58      public EntryType() 
59       {
60          super();
61          _metadataList = new ArrayList();
62      } //-- fr.in2p3.jsaga.adaptor.schema.data.catalog.EntryType()
63  
64  
65        //-----------/
66       //- Methods -/
67      //-----------/
68  
69      /**
70       * Method addMetadata
71       * 
72       * 
73       * 
74       * @param vMetadata
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      } //-- void addMetadata(fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata) 
81  
82      /**
83       * Method addMetadata
84       * 
85       * 
86       * 
87       * @param index
88       * @param vMetadata
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      } //-- void addMetadata(int, fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata) 
95  
96      /**
97       * Method clearMetadata
98       * 
99       */
100     public void clearMetadata()
101     {
102         _metadataList.clear();
103     } //-- void clearMetadata() 
104 
105     /**
106      * Method enumerateMetadata
107      * 
108      * 
109      * 
110      * @return Enumeration
111      */
112     public java.util.Enumeration enumerateMetadata()
113     {
114         return new org.exolab.castor.util.IteratorEnumeration(_metadataList.iterator());
115     } //-- java.util.Enumeration enumerateMetadata() 
116 
117     /**
118      * Returns the value of field 'link'.
119      * 
120      * @return String
121      * @return the value of field 'link'.
122      */
123     public java.lang.String getLink()
124     {
125         return this._link;
126     } //-- java.lang.String getLink() 
127 
128     /**
129      * Method getMetadata
130      * 
131      * 
132      * 
133      * @param index
134      * @return Metadata
135      */
136     public fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata getMetadata(int index)
137         throws java.lang.IndexOutOfBoundsException
138     {
139         //-- check bounds for index
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     } //-- fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata getMetadata(int) 
146 
147     /**
148      * Method getMetadata
149      * 
150      * 
151      * 
152      * @return Metadata
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     } //-- fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata[] getMetadata() 
163 
164     /**
165      * Method getMetadataCount
166      * 
167      * 
168      * 
169      * @return int
170      */
171     public int getMetadataCount()
172     {
173         return _metadataList.size();
174     } //-- int getMetadataCount() 
175 
176     /**
177      * Returns the value of field 'name'.
178      * 
179      * @return String
180      * @return the value of field 'name'.
181      */
182     public java.lang.String getName()
183     {
184         return this._name;
185     } //-- java.lang.String getName() 
186 
187     /**
188      * Method isValid
189      * 
190      * 
191      * 
192      * @return boolean
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     } //-- boolean isValid() 
204 
205     /**
206      * Method marshal
207      * 
208      * 
209      * 
210      * @param out
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     } //-- void marshal(java.io.Writer) 
218 
219     /**
220      * Method marshal
221      * 
222      * 
223      * 
224      * @param handler
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     } //-- void marshal(org.xml.sax.ContentHandler) 
232 
233     /**
234      * Method removeMetadata
235      * 
236      * 
237      * 
238      * @param vMetadata
239      * @return boolean
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     } //-- boolean removeMetadata(fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata) 
246 
247     /**
248      * Sets the value of field 'link'.
249      * 
250      * @param link the value of field 'link'.
251      */
252     public void setLink(java.lang.String link)
253     {
254         this._link = link;
255     } //-- void setLink(java.lang.String) 
256 
257     /**
258      * Method setMetadata
259      * 
260      * 
261      * 
262      * @param index
263      * @param vMetadata
264      */
265     public void setMetadata(int index, fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata vMetadata)
266         throws java.lang.IndexOutOfBoundsException
267     {
268         //-- check bounds for index
269         if ((index < 0) || (index > _metadataList.size())) {
270             throw new IndexOutOfBoundsException();
271         }
272         _metadataList.set(index, vMetadata);
273     } //-- void setMetadata(int, fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata) 
274 
275     /**
276      * Method setMetadata
277      * 
278      * 
279      * 
280      * @param metadataArray
281      */
282     public void setMetadata(fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata[] metadataArray)
283     {
284         //-- copy array
285         _metadataList.clear();
286         for (int i = 0; i < metadataArray.length; i++) {
287             _metadataList.add(metadataArray[i]);
288         }
289     } //-- void setMetadata(fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata) 
290 
291     /**
292      * Sets the value of field 'name'.
293      * 
294      * @param name the value of field 'name'.
295      */
296     public void setName(java.lang.String name)
297     {
298         this._name = name;
299     } //-- void setName(java.lang.String) 
300 
301     /**
302      * Method unmarshal
303      * 
304      * 
305      * 
306      * @param reader
307      * @return Object
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     } //-- java.lang.Object unmarshal(java.io.Reader) 
314 
315     /**
316      * Method validate
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     } //-- void validate() 
325 
326 }