diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml index 3908d86c60..be0eee231f 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml @@ -28,18 +28,10 @@ isSharedWithAllTenants true - - providerTenantDomain - carbon.super - managed-api-enabled true - - managed-api-owner - admin - diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/webapp/WEB-INF/web.xml index 4c38553526..a137eb9cc7 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/webapp/WEB-INF/web.xml @@ -28,19 +28,11 @@ isSharedWithAllTenants true - - providerTenantDomain - carbon.super - managed-api-enabled true - - managed-api-owner - admin - \ No newline at end of file diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/WEB-INF/web.xml index 623d182b7a..975eb808a0 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/WEB-INF/web.xml @@ -28,19 +28,11 @@ isSharedWithAllTenants true - - providerTenantDomain - carbon.super - managed-api-enabled true - - managed-api-owner - admin - \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml index 2d1c6e26b9..d250c67de7 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml @@ -34,9 +34,5 @@ managed-api-enabled true - - managed-api-owner - admin - \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml index 1daeeb516c..2d8392be43 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml @@ -28,19 +28,11 @@ isSharedWithAllTenants true - - providerTenantDomain - carbon.super - managed-api-enabled false - - managed-api-owner - admin - \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index 409dcd758a..e59fac68a7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -39,7 +39,7 @@ import org.wso2.carbon.mdm.services.android.util.AndroidConstants; import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils; import org.wso2.carbon.mdm.services.android.util.Message; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import javax.validation.Valid; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 9399eb9965..65b7c60b97 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -47,6 +47,7 @@ import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagement import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; 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.common.policy.mgt.monitor.ComplianceFeature; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; @@ -55,7 +56,7 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; import org.wso2.carbon.mdm.services.android.exception.BadRequestException; -import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import javax.ws.rs.core.MediaType; @@ -275,7 +276,8 @@ public class AndroidAPIUtils { if (log.isDebugEnabled()) { log.info("Received compliance status from MONITOR operation ID: " + operation.getId()); } - getPolicyManagerService().checkPolicyCompliance(deviceIdentifier, operation.getPayLoad()); + getPolicyManagerService().checkPolicyCompliance(deviceIdentifier, + getComplianceFeatures(operation.getPayLoad())); } else if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants. OperationCodes.APPLICATION_LIST.equals(operation.getCode())) { if (log.isDebugEnabled()) { @@ -493,4 +495,29 @@ public class AndroidAPIUtils { } return ""; } + + private static List getComplianceFeatures(Object compliancePayload) throws PolicyComplianceException { + String compliancePayloadString = new Gson().toJson(compliancePayload); + if (compliancePayload == null) { + return null; + } + // Parsing json string to get compliance features. + JsonElement jsonElement; + if (compliancePayloadString instanceof String) { + jsonElement = new JsonParser().parse(compliancePayloadString); + } else { + throw new PolicyComplianceException("Invalid policy compliance payload"); + } + + JsonArray jsonArray = jsonElement.getAsJsonArray(); + Gson gson = new Gson(); + ComplianceFeature complianceFeature; + List complianceFeatures = new ArrayList(jsonArray.size()); + + for (JsonElement element : jsonArray) { + complianceFeature = gson.fromJson(element, ComplianceFeature.class); + complianceFeatures.add(complianceFeature); + } + return complianceFeatures; + } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/web.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/web.xml index b39cda6735..63510fe9b1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/web.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/web.xml @@ -51,10 +51,6 @@ managed-api-enabled true - - managed-api-owner - admin - doAuthentication true diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java index 28d35db868..211619e28a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java @@ -27,6 +27,7 @@ import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.mobile.android.impl.util.AndroidPluginConstants; @@ -47,6 +48,7 @@ public class AndroidDeviceManagementService implements DeviceManagementService { private static final String NOTIFIER_PROPERTY = "notifierType"; private static final String GCM_API_KEY = "gcmAPIKey"; private static final String GCM_SENDER_ID = "gcmSenderId"; + private PolicyMonitoringManager policyMonitoringManager; @Override public String getType() { @@ -61,6 +63,7 @@ public class AndroidDeviceManagementService implements DeviceManagementService { @Override public void init() throws DeviceManagementException { this.deviceManager = new AndroidDeviceManager(); + this.policyMonitoringManager = new AndroidPolicyMonitoringManager(); } @Override @@ -105,6 +108,11 @@ public class AndroidDeviceManagementService implements DeviceManagementService { return null; } + @Override + public PolicyMonitoringManager getPolicyMonitoringManager() { + return policyMonitoringManager; + } + private String getConfigProperty(List configs, String propertyName) { for (ConfigurationEntry entry : configs) { if (propertyName.equals(entry.getName())) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPolicyMonitoringService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPolicyMonitoringManager.java similarity index 67% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPolicyMonitoringService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPolicyMonitoringManager.java index 35c28bd2f2..11d2f53325 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPolicyMonitoringService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPolicyMonitoringManager.java @@ -25,39 +25,27 @@ import com.google.gson.JsonElement; import com.google.gson.JsonParser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.mobile.android.impl.gcm.GCMService; -import org.wso2.carbon.device.mgt.mobile.android.internal.AndroidDeviceManagementDataHolder; -import org.wso2.carbon.policy.mgt.common.Policy; -import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData; -import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature; -import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; -import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; +import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; +import org.wso2.carbon.device.mgt.common.policy.mgt.Policy; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import java.util.ArrayList; import java.util.List; -public class AndroidPolicyMonitoringService implements PolicyMonitoringService { +public class AndroidPolicyMonitoringManager implements PolicyMonitoringManager { - private static Log log = LogFactory.getLog(AndroidPolicyMonitoringService.class); + private static Log log = LogFactory.getLog(AndroidPolicyMonitoringManager.class); @Override - public void notifyDevices(List list) throws PolicyComplianceException { - GCMService gcmService = AndroidDeviceManagementDataHolder.getInstance().getGCMService(); - if (gcmService.isGCMEnabled() && !list.isEmpty()) { - gcmService.sendNotification("POLICY_BUNDLE", list); - } - } - - @Override - public ComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, + public NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object compliancePayload) throws PolicyComplianceException { if (log.isDebugEnabled()) { log.debug("Checking policy compliance status of device '" + deviceIdentifier.getId() + "'"); } - ComplianceData complianceData = new ComplianceData(); + NonComplianceData complianceData = new NonComplianceData(); if (compliancePayload == null || policy == null) { return complianceData; } @@ -93,8 +81,4 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService { return complianceData; } - @Override - public String getType() { - return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID; - } } \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/internal/AndroidDeviceManagementServiceComponent.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/internal/AndroidDeviceManagementServiceComponent.java index 409e15025a..66e441ecb9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/internal/AndroidDeviceManagementServiceComponent.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/internal/AndroidDeviceManagementServiceComponent.java @@ -25,10 +25,8 @@ import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.mobile.android.impl.AndroidDeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.android.impl.AndroidPolicyMonitoringService; import org.wso2.carbon.device.mgt.mobile.android.impl.gcm.GCMService; import org.wso2.carbon.ndatasource.core.DataSourceService; -import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; import org.wso2.carbon.registry.core.service.RegistryService; /** @@ -75,8 +73,8 @@ public class AndroidDeviceManagementServiceComponent { // Policy management service - bundleContext.registerService(PolicyMonitoringService.class, - new AndroidPolicyMonitoringService(), null); +// bundleContext.registerService(PolicyMonitoringManager.class, +// new AndroidPolicyMonitoringManager(), null); AndroidDeviceManagementDataHolder.getInstance().setAndroidDeviceManagementService( androidDeviceManagementService); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java index 52ff4c4e20..e42337cfcd 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java @@ -35,9 +35,9 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.Profile; import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.common.ProfileFeature; -import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature; -import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; +import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import java.util.ArrayList; import java.util.List; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java index 658e7dc133..2ea69dd119 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java @@ -33,7 +33,7 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.Wifi; import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*; import org.wso2.carbon.policy.mgt.common.FeatureManagementException; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.common.ProfileFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; import java.util.ArrayList; import java.util.List; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml index bd8fe21f69..50033c2e52 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml @@ -56,10 +56,6 @@ managed-api-enabled true - - managed-api-owner - admin - doAuthentication true diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java index 365468f7c8..2a9c5fb5d1 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; +import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; @@ -34,6 +35,7 @@ public class WindowsDeviceManagementService implements DeviceManagementService { private DeviceManager deviceManager; public static final String DEVICE_TYPE_WINDOWS = "windows"; private final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super"; + private PolicyMonitoringManager policyMonitoringManager; @Override public String getType() { @@ -48,6 +50,7 @@ public class WindowsDeviceManagementService implements DeviceManagementService { @Override public void init() throws DeviceManagementException { this.deviceManager = new WindowsDeviceManager(); + this.policyMonitoringManager = new WindowsPolicyMonitoringManager(); } @Override @@ -70,4 +73,9 @@ public class WindowsDeviceManagementService implements DeviceManagementService { return null; } + @Override + public PolicyMonitoringManager getPolicyMonitoringManager() { + return policyMonitoringManager; + } + } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsPolicyMonitoringService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsPolicyMonitoringManager.java similarity index 65% rename from components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsPolicyMonitoringService.java rename to components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsPolicyMonitoringManager.java index 3c9c0f3abd..59aed808ab 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsPolicyMonitoringService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsPolicyMonitoringManager.java @@ -20,36 +20,29 @@ package org.wso2.carbon.device.mgt.mobile.windows.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.policy.mgt.common.Policy; -import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData; -import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature; -import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; -import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; +import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; +import org.wso2.carbon.device.mgt.common.policy.mgt.Policy; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import java.util.ArrayList; import java.util.List; -public class WindowsPolicyMonitoringService implements PolicyMonitoringService { +public class WindowsPolicyMonitoringManager implements PolicyMonitoringManager { - private static Log log = LogFactory.getLog(WindowsPolicyMonitoringService.class); + private static Log log = LogFactory.getLog(WindowsPolicyMonitoringManager.class); @Override - public void notifyDevices(List list) throws PolicyComplianceException { - - } - - @Override - public ComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object compliancePayload) + public NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object compliancePayload) throws PolicyComplianceException { if (log.isDebugEnabled()) { log.debug("checking policy compliance status of device '" + deviceIdentifier.getId() + "'"); } List complianceFeatures = (List) compliancePayload; List nonComplianceFeatures = new ArrayList<>(); - ComplianceData complianceData = new ComplianceData(); + NonComplianceData complianceData = new NonComplianceData(); if (policy == null || compliancePayload == null) { return complianceData; @@ -66,8 +59,4 @@ public class WindowsPolicyMonitoringService implements PolicyMonitoringService { return complianceData; } - @Override - public String getType() { - return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS; - } } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/internal/WindowsDeviceManagementServiceComponent.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/internal/WindowsDeviceManagementServiceComponent.java index f5a07a67de..fd1e661d3c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/internal/WindowsDeviceManagementServiceComponent.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/internal/WindowsDeviceManagementServiceComponent.java @@ -23,11 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.windows.impl.WindowsDeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.windows.impl.WindowsPolicyMonitoringService; import org.wso2.carbon.ndatasource.core.DataSourceService; -import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; import org.wso2.carbon.registry.core.service.RegistryService; /** @@ -67,8 +63,8 @@ public class WindowsDeviceManagementServiceComponent { // Policy management service - bundleContext.registerService(PolicyMonitoringService.class, - new WindowsPolicyMonitoringService(), null); +// bundleContext.registerService(PolicyMonitoringManager.class, +// new WindowsPolicyMonitoringManager(), null); if (log.isDebugEnabled()) { log.debug("Android Mobile Device Management Service Component has been successfully activated"); diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml index 0585832902..9c2883b72e 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml @@ -253,11 +253,11 @@ - - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android:${carbon.devicemgt.plugins.version} - - + + + + + org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml index f3a949c116..ed7371b3da 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml @@ -348,4 +348,5 @@ + \ No newline at end of file diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml index 33b2a0dec7..0032639f2e 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml @@ -202,11 +202,11 @@ - - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.windows:${carbon.devicemgt.plugins.version} - - + + + + + org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/devicetypes/windows.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/devicetypes/windows.xml index 1313b68673..7503be6d4f 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/devicetypes/windows.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/devicetypes/windows.xml @@ -124,4 +124,6 @@ false + +