public abstract class TaskBase extends Object
A new Task for the troubleshoot report module can be defined by extending this class (or one of its subclasses)
and annotating it with the TaskMeta
and
TaskParamMeta
annotations appropriately. Tasks defined as such,
will be accessible by their annotated task names via TaskRegistry
and the management service TroubleshootService
.
A Task should write its output to a file or file hierarchy located at the path corresponding to the
outputRoot
provided via execute(String, java.util.Map)
, and return a Status
code
indicating success or failure.
Values (user-specified, or default values if otherwise) for parameters defined in the
TaskParamMeta
annotation of the task, would be passed to it as a
<String, String>
during task execution via the execute(String, Map)
method.
Exceptions arising during task execution should be rethrown to the parent task template, after (optionally) dealing with them within the task logic.
Modifier and Type | Field and Description |
---|---|
protected XServerConfig |
serverConfig |
Constructor and Description |
---|
TaskBase() |
Modifier and Type | Method and Description |
---|---|
abstract Status |
execute(String outputRoot,
Map<String,String> parameters)
Executes the core logic of the task.
|
String |
getDescription() |
String |
getId() |
String |
getName() |
Map<String,TaskParameterView> |
getParameterDetails() |
boolean |
isIntensive() |
boolean |
isMaskable() |
void |
setDescription(String description) |
void |
setId(String id) |
void |
setIntensive(boolean intensive) |
void |
setMaskable(boolean maskable) |
void |
setName(String name) |
void |
setParameterDetails(Map<String,TaskParameterView> parameterDetails) |
void |
setServerConfig(XServerConfig serverConfig) |
TaskView |
toView()
Returns a
TaskView representation of this task |
protected XServerConfig serverConfig
public final boolean isMaskable()
public final void setMaskable(boolean maskable)
public final boolean isIntensive()
public final void setIntensive(boolean intensive)
public final String getId()
public final void setId(String id)
public final String getName()
public final void setName(String name)
public final String getDescription()
public final void setDescription(String description)
public final Map<String,TaskParameterView> getParameterDetails()
public final void setParameterDetails(Map<String,TaskParameterView> parameterDetails)
public void setServerConfig(XServerConfig serverConfig)
public abstract Status execute(String outputRoot, Map<String,String> parameters) throws Exception
File.separator
-terminated path
defined by the outputRoot
parameter.
Any exceptions should be thrown to the base method, for maintaining proper exception notification.outputRoot
- root directory for task output file(s)parameters
- runtime parameters for the taskException
- in case of a failure to execute the taskCopyright © 2016–2019 AdroitLogic. All rights reserved.