|
|
@ -16,7 +16,6 @@
|
|
|
|
* under the License.
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package org.wso2.carbon.policy.mgt.core.mgt.impl;
|
|
|
|
package org.wso2.carbon.policy.mgt.core.mgt.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
@ -75,7 +74,8 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
|
|
|
|
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<>();
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
DeviceManagementProviderService service =
|
|
|
|
|
|
|
|
PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
PolicyManager manager = PolicyManagementDataHolder.getInstance().getPolicyManager();
|
|
|
|
PolicyManager manager = PolicyManagementDataHolder.getInstance().getPolicyManager();
|
|
|
|
Device device = service.getDevice(deviceIdentifier);
|
|
|
|
Device device = service.getDevice(deviceIdentifier);
|
|
|
|
Policy policy = manager.getAppliedPolicyToDevice(deviceIdentifier);
|
|
|
|
Policy policy = manager.getAppliedPolicyToDevice(deviceIdentifier);
|
|
|
@ -90,7 +90,7 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
ComplianceData cmd = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId());
|
|
|
|
ComplianceData cmd = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId());
|
|
|
|
complianceData = monitoringService.checkPolicyCompliance(deviceIdentifier,
|
|
|
|
complianceData = monitoringService.checkPolicyCompliance(deviceIdentifier,
|
|
|
|
policy, deviceResponse);
|
|
|
|
policy, deviceResponse);
|
|
|
|
|
|
|
|
|
|
|
|
complianceData.setId(cmd.getId());
|
|
|
|
complianceData.setId(cmd.getId());
|
|
|
|
complianceData.setPolicy(policy);
|
|
|
|
complianceData.setPolicy(policy);
|
|
|
@ -100,8 +100,9 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new PolicyComplianceException("Error occurred while opening a data source connection", e);
|
|
|
|
throw new PolicyComplianceException("Error occurred while opening a data source connection", e);
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
throw new PolicyComplianceException("Unable to add the none compliance features to database for device " +
|
|
|
|
throw new PolicyComplianceException(
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
"Unable to add the none compliance features to database for device " +
|
|
|
|
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -112,19 +113,20 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
monitoringDAO.setDeviceAsNoneCompliance(device.getId(), device.getEnrolmentInfo().getId(),
|
|
|
|
monitoringDAO.setDeviceAsNoneCompliance(device.getId(), device.getEnrolmentInfo().getId(),
|
|
|
|
policy.getId());
|
|
|
|
policy.getId());
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Compliance status primary key " + complianceData.getId());
|
|
|
|
log.debug("Compliance status primary key " + complianceData.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
monitoringDAO.deleteNoneComplianceData(complianceData.getId());
|
|
|
|
monitoringDAO.deleteNoneComplianceData(complianceData.getId());
|
|
|
|
monitoringDAO.addNonComplianceFeatures(complianceData.getId(), device.getId(),
|
|
|
|
monitoringDAO.addNonComplianceFeatures(complianceData.getId(), device.getId(),
|
|
|
|
complianceFeatures);
|
|
|
|
complianceFeatures);
|
|
|
|
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new PolicyComplianceException("Unable to add the none compliance features to database for device " +
|
|
|
|
throw new PolicyComplianceException(
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
"Unable to add the none compliance features to database for device " +
|
|
|
|
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -146,8 +148,9 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
PolicyManagementDAOFactory.commitTransaction();
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
PolicyManagementDAOFactory.rollbackTransaction();
|
|
|
|
throw new PolicyComplianceException("Unable to remove the none compliance features from database for device " +
|
|
|
|
throw new PolicyComplianceException(
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
"Unable to remove the none compliance features from database for device " +
|
|
|
|
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
PolicyManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -159,10 +162,10 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
throw new PolicyComplianceException("Unable tor retrieve device data from DB for " +
|
|
|
|
throw new PolicyComplianceException("Unable tor retrieve device data from DB for " +
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
} catch (PolicyManagerDAOException | PolicyManagementException e) {
|
|
|
|
} catch (PolicyManagerDAOException | PolicyManagementException e) {
|
|
|
|
throw new PolicyComplianceException("Unable tor retrieve policy data from DB for device " +
|
|
|
|
throw new PolicyComplianceException("Unable tor retrieve policy data from DB for device " +
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
deviceIdentifier.getId() + " - " + deviceIdentifier.getType(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return complianceFeatures;
|
|
|
|
return complianceFeatures;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -170,21 +173,22 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean isCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
|
|
|
public boolean isCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
DeviceManagementProviderService service =
|
|
|
|
|
|
|
|
PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
Device device = service.getDevice(deviceIdentifier);
|
|
|
|
Device device = service.getDevice(deviceIdentifier);
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
ComplianceData complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo()
|
|
|
|
ComplianceData complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo()
|
|
|
|
.getId());
|
|
|
|
.getId());
|
|
|
|
if (complianceData == null || !complianceData.isStatus()) {
|
|
|
|
if (complianceData == null || !complianceData.isStatus()) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() +
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() +
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
|
|
|
|
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve compliance status for " + deviceIdentifier.getId() +
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve compliance status for " + deviceIdentifier.getId() +
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e);
|
|
|
|
throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
@ -195,12 +199,12 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ComplianceData getDevicePolicyCompliance(DeviceIdentifier deviceIdentifier) throws
|
|
|
|
public ComplianceData getDevicePolicyCompliance(DeviceIdentifier deviceIdentifier) throws
|
|
|
|
PolicyComplianceException {
|
|
|
|
PolicyComplianceException {
|
|
|
|
|
|
|
|
|
|
|
|
ComplianceData complianceData;
|
|
|
|
ComplianceData complianceData;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
DeviceManagementProviderService service =
|
|
|
|
|
|
|
|
PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
Device device = service.getDevice(deviceIdentifier);
|
|
|
|
Device device = service.getDevice(deviceIdentifier);
|
|
|
|
complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId());
|
|
|
|
complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId());
|
|
|
|
List<ComplianceFeature> complianceFeatures =
|
|
|
|
List<ComplianceFeature> complianceFeatures =
|
|
|
@ -209,11 +213,11 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
|
|
|
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() +
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve device data for " + deviceIdentifier.getId() +
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
|
|
|
|
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
} catch (MonitoringDAOException e) {
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve compliance data for " + deviceIdentifier.getId() +
|
|
|
|
throw new PolicyComplianceException("Unable to retrieve compliance data for " + deviceIdentifier.getId() +
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
" - " + deviceIdentifier.getType(), e);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e);
|
|
|
|
throw new PolicyComplianceException("Error occurred while opening a connection to the data source", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
@ -232,6 +236,7 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
PolicyManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
//TODO: Return a map from getCompliance to reduce O(n^2) -> O(n)
|
|
|
|
List<ComplianceData> cd = monitoringDAO.getCompliance();
|
|
|
|
List<ComplianceData> cd = monitoringDAO.getCompliance();
|
|
|
|
|
|
|
|
|
|
|
|
for (Device device : devices) {
|
|
|
|
for (Device device : devices) {
|
|
|
@ -266,7 +271,7 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
Map<Integer, Device> deviceIdsToAddOperation = new HashMap<>();
|
|
|
|
Map<Integer, Device> deviceIdsToAddOperation = new HashMap<>();
|
|
|
|
Map<Integer, Device> deviceIdsWithExistingOperation = new HashMap<>();
|
|
|
|
Map<Integer, Device> deviceIdsWithExistingOperation = new HashMap<>();
|
|
|
|
Map<Integer, Device> inactiveDeviceIds = new HashMap<>();
|
|
|
|
Map<Integer, Device> inactiveDeviceIds = new HashMap<>();
|
|
|
|
Map<Integer, Device> deviceToMarkUnreachable = new HashMap<>();
|
|
|
|
Map<Integer, Device> devicesToMarkUnreachable = new HashMap<>();
|
|
|
|
//Map<Integer, Integer> firstTimeDeviceIdsWithPolicyIds = new HashMap<>();
|
|
|
|
//Map<Integer, Integer> firstTimeDeviceIdsWithPolicyIds = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
List<PolicyDeviceWrapper> firstTimeDevices = new ArrayList<>();
|
|
|
|
List<PolicyDeviceWrapper> firstTimeDevices = new ArrayList<>();
|
|
|
@ -281,18 +286,18 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
|
|
|
|
|
|
|
|
if (complianceData.getAttempts() == 0) {
|
|
|
|
if (complianceData.getAttempts() == 0) {
|
|
|
|
deviceIdsToAddOperation.put(complianceData.getDeviceId(),
|
|
|
|
deviceIdsToAddOperation.put(complianceData.getDeviceId(),
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
deviceIdsWithExistingOperation.put(complianceData.getDeviceId(),
|
|
|
|
deviceIdsWithExistingOperation.put(complianceData.getDeviceId(),
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
if (complianceData.getAttempts() >= policyConfiguration.getMinRetriesToMarkUnreachable()) {
|
|
|
|
if (complianceData.getAttempts() >= policyConfiguration.getMinRetriesToMarkUnreachable()) {
|
|
|
|
deviceToMarkUnreachable.put(complianceData.getDeviceId(),
|
|
|
|
devicesToMarkUnreachable.put(complianceData.getDeviceId(),
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (complianceData.getAttempts() >= policyConfiguration.getMinRetriesToMarkInactive()) {
|
|
|
|
if (complianceData.getAttempts() >= policyConfiguration.getMinRetriesToMarkInactive()) {
|
|
|
|
inactiveDeviceIds.put(complianceData.getDeviceId(),
|
|
|
|
inactiveDeviceIds.put(complianceData.getDeviceId(),
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
deviceIds.get(complianceData.getDeviceId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -316,14 +321,14 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
log.debug("These devices are in the system for the first time");
|
|
|
|
log.debug("These devices are in the system for the first time");
|
|
|
|
for (PolicyDeviceWrapper wrapper : firstTimeDevices) {
|
|
|
|
for (PolicyDeviceWrapper wrapper : firstTimeDevices) {
|
|
|
|
log.debug("First time device primary key : " + wrapper.getDeviceId() + " & policy id " +
|
|
|
|
log.debug("First time device primary key : " + wrapper.getDeviceId() + " & policy id " +
|
|
|
|
wrapper.getPolicyId());
|
|
|
|
wrapper.getPolicyId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
PolicyManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
if (!deviceIdsToAddOperation.isEmpty()) {
|
|
|
|
if (!deviceIdsToAddOperation.isEmpty()) {
|
|
|
|
// monitoringDAO.addComplianceDetails(firstTimeDeviceIdsWithPolicyIds);
|
|
|
|
// monitoringDAO.addComplianceDetails(firstTimeDeviceIdsWithPolicyIds);
|
|
|
|
monitoringDAO.addComplianceDetails(firstTimeDevices);
|
|
|
|
monitoringDAO.addComplianceDetails(firstTimeDevices);
|
|
|
|
monitoringDAO.updateAttempts(new ArrayList<>(deviceIdsToAddOperation.keySet()), false);
|
|
|
|
monitoringDAO.updateAttempts(new ArrayList<>(deviceIdsToAddOperation.keySet()), false);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -356,11 +361,17 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
// TODO : This should be uncommented, this is to mark the device as unreachable, But given the current
|
|
|
|
// TODO : This should be uncommented, this is to mark the device as unreachable, But given the current
|
|
|
|
// implementation we are not able to do so.
|
|
|
|
// implementation we are not able to do so.
|
|
|
|
|
|
|
|
|
|
|
|
// if(!deviceToMarkUnreachable.isEmpty()) {
|
|
|
|
if (!devicesToMarkUnreachable.isEmpty()) {
|
|
|
|
// ComplianceDecisionPoint decisionPoint = new ComplianceDecisionPointImpl();
|
|
|
|
ComplianceDecisionPoint decisionPoint = new ComplianceDecisionPointImpl();
|
|
|
|
// decisionPoint.setDevicesAsUnreachable(this.getDeviceIdentifiersFromDevices(
|
|
|
|
decisionPoint.setDevicesAsUnreachable(this.getDeviceIdentifiersFromDevices(
|
|
|
|
// new ArrayList<>(deviceToMarkUnreachable.values())));
|
|
|
|
new ArrayList<>(devicesToMarkUnreachable.values())));
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!inactiveDeviceIds.isEmpty()) {
|
|
|
|
|
|
|
|
ComplianceDecisionPoint decisionPoint = new ComplianceDecisionPointImpl();
|
|
|
|
|
|
|
|
decisionPoint.setDevicesAsInactive(this.getDeviceIdentifiersFromDevices(
|
|
|
|
|
|
|
|
new ArrayList<>(inactiveDeviceIds.values())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -369,7 +380,8 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
|
|
|
|
|
|
|
|
List<String> deviceTypes = new ArrayList<>();
|
|
|
|
List<String> deviceTypes = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
deviceTypes = PolicyManagementDataHolder.getInstance().getDeviceManagementService().getAvailableDeviceTypes();
|
|
|
|
deviceTypes =
|
|
|
|
|
|
|
|
PolicyManagementDataHolder.getInstance().getDeviceManagementService().getAvailableDeviceTypes();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
throw new PolicyComplianceException("Error occurred while getting the device types.", e);
|
|
|
|
throw new PolicyComplianceException("Error occurred while getting the device types.", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -384,14 +396,14 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
monitoringOperation.setEnabled(true);
|
|
|
|
monitoringOperation.setEnabled(true);
|
|
|
|
monitoringOperation.setType(Operation.Type.COMMAND);
|
|
|
|
monitoringOperation.setType(Operation.Type.COMMAND);
|
|
|
|
monitoringOperation.setCode(OPERATION_MONITOR);
|
|
|
|
monitoringOperation.setCode(OPERATION_MONITOR);
|
|
|
|
// CommandOperation infoOperation = new CommandOperation();
|
|
|
|
// CommandOperation infoOperation = new CommandOperation();
|
|
|
|
// infoOperation.setEnabled(true);
|
|
|
|
// infoOperation.setEnabled(true);
|
|
|
|
// infoOperation.setType(Operation.Type.COMMAND);\\
|
|
|
|
// infoOperation.setType(Operation.Type.COMMAND);\\
|
|
|
|
// infoOperation.setCode(OPERATION_INFO);
|
|
|
|
// infoOperation.setCode(OPERATION_INFO);
|
|
|
|
// CommandOperation appListOperation = new CommandOperation();
|
|
|
|
// CommandOperation appListOperation = new CommandOperation();
|
|
|
|
// appListOperation.setEnabled(true);
|
|
|
|
// appListOperation.setEnabled(true);
|
|
|
|
// appListOperation.setType(Operation.Type.COMMAND);
|
|
|
|
// appListOperation.setType(Operation.Type.COMMAND);
|
|
|
|
// appListOperation.setCode(OPERATION_APP_LIST);
|
|
|
|
// appListOperation.setCode(OPERATION_APP_LIST);
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Fix this properly later adding device type to be passed in when the task manage executes "addOperations()"
|
|
|
|
//TODO: Fix this properly later adding device type to be passed in when the task manage executes "addOperations()"
|
|
|
|
String type = null;
|
|
|
|
String type = null;
|
|
|
@ -400,8 +412,8 @@ public class MonitoringManagerImpl implements MonitoringManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService();
|
|
|
|
service.addOperation(type, monitoringOperation, deviceIdentifiers);
|
|
|
|
service.addOperation(type, monitoringOperation, deviceIdentifiers);
|
|
|
|
// service.addOperation(infoOperation, deviceIdentifiers);
|
|
|
|
// service.addOperation(infoOperation, deviceIdentifiers);
|
|
|
|
// service.addOperation(appListOperation, deviceIdentifiers);
|
|
|
|
// service.addOperation(appListOperation, deviceIdentifiers);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<DeviceIdentifier> getDeviceIdentifiersFromDevices(List<Device> devices) {
|
|
|
|
private List<DeviceIdentifier> getDeviceIdentifiersFromDevices(List<Device> devices) {
|
|
|
|