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.engine.schema.config;
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 Resource.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class Resource extends fr.in2p3.jsaga.engine.schema.config.ObjectType 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /**
41       * Field _type
42       */
43      private java.lang.String _type;
44  
45      /**
46       * Field _impl
47       */
48      private java.lang.String _impl;
49  
50      /**
51       * Field _usage
52       */
53      private java.lang.String _usage;
54  
55      /**
56       * Field _supportedContextTypeList
57       */
58      private java.util.ArrayList _supportedContextTypeList;
59  
60  
61        //----------------/
62       //- Constructors -/
63      //----------------/
64  
65      public Resource() 
66       {
67          super();
68          _supportedContextTypeList = new ArrayList();
69      } //-- fr.in2p3.jsaga.engine.schema.config.Resource()
70  
71  
72        //-----------/
73       //- Methods -/
74      //-----------/
75  
76      /**
77       * Method addSupportedContextType
78       * 
79       * 
80       * 
81       * @param vSupportedContextType
82       */
83      public void addSupportedContextType(java.lang.String vSupportedContextType)
84          throws java.lang.IndexOutOfBoundsException
85      {
86          _supportedContextTypeList.add(vSupportedContextType);
87      } //-- void addSupportedContextType(java.lang.String) 
88  
89      /**
90       * Method addSupportedContextType
91       * 
92       * 
93       * 
94       * @param index
95       * @param vSupportedContextType
96       */
97      public void addSupportedContextType(int index, java.lang.String vSupportedContextType)
98          throws java.lang.IndexOutOfBoundsException
99      {
100         _supportedContextTypeList.add(index, vSupportedContextType);
101     } //-- void addSupportedContextType(int, java.lang.String) 
102 
103     /**
104      * Method clearSupportedContextType
105      * 
106      */
107     public void clearSupportedContextType()
108     {
109         _supportedContextTypeList.clear();
110     } //-- void clearSupportedContextType() 
111 
112     /**
113      * Method enumerateSupportedContextType
114      * 
115      * 
116      * 
117      * @return Enumeration
118      */
119     public java.util.Enumeration enumerateSupportedContextType()
120     {
121         return new org.exolab.castor.util.IteratorEnumeration(_supportedContextTypeList.iterator());
122     } //-- java.util.Enumeration enumerateSupportedContextType() 
123 
124     /**
125      * Returns the value of field 'impl'.
126      * 
127      * @return String
128      * @return the value of field 'impl'.
129      */
130     public java.lang.String getImpl()
131     {
132         return this._impl;
133     } //-- java.lang.String getImpl() 
134 
135     /**
136      * Method getSupportedContextType
137      * 
138      * 
139      * 
140      * @param index
141      * @return String
142      */
143     public java.lang.String getSupportedContextType(int index)
144         throws java.lang.IndexOutOfBoundsException
145     {
146         //-- check bounds for index
147         if ((index < 0) || (index > _supportedContextTypeList.size())) {
148             throw new IndexOutOfBoundsException();
149         }
150         
151         return (String)_supportedContextTypeList.get(index);
152     } //-- java.lang.String getSupportedContextType(int) 
153 
154     /**
155      * Method getSupportedContextType
156      * 
157      * 
158      * 
159      * @return String
160      */
161     public java.lang.String[] getSupportedContextType()
162     {
163         int size = _supportedContextTypeList.size();
164         java.lang.String[] mArray = new java.lang.String[size];
165         for (int index = 0; index < size; index++) {
166             mArray[index] = (String)_supportedContextTypeList.get(index);
167         }
168         return mArray;
169     } //-- java.lang.String[] getSupportedContextType() 
170 
171     /**
172      * Method getSupportedContextTypeCount
173      * 
174      * 
175      * 
176      * @return int
177      */
178     public int getSupportedContextTypeCount()
179     {
180         return _supportedContextTypeList.size();
181     } //-- int getSupportedContextTypeCount() 
182 
183     /**
184      * Returns the value of field 'type'.
185      * 
186      * @return String
187      * @return the value of field 'type'.
188      */
189     public java.lang.String getType()
190     {
191         return this._type;
192     } //-- java.lang.String getType() 
193 
194     /**
195      * Returns the value of field 'usage'.
196      * 
197      * @return String
198      * @return the value of field 'usage'.
199      */
200     public java.lang.String getUsage()
201     {
202         return this._usage;
203     } //-- java.lang.String getUsage() 
204 
205     /**
206      * Method isValid
207      * 
208      * 
209      * 
210      * @return boolean
211      */
212     public boolean isValid()
213     {
214         try {
215             validate();
216         }
217         catch (org.exolab.castor.xml.ValidationException vex) {
218             return false;
219         }
220         return true;
221     } //-- boolean isValid() 
222 
223     /**
224      * Method marshal
225      * 
226      * 
227      * 
228      * @param out
229      */
230     public void marshal(java.io.Writer out)
231         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
232     {
233         
234         Marshaller.marshal(this, out);
235     } //-- void marshal(java.io.Writer) 
236 
237     /**
238      * Method marshal
239      * 
240      * 
241      * 
242      * @param handler
243      */
244     public void marshal(org.xml.sax.ContentHandler handler)
245         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
246     {
247         
248         Marshaller.marshal(this, handler);
249     } //-- void marshal(org.xml.sax.ContentHandler) 
250 
251     /**
252      * Method removeSupportedContextType
253      * 
254      * 
255      * 
256      * @param vSupportedContextType
257      * @return boolean
258      */
259     public boolean removeSupportedContextType(java.lang.String vSupportedContextType)
260     {
261         boolean removed = _supportedContextTypeList.remove(vSupportedContextType);
262         return removed;
263     } //-- boolean removeSupportedContextType(java.lang.String) 
264 
265     /**
266      * Sets the value of field 'impl'.
267      * 
268      * @param impl the value of field 'impl'.
269      */
270     public void setImpl(java.lang.String impl)
271     {
272         this._impl = impl;
273     } //-- void setImpl(java.lang.String) 
274 
275     /**
276      * Method setSupportedContextType
277      * 
278      * 
279      * 
280      * @param index
281      * @param vSupportedContextType
282      */
283     public void setSupportedContextType(int index, java.lang.String vSupportedContextType)
284         throws java.lang.IndexOutOfBoundsException
285     {
286         //-- check bounds for index
287         if ((index < 0) || (index > _supportedContextTypeList.size())) {
288             throw new IndexOutOfBoundsException();
289         }
290         _supportedContextTypeList.set(index, vSupportedContextType);
291     } //-- void setSupportedContextType(int, java.lang.String) 
292 
293     /**
294      * Method setSupportedContextType
295      * 
296      * 
297      * 
298      * @param supportedContextTypeArray
299      */
300     public void setSupportedContextType(java.lang.String[] supportedContextTypeArray)
301     {
302         //-- copy array
303         _supportedContextTypeList.clear();
304         for (int i = 0; i < supportedContextTypeArray.length; i++) {
305             _supportedContextTypeList.add(supportedContextTypeArray[i]);
306         }
307     } //-- void setSupportedContextType(java.lang.String) 
308 
309     /**
310      * Sets the value of field 'type'.
311      * 
312      * @param type the value of field 'type'.
313      */
314     public void setType(java.lang.String type)
315     {
316         this._type = type;
317     } //-- void setType(java.lang.String) 
318 
319     /**
320      * Sets the value of field 'usage'.
321      * 
322      * @param usage the value of field 'usage'.
323      */
324     public void setUsage(java.lang.String usage)
325     {
326         this._usage = usage;
327     } //-- void setUsage(java.lang.String) 
328 
329     /**
330      * Method unmarshal
331      * 
332      * 
333      * 
334      * @param reader
335      * @return Object
336      */
337     public static java.lang.Object unmarshal(java.io.Reader reader)
338         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
339     {
340         return (fr.in2p3.jsaga.engine.schema.config.Resource) Unmarshaller.unmarshal(fr.in2p3.jsaga.engine.schema.config.Resource.class, reader);
341     } //-- java.lang.Object unmarshal(java.io.Reader) 
342 
343     /**
344      * Method validate
345      * 
346      */
347     public void validate()
348         throws org.exolab.castor.xml.ValidationException
349     {
350         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
351         validator.validate(this);
352     } //-- void validate() 
353 
354 }