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