public interface TaskBuilder
TaskBuilder objects can be instantiated via the RuleEngine.createTaskBuilder(String) method.
Example:
RuleEngine engine = ...
TaskBuilder builder = engine.createTaskBuilder("My Task");
builder.setDeviceScope("mprm.osgi.device", "ROOT/", null)
.setAction("target.consoleCommand('config.ls')")
.launchTask();
| Modifier and Type | Method and Description |
|---|---|
Task |
launchTask()
Assembles all Task parameters set via this builder and launches the built Task.
|
TaskBuilder |
setAction(java.lang.String action)
Defines the Task action.
|
TaskBuilder |
setConcurrency(int limit)
Defines concurrency limit execution option.
|
TaskBuilder |
setDeviceCustomScope(java.lang.String listingScript,
java.lang.String isMemberScript)
Sets the built-up Task to have Device scope with custom involving of devices.
|
TaskBuilder |
setDeviceScope(java.lang.String deviceType,
java.lang.String groupId,
java.lang.String deviceFilter)
Sets the built-up Task to have Device scope with default involving of devices.
|
TaskBuilder |
setDeviceScopeIsMemberCheck(java.lang.String isMemberScript)
Sets the built-up Task with already defined Device scope (see
setDeviceScope(String, String, String))
to have a custom groovy 'is-member' verification. |
TaskBuilder |
setSystemScope(boolean singleHostPerRole,
java.lang.String[] beHostRoles)
Sets the built-up Task to have System scope.
|
TaskBuilder |
setTimeConstraint(TimeConstraint timeConstraint)
Defines at what time-schedule it is permitted for the Task to act.
|
TaskBuilder setSystemScope(boolean singleHostPerRole, java.lang.String[] beHostRoles)
singleBeHost - defines whether single or all backend hosts with the supplied (by beHostRoles parameter)
role(s) should execute the Task.beTargets - array of the target backend host roles.
Elements of the array can be one of Roles.CC, Roles.MS, Roles.RAS,
or id of particular Management Server. Also, array of concrete backend host ids can be provided - in such
a case, the singleHostPerRole parameter is ignored.TaskBuilder having the changes applied.TaskBuilder setDeviceScope(java.lang.String deviceType, java.lang.String groupId, java.lang.String deviceFilter)
deviceType - specifies the type of devices to be in the execution scope.groupId - specifies the device group, whose member devices to be in the execution scope.deviceFilter - devices that satisfy this device filter will be in the execution scope.TaskBuilder having the changes applied.TaskBuilder setDeviceScopeIsMemberCheck(java.lang.String isMemberScript)
setDeviceScope(String, String, String))
to have a custom groovy 'is-member' verification.isMemberScript - should be a groovy script that will be executed for each device
(restricted by deviceType and deviceGroupId) bound as 'target'; the script must return
boolean value specifying if the target device to be or not to be included in the execution scope.TaskBuilder having the changes applied.TaskBuilder setDeviceCustomScope(java.lang.String listingScript, java.lang.String isMemberScript)
listingScript - groovy script that lists devices. The device objects must have methods
getDeviceType and getDeviceId in order to determine the target device.isMemberScript - should be a groovy script that will be executed for each device
(listed by the targetsListScript script) bound as 'target'; the script must return
boolean value specifying if the target device to be or not to be included in the execution scope.TaskBuilder having the changes applied.TaskBuilder setConcurrency(int limit)
limit - concurrency limit number.TaskBuilder having the changes applied.TaskBuilder setTimeConstraint(TimeConstraint timeConstraint)
timeConstraint - time schedule constraint definition.TaskBuilder having the changes applied.TaskBuilder setAction(java.lang.String action)
action - the Task action provided as groovy script.TaskBuilder having the changes applied.Task launchTask() throws ManagementException
Task object representing the launched Task.ManagementException - if system error occurs.java.lang.IllegalArgumentException - if Task parameters are inconsistent or not correct.Copyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.