611c9815a3fd9962c24563397ef212b5878547fb
[jalview.git] / src / jalview / schemabinding / version2 / WebServiceParameterSet.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package jalview.schemabinding.version2;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class WebServiceParameterSet.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class WebServiceParameterSet implements java.io.Serializable {
23
24
25       //--------------------------/
26      //- Class/Member Variables -/
27     //--------------------------/
28
29     /**
30      * The short name for the parameter set. This will be shown
31      * amongst the
32      *  other presets for the web service.
33      *  
34      */
35     private java.lang.String _name;
36
37     /**
38      * A Jalview Web Service Parameter Set container
39      *  version number.
40      *  Version 1 created for storing Jaba user presets.
41      *  
42      */
43     private java.lang.String _version;
44
45     /**
46      * Short description - as utf8 encoded text. This is
47      *  usually displayed
48      *  in the body of an HTML capable tooltip, so HTML tags may be
49      * embedded
50      *  using standard UTF8 encoding.
51      *  
52      */
53     private java.lang.String _description;
54
55     /**
56      * URL for which the parameter set is valid. Jalview will use
57      * it to
58      *  match up parameter sets to service instances that can parse
59      * the
60      *  parameter set payload.
61      *  
62      */
63     private java.util.Vector _serviceURLList;
64
65     /**
66      * UTF8 encoded string to be processed into a specific web
67      * services'
68      *  parameter set. Note - newlines may be important to the
69      * structure
70      *  of this file.
71      *  
72      */
73     private java.lang.String _parameters;
74
75
76       //----------------/
77      //- Constructors -/
78     //----------------/
79
80     public WebServiceParameterSet() {
81         super();
82         this._serviceURLList = new java.util.Vector();
83     }
84
85
86       //-----------/
87      //- Methods -/
88     //-----------/
89
90     /**
91      * 
92      * 
93      * @param vServiceURL
94      * @throws java.lang.IndexOutOfBoundsException if the index
95      * given is outside the bounds of the collection
96      */
97     public void addServiceURL(
98             final java.lang.String vServiceURL)
99     throws java.lang.IndexOutOfBoundsException {
100         this._serviceURLList.addElement(vServiceURL);
101     }
102
103     /**
104      * 
105      * 
106      * @param index
107      * @param vServiceURL
108      * @throws java.lang.IndexOutOfBoundsException if the index
109      * given is outside the bounds of the collection
110      */
111     public void addServiceURL(
112             final int index,
113             final java.lang.String vServiceURL)
114     throws java.lang.IndexOutOfBoundsException {
115         this._serviceURLList.add(index, vServiceURL);
116     }
117
118     /**
119      * Method enumerateServiceURL.
120      * 
121      * @return an Enumeration over all java.lang.String elements
122      */
123     public java.util.Enumeration enumerateServiceURL(
124     ) {
125         return this._serviceURLList.elements();
126     }
127
128     /**
129      * Returns the value of field 'description'. The field
130      * 'description' has the following description: Short
131      * description - as utf8 encoded text. This is
132      *  usually displayed
133      *  in the body of an HTML capable tooltip, so HTML tags may be
134      * embedded
135      *  using standard UTF8 encoding.
136      *  
137      * 
138      * @return the value of field 'Description'.
139      */
140     public java.lang.String getDescription(
141     ) {
142         return this._description;
143     }
144
145     /**
146      * Returns the value of field 'name'. The field 'name' has the
147      * following description: The short name for the parameter set.
148      * This will be shown amongst the
149      *  other presets for the web service.
150      *  
151      * 
152      * @return the value of field 'Name'.
153      */
154     public java.lang.String getName(
155     ) {
156         return this._name;
157     }
158
159     /**
160      * Returns the value of field 'parameters'. The field
161      * 'parameters' has the following description: UTF8 encoded
162      * string to be processed into a specific web services'
163      *  parameter set. Note - newlines may be important to the
164      * structure
165      *  of this file.
166      *  
167      * 
168      * @return the value of field 'Parameters'.
169      */
170     public java.lang.String getParameters(
171     ) {
172         return this._parameters;
173     }
174
175     /**
176      * Method getServiceURL.
177      * 
178      * @param index
179      * @throws java.lang.IndexOutOfBoundsException if the index
180      * given is outside the bounds of the collection
181      * @return the value of the java.lang.String at the given index
182      */
183     public java.lang.String getServiceURL(
184             final int index)
185     throws java.lang.IndexOutOfBoundsException {
186         // check bounds for index
187         if (index < 0 || index >= this._serviceURLList.size()) {
188             throw new IndexOutOfBoundsException("getServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]");
189         }
190         
191         return (java.lang.String) _serviceURLList.get(index);
192     }
193
194     /**
195      * Method getServiceURL.Returns the contents of the collection
196      * in an Array.  <p>Note:  Just in case the collection contents
197      * are changing in another thread, we pass a 0-length Array of
198      * the correct type into the API call.  This way we <i>know</i>
199      * that the Array returned is of exactly the correct length.
200      * 
201      * @return this collection as an Array
202      */
203     public java.lang.String[] getServiceURL(
204     ) {
205         java.lang.String[] array = new java.lang.String[0];
206         return (java.lang.String[]) this._serviceURLList.toArray(array);
207     }
208
209     /**
210      * Method getServiceURLCount.
211      * 
212      * @return the size of this collection
213      */
214     public int getServiceURLCount(
215     ) {
216         return this._serviceURLList.size();
217     }
218
219     /**
220      * Returns the value of field 'version'. The field 'version'
221      * has the following description: A Jalview Web Service
222      * Parameter Set container
223      *  version number.
224      *  Version 1 created for storing Jaba user presets.
225      *  
226      * 
227      * @return the value of field 'Version'.
228      */
229     public java.lang.String getVersion(
230     ) {
231         return this._version;
232     }
233
234     /**
235      * Method isValid.
236      * 
237      * @return true if this object is valid according to the schema
238      */
239     public boolean isValid(
240     ) {
241         try {
242             validate();
243         } catch (org.exolab.castor.xml.ValidationException vex) {
244             return false;
245         }
246         return true;
247     }
248
249     /**
250      * 
251      * 
252      * @param out
253      * @throws org.exolab.castor.xml.MarshalException if object is
254      * null or if any SAXException is thrown during marshaling
255      * @throws org.exolab.castor.xml.ValidationException if this
256      * object is an invalid instance according to the schema
257      */
258     public void marshal(
259             final java.io.Writer out)
260     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
261         Marshaller.marshal(this, out);
262     }
263
264     /**
265      * 
266      * 
267      * @param handler
268      * @throws java.io.IOException if an IOException occurs during
269      * marshaling
270      * @throws org.exolab.castor.xml.ValidationException if this
271      * object is an invalid instance according to the schema
272      * @throws org.exolab.castor.xml.MarshalException if object is
273      * null or if any SAXException is thrown during marshaling
274      */
275     public void marshal(
276             final org.xml.sax.ContentHandler handler)
277     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
278         Marshaller.marshal(this, handler);
279     }
280
281     /**
282      */
283     public void removeAllServiceURL(
284     ) {
285         this._serviceURLList.clear();
286     }
287
288     /**
289      * Method removeServiceURL.
290      * 
291      * @param vServiceURL
292      * @return true if the object was removed from the collection.
293      */
294     public boolean removeServiceURL(
295             final java.lang.String vServiceURL) {
296         boolean removed = _serviceURLList.remove(vServiceURL);
297         return removed;
298     }
299
300     /**
301      * Method removeServiceURLAt.
302      * 
303      * @param index
304      * @return the element removed from the collection
305      */
306     public java.lang.String removeServiceURLAt(
307             final int index) {
308         java.lang.Object obj = this._serviceURLList.remove(index);
309         return (java.lang.String) obj;
310     }
311
312     /**
313      * Sets the value of field 'description'. The field
314      * 'description' has the following description: Short
315      * description - as utf8 encoded text. This is
316      *  usually displayed
317      *  in the body of an HTML capable tooltip, so HTML tags may be
318      * embedded
319      *  using standard UTF8 encoding.
320      *  
321      * 
322      * @param description the value of field 'description'.
323      */
324     public void setDescription(
325             final java.lang.String description) {
326         this._description = description;
327     }
328
329     /**
330      * Sets the value of field 'name'. The field 'name' has the
331      * following description: The short name for the parameter set.
332      * This will be shown amongst the
333      *  other presets for the web service.
334      *  
335      * 
336      * @param name the value of field 'name'.
337      */
338     public void setName(
339             final java.lang.String name) {
340         this._name = name;
341     }
342
343     /**
344      * Sets the value of field 'parameters'. The field 'parameters'
345      * has the following description: UTF8 encoded string to be
346      * processed into a specific web services'
347      *  parameter set. Note - newlines may be important to the
348      * structure
349      *  of this file.
350      *  
351      * 
352      * @param parameters the value of field 'parameters'.
353      */
354     public void setParameters(
355             final java.lang.String parameters) {
356         this._parameters = parameters;
357     }
358
359     /**
360      * 
361      * 
362      * @param index
363      * @param vServiceURL
364      * @throws java.lang.IndexOutOfBoundsException if the index
365      * given is outside the bounds of the collection
366      */
367     public void setServiceURL(
368             final int index,
369             final java.lang.String vServiceURL)
370     throws java.lang.IndexOutOfBoundsException {
371         // check bounds for index
372         if (index < 0 || index >= this._serviceURLList.size()) {
373             throw new IndexOutOfBoundsException("setServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]");
374         }
375         
376         this._serviceURLList.set(index, vServiceURL);
377     }
378
379     /**
380      * 
381      * 
382      * @param vServiceURLArray
383      */
384     public void setServiceURL(
385             final java.lang.String[] vServiceURLArray) {
386         //-- copy array
387         _serviceURLList.clear();
388         
389         for (int i = 0; i < vServiceURLArray.length; i++) {
390                 this._serviceURLList.add(vServiceURLArray[i]);
391         }
392     }
393
394     /**
395      * Sets the value of field 'version'. The field 'version' has
396      * the following description: A Jalview Web Service Parameter
397      * Set container
398      *  version number.
399      *  Version 1 created for storing Jaba user presets.
400      *  
401      * 
402      * @param version the value of field 'version'.
403      */
404     public void setVersion(
405             final java.lang.String version) {
406         this._version = version;
407     }
408
409     /**
410      * Method unmarshal.
411      * 
412      * @param reader
413      * @throws org.exolab.castor.xml.MarshalException if object is
414      * null or if any SAXException is thrown during marshaling
415      * @throws org.exolab.castor.xml.ValidationException if this
416      * object is an invalid instance according to the schema
417      * @return the unmarshaled
418      * jalview.schemabinding.version2.WebServiceParameterSet
419      */
420     public static jalview.schemabinding.version2.WebServiceParameterSet unmarshal(
421             final java.io.Reader reader)
422     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
423         return (jalview.schemabinding.version2.WebServiceParameterSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.WebServiceParameterSet.class, reader);
424     }
425
426     /**
427      * 
428      * 
429      * @throws org.exolab.castor.xml.ValidationException if this
430      * object is an invalid instance according to the schema
431      */
432     public void validate(
433     )
434     throws org.exolab.castor.xml.ValidationException {
435         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
436         validator.validate(this);
437     }
438
439 }