|
|
@ -53,16 +53,32 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|
|
|
|
|
|
|
|
|
|
|
List<TaskConfiguration.Operation> ops = taskConfiguration.getOperations();
|
|
|
|
List<TaskConfiguration.Operation> ops = taskConfiguration.getOperations();
|
|
|
|
List<TaskOperation> taskOperations = new ArrayList<>();
|
|
|
|
List<TaskOperation> taskOperations = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
for (TaskConfiguration.Operation op : ops) {
|
|
|
|
for (TaskConfiguration.Operation op : ops) {
|
|
|
|
TaskOperation taskOperation = new TaskOperation();
|
|
|
|
TaskOperation taskOperation = new TaskOperation();
|
|
|
|
taskOperation.setTaskName(op.getOperationName());
|
|
|
|
taskOperation.setTaskName(op.getOperationName());
|
|
|
|
taskOperation.setRecurrentTimes(op.getRecurrency());
|
|
|
|
taskOperation.setRecurrentTimes(op.getRecurrency());
|
|
|
|
|
|
|
|
taskOperation.setTaskPlatforms(op.getPlatforms());
|
|
|
|
taskOperations.add(taskOperation);
|
|
|
|
taskOperations.add(taskOperation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return taskOperations;
|
|
|
|
return taskOperations;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<String> getPlatformsForOperations(String opName) {
|
|
|
|
|
|
|
|
List<String> operationPlatforms = new ArrayList<>();
|
|
|
|
|
|
|
|
TaskConfiguration taskConfiguration =
|
|
|
|
|
|
|
|
DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getTaskConfiguration();
|
|
|
|
|
|
|
|
List<TaskConfiguration.Operation> ops = taskConfiguration.getOperations();
|
|
|
|
|
|
|
|
for (TaskConfiguration.Operation op : ops) {
|
|
|
|
|
|
|
|
if (op.getOperationName().equals(opName)) {
|
|
|
|
|
|
|
|
List<String> platform = op.getPlatforms();
|
|
|
|
|
|
|
|
for (String operationPlatform : platform) {
|
|
|
|
|
|
|
|
operationPlatforms.add(operationPlatform);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return operationPlatforms;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getTaskFrequency() throws DeviceMgtTaskException {
|
|
|
|
public int getTaskFrequency() throws DeviceMgtTaskException {
|
|
|
|
return DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getTaskConfiguration().
|
|
|
|
return DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getTaskConfiguration().
|
|
|
@ -84,13 +100,14 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void addOperations() throws DeviceMgtTaskException {
|
|
|
|
public void addOperations() throws DeviceMgtTaskException {
|
|
|
|
|
|
|
|
List<String> deviceTypes;
|
|
|
|
DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance().
|
|
|
|
DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance().
|
|
|
|
getDeviceManagementProvider();
|
|
|
|
getDeviceManagementProvider();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<String> deviceTypes = deviceManagementProviderService.getAvailableDeviceTypes();
|
|
|
|
|
|
|
|
List<Device> devices;
|
|
|
|
List<Device> devices;
|
|
|
|
List<String> operations = this.getValidOperationNames();
|
|
|
|
List<String> operations = this.getValidOperationNames();
|
|
|
|
|
|
|
|
for (String taskOperation : operations) {
|
|
|
|
|
|
|
|
deviceTypes = getPlatformsForOperations(taskOperation);
|
|
|
|
for (String deviceType : deviceTypes) {
|
|
|
|
for (String deviceType : deviceTypes) {
|
|
|
|
devices = deviceManagementProviderService.getAllDevices(deviceType);
|
|
|
|
devices = deviceManagementProviderService.getAllDevices(deviceType);
|
|
|
|
if (!devices.isEmpty()) {
|
|
|
|
if (!devices.isEmpty()) {
|
|
|
@ -107,6 +124,8 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|
|
|
log.debug("No devices are available to perform the operations.");
|
|
|
|
log.debug("No devices are available to perform the operations.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (InvalidDeviceException e) {
|
|
|
|
} catch (InvalidDeviceException e) {
|
|
|
|
throw new DeviceMgtTaskException("Invalid DeviceIdentifiers found.", e);
|
|
|
|
throw new DeviceMgtTaskException("Invalid DeviceIdentifiers found.", e);
|
|
|
@ -145,6 +164,8 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|
|
|
return opNames;
|
|
|
|
return opNames;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean isTaskOperation(String opName) {
|
|
|
|
public boolean isTaskOperation(String opName) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|