Class StepResult
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.core.workflow.StepResult
-
public class StepResult extends Object
This class define a step result.- Since:
- 2.0
- Author:
- Laurent Jourdren
-
-
Constructor Summary
Constructors Constructor Description StepResult(AbstractStep step)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResult(TaskContextImpl context, TaskResultImpl result)
Add a task result to the step result.Map<String,Long>
getContextCounters(int contextId)
Get the contextName counters.String
getContextMessage(int contextId)
Get a context message.long
getDuration()
Get the duration of the step.String
getErrorMessage()
Get the error message.Throwable
getException()
Get the exception.Map<String,Long>
getStepCounters()
Get the step counters.String
getStepMessage()
Get step message.boolean
isImmutable()
Test if the object immutable.boolean
isSuccess()
Test if the step result is a success.void
read(DataFile file)
Read a step result file.void
read(InputStream in)
Read a step result file.void
setImmutable()
Set the object immutable.String
toEoulsanLogV1()
Get a representation of the result in the old Eoulsan format.String
toJSON()
Convert the object to JSONvoid
write(DataFile file, boolean oldFormat)
Write the result.void
write(OutputStream out, boolean oldFormat)
Write the result.
-
-
-
Constructor Detail
-
StepResult
public StepResult(AbstractStep step)
Constructor.- Parameters:
step
- the step
-
-
Method Detail
-
getStepMessage
public String getStepMessage()
Get step message.- Returns:
- the step message in a String
-
getStepCounters
public Map<String,Long> getStepCounters()
Get the step counters.- Returns:
- the step counters in a map
-
getContextMessage
public String getContextMessage(int contextId)
Get a context message.- Parameters:
contextId
- context id- Returns:
- the message for the context
-
getContextCounters
public Map<String,Long> getContextCounters(int contextId)
Get the contextName counters.- Parameters:
contextId
- context id- Returns:
- the contextName counters as a map
-
isImmutable
public boolean isImmutable()
Test if the object immutable.- Returns:
- true if the object is immutable
-
isSuccess
public boolean isSuccess()
Test if the step result is a success.- Returns:
- true if the step result is a success
-
getException
public Throwable getException()
Get the exception.- Returns:
- an Exception object or null if the step has not returned an Exception
-
getErrorMessage
public String getErrorMessage()
Get the error message.- Returns:
- the error message
-
getDuration
public long getDuration()
Get the duration of the step.- Returns:
- the duration of the step in milliseconds
-
setImmutable
public void setImmutable()
Set the object immutable.
-
addResult
public void addResult(TaskContextImpl context, TaskResultImpl result)
Add a task result to the step result.- Parameters:
context
- the context to executeresult
- the result to add
-
toJSON
public String toJSON()
Convert the object to JSON- Returns:
- a string with the object content at the JSON format
-
toEoulsanLogV1
public String toEoulsanLogV1()
Get a representation of the result in the old Eoulsan format.- Returns:
- a String with the result
-
read
public void read(DataFile file) throws IOException
Read a step result file.- Parameters:
file
- the file to read- Throws:
IOException
- if an error occurs while reading the file
-
read
public void read(InputStream in)
Read a step result file.- Parameters:
in
- the input stream to read
-
write
public void write(DataFile file, boolean oldFormat) throws IOException
Write the result.- Parameters:
file
- output fileoldFormat
- write the result in old Eoulsan format instead of JSON- Throws:
IOException
- if an error occurs while writing result
-
write
public void write(OutputStream out, boolean oldFormat) throws IOException
Write the result.- Parameters:
out
- output streamoldFormat
- write the result in old Eoulsan format instead of JSON- Throws:
IOException
- if an error occurs while writing result
-
-