|
Version: ${maven.project.version} | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Parameter
An interface defining a paramter of a Soaplab2 job, usualy a
command-line parameter. Once given input data and a reference to a
particular job, the instances implementing this interface are able
to produce command-line arguments (by methods createArg
and createNamedArg
), environment
variables (by method createEnv
) and IO elements
(by method createIO
) with this input data,
wrapped/created as defined by service metadata. Usually, however,
only some of these methods return non-empty results (for example, a
single parameter is usually either used as a command-line argument,
or as an environment variable, but rarely as both in the same
time).
There is a strong recommendation to implement this interface as a sub-class of org.soaplab.services.cmdline.BaseParameter. Or, at least, to include the same constructor:
public YourParameter (ParamDef paramDef)
Method Summary | |
---|---|
java.lang.String[] |
createArg(java.util.Map<java.lang.String,java.lang.Object> inputs,
Job job)
Return an array that can be directly used on the command-line. |
java.util.Properties |
createEnv(java.util.Map<java.lang.String,java.lang.Object> inputs,
Job job)
Return properties that represent an "environment" of the analysis that is going to be started. |
org.soaplab.services.IOData[] |
createIO(java.util.Map<java.lang.String,java.lang.Object> inputs,
Job job)
Create an array of data containers that kept (usually local) data whose references are mentioned on the command-line - for that see method createArg(java.util.Map , or are not mentioned
anywhere (e.g. |
NamedValues |
createNamedArg(java.util.Map<java.lang.String,java.lang.Object> inputs,
Job job)
Return a structure similar to the arguments for a command-line (as returned by createArg ) but slightly more
general. |
ParamDef |
getDefinition()
Return a definition of this parameter. |
void |
validate(java.util.Map<java.lang.String,java.lang.Object> inputs,
Job job,
java.lang.Object testedValue)
Verify value (or values, if they are repetitive) of this parameter. |
Method Detail |
---|
ParamDef getDefinition()
java.lang.String[] createArg(java.util.Map<java.lang.String,java.lang.Object> inputs, Job job) throws org.soaplab.services.cmdline.ParameterException
inputs
- are the end-user's input data (which will become
parts of the returned command-line arguments). It may contain
more data than just for this parameter.job
- whose arguments are being created
ParameterException
- if there are not-valid (or missing)
data for this parameter in the given 'inputs'java.util.Properties createEnv(java.util.Map<java.lang.String,java.lang.Object> inputs, Job job) throws org.soaplab.services.cmdline.ParameterException
The property keys are usually not prefixed by the '-' character (as often are the command-line arguments).
It is left to the 'user' of the parameters (which is, for
example, a class implementing the Job
interface) how to use the
returned value. Obvious choice is to use it for setting
environment variables. But some classes may use it to set Java
System proprties instead, etc.
inputs
- are the end-user's input data (which will become
parts of the returned environment). It may contain more data
than just for this parameter.job
- whose environment variables are being created
ParameterException
- if there are not-valid (or missing)
data for this parameter in the given 'inputs'org.soaplab.services.IOData[] createIO(java.util.Map<java.lang.String,java.lang.Object> inputs, Job job) throws org.soaplab.services.cmdline.ParameterException
createArg(java.util.Map, org.soaplab.services.Job)
, or are not mentioned
anywhere (e.g. data given to an analysis tool on its standard
input).
For example, if an analysis tool expects an input file name on
its command-line (let's say prefixed by the -infile),
the createArg(java.util.Map
method would return this command-line:
*
-infile 12avd5467dfh-tmpand this method would return a data container that makes sure that the input data are stored in the local file 12avd5467dfh-tmp.
inputs
- are the end-user's input data (which will become
parts of the returned containers). It may contain more data
than just for this parameter.job
- whose data containers are being created
ParameterException
- if there are not-valid (or missing)
data for this parameter in the given 'inputs', or if there were
IO problems when localizing 'inputs'void validate(java.util.Map<java.lang.String,java.lang.Object> inputs, Job job, java.lang.Object testedValue) throws org.soaplab.services.cmdline.ParameterException
inputs
- are the end-user's input data - they are passed
here all of them because they might be needed for some
inter-parameters value validationjob
- whose input is being validatedtestedValue
- is the value that should be validated. A
value with the same name often appears also in 'inputs' (sent
by a user) - but if not than it indicates that the
'testedValue' is a default value taken from the metadata
definition (which may have some impact on the validation
procedure). It may be also null - in which case try to find it
first in the 'inputs'.
ParameterException
- is validation failedNamedValues createNamedArg(java.util.Map<java.lang.String,java.lang.Object> inputs, Job job) throws org.soaplab.services.cmdline.ParameterException
createArg
) but slightly more
general. It can be used for jobs that do not create command
lines but still need to get user data in a structured way. A
typical example are Gowlab jobs. More details are in the class
NamedValues
.
inputs
- are the end-user's input data (which will become
parts of the returned structure). It may contain
more data than just for this parameter.job
- whose arguments are being created
ParameterException
- if there are not-valid (or missing)
data for this parameter in the given 'inputs'
|
Version: ${maven.project.version} | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |