Class RuleSetRunner
- java.lang.Object
-
- com.sodius.mdw.internal.core.operations.InternalRuleSetRunner
-
- com.sodius.mdw.core.operations.RuleSetRunner
-
public final class RuleSetRunner extends com.sodius.mdw.internal.core.operations.InternalRuleSetRunner
Runs a mainOperation
, which might be decomposed into sub operations, within a ruleset context.This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Constructor Description RuleSetRunner(EvaluationContext context)
Creates a new instance ofRuleSetRunner
for the specified evaluation context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
logError(OperationStatus status)
Logs information if the execution of anOperation
failed or produced warnings.void
run(Operation operation)
Requests the execution of the specified operation.void
writeStatus(OperationStatus status, String filename)
Writes the specified operation status tree into a file.void
writeStatus(OperationStatus status, String filename, StatusWriter writer)
Writes the specified operation status tree into a file, using the specified status writer.
-
-
-
Constructor Detail
-
RuleSetRunner
public RuleSetRunner(EvaluationContext context)
Creates a new instance ofRuleSetRunner
for the specified evaluation context.- Parameters:
context
- the ruleset evaluation context.
-
-
Method Detail
-
run
public void run(Operation operation)
Requests the execution of the specified operation.If an error occurs during the operation execution, the error is recorded in the operation status. Meaning this
run()
call can never fail.When the operation execution is completed, a log can be generated by a call to
writeStatus()
to have a complete execution trace.- Overrides:
run
in classcom.sodius.mdw.internal.core.operations.InternalRuleSetRunner
- Parameters:
operation
- the operation to execute.- See Also:
writeStatus(OperationStatus, String)
-
writeStatus
public void writeStatus(OperationStatus status, String filename)
Writes the specified operation status tree into a file.The specified filename must be a relative path (e.g.
log.html
). The filename extension must be either.html
or.xml
.The generated file is then accessible from the evaluation result.
- Overrides:
writeStatus
in classcom.sodius.mdw.internal.core.operations.InternalRuleSetRunner
- Parameters:
status
- the operation status to log.filename
- the relative path of the log file to generate (e.g.log.html
).- See Also:
EvaluationResult.getReport()
-
writeStatus
public void writeStatus(OperationStatus status, String filename, StatusWriter writer)
Writes the specified operation status tree into a file, using the specified status writer.The specified filename must be a relative path (e.g.
log.html
).The generated file is then accessible from the evaluation result.
- Overrides:
writeStatus
in classcom.sodius.mdw.internal.core.operations.InternalRuleSetRunner
- Parameters:
status
- the operation status to log.filename
- the relative path of the log file to generate (e.g.log.html
).writer
- the status writer used to log the information.- See Also:
EvaluationResult.getReport()
-
logError
public void logError(OperationStatus status)
Logs information if the execution of anOperation
failed or produced warnings.This method goes down recursively in the specified status tree. If at least an error or a warning is found, a log is printed out using
EvaluationContext.getLogger()
to notify the end user the execution hasn't terminated as expected.If problems are found and the operation status has been previously logged using
writeStatus()
, and additional message is logged to invite the end user to consult the generated log.- Overrides:
logError
in classcom.sodius.mdw.internal.core.operations.InternalRuleSetRunner
- Parameters:
status
- the operation status.- See Also:
writeStatus(OperationStatus, String)
-
-