2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.schemabinding.version2;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
28 * Class WebServiceParameterSet.
30 * @version $Revision$ $Date$
32 public class WebServiceParameterSet implements java.io.Serializable {
35 //--------------------------/
36 //- Class/Member Variables -/
37 //--------------------------/
40 * The short name for the parameter set. This will be shown
42 * other presets for the web service.
45 private java.lang.String _name;
48 * A Jalview Web Service Parameter Set container
50 * Version 1 created for storing Jaba user presets.
53 private java.lang.String _version;
56 * Short description - as utf8 encoded text. This is
58 * in the body of an HTML capable tooltip, so HTML tags may be
60 * using standard UTF8 encoding.
63 private java.lang.String _description;
66 * URL for which the parameter set is valid. Jalview will use
68 * match up parameter sets to service instances that can parse
70 * parameter set payload.
73 private java.util.Vector _serviceURLList;
76 * UTF8 encoded string to be processed into a specific web
78 * parameter set. Note - newlines may be important to the
83 private java.lang.String _parameters;
90 public WebServiceParameterSet() {
92 this._serviceURLList = new java.util.Vector();
104 * @throws java.lang.IndexOutOfBoundsException if the index
105 * given is outside the bounds of the collection
107 public void addServiceURL(
108 final java.lang.String vServiceURL)
109 throws java.lang.IndexOutOfBoundsException {
110 this._serviceURLList.addElement(vServiceURL);
118 * @throws java.lang.IndexOutOfBoundsException if the index
119 * given is outside the bounds of the collection
121 public void addServiceURL(
123 final java.lang.String vServiceURL)
124 throws java.lang.IndexOutOfBoundsException {
125 this._serviceURLList.add(index, vServiceURL);
129 * Method enumerateServiceURL.
131 * @return an Enumeration over all java.lang.String elements
133 public java.util.Enumeration enumerateServiceURL(
135 return this._serviceURLList.elements();
139 * Returns the value of field 'description'. The field
140 * 'description' has the following description: Short
141 * description - as utf8 encoded text. This is
143 * in the body of an HTML capable tooltip, so HTML tags may be
145 * using standard UTF8 encoding.
148 * @return the value of field 'Description'.
150 public java.lang.String getDescription(
152 return this._description;
156 * Returns the value of field 'name'. The field 'name' has the
157 * following description: The short name for the parameter set.
158 * This will be shown amongst the
159 * other presets for the web service.
162 * @return the value of field 'Name'.
164 public java.lang.String getName(
170 * Returns the value of field 'parameters'. The field
171 * 'parameters' has the following description: UTF8 encoded
172 * string to be processed into a specific web services'
173 * parameter set. Note - newlines may be important to the
178 * @return the value of field 'Parameters'.
180 public java.lang.String getParameters(
182 return this._parameters;
186 * Method getServiceURL.
189 * @throws java.lang.IndexOutOfBoundsException if the index
190 * given is outside the bounds of the collection
191 * @return the value of the java.lang.String at the given index
193 public java.lang.String getServiceURL(
195 throws java.lang.IndexOutOfBoundsException {
196 // check bounds for index
197 if (index < 0 || index >= this._serviceURLList.size()) {
198 throw new IndexOutOfBoundsException("getServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]");
201 return (java.lang.String) _serviceURLList.get(index);
205 * Method getServiceURL.Returns the contents of the collection
206 * in an Array. <p>Note: Just in case the collection contents
207 * are changing in another thread, we pass a 0-length Array of
208 * the correct type into the API call. This way we <i>know</i>
209 * that the Array returned is of exactly the correct length.
211 * @return this collection as an Array
213 public java.lang.String[] getServiceURL(
215 java.lang.String[] array = new java.lang.String[0];
216 return (java.lang.String[]) this._serviceURLList.toArray(array);
220 * Method getServiceURLCount.
222 * @return the size of this collection
224 public int getServiceURLCount(
226 return this._serviceURLList.size();
230 * Returns the value of field 'version'. The field 'version'
231 * has the following description: A Jalview Web Service
232 * Parameter Set container
234 * Version 1 created for storing Jaba user presets.
237 * @return the value of field 'Version'.
239 public java.lang.String getVersion(
241 return this._version;
247 * @return true if this object is valid according to the schema
249 public boolean isValid(
253 } catch (org.exolab.castor.xml.ValidationException vex) {
263 * @throws org.exolab.castor.xml.MarshalException if object is
264 * null or if any SAXException is thrown during marshaling
265 * @throws org.exolab.castor.xml.ValidationException if this
266 * object is an invalid instance according to the schema
269 final java.io.Writer out)
270 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
271 Marshaller.marshal(this, out);
278 * @throws java.io.IOException if an IOException occurs during
280 * @throws org.exolab.castor.xml.ValidationException if this
281 * object is an invalid instance according to the schema
282 * @throws org.exolab.castor.xml.MarshalException if object is
283 * null or if any SAXException is thrown during marshaling
286 final org.xml.sax.ContentHandler handler)
287 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
288 Marshaller.marshal(this, handler);
293 public void removeAllServiceURL(
295 this._serviceURLList.clear();
299 * Method removeServiceURL.
302 * @return true if the object was removed from the collection.
304 public boolean removeServiceURL(
305 final java.lang.String vServiceURL) {
306 boolean removed = _serviceURLList.remove(vServiceURL);
311 * Method removeServiceURLAt.
314 * @return the element removed from the collection
316 public java.lang.String removeServiceURLAt(
318 java.lang.Object obj = this._serviceURLList.remove(index);
319 return (java.lang.String) obj;
323 * Sets the value of field 'description'. The field
324 * 'description' has the following description: Short
325 * description - as utf8 encoded text. This is
327 * in the body of an HTML capable tooltip, so HTML tags may be
329 * using standard UTF8 encoding.
332 * @param description the value of field 'description'.
334 public void setDescription(
335 final java.lang.String description) {
336 this._description = description;
340 * Sets the value of field 'name'. The field 'name' has the
341 * following description: The short name for the parameter set.
342 * This will be shown amongst the
343 * other presets for the web service.
346 * @param name the value of field 'name'.
349 final java.lang.String name) {
354 * Sets the value of field 'parameters'. The field 'parameters'
355 * has the following description: UTF8 encoded string to be
356 * processed into a specific web services'
357 * parameter set. Note - newlines may be important to the
362 * @param parameters the value of field 'parameters'.
364 public void setParameters(
365 final java.lang.String parameters) {
366 this._parameters = parameters;
374 * @throws java.lang.IndexOutOfBoundsException if the index
375 * given is outside the bounds of the collection
377 public void setServiceURL(
379 final java.lang.String vServiceURL)
380 throws java.lang.IndexOutOfBoundsException {
381 // check bounds for index
382 if (index < 0 || index >= this._serviceURLList.size()) {
383 throw new IndexOutOfBoundsException("setServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]");
386 this._serviceURLList.set(index, vServiceURL);
392 * @param vServiceURLArray
394 public void setServiceURL(
395 final java.lang.String[] vServiceURLArray) {
397 _serviceURLList.clear();
399 for (int i = 0; i < vServiceURLArray.length; i++) {
400 this._serviceURLList.add(vServiceURLArray[i]);
405 * Sets the value of field 'version'. The field 'version' has
406 * the following description: A Jalview Web Service Parameter
409 * Version 1 created for storing Jaba user presets.
412 * @param version the value of field 'version'.
414 public void setVersion(
415 final java.lang.String version) {
416 this._version = version;
423 * @throws org.exolab.castor.xml.MarshalException if object is
424 * null or if any SAXException is thrown during marshaling
425 * @throws org.exolab.castor.xml.ValidationException if this
426 * object is an invalid instance according to the schema
427 * @return the unmarshaled
428 * jalview.schemabinding.version2.WebServiceParameterSet
430 public static jalview.schemabinding.version2.WebServiceParameterSet unmarshal(
431 final java.io.Reader reader)
432 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
433 return (jalview.schemabinding.version2.WebServiceParameterSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.WebServiceParameterSet.class, reader);
439 * @throws org.exolab.castor.xml.ValidationException if this
440 * object is an invalid instance according to the schema
442 public void validate(
444 throws org.exolab.castor.xml.ValidationException {
445 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
446 validator.validate(this);