From cfbc36ff2daf3ab1251e9de72e504fe1c9c286fc Mon Sep 17 00:00:00 2001 From: prabathabey Date: Tue, 26 Apr 2016 17:17:37 +0530 Subject: [PATCH] Making the plug-in implementations compatible with the changes introduced to DeviceManagementService SPI --- .../impl/AndroidSenseManagerService.java | 30 ++++----- .../plugin/impl/ArduinoManagerService.java | 31 ++++----- .../impl/RaspberrypiManagerService.java | 31 ++++----- .../impl/VirtualFireAlarmManagerService.java | 66 ++++++++----------- .../impl/AndroidDeviceManagementService.java | 20 +++--- .../AndroidDeviceManagementService.java | 19 ++---- .../WindowsDeviceManagementService.java | 21 +++--- .../impl/WindowsDeviceManagementService.java | 21 +++--- 8 files changed, 94 insertions(+), 145 deletions(-) diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java index 965d289e48..5241ce2ac5 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java @@ -16,19 +16,16 @@ package org.wso2.carbon.device.mgt.iot.androidsense.plugin.impl; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; +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.operation.mgt.Operation; +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.iot.androidsense.plugin.constants.AndroidSenseConstants; -import java.util.List; - public class AndroidSenseManagerService implements DeviceManagementService { + private DeviceManager deviceManager; @Override @@ -36,16 +33,6 @@ public class AndroidSenseManagerService implements DeviceManagementService { return AndroidSenseConstants.DEVICE_TYPE; } - @Override - public String getProviderTenantDomain() { - return AndroidSenseConstants.DEVICE_TYPE_PROVIDER_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { this.deviceManager=new AndroidSenseManager(); @@ -61,9 +48,14 @@ public class AndroidSenseManagerService implements DeviceManagementService { return null; } - @Override public void notifyOperationToDevices(Operation operation, List list) - throws DeviceManagementException { + @Override + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(AndroidSenseConstants.DEVICE_TYPE_PROVIDER_DOMAIN, true); + } - } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; + } } diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/plugin/impl/ArduinoManagerService.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/plugin/impl/ArduinoManagerService.java index ef48dc9ad7..4a4de0cb71 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/plugin/impl/ArduinoManagerService.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/plugin/impl/ArduinoManagerService.java @@ -18,19 +18,16 @@ package org.wso2.carbon.device.mgt.iot.arduino.plugin.impl; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; +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.operation.mgt.Operation; +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.iot.arduino.plugin.constants.ArduinoConstants; -import java.util.List; - public class ArduinoManagerService implements DeviceManagementService { + private DeviceManager deviceManager; private final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super"; @@ -39,16 +36,6 @@ public class ArduinoManagerService implements DeviceManagementService { return ArduinoConstants.DEVICE_TYPE; } - @Override - public String getProviderTenantDomain() { - return DEVICE_TYPE_PROVIDER_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { deviceManager=new ArduinoManager(); @@ -65,10 +52,14 @@ public class ArduinoManagerService implements DeviceManagementService { return null; } - @Override - public void notifyOperationToDevices(Operation operation, List deviceIds) - throws DeviceManagementException { + @Override + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(DEVICE_TYPE_PROVIDER_DOMAIN, true); + } - } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; + } } diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/impl/RaspberrypiManagerService.java b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/impl/RaspberrypiManagerService.java index 4dfb6de587..07b69c6c9d 100644 --- a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/impl/RaspberrypiManagerService.java +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/impl/RaspberrypiManagerService.java @@ -18,18 +18,14 @@ package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; +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.operation.mgt.Operation; +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.iot.raspberrypi.plugin.constants.RaspberrypiConstants; -import java.util.List; - public class RaspberrypiManagerService implements DeviceManagementService { private DeviceManager deviceManager; @@ -39,16 +35,6 @@ public class RaspberrypiManagerService implements DeviceManagementService { return RaspberrypiConstants.DEVICE_TYPE; } - @Override - public String getProviderTenantDomain() { - return RaspberrypiConstants.DEVICE_TYPE_PROVIDER_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { deviceManager = new RaspberrypiManager(); @@ -64,10 +50,15 @@ public class RaspberrypiManagerService implements DeviceManagementService { return null; } - @Override - public void notifyOperationToDevices(Operation operation, List deviceIds) - throws DeviceManagementException { + @Override + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(RaspberrypiConstants.DEVICE_TYPE_PROVIDER_DOMAIN, true); + } + + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; + } - } } diff --git a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmManagerService.java b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmManagerService.java index d5883a5bdc..0371a7aca1 100644 --- a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmManagerService.java +++ b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmManagerService.java @@ -18,56 +18,46 @@ package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; +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.operation.mgt.Operation; +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.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; -import java.util.List; +public class VirtualFireAlarmManagerService implements DeviceManagementService { -public class VirtualFireAlarmManagerService implements DeviceManagementService{ - private DeviceManager deviceManager; + private DeviceManager deviceManager; - @Override - public String getType() { - return VirtualFireAlarmConstants.DEVICE_TYPE; - } + @Override + public String getType() { + return VirtualFireAlarmConstants.DEVICE_TYPE; + } + @Override + public void init() throws DeviceManagementException { + this.deviceManager = new VirtualFireAlarmManager(); + } - @Override - public String getProviderTenantDomain() { - return VirtualFireAlarmConstants.DEVICE_TYPE_PROVIDER_DOMAIN; - } + @Override + public DeviceManager getDeviceManager() { + return deviceManager; + } - @Override - public boolean isSharedWithAllTenants() { - return true; - } + @Override + public ApplicationManager getApplicationManager() { + return null; + } - @Override - public void init() throws DeviceManagementException { - this.deviceManager=new VirtualFireAlarmManager(); - } + @Override + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(VirtualFireAlarmConstants.DEVICE_TYPE_PROVIDER_DOMAIN, true); + } - @Override - public DeviceManager getDeviceManager() { - return deviceManager; - } - - @Override - public ApplicationManager getApplicationManager() { - return null; - } - - @Override - public void notifyOperationToDevices(Operation operation, List deviceIds) - throws DeviceManagementException { - - } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; + } } 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 67fb963190..aadd3783f9 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 @@ -21,10 +21,12 @@ package org.wso2.carbon.device.mgt.mobile.android.impl; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; +import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; +import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import java.util.List; @@ -43,16 +45,6 @@ public class AndroidDeviceManagementService implements DeviceManagementService { return AndroidDeviceManagementService.DEVICE_TYPE_ANDROID; } - @Override - public String getProviderTenantDomain() { - return SUPER_TENANT_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return false; - } - @Override public void init() throws DeviceManagementException { this.deviceManager = new AndroidDeviceManager(); @@ -69,9 +61,13 @@ public class AndroidDeviceManagementService implements DeviceManagementService { } @Override - public void notifyOperationToDevices(Operation operation, List deviceIdentifiers) - throws DeviceManagementException { + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(SUPER_TENANT_DOMAIN, true); + } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java index 6140f79948..5eae35cbeb 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; +import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import java.util.List; @@ -41,16 +42,6 @@ public class AndroidDeviceManagementService implements DeviceManagementService { return AndroidDeviceManagementService.DEVICE_TYPE_ANDROID; } - @Override - public String getProviderTenantDomain() { - return SUPER_TENANT_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { this.deviceManager = new AndroidDeviceManager(); @@ -67,9 +58,13 @@ public class AndroidDeviceManagementService implements DeviceManagementService { } @Override - public void notifyOperationToDevices(Operation operation, List deviceIdentifiers) - throws DeviceManagementException { + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(SUPER_TENANT_DOMAIN, true); + } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java index 2b70d02f9e..fe53720773 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java @@ -21,10 +21,12 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; +import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; +import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import java.util.List; @@ -43,16 +45,6 @@ public class WindowsDeviceManagementService implements DeviceManagementService { return WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS; } - @Override - public String getProviderTenantDomain() { - return SUPER_TENANT_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { this.deviceManager = new WindowsDeviceManager(); @@ -68,9 +60,14 @@ public class WindowsDeviceManagementService implements DeviceManagementService { return null; } - @Override public void notifyOperationToDevices(Operation operation, List deviceIdentifiers) - throws DeviceManagementException { + @Override + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(SUPER_TENANT_DOMAIN, true); + } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; } } 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 511ae07124..9658237078 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 @@ -21,10 +21,12 @@ package org.wso2.carbon.device.mgt.mobile.windows.impl; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; +import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; +import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import java.util.List; @@ -43,16 +45,6 @@ public class WindowsDeviceManagementService implements DeviceManagementService { return WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS; } - @Override - public String getProviderTenantDomain() { - return DEVICE_TYPE_PROVIDER_DOMAIN; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { this.deviceManager = new WindowsDeviceManager(); @@ -68,9 +60,14 @@ public class WindowsDeviceManagementService implements DeviceManagementService { return null; } - @Override public void notifyOperationToDevices(Operation operation, List deviceIdentifiers) - throws DeviceManagementException { + @Override + public ProvisioningConfig getProvisioningConfig() { + return new ProvisioningConfig(DEVICE_TYPE_PROVIDER_DOMAIN, true); + } + @Override + public PushNotificationConfig getPushNotificationConfig() { + return null; } }