2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
31 * Class WebServiceParameterSet.
33 * @version $Revision$ $Date$
35 public class WebServiceParameterSet implements java.io.Serializable
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
43 * The short name for the parameter set. This will be shown amongst the other
44 * presets for the web service.
47 private java.lang.String _name;
50 * A Jalview Web Service Parameter Set container version number. Version 1
51 * created for storing Jaba user presets.
54 private java.lang.String _version;
57 * Short description - as utf8 encoded text. This is usually displayed in the
58 * body of an HTML capable tooltip, so HTML tags may be embedded using
59 * standard UTF8 encoding.
62 private java.lang.String _description;
65 * URL for which the parameter set is valid. Jalview will use it to match up
66 * parameter sets to service instances that can parse the parameter set
70 private java.util.Vector _serviceURLList;
73 * UTF8 encoded string to be processed into a specific web services' parameter
74 * set. Note - newlines may be important to the structure of this file.
77 private java.lang.String _parameters;
83 public WebServiceParameterSet()
86 this._serviceURLList = new java.util.Vector();
97 * @throws java.lang.IndexOutOfBoundsException
98 * if the index given is outside the bounds of the collection
100 public void addServiceURL(final java.lang.String vServiceURL)
101 throws java.lang.IndexOutOfBoundsException
103 this._serviceURLList.addElement(vServiceURL);
111 * @throws java.lang.IndexOutOfBoundsException
112 * if the index given is outside the bounds of the collection
114 public void addServiceURL(final int index,
115 final java.lang.String vServiceURL)
116 throws java.lang.IndexOutOfBoundsException
118 this._serviceURLList.add(index, vServiceURL);
122 * Method enumerateServiceURL.
124 * @return an Enumeration over all java.lang.String elements
126 public java.util.Enumeration enumerateServiceURL()
128 return this._serviceURLList.elements();
132 * Returns the value of field 'description'. The field 'description' has the
133 * following description: Short description - as utf8 encoded text. This is
134 * usually displayed in the body of an HTML capable tooltip, so HTML tags may
135 * be embedded using standard UTF8 encoding.
138 * @return the value of field 'Description'.
140 public java.lang.String getDescription()
142 return this._description;
146 * Returns the value of field 'name'. The field 'name' has the following
147 * description: The short name for the parameter set. This will be shown
148 * amongst the other presets for the web service.
151 * @return the value of field 'Name'.
153 public java.lang.String getName()
159 * Returns the value of field 'parameters'. The field 'parameters' has the
160 * following description: UTF8 encoded string to be processed into a specific
161 * web services' parameter set. Note - newlines may be important to the
162 * structure of this file.
165 * @return the value of field 'Parameters'.
167 public java.lang.String getParameters()
169 return this._parameters;
173 * Method getServiceURL.
176 * @throws java.lang.IndexOutOfBoundsException
177 * if the index given is outside the bounds of the collection
178 * @return the value of the java.lang.String at the given index
180 public java.lang.String getServiceURL(final int index)
181 throws java.lang.IndexOutOfBoundsException
183 // check bounds for index
184 if (index < 0 || index >= this._serviceURLList.size())
186 throw new IndexOutOfBoundsException("getServiceURL: Index value '"
187 + index + "' not in range [0.."
188 + (this._serviceURLList.size() - 1) + "]");
191 return (java.lang.String) _serviceURLList.get(index);
195 * Method getServiceURL.Returns the contents of the collection in an Array.
197 * Note: Just in case the collection contents are changing in another thread,
198 * we pass a 0-length Array of the correct type into the API call. This way we
199 * <i>know</i> that the Array returned is of exactly the correct length.
201 * @return this collection as an Array
203 public java.lang.String[] getServiceURL()
205 java.lang.String[] array = new java.lang.String[0];
206 return (java.lang.String[]) this._serviceURLList.toArray(array);
210 * Method getServiceURLCount.
212 * @return the size of this collection
214 public int getServiceURLCount()
216 return this._serviceURLList.size();
220 * Returns the value of field 'version'. The field 'version' has the following
221 * description: A Jalview Web Service Parameter Set container version number.
222 * Version 1 created for storing Jaba user presets.
225 * @return the value of field 'Version'.
227 public java.lang.String getVersion()
229 return this._version;
235 * @return true if this object is valid according to the schema
237 public boolean isValid()
242 } catch (org.exolab.castor.xml.ValidationException vex)
253 * @throws org.exolab.castor.xml.MarshalException
254 * if object is null or if any SAXException is thrown during
256 * @throws org.exolab.castor.xml.ValidationException
257 * if this object is an invalid instance according to the schema
259 public void marshal(final java.io.Writer out)
260 throws org.exolab.castor.xml.MarshalException,
261 org.exolab.castor.xml.ValidationException
263 Marshaller.marshal(this, out);
270 * @throws java.io.IOException
271 * if an IOException occurs during marshaling
272 * @throws org.exolab.castor.xml.ValidationException
273 * if this object is an invalid instance according to the schema
274 * @throws org.exolab.castor.xml.MarshalException
275 * if object is null or if any SAXException is thrown during
278 public void marshal(final org.xml.sax.ContentHandler handler)
279 throws java.io.IOException,
280 org.exolab.castor.xml.MarshalException,
281 org.exolab.castor.xml.ValidationException
283 Marshaller.marshal(this, handler);
288 public void removeAllServiceURL()
290 this._serviceURLList.clear();
294 * Method removeServiceURL.
297 * @return true if the object was removed from the collection.
299 public boolean removeServiceURL(final java.lang.String vServiceURL)
301 boolean removed = _serviceURLList.remove(vServiceURL);
306 * Method removeServiceURLAt.
309 * @return the element removed from the collection
311 public java.lang.String removeServiceURLAt(final int index)
313 java.lang.Object obj = this._serviceURLList.remove(index);
314 return (java.lang.String) obj;
318 * Sets the value of field 'description'. The field 'description' has the
319 * following description: Short description - as utf8 encoded text. This is
320 * usually displayed in the body of an HTML capable tooltip, so HTML tags may
321 * be embedded using standard UTF8 encoding.
325 * the value of field 'description'.
327 public void setDescription(final java.lang.String description)
329 this._description = description;
333 * Sets the value of field 'name'. The field 'name' has the following
334 * description: The short name for the parameter set. This will be shown
335 * amongst the other presets for the web service.
339 * the value of field 'name'.
341 public void setName(final java.lang.String name)
347 * Sets the value of field 'parameters'. The field 'parameters' has the
348 * following description: UTF8 encoded string to be processed into a specific
349 * web services' parameter set. Note - newlines may be important to the
350 * structure of this file.
354 * the value of field 'parameters'.
356 public void setParameters(final java.lang.String parameters)
358 this._parameters = parameters;
366 * @throws java.lang.IndexOutOfBoundsException
367 * if the index given is outside the bounds of the collection
369 public void setServiceURL(final int index,
370 final java.lang.String vServiceURL)
371 throws java.lang.IndexOutOfBoundsException
373 // check bounds for index
374 if (index < 0 || index >= this._serviceURLList.size())
376 throw new IndexOutOfBoundsException("setServiceURL: Index value '"
377 + index + "' not in range [0.."
378 + (this._serviceURLList.size() - 1) + "]");
381 this._serviceURLList.set(index, vServiceURL);
387 * @param vServiceURLArray
389 public void setServiceURL(final java.lang.String[] vServiceURLArray)
392 _serviceURLList.clear();
394 for (int i = 0; i < vServiceURLArray.length; i++)
396 this._serviceURLList.add(vServiceURLArray[i]);
401 * Sets the value of field 'version'. The field 'version' has the following
402 * description: A Jalview Web Service Parameter Set container version number.
403 * Version 1 created for storing Jaba user presets.
407 * the value of field 'version'.
409 public void setVersion(final java.lang.String version)
411 this._version = version;
418 * @throws org.exolab.castor.xml.MarshalException
419 * if object is null or if any SAXException is thrown during
421 * @throws org.exolab.castor.xml.ValidationException
422 * if this object is an invalid instance according to the schema
423 * @return the unmarshaled
424 * jalview.schemabinding.version2.WebServiceParameterSet
426 public static jalview.schemabinding.version2.WebServiceParameterSet unmarshal(
427 final java.io.Reader reader)
428 throws org.exolab.castor.xml.MarshalException,
429 org.exolab.castor.xml.ValidationException
431 return (jalview.schemabinding.version2.WebServiceParameterSet) Unmarshaller
433 jalview.schemabinding.version2.WebServiceParameterSet.class,
440 * @throws org.exolab.castor.xml.ValidationException
441 * if this object is an invalid instance according to the schema
443 public void validate() throws org.exolab.castor.xml.ValidationException
445 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
446 validator.validate(this);