From 20c3940ca47fde182ebe4f82fa62c79ae9731dff Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 5 Jan 2017 22:06:11 +0530 Subject: [PATCH] made MonitoringTask to get config from device management service --- .../type/deployer/template/DeviceTypeManagerService.java | 2 +- .../wso2/carbon/policy/mgt/core/task/MonitoringTask.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java index 347782bf5f..c7720093a6 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java @@ -154,7 +154,7 @@ public class DeviceTypeManagerService implements DeviceManagementService { @Override public PolicyMonitoringManager getPolicyMonitoringManager() { - return null; + return policyMonitoringManager; } private void setProvisioningConfig(String tenantDomain, DeviceTypeConfiguration deviceTypeConfiguration) { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java index 965d61a9e3..eb28b9e7d8 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java @@ -135,8 +135,11 @@ public class MonitoringTask implements Task { */ private boolean isPlatformExist(String deviceType) { - PolicyConfiguration policyConfiguration = - DeviceConfigurationManager.getInstance().getDeviceManagementConfig().getPolicyConfiguration(); - return (policyConfiguration.getPlatforms().contains(deviceType)); + PolicyMonitoringManager policyMonitoringManager = PolicyManagementDataHolder.getInstance() + .getDeviceManagementService().getPolicyMonitoringManager(deviceType); + if (policyMonitoringManager != null) { + return true; + } + return false; } }