|
|
|
@ -14,6 +14,22 @@
|
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
|
* under the License.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
|
|
|
* Version 2.0 (the "License"); you may not use this file except
|
|
|
|
|
* in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
|
* under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -21,6 +37,7 @@ package org.wso2.carbon.device.mgt.core.task.impl;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
import org.wso2.carbon.base.ServerConfiguration;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.Device;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
|
|
|
@ -31,6 +48,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.task.DeviceTaskManager;
|
|
|
|
@ -100,9 +118,15 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|
|
|
|
.size());
|
|
|
|
|
}
|
|
|
|
|
for (String str : operations) {
|
|
|
|
|
CommandOperation operation = new CommandOperation();
|
|
|
|
|
operation.setEnabled(true);
|
|
|
|
|
Operation operation;
|
|
|
|
|
if ("SERVER_VERSION".equals(str)) {
|
|
|
|
|
operation = new ProfileOperation();
|
|
|
|
|
operation.setPayLoad(ServerConfiguration.getInstance().getFirstProperty("Version"));
|
|
|
|
|
} else {
|
|
|
|
|
operation = new CommandOperation();
|
|
|
|
|
}
|
|
|
|
|
operation.setType(Operation.Type.COMMAND);
|
|
|
|
|
operation.setEnabled(true);
|
|
|
|
|
operation.setCode(str);
|
|
|
|
|
deviceManagementProviderService.addOperation(deviceType, operation, validDeviceIdentifiers);
|
|
|
|
|
}
|
|
|
|
|