From: jprocter Date: Mon, 6 Sep 2010 16:37:44 +0000 (+0000) Subject: new XML representation for web services parameters X-Git-Tag: Release_2_6~67 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ddd39d934b5cfeb812cc33326c04e64cf36d72d4;p=jalview.git new XML representation for web services parameters --- diff --git a/build.xml b/build.xml index 549d237..3894e21 100755 --- a/build.xml +++ b/build.xml @@ -549,6 +549,14 @@ verbose="true" properties="${schemaDir}/jalview.properties" /> + + + + + + + + + A Jalview Web Service Parameter Set container + version number. + Version 1 created for storing Jaba user presets. + + + + + + Short description - as utf8 encoded text. This is + usually displayed + in the body of an HTML capable tooltip, so HTML tags may be embedded + using standard UTF8 encoding. + + + + + + + URL for which the parameter set is valid. Jalview will use it to + match up parameter sets to service instances that can parse the + parameter set payload. + + + + + + + + UTF8 encoded string to be processed into a specific web services' + parameter set. Note - newlines may be important to the structure + of this file. + + + + + + + + The short name for the parameter set. This will be shown amongst the + other presets for the web service. + + + + + diff --git a/src/jalview/schemabinding/version2/.castor.cdr b/src/jalview/schemabinding/version2/.castor.cdr index ab2550b..93d2e0f 100644 --- a/src/jalview/schemabinding/version2/.castor.cdr +++ b/src/jalview/schemabinding/version2/.castor.cdr @@ -1,4 +1,4 @@ -#Wed Apr 14 11:41:13 BST 2010 +#Mon Sep 06 13:16:48 BST 2010 jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor @@ -19,6 +19,7 @@ jalview.schemabinding.version2.AlcodMap=jalview.schemabinding.version2.descripto jalview.schemabinding.version2.Annotation=jalview.schemabinding.version2.descriptors.AnnotationDescriptor jalview.schemabinding.version2.JSeq=jalview.schemabinding.version2.descriptors.JSeqDescriptor jalview.schemabinding.version2.Sequence=jalview.schemabinding.version2.descriptors.SequenceDescriptor +jalview.schemabinding.version2.WebServiceParameterSet=jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor jalview.schemabinding.version2.Alcodon=jalview.schemabinding.version2.descriptors.AlcodonDescriptor jalview.schemabinding.version2.AnnotationColours=jalview.schemabinding.version2.descriptors.AnnotationColoursDescriptor jalview.schemabinding.version2.Pdbids=jalview.schemabinding.version2.descriptors.PdbidsDescriptor diff --git a/src/jalview/schemabinding/version2/WebServiceParameterSet.java b/src/jalview/schemabinding/version2/WebServiceParameterSet.java new file mode 100644 index 0000000..611c981 --- /dev/null +++ b/src/jalview/schemabinding/version2/WebServiceParameterSet.java @@ -0,0 +1,439 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Class WebServiceParameterSet. + * + * @version $Revision$ $Date$ + */ +public class WebServiceParameterSet implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The short name for the parameter set. This will be shown + * amongst the + * other presets for the web service. + * + */ + private java.lang.String _name; + + /** + * A Jalview Web Service Parameter Set container + * version number. + * Version 1 created for storing Jaba user presets. + * + */ + private java.lang.String _version; + + /** + * Short description - as utf8 encoded text. This is + * usually displayed + * in the body of an HTML capable tooltip, so HTML tags may be + * embedded + * using standard UTF8 encoding. + * + */ + private java.lang.String _description; + + /** + * URL for which the parameter set is valid. Jalview will use + * it to + * match up parameter sets to service instances that can parse + * the + * parameter set payload. + * + */ + private java.util.Vector _serviceURLList; + + /** + * UTF8 encoded string to be processed into a specific web + * services' + * parameter set. Note - newlines may be important to the + * structure + * of this file. + * + */ + private java.lang.String _parameters; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public WebServiceParameterSet() { + super(); + this._serviceURLList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vServiceURL + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addServiceURL( + final java.lang.String vServiceURL) + throws java.lang.IndexOutOfBoundsException { + this._serviceURLList.addElement(vServiceURL); + } + + /** + * + * + * @param index + * @param vServiceURL + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addServiceURL( + final int index, + final java.lang.String vServiceURL) + throws java.lang.IndexOutOfBoundsException { + this._serviceURLList.add(index, vServiceURL); + } + + /** + * Method enumerateServiceURL. + * + * @return an Enumeration over all java.lang.String elements + */ + public java.util.Enumeration enumerateServiceURL( + ) { + return this._serviceURLList.elements(); + } + + /** + * Returns the value of field 'description'. The field + * 'description' has the following description: Short + * description - as utf8 encoded text. This is + * usually displayed + * in the body of an HTML capable tooltip, so HTML tags may be + * embedded + * using standard UTF8 encoding. + * + * + * @return the value of field 'Description'. + */ + public java.lang.String getDescription( + ) { + return this._description; + } + + /** + * Returns the value of field 'name'. The field 'name' has the + * following description: The short name for the parameter set. + * This will be shown amongst the + * other presets for the web service. + * + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Returns the value of field 'parameters'. The field + * 'parameters' has the following description: UTF8 encoded + * string to be processed into a specific web services' + * parameter set. Note - newlines may be important to the + * structure + * of this file. + * + * + * @return the value of field 'Parameters'. + */ + public java.lang.String getParameters( + ) { + return this._parameters; + } + + /** + * Method getServiceURL. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the java.lang.String at the given index + */ + public java.lang.String getServiceURL( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._serviceURLList.size()) { + throw new IndexOutOfBoundsException("getServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]"); + } + + return (java.lang.String) _serviceURLList.get(index); + } + + /** + * Method getServiceURL.Returns the contents of the collection + * in an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.String[] getServiceURL( + ) { + java.lang.String[] array = new java.lang.String[0]; + return (java.lang.String[]) this._serviceURLList.toArray(array); + } + + /** + * Method getServiceURLCount. + * + * @return the size of this collection + */ + public int getServiceURLCount( + ) { + return this._serviceURLList.size(); + } + + /** + * Returns the value of field 'version'. The field 'version' + * has the following description: A Jalview Web Service + * Parameter Set container + * version number. + * Version 1 created for storing Jaba user presets. + * + * + * @return the value of field 'Version'. + */ + public java.lang.String getVersion( + ) { + return this._version; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllServiceURL( + ) { + this._serviceURLList.clear(); + } + + /** + * Method removeServiceURL. + * + * @param vServiceURL + * @return true if the object was removed from the collection. + */ + public boolean removeServiceURL( + final java.lang.String vServiceURL) { + boolean removed = _serviceURLList.remove(vServiceURL); + return removed; + } + + /** + * Method removeServiceURLAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.String removeServiceURLAt( + final int index) { + java.lang.Object obj = this._serviceURLList.remove(index); + return (java.lang.String) obj; + } + + /** + * Sets the value of field 'description'. The field + * 'description' has the following description: Short + * description - as utf8 encoded text. This is + * usually displayed + * in the body of an HTML capable tooltip, so HTML tags may be + * embedded + * using standard UTF8 encoding. + * + * + * @param description the value of field 'description'. + */ + public void setDescription( + final java.lang.String description) { + this._description = description; + } + + /** + * Sets the value of field 'name'. The field 'name' has the + * following description: The short name for the parameter set. + * This will be shown amongst the + * other presets for the web service. + * + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * Sets the value of field 'parameters'. The field 'parameters' + * has the following description: UTF8 encoded string to be + * processed into a specific web services' + * parameter set. Note - newlines may be important to the + * structure + * of this file. + * + * + * @param parameters the value of field 'parameters'. + */ + public void setParameters( + final java.lang.String parameters) { + this._parameters = parameters; + } + + /** + * + * + * @param index + * @param vServiceURL + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setServiceURL( + final int index, + final java.lang.String vServiceURL) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._serviceURLList.size()) { + throw new IndexOutOfBoundsException("setServiceURL: Index value '" + index + "' not in range [0.." + (this._serviceURLList.size() - 1) + "]"); + } + + this._serviceURLList.set(index, vServiceURL); + } + + /** + * + * + * @param vServiceURLArray + */ + public void setServiceURL( + final java.lang.String[] vServiceURLArray) { + //-- copy array + _serviceURLList.clear(); + + for (int i = 0; i < vServiceURLArray.length; i++) { + this._serviceURLList.add(vServiceURLArray[i]); + } + } + + /** + * Sets the value of field 'version'. The field 'version' has + * the following description: A Jalview Web Service Parameter + * Set container + * version number. + * Version 1 created for storing Jaba user presets. + * + * + * @param version the value of field 'version'. + */ + public void setVersion( + final java.lang.String version) { + this._version = version; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * jalview.schemabinding.version2.WebServiceParameterSet + */ + public static jalview.schemabinding.version2.WebServiceParameterSet unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.schemabinding.version2.WebServiceParameterSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.WebServiceParameterSet.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java new file mode 100644 index 0000000..8c61a2d --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java @@ -0,0 +1,354 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.WebServiceParameterSet; + +/** + * Class WebServiceParameterSetDescriptor. + * + * @version $Revision$ $Date$ + */ +public class WebServiceParameterSetDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public WebServiceParameterSetDescriptor() { + super(); + _nsURI = "www.jalview.org/xml/wsparamset"; + _xmlName = "WebServiceParameterSet"; + _elementDefinition = false; + + //-- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _name + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + WebServiceParameterSet target = (WebServiceParameterSet) object; + return target.getName(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + WebServiceParameterSet target = (WebServiceParameterSet) object; + target.setName( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _name + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + //-- _version + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "Version", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + WebServiceParameterSet target = (WebServiceParameterSet) object; + return target.getVersion(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + WebServiceParameterSet target = (WebServiceParameterSet) object; + target.setVersion( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _version + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _description + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + WebServiceParameterSet target = (WebServiceParameterSet) object; + return target.getDescription(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + WebServiceParameterSet target = (WebServiceParameterSet) object; + target.setDescription( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _description + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + //-- _serviceURLList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_serviceURLList", "serviceURL", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + WebServiceParameterSet target = (WebServiceParameterSet) object; + return target.getServiceURL(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + WebServiceParameterSet target = (WebServiceParameterSet) object; + target.addServiceURL( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + WebServiceParameterSet target = (WebServiceParameterSet) object; + target.removeAllServiceURL(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new java.lang.String(); + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _serviceURLList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + } + desc.setValidator(fieldValidator); + //-- _parameters + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_parameters", "parameters", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + WebServiceParameterSet target = (WebServiceParameterSet) object; + return target.getParameters(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + WebServiceParameterSet target = (WebServiceParameterSet) object; + target.setParameters( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _parameters + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.WebServiceParameterSet.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +}