Class ParameterDefinition

java.lang.Object
net.sf.basedb.plugins.executor.ParameterDefinition

public class ParameterDefinition
extends Object
Represents a parameter definition for the external program. A name and type is required. All other settings are optional. Supported values for type is:
  • string: The parameter is a free-text string parameter with a maximum length of 255 characters.
  • text: The parameter is a free-text string parameter with a maximum length of 64K characters.
  • integer, float: The parameter is a numeric parameter. Options 'min' and 'max' can be set to restrict the range of valid values.
  • boolean: The parameter is a true/false parameter.
  • enumeration: The parameter is an enumeration that must take it's value from a predefined list of values. The predefined list should be set in the 'enum' option with a line break as a delimiter between values.
  • factor: The parameter is an enumeration among the experimental factors that has been defined for the experiment. The default value is matched against the name/external id of the annotation types.
  • spotformula: The parameter is an enumeration among the formulas that can be used with the current source bioassay set. The default value is matched against the name of the formulas.
  • assays: The parameter is an enumeration among the bioassays in the current source bioassay set. The default value is matched against the name of the bioassays.
Since:
2.15
Author:
Nicklas
  • Field Details

    • dtdFile

      private static final URL dtdFile
    • type

      private String type
    • name

      private String name
    • required

      private boolean required
    • multiple

      private boolean multiple
    • defaultValue

      private String defaultValue
    • description

      private String description
    • options

      private Map<String,​String> options
  • Constructor Details

    • ParameterDefinition

      public ParameterDefinition()
      Create a new empty parameter definition. Before it can be used a name and type must be specified.
  • Method Details

    • parseXml

      public static List<ParameterDefinition> parseXml​(String xml, boolean validate)
      Parse an XML document containing parameter definitions.
      Parameters:
      xml - The xml as a string (with or without a DOCTYPE declaration)
      validate - TRUE to validate the XML against the dtd (external-plugin-parameters.dtd)
      Returns:
      A list with parameter definition
    • getType

      public String getType()
      Get the type of the parameter.
    • setType

      public void setType​(String type)
      Set the type of the parameter. For supported values see the class documentation.
    • getName

      public String getName()
      Get the name of the parameter. This value is required.
    • setName

      public void setName​(String name)
      Set the name of the parameter.
    • isRequired

      public boolean isRequired()
      Is this parameter a required parameter or not?
    • setRequired

      public void setRequired​(boolean required)
      Set if this parameter should be a required or optional parameter.
    • isMultiple

      public boolean isMultiple()
      Can this parameter have multiple values or only one?
    • setMultiple

      public void setMultiple​(boolean multiple)
      Set if this parameter can have multiple values or only one.
    • getDefaultValue

      public String getDefaultValue()
      Get the default value for this parameter.
    • setDefaultValue

      public void setDefaultValue​(String defaultValue)
      Set the default value for this parameter.
    • getDescription

      public String getDescription()
      Get a description/help text about this parameter.
    • setDescription

      public void setDescription​(String description)
      Set a description/help text for this parmeter.
    • getOptions

      public Set<String> getOptions()
      Get the names of other options that are defined for this parmeter. Useful options depend on the parameter type and are described in the class documentation.
    • getOption

      public String getOption​(String key)
      Get the value for an option.
    • setOption

      public void setOption​(String key, String value)
      Set the value for an option.
    • toXmlFragment

      public String toXmlFragment​(boolean compact)
      Render this parameter definition as an XML fragment. Multiple fragments can be concatenated and then wrapped with:
      <!DOCTYPE parameter-definition SYSTEM "external-plugin-parameters.dtd">
      <parameter-definition>
      ...
      </parameter-definition>
      
      Parameters:
      compact - If TRUE, the generated XML is compacted and without line breaks.
      Returns:
      An XML representation of this parameter definition
    • toPluginParameter

      public PluginParameter<?> toPluginParameter​(DbControl dc, BioAssaySet source)
      Convert this parameter definition to a PluginParameter object.
      Parameters:
      dc - A DbControl to use for database access
      source - The source bioassay set