AdventNet CLI 2.0 API Specification

com.adventnet.cli.config
Class Task

java.lang.Object
  |
  +--com.adventnet.cli.config.Task

public class Task
extends java.lang.Object

This class represents a command or a script task to be executed. It essentially models the 'CMDTASK' and 'SCRIPTTASK' tags of the xml file.

Since:
2.0

Field Summary
static int COMMAND
          A command task.
static int SCRIPT
          A script task.
 
Constructor Summary
Task()
          Creates a new Task instance.
 
Method Summary
 java.lang.String getCommand()
          Gets the command set in the task.
 boolean getDataRequired()
          Gets the value of the DataRequired flag.
 java.lang.String getDescription()
          Gets the description for the task.
 int getExecutionCount()
          Gets the executionCount of the task.
 java.lang.String getLoginLevel()
          Gets the login level of the task.
 boolean getMandatory()
          Gets the mandatory flag.
 java.lang.String getScriptName()
          Gets the name of the file containing the script.
 java.lang.String getScriptType()
          Gets the name of the scripting language used in the script (like python, beanshell etc.)
 java.lang.String getTaskName()
          Gets the name of the task.
 int getTaskType()
          Gets the type of task.
 void setCommand(java.lang.String command)
          Sets the command of the task.
 void setDataRequired(boolean dataReq)
          Sets the dataRequired flag.
 void setDescription(java.lang.String describe)
          Sets the description for the task.
 void setExecutionCount(int count)
          Sets the executionCount of the task.
 void setLoginLevel(java.lang.String logLevel)
          Sets the login level of the task.
 void setMandatory(boolean mand)
          Sets the mandatory flag.
 void setScriptName(java.lang.String scriptName)
          Sets the filename containing the script.
 void setScriptType(java.lang.String sType)
          Sets the scripting language of the script (eg: python, beanshell etc.)
 void setTaskName(java.lang.String tName)
          Sets the name of the task.
 void setTaskType(int taskType)
          Sets the type of the task.
 java.lang.String toString()
          Returns the taskName, which is used as the identifier for the task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCRIPT

public static final int SCRIPT
A script task.

COMMAND

public static final int COMMAND
A command task.
Constructor Detail

Task

public Task()
Creates a new Task instance. The default constructor which can be used for creating a new task and adding it to the configuration, by setting a taskName.
Method Detail

getTaskType

public int getTaskType()
Gets the type of task. Task can be of two types Command and script, the default type being COMMAND.

 COMMAND - 1
 SCRIPT  - 2
 

Returns:
an int value, representing the code of the type.

setTaskType

public void setTaskType(int taskType)
Sets the type of the task. Task can be of two types Command and script, the default type being COMMAND.
Parameters:
taskType - an int value, representing the type.

getTaskName

public java.lang.String getTaskName()
Gets the name of the task. The taskName should be unique (i.e.) no two tasks can have the same taskName.
Returns:
the name of the task.

setTaskName

public void setTaskName(java.lang.String tName)
Sets the name of the task. The taskName should be unique and so no two tasks can have the same taskName.
Parameters:
tName - the task name as a String value

getCommand

public java.lang.String getCommand()
Gets the command set in the task. This will return null in case of a script and is applicable only for a command task.
Returns:
the command of the task.

setCommand

public void setCommand(java.lang.String command)
Sets the command of the task. This is not applicable in case of a script task.
Parameters:
command - the command as a String value

getScriptName

public java.lang.String getScriptName()
Gets the name of the file containing the script. It returns null in case of a cmd task and is applicable only in case of a script task.
Returns:
the script name.

setScriptName

public void setScriptName(java.lang.String scriptName)
Sets the filename containing the script. This is valid only in case of a script task.
Parameters:
scriptName - the filename containing the script.

getScriptType

public java.lang.String getScriptType()
Gets the name of the scripting language used in the script (like python, beanshell etc.)
Returns:
the scripting language of the script.

setScriptType

public void setScriptType(java.lang.String sType)
Sets the scripting language of the script (eg: python, beanshell etc.)
Parameters:
sType - the type or scripting language of the script.

getLoginLevel

public java.lang.String getLoginLevel()
Gets the login level of the task. This returns null when no login level is specified for the task.
Returns:
the login level of the task.

setLoginLevel

public void setLoginLevel(java.lang.String logLevel)
Sets the login level of the task. This is to be used only when the task is to be executed in a login level other than the configuration's login level. Note that the login level should be one of those defined in the conf file.
Parameters:
logLevel - the login level of the task.

getMandatory

public boolean getMandatory()
Gets the mandatory flag. This flag, when true will execute the task, when false will skip the task. The execution of the task will also depend on the data requirement of the task. It has a default value of true.
Returns:
the value of mandatory task.
See Also:
ConfigAPI.runTask(String, String, TaskData)

setMandatory

public void setMandatory(boolean mand)
Sets the mandatory flag. This flag, when true will execute the task, when false will skip the task. The execution of the task will also depend on the data requirement of the task and data supplied to the task.
Parameters:
mand - the value of the mandatory flag to be set.

getDataRequired

public boolean getDataRequired()
Gets the value of the DataRequired flag. This flag is to be set when the task requires data. If there are no parameters for the task, this flag can be disabled. It takes the default value as true.
Returns:
the dataRequired flag.

setDataRequired

public void setDataRequired(boolean dataReq)
Sets the dataRequired flag. This flag is to be set if the task requires data. When there are no parameters for the task, this flag can be disabled.
Parameters:
dataReq - the dataRequired flag value.

getDescription

public java.lang.String getDescription()
Gets the description for the task.
Returns:
the description.

setDescription

public void setDescription(java.lang.String describe)
Sets the description for the task.
Parameters:
describe - the description for the task.

getExecutionCount

public int getExecutionCount()
Gets the executionCount of the task. ExecutionCount specifies the number of times the task has to be repeatedly executed when running a configuration. It takes the default value as 1. Note that unlike the other parameters, there is no provision for setting this in the xml file. The user can directly get the task and set it in the task.
Returns:
the execution count value.

setExecutionCount

public void setExecutionCount(int count)
Sets the executionCount of the task. ExecutionCount specifies the number of times the task has to be repeatedly executed when running a configuration. It takes the default value as 1. Note that unlike the other parameters, there is no provision for setting this in the xml file. The user can directly get the task and set it in the task.
Parameters:
count - the execution count as an int value

toString

public java.lang.String toString()
Returns the taskName, which is used as the identifier for the task.
Overrides:
toString in class java.lang.Object
Returns:
the name of the task.

AdventNet CLI 2.0 API Specification