public class FileParameter extends Parameter implements GalaxyConvertible
Parameter
that represents a local file.Modifier and Type | Class and Description |
---|---|
static class |
FileParameter.FileRepresentation
Class that represents a file.
|
comment, datatype, name
Constructor and Description |
---|
FileParameter(StringBuffer buf)
The standard constructor for the interface
Storable . |
FileParameter(String name,
String comment,
String filetype,
boolean required)
Creates a
FileParameter . |
FileParameter(String name,
String comment,
String filetype,
boolean required,
ParameterValidator validator)
Constructs a
FileParameter . |
Modifier and Type | Method and Description |
---|---|
protected void |
appendFurtherInfos(StringBuffer buf)
This method can be used in the method
Storable.toXML() to extract
further information (name, comment, datatype). |
boolean |
checkValue(Object value)
Checks the value for correctness, e.g.
|
FileParameter |
clone() |
protected void |
extractFurtherInfos(StringBuffer buf)
This method can be used in the constructor with parameter
StringBuffer to
extract the further information. |
void |
fromGalaxy(String namePrefix,
StringBuffer command)
Parses the contents of
command in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean)
and sets the values of the Parameter or ParameterSet accordingly. |
String |
getAcceptedMimeType()
Returns the type(s) of the allowed files as list of file extensions, separated by commas
|
String |
getErrorMessage()
If a value could not be set successfully this method returns the
corresponding error message.
|
String |
getExtendedType()
Returns the extended type (or
null if not set) of this FileParameter . |
FileParameter.FileRepresentation |
getFileContents()
Returns the content of the file.
|
Object |
getValue()
Returns the value of the
AnnotatedEntity . |
String |
getXMLTag()
This method returns a tag used as outer tag of the XML description.
|
boolean |
hasDefaultOrIsSet()
Returns
true if the parameter either has a default value or
the value was set by the user, false otherwise. |
boolean |
isAtomic()
Returns
true if the parameter is of an atomic data type,
false otherwise. |
boolean |
isRequired()
|
boolean |
isSet()
Returns
true if the parameter was set by the user,
false otherwise. |
void |
reset()
Resets the
FileParameter to its original state. |
void |
setDefault(Object defaultValue)
Sets the default value of the
Parameter to
defaultValue . |
void |
setExtendedType(String extendedType)
Sets the extended type of this
FileParameter . |
void |
setValue(Object value)
Sets the value of this
Parameter to value . |
void |
toGalaxy(String namePrefix,
String configPrefix,
int depth,
StringBuffer descBuffer,
StringBuffer configBuffer,
boolean addLine)
Creates an Galaxy XML-representation of the parameters and appends it to
descBuffer
and variable configuration and appends it to configBuffer . |
String |
toString() |
getParent, isComparable, setParent
getComment, getDatatype, getName, toXML
public FileParameter(StringBuffer buf) throws NonParsableException
Storable
.
Restores a FileParameter
from an XML representation.buf
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedpublic FileParameter(String name, String comment, String filetype, boolean required)
FileParameter
.name
- the name of the parametercomment
- a comment on the parameterfiletype
- the type of allowed files, may be allowed file extensions, separated by commasrequired
- true
if this FileParameter
is required to
continue, false
otherwisepublic FileParameter(String name, String comment, String filetype, boolean required, ParameterValidator validator)
FileParameter
.name
- the name of the parametercomment
- a comment on the parameterfiletype
- the type of allowed files, may be allowed file extensions, separated by commasrequired
- true
if this FileParameter
is requiredvalidator
- a validator that validates e.g. the contents of the filepublic FileParameter clone() throws CloneNotSupportedException
clone
in class Parameter
CloneNotSupportedException
public boolean isAtomic()
Parameter
true
if the parameter is of an atomic data type,
false
otherwise.public boolean isRequired()
Parameter
isRequired
in class Parameter
true
if the Parameter
is required,
false
otherwisepublic void reset()
FileParameter
to its original state.public FileParameter.FileRepresentation getFileContents()
public String getErrorMessage()
Parameter
getErrorMessage
in class Parameter
public boolean checkValue(Object value)
Parameter
checkValue
in class Parameter
value
- the value to be checkedtrue
if the value is valid, false
otherwisepublic void setDefault(Object defaultValue) throws SimpleParameter.IllegalValueException
Parameter
Parameter
to
defaultValue
. This method also sets the current
value of this Parameter
to the default.setDefault
in class Parameter
defaultValue
- the default valueSimpleParameter.IllegalValueException
public void setValue(Object value) throws SimpleParameter.IllegalValueException
Parameter
Parameter
to value
.setValue
in class Parameter
value
- the new value of the Parameter
SimpleParameter.IllegalValueException
- if the specified value is not valid for this
Parameter
public Object getValue()
AnnotatedEntity
AnnotatedEntity
.getValue
in class AnnotatedEntity
AnnotatedEntity
public boolean hasDefaultOrIsSet()
Parameter
true
if the parameter either has a default value or
the value was set by the user, false
otherwise.hasDefaultOrIsSet
in class Parameter
true
if value has a default value or was set,
false
otherwisepublic boolean isSet()
Parameter
true
if the parameter was set by the user,
false
otherwise.public String getXMLTag()
AnnotatedEntity
getXMLTag
in class AnnotatedEntity
protected void appendFurtherInfos(StringBuffer buf)
AnnotatedEntity
Storable.toXML()
to extract
further information (name, comment, datatype).appendFurtherInfos
in class Parameter
buf
- a XML representation of the main information as
StringBuffer
Storable.toXML()
protected void extractFurtherInfos(StringBuffer buf) throws NonParsableException
AnnotatedEntity
StringBuffer
to
extract the further information.extractFurtherInfos
in class Parameter
buf
- a XML represenation of the main information as
StringBuffer
NonParsableException
- if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)
public String getAcceptedMimeType()
public String getExtendedType()
null
if not set) of this FileParameter
.public void setExtendedType(String extendedType)
FileParameter
.extendedType
- the extended typepublic void toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer, boolean addLine)
GalaxyConvertible
descBuffer
and variable configuration and appends it to configBuffer
. The variable configuration
is also used to parse user-supplied values returned by Galaxy.toGalaxy
in interface GalaxyConvertible
namePrefix
- the prefix of the variable name used in GalaxyconfigPrefix
- the prefix for conditionalsdepth
- the depth in the parameter hierarchy, used for graphical representation of nestingdescBuffer
- the buffer for the parameter descriptionconfigBuffer
- the buffer for the configuration lineaddLine
- if true, a line is added before the title of a parameterpublic void fromGalaxy(String namePrefix, StringBuffer command) throws Exception
GalaxyConvertible
command
in the format defined by configBuffer
of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean)
and sets the values of the Parameter
or ParameterSet
accordingly.fromGalaxy
in interface GalaxyConvertible
namePrefix
- the prefix of the variable namecommand
- the command stringException
- if the command string could not be parsed