compbio.metadata
Class RunnerConfig<T>

java.lang.Object
  extended by compbio.metadata.RunnerConfig<T>
Type Parameters:
T - type of an Executable

@NotThreadSafe
public class RunnerConfig<T>
extends Object

The list of Parameters and Options supported by executable. The lists is defined in and loaded from Parameters.xml file.

Version:
1.0 October 2009
Author:
pvtroshin

Constructor Summary
RunnerConfig()
           
 
Method Summary
 void addOption(Option<T> option)
          Adds Option to the internal list of options
 void addParameter(Parameter<T> param)
          Adds parameter to the internal parameter list
 RunnerConfig<T> copyAndValidateRConfig(RunnerConfig<?> runnerConf)
           
 boolean equals(Object obj)
           
 Option<T> getArgument(String name)
          Returns the argument by its name if found, NULL otherwise.
 Option<T> getArgumentByOptionName(String optionName)
          Returns the argument by option name, NULL if the argument is not found
 List<Option<T>> getArguments()
          Returns list of Parameter and Option supported by current runner
 List<Option<T>> getOptions()
          Returns the list of the Options supported by the executable of type T
 List<Parameter<T>> getParameters()
          Returns the list of parameters supported executable of type T.
 String getPrmSeparator()
           
 String getRunnerClassName()
           
 boolean removeArgument(String name)
          Removes the argument Argument if found.
 boolean removeArgumentByOptionName(String optionName)
          Removes the argument which can be a Parameter or an Option instance by the value in element of the runner configuration descriptor.
 void setOptions(List<Option<T>> parameters)
          Adds the list of options or parameters to the internal list of options
 void setParameters(List<Parameter<T>> parameters)
          Sets the list of parameters as internal list
 void setPrmSeparator(String prmSeparator)
          Sets name value separator character
 void setRunnerClassName(String runnerClassName)
          Set the name of a runner class
 String toString()
           
 void validate()
          Validate the value of the argument.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RunnerConfig

public RunnerConfig()
Method Detail

copyAndValidateRConfig

public RunnerConfig<T> copyAndValidateRConfig(RunnerConfig<?> runnerConf)

getOptions

public List<Option<T>> getOptions()
Returns the list of the Options supported by the executable of type T

Returns:
list of Option supported by type T
See Also:
Option

addParameter

public void addParameter(Parameter<T> param)
Adds parameter to the internal parameter list

Parameters:
param - the Parameter to add
See Also:
Parameter

addOption

public void addOption(Option<T> option)
Adds Option to the internal list of options

Parameters:
option - the Option to add

getArguments

public List<Option<T>> getArguments()
Returns list of Parameter and Option supported by current runner

Returns:
list of Option and Parameter supported by type T

getPrmSeparator

public String getPrmSeparator()
Returns:
name value separator character

setPrmSeparator

public void setPrmSeparator(String prmSeparator)
Sets name value separator character

Parameters:
prmSeparator - the separator char

setOptions

public void setOptions(List<Option<T>> parameters)
Adds the list of options or parameters to the internal list of options

Parameters:
parameters - the list of parameters to add

getRunnerClassName

public String getRunnerClassName()
Returns:
fully qualified class name for type T

setRunnerClassName

public void setRunnerClassName(String runnerClassName)
Set the name of a runner class

Parameters:
runnerClassName - the name of the executable wrapping class

setParameters

public void setParameters(List<Parameter<T>> parameters)
Sets the list of parameters as internal list

Parameters:
parameters - the list of parameters

getParameters

public List<Parameter<T>> getParameters()
Returns the list of parameters supported executable of type T. Where Parameter is an Option with value.

Returns:
List of Parameter supported by type T.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getArgument

public Option<T> getArgument(String name)
Returns the argument by its name if found, NULL otherwise. Where the Argument is a common interface for Option and Parameter therefore this method can return either. If you need to retrieve the Option by its optionNames use @link getArgumentByOptionName(String) method. The difference between option name and optionName is explained by the following example:
 Sequence type
         
         --nuc - Assume the sequences are nucleotide.
         --amino - Assume the sequences are amino acid. 
         --amino
         --nuc
         --auto
 
In the example, the "Sequence type" is a name whereas --amino, --nuc and --auto are all optionNames. This dichotomy only manifests in Option never in Parameters as the latter can only have single element

Parameters:
name - the Parameter of Option name
Returns:
Argument

removeArgument

public boolean removeArgument(String name)
Removes the argument Argument if found. Where Argument is either Option or Parameter.

Parameters:
name - of the argument
Returns:
true if argument was removed, false otherwise

getArgumentByOptionName

public Option<T> getArgumentByOptionName(String optionName)
Returns the argument by option name, NULL if the argument is not found

Parameters:
optionName - - the optionName. This is not the same as an Option name. For example:
            Output sequences order
                          --inputorder - Output order: same as input. 
                           --reorder - Output order: aligned. Default: same as input
                          --inputorder
                          --reorder
 
The name of the option in the example is "Output sequences order" whereas optionNames are "--inputorder" and "--reorder". If you need to retrieve the Option or Parameter by its names use getArgument(String) method
Returns:
Option

removeArgumentByOptionName

public boolean removeArgumentByOptionName(String optionName)
Removes the argument which can be a Parameter or an Option instance by the value in element of the runner configuration descriptor.

Parameters:
optionName - the optionName of the option, do not confuse with the name!
Returns:
true if argument with optionName exists and was removed, false otherwise
See Also:
for destinctions between optionNames and the name of the Option

validate

public void validate()
              throws ValidationException
Validate the value of the argument. Checks whether the argument value is in the valid values range.

Throws:
ValidationException - if any of the arguments found invalid which is when
  • Parameter value outside ValueConstrain boundary
  • Parameter name is not listed in possible values