From 441a135acb55ded2909f1fb0dda3feb1bc5b7422 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Tue, 9 Dec 2014 20:28:11 +0530 Subject: [PATCH 1/2] Cleaning up constants --- .../mgt/common/DeviceManagementConstants.java | 9 +++++ .../impl/MobileDeviceManagementConstants.java | 33 ------------------- .../android/AndroidDeviceManagerService.java | 4 +-- .../impl/ios/IOSDeviceManagerService.java | 4 +-- .../windows/WindowsDeviceManagerService.java | 4 +-- 5 files changed, 15 insertions(+), 39 deletions(-) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConstants.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java index 9220c079af..0649a9d6a3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java @@ -34,4 +34,13 @@ public final class DeviceManagementConstants { public static final String SECURE_VAULT_NS = "http://org.wso2.securevault/configuration"; } + public static class MobileDeviceTypes { + private MobileDeviceTypes() { + throw new AssertionError(); + } + public final static String MOBILE_DEVICE_TYPE_ANDROID = "android"; + public final static String MOBILE_DEVICE_TYPE_IOS = "ios"; + public final static String MOBILE_DEVICE_TYPE_WINDOWS = "windows"; + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConstants.java deleted file mode 100644 index a0b5933cf3..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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. - */ - -package org.wso2.carbon.device.mgt.mobile.impl; - -/** - * Constants used by Mobile device Management classes. - */ -public final class MobileDeviceManagementConstants { - - public static class PlatformTypes { - private PlatformTypes() { - throw new AssertionError(); - } - public final static String MOBILE_DEVICE_TYPE_ANDROID = "android"; - public final static String MOBILE_DEVICE_TYPE_IOS = "ios"; - public final static String MOBILE_DEVICE_TYPE_WINDOWS = "windows"; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java index f7dc5987ea..59f44f9283 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java @@ -18,9 +18,9 @@ package org.wso2.carbon.device.mgt.mobile.impl.android; 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.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; -import org.wso2.carbon.device.mgt.mobile.impl.MobileDeviceManagementConstants; import java.util.List; @@ -31,7 +31,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService { @Override public String getProviderType() { - return MobileDeviceManagementConstants.PlatformTypes.MOBILE_DEVICE_TYPE_ANDROID; + return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID; } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java index 7252a13ada..4baee059dd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java @@ -18,9 +18,9 @@ package org.wso2.carbon.device.mgt.mobile.impl.ios; 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.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; -import org.wso2.carbon.device.mgt.mobile.impl.MobileDeviceManagementConstants; import java.util.List; @@ -31,7 +31,7 @@ public class IOSDeviceManagerService implements DeviceManagerService { @Override public String getProviderType() { - return MobileDeviceManagementConstants.PlatformTypes.MOBILE_DEVICE_TYPE_IOS; + return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS; } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java index 93b40d392c..b144670b5f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java @@ -18,9 +18,9 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows; 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.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; -import org.wso2.carbon.device.mgt.mobile.impl.MobileDeviceManagementConstants; import java.util.List; @@ -31,7 +31,7 @@ public class WindowsDeviceManagerService implements DeviceManagerService { @Override public String getProviderType() { - return MobileDeviceManagementConstants.PlatformTypes.MOBILE_DEVICE_TYPE_WINDOWS; + return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS; } @Override From ab6c2717c919fb0872266ffe38ff9841dc7694c0 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Tue, 9 Dec 2014 20:32:56 +0530 Subject: [PATCH 2/2] fixing Android API util related issues --- product/modules/agents/android/jax-rs/pom.xml | 5 +++++ .../src/main/java/cdm/api/android/util/AndroidAPIUtil.java | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/product/modules/agents/android/jax-rs/pom.xml b/product/modules/agents/android/jax-rs/pom.xml index c9d0901cf6..86c77925e0 100644 --- a/product/modules/agents/android/jax-rs/pom.xml +++ b/product/modules/agents/android/jax-rs/pom.xml @@ -150,6 +150,11 @@ org.wso2.carbon org.wso2.carbon.utils + + org.wso2.carbon + org.wso2.carbon.device.mgt.common + 2.0.0-SNAPSHOT + 2.6.1 diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtil.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtil.java index 0995f27cc9..967b5784d4 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtil.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtil.java @@ -17,9 +17,8 @@ package cdm.api.android.util; import com.google.gson.JsonObject; -import org.wso2.carbon.device.mgt.core.dto.Device; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; -import org.wso2.carbon.device.mgt.mobile.impl.MobileDeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; /** * AndroidAPIUtil class provides utility function used by Android REST-API classes. @@ -35,7 +34,7 @@ public class AndroidAPIUtil { Device device = new Device(); DeviceType type = new DeviceType(); device.setId(deviceId); - type.setName(MobileDeviceManagementConstants.MOBILE_DEVICE_TYPE_ANDROID); + type.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); device.setDeviceType(type); return device; }