From e3c6bb319b5e448028a40027fb5aa09e8f624269 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Wed, 27 Nov 2019 20:05:46 +0530 Subject: [PATCH 01/30] Format Android plugin source --- .../pom.xml | 97 +++++ .../android/addons}/ApiOriginFilter.java | 9 +- .../addons}/ValidationInterceptor.java | 8 +- .../pom.xml | 195 ++-------- .../android/api/AndroidEnterpriseAPI.java} | 73 ++-- .../android/api/DeviceManagementAPI.java} | 24 +- .../api/DeviceManagementAdminAPI.java} | 78 ++-- .../api/DeviceTypeConfigurationAPI.java} | 20 +- .../mobile/android/api/EventReceiverAPI.java} | 22 +- .../api}/exception/GlobalThrowableMapper.java | 9 +- .../ParameterValidationException.java | 6 +- .../api/impl/AndroidEnterpriseAPIImpl.java} | 57 ++- .../api/impl/DeviceManagementAPIImpl.java} | 38 +- .../impl/DeviceManagementAdminAPIImpl.java} | 99 +++--- .../impl/DeviceTypeConfigurationAPIImpl.java | 130 +++++++ .../api/impl/EventReceiverAPIImpl.java} | 28 +- .../mdm/services/android/bean/ProxyType.java | 5 - .../DeviceTypeConfigurationServiceImpl.java | 238 ------------- .../services/android/util/DeviceIDHolder.java | 48 --- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 18 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../DeviceManagementAdminServiceTests.java | 312 ---------------- .../android/DeviceManagementServiceTests.java | 334 ------------------ .../pom.xml | 117 ++++++ .../android/common}/AndroidConstants.java | 2 +- .../common}/AndroidPluginConstants.java | 2 +- .../mobile}/android/common/ErrorHandler.java | 4 +- .../mobile}/android/common/ErrorMessage.java | 2 +- .../android/common/GoogleAPIInvoker.java | 12 +- .../common/GsonMessageBodyHandler.java | 2 +- .../mgt/mobile/android/common}/Message.java | 3 +- .../common}/bean/AndroidOperation.java | 2 +- .../bean/AndroidPlatformConfiguration.java | 3 +- .../common}/bean/ApiRegistrationProfile.java | 2 +- .../android/common}/bean/AppRestriction.java | 2 +- .../common}/bean/ApplicationInstallation.java | 2 +- .../common}/bean/ApplicationRestriction.java | 2 +- .../bean/ApplicationUninstallation.java | 2 +- .../common}/bean/ApplicationUpdate.java | 2 +- .../android/common}/bean/BasicUserInfo.java | 2 +- .../common}/bean/BlacklistApplications.java | 2 +- .../mobile/android/common}/bean/Camera.java | 2 +- .../common}/bean/DeviceEncryption.java | 2 +- .../android/common}/bean/DeviceLock.java | 2 +- .../android/common}/bean/DeviceState.java | 2 +- .../android/common}/bean/Disenrollment.java | 4 +- .../android/common}/bean/DisplayMessage.java | 2 +- .../common}/bean/EnterpriseConfigs.java | 2 +- .../common}/bean/EnterpriseStoreCluster.java | 2 +- .../common}/bean/EnterpriseStorePackages.java | 2 +- .../common}/bean/EnterpriseStorePage.java | 2 +- .../bean/EnterpriseStorePageLinks.java | 2 +- .../common}/bean/EnterpriseTokenUrl.java | 2 +- .../android/common}/bean/ErrorListItem.java | 2 +- .../android/common}/bean/ErrorResponse.java | 2 +- .../android/common}/bean/FileTransfer.java | 3 +- .../android/common}/bean/GlobalProxy.java | 2 +- .../common}/bean/GoogleAppSyncResponse.java | 2 +- .../mobile/android/common}/bean/LockCode.java | 2 +- .../android/common}/bean/Notification.java | 2 +- .../common}/bean/NotifierFrequency.java | 2 +- .../android/common}/bean/PasscodePolicy.java | 2 +- .../mobile/android/common/bean/ProxyType.java | 5 + .../android/common}/bean/UpgradeFirmware.java | 2 +- .../mgt/mobile/android/common}/bean/Vpn.java | 2 +- .../mobile/android/common}/bean/WebClip.java | 2 +- .../mgt/mobile/android/common}/bean/Wifi.java | 2 +- .../mobile/android/common}/bean/WipeData.java | 2 +- .../bean/wrapper/AndroidApplication.java | 2 +- .../common}/bean/wrapper/AndroidDevice.java | 2 +- .../bean/wrapper/AndroidDeviceInfo.java | 2 +- .../wrapper/AppRestrictionBeanWrapper.java | 4 +- .../ApplicationInstallationBeanWrapper.java | 4 +- .../ApplicationRestrictionBeanWrapper.java | 4 +- .../ApplicationUninstallationBeanWrapper.java | 4 +- .../wrapper/ApplicationUpdateBeanWrapper.java | 4 +- .../BlacklistApplicationsBeanWrapper.java | 4 +- .../bean/wrapper/CameraBeanWrapper.java | 4 +- .../bean/wrapper/DeviceEnrollmentInfo.java | 2 +- .../bean/wrapper/DeviceLockBeanWrapper.java | 4 +- .../wrapper/DisenrollmentBeanWrapper.java | 4 +- .../wrapper/DisplayMessageBeanWrapper.java | 4 +- .../bean/wrapper/EncryptionBeanWrapper.java | 4 +- .../common}/bean/wrapper/EnterpriseApp.java | 2 +- .../bean/wrapper/EnterpriseInstallPolicy.java | 2 +- .../common}/bean/wrapper/EnterpriseUser.java | 2 +- .../bean/wrapper/EventBeanWrapper.java | 2 +- .../bean/wrapper/FileTransferBeanWrapper.java | 4 +- .../bean/wrapper/GlobalProxyBeanWrapper.java | 4 +- .../bean/wrapper/LockCodeBeanWrapper.java | 4 +- .../bean/wrapper/NotificationBeanWrapper.java | 4 +- .../wrapper/PasswordPolicyBeanWrapper.java | 4 +- .../common}/bean/wrapper/TokenWrapper.java | 2 +- .../wrapper/UpgradeFirmwareBeanWrapper.java | 4 +- .../common}/bean/wrapper/VpnBeanWrapper.java | 4 +- .../bean/wrapper/WebClipBeanWrapper.java | 4 +- .../common}/bean/wrapper/WifiBeanWrapper.java | 4 +- .../bean/wrapper/WipeDataBeanWrapper.java | 4 +- .../AndroidDataSourceConfigurations.java | 2 +- .../datasource/DataSourceConfigAdapter.java | 2 +- .../datasource/JNDILookupDefinition.java | 2 +- .../datasource/MobileDataSourceConfig.java | 2 +- .../MobileDataSourceConfigurations.java | 2 +- .../config/task/TaskConfiguration.java | 2 +- .../dto/AndroidEnterpriseManagedConfig.java | 2 +- .../common}/dto/AndroidEnterpriseUser.java | 2 +- .../mobile/android/common/dto}/ErrorDTO.java | 2 +- .../android/common}/dto/MobileDevice.java | 3 +- .../dto/MobileDeviceOperationMapping.java | 2 +- .../android/common}/dto/MobileFeature.java | 2 +- .../android/common}/dto/MobileOperation.java | 2 +- .../common}/dto/MobileOperationProperty.java | 2 +- .../exception/AndroidAgentException.java | 2 +- .../AndroidDeviceMgtPluginException.java | 2 +- .../exception/AndroidOperationException.java | 4 +- .../exception/BadRequestException.java | 4 +- .../exception/BadRequestExceptionDup.java | 32 ++ .../EnterpriseManagementDAOException.java | 2 +- .../EnterpriseServiceException.java | 2 +- .../common}/exception/ForbiddenException.java | 5 +- .../MobileDeviceManagementDAOException.java | 2 +- .../common}/exception/NotFoundException.java | 7 +- .../OperationConfigurationException.java | 2 +- .../UnexpectedServerErrorException.java | 7 +- .../spi/AndroidGoogleEnterpriseService.java} | 10 +- .../android/common/spi/AndroidService.java | 31 ++ .../pom.xml | 114 +++++- ...tractMobileDeviceManagementDAOFactory.java | 10 +- .../android/core}/dao/AndroidDAOFactory.java | 5 +- .../android/core}/dao/EnterpriseDAO.java | 7 +- .../dao/MobileDeviceManagementDAOFactory.java | 2 +- .../core}/dao/impl/EnterpriseDAOImpl.java | 19 +- .../util/MobileDeviceManagementDAOUtil.java | 2 +- .../AndroidGoogleEnterpriseServiceImpl.java} | 21 +- .../core/impl/AndroidPluginServiceImpl.java | 75 ++++ .../android/core/impl/AndroidServiceImpl.java | 184 ++++++++++ .../AndroidDeviceManagementDataHolder.java | 20 +- .../AndroidPluginServiceComponent.java | 24 +- .../android/core}/util/AndroidAPIUtils.java | 27 +- .../core}/util/AndroidDeviceUtils.java | 69 ++-- .../core}/util/AndroidEnterpriseUtils.java | 26 +- .../util/MobileDeviceManagementUtil.java | 21 +- .../mobile/android/core}/util/OAuthUtils.java | 5 +- .../DeviceManagementAdminServiceTests.java | 311 ++++++++++++++++ .../core/DeviceManagementServiceTests.java | 333 +++++++++++++++++ ...licationManagementProviderServiceMock.java | 2 +- .../DeviceInformationManagerServiceMock.java | 3 +- .../DeviceManagementProviderServiceMock.java | 4 +- .../NotificationManagementServiceMock.java | 2 +- .../core/mokcs}/PolicyManagerServiceMock.java | 2 +- .../android/core/mokcs}/utils/TestUtils.java | 86 ++--- .../src/test/resources/log4j.properties | 0 .../src/test/resources/testng.xml | 4 +- .../MobileDeviceConfigurationManager.java | 78 ---- .../config/MobileDeviceManagementConfig.java | 42 --- .../MobileDeviceManagementRepository.java | 57 --- .../mobile-plugins/android-plugin/pom.xml | 4 +- .../pom.xml | 11 +- pom.xml | 12 +- 159 files changed, 2033 insertions(+), 1867 deletions(-) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util => org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons}/ApiOriginFilter.java (84%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common => org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons}/ValidationInterceptor.java (94%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/AndroidEnterpriseService.java => device/mgt/mobile/android/api/AndroidEnterpriseAPI.java} (96%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/DeviceManagementService.java => device/mgt/mobile/android/api/DeviceManagementAPI.java} (97%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/DeviceManagementAdminService.java => device/mgt/mobile/android/api/DeviceManagementAdminAPI.java} (96%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/DeviceTypeConfigurationService.java => device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java} (95%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/EventReceiverService.java => device/mgt/mobile/android/api/EventReceiverAPI.java} (92%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android => device/mgt/mobile/android/api}/exception/GlobalThrowableMapper.java (88%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android => device/mgt/mobile/android/api}/exception/ParameterValidationException.java (89%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/impl/AndroidEnterpriseServiceImpl.java => device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java} (95%) rename 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 => device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java} (95%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java => device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java} (93%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/{mdm/services/android/services/impl/EventReceiverServiceImpl.java => device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java} (91%) delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ProxyType.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/DeviceIDHolder.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/AndroidConstants.java (99%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/AndroidPluginConstants.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile}/android/common/ErrorHandler.java (89%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile}/android/common/ErrorMessage.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile}/android/common/GoogleAPIInvoker.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile}/android/common/GsonMessageBodyHandler.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/Message.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/AndroidOperation.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/AndroidPlatformConfiguration.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ApiRegistrationProfile.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/AppRestriction.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ApplicationInstallation.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ApplicationRestriction.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ApplicationUninstallation.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ApplicationUpdate.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/BasicUserInfo.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/BlacklistApplications.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/Camera.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/DeviceEncryption.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/DeviceLock.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/DeviceState.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/Disenrollment.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/DisplayMessage.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/EnterpriseConfigs.java (90%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/EnterpriseStoreCluster.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/EnterpriseStorePackages.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/EnterpriseStorePage.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/EnterpriseStorePageLinks.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/EnterpriseTokenUrl.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ErrorListItem.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/ErrorResponse.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/FileTransfer.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/GlobalProxy.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/GoogleAppSyncResponse.java (77%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/LockCode.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/Notification.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/NotifierFrequency.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/PasscodePolicy.java (98%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ProxyType.java rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/UpgradeFirmware.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/Vpn.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/WebClip.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/Wifi.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/WipeData.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/AndroidApplication.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/AndroidDevice.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/AndroidDeviceInfo.java (99%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/AppRestrictionBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/ApplicationInstallationBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/ApplicationRestrictionBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/ApplicationUninstallationBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/ApplicationUpdateBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/BlacklistApplicationsBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/CameraBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/DeviceEnrollmentInfo.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/DeviceLockBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/DisenrollmentBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/DisplayMessageBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/EncryptionBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/EnterpriseApp.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/EnterpriseInstallPolicy.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/EnterpriseUser.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/EventBeanWrapper.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/FileTransferBeanWrapper.java (93%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/GlobalProxyBeanWrapper.java (92%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/LockCodeBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/NotificationBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/PasswordPolicyBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/TokenWrapper.java (72%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/UpgradeFirmwareBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/VpnBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/WebClipBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/WifiBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/bean/wrapper/WipeDataBeanWrapper.java (91%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/config/datasource/AndroidDataSourceConfigurations.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/config/datasource/DataSourceConfigAdapter.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/config/datasource/JNDILookupDefinition.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/config/datasource/MobileDataSourceConfig.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/config/datasource/MobileDataSourceConfigurations.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/config/task/TaskConfiguration.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/AndroidEnterpriseManagedConfig.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/AndroidEnterpriseUser.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto}/ErrorDTO.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/MobileDevice.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/MobileDeviceOperationMapping.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/MobileFeature.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/MobileOperation.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/dto/MobileOperationProperty.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/AndroidAgentException.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception}/AndroidDeviceMgtPluginException.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/AndroidOperationException.java (89%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/BadRequestException.java (87%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception}/EnterpriseManagementDAOException.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception}/EnterpriseServiceException.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/ForbiddenException.java (87%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception}/MobileDeviceManagementDAOException.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/NotFoundException.java (83%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/OperationConfigurationException.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common}/exception/UnexpectedServerErrorException.java (84%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/AndroidPluginService.java => org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java} (79%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android => org.wso2.carbon.device.mgt.mobile.android.core}/pom.xml (69%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/dao/AbstractMobileDeviceManagementDAOFactory.java (90%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/dao/AndroidDAOFactory.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/dao/EnterpriseDAO.java (84%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/dao/MobileDeviceManagementDAOFactory.java (92%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/dao/impl/EnterpriseDAOImpl.java (93%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/dao/util/MobileDeviceManagementDAOUtil.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidPluginServiceImpl.java => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java} (90%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidPluginServiceImpl.java create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/internal/AndroidDeviceManagementDataHolder.java (69%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/internal/AndroidPluginServiceComponent.java (80%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/util/AndroidAPIUtils.java (87%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/util/AndroidDeviceUtils.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/util/AndroidEnterpriseUtils.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/util/MobileDeviceManagementUtil.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core}/util/OAuthUtils.java (95%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks => org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs}/ApplicationManagementProviderServiceMock.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks => org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs}/DeviceInformationManagerServiceMock.java (93%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks => org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs}/DeviceManagementProviderServiceMock.java (99%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks => org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs}/NotificationManagementServiceMock.java (97%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks => org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs}/PolicyManagerServiceMock.java (98%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android => org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs}/utils/TestUtils.java (86%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api => org.wso2.carbon.device.mgt.mobile.android.core}/src/test/resources/log4j.properties (100%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.api => org.wso2.carbon.device.mgt.mobile.android.core}/src/test/resources/testng.xml (80%) delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/config/MobileDeviceConfigurationManager.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/config/MobileDeviceManagementConfig.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/config/MobileDeviceManagementRepository.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml new file mode 100644 index 000000000..3f658001d --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml @@ -0,0 +1,97 @@ + + + + + + android-plugin + org.wso2.carbon.devicemgt-plugins + 5.0.5-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.mobile.android.addons + bundle + WSO2 Carbon - Mobile Device Management Android Addons Impl + WSO2 Carbon - Mobile Device Management Android Addons Implementation + https://entgra.io/ + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.devicemgt.plugins.version} + Device Management Mobile Android addons Impl Bundle + + com.google.gson.* + + + org.wso2.carbon.device.mgt.mobile.android.addons.* + + + + + + + + + + javax.servlet + servlet-api + provided + + + org.apache.cxf + cxf-rt-frontend-jaxws + provided + + + org.apache.cxf + cxf-rt-frontend-jaxrs + provided + + + org.apache.cxf + cxf-rt-transports-http + provided + + + org.hibernate + hibernate-validator + + + org.wso2.carbon + org.wso2.carbon.logging + + + 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/ApiOriginFilter.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ApiOriginFilter.java similarity index 84% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/ApiOriginFilter.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ApiOriginFilter.java index 455d582bb..e9c4c69da 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/ApiOriginFilter.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ApiOriginFilter.java @@ -16,9 +16,14 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.addons; -import javax.servlet.*; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import java.io.IOException; 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/common/ValidationInterceptor.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ValidationInterceptor.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/ValidationInterceptor.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ValidationInterceptor.java index a563f09d1..adc298e18 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/ValidationInterceptor.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ValidationInterceptor.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.common; +package org.wso2.carbon.device.mgt.mobile.android.addons; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -29,7 +29,11 @@ import org.apache.cxf.message.MessageContentsList; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; -import javax.validation.*; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validation; +import javax.validation.Validator; +import javax.validation.ValidatorFactory; import javax.validation.executable.ExecutableValidator; import java.lang.reflect.Method; import java.util.List; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 1855a35d4..d902ed524 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -49,44 +49,6 @@ api#device-mgt#android#v1.0 - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - file:src/test/resources/log4j.properties - - - src/test/resources/testng.xml - - - @@ -99,7 +61,7 @@ org.apache.maven.plugins maven-antrun-plugin - 1.7 + 1.8 compile @@ -118,54 +80,6 @@ - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - - - - - - - client - - test - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - test - - java - - - - @@ -212,32 +126,6 @@ org.wso2.carbon.apimgt.annotations provided - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.slf4j - slf4j-api - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.policy.mgt.common - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.policy.mgt.core - provided - - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.android - provided - commons-httpclient.wso2 commons-httpclient @@ -287,11 +175,7 @@ - - javax.servlet - servlet-api - provided - + org.hibernate hibernate-validator @@ -300,78 +184,49 @@ javax.ws.rs javax.ws.rs-api + - org.testng - testng - test - - - org.powermock - powermock-module-testng - test - - - org.powermock - powermock-api-mockito - test - - - com.h2database.wso2 - h2-database-engine - test - - - org.wso2.carbon - org.wso2.carbon.queuing - test - - - org.wso2.carbon - org.wso2.carbon.ndatasource.core - test - - - commons-dbcp.wso2 - commons-dbcp - test + org.codehaus.jackson + jackson-core-asl - commons-pool.wso2 - commons-pool - test + com.google.apis + google-api-services-androidenterprise + v1-rev186-1.25.0 - org.wso2.carbon - javax.cache.wso2 - test + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common + provided - javassist - javassist - test + org.apache.httpcomponents + httpclient + - org.codehaus.jackson - jackson-core-asl + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.common + provided - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.application.extension + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.addons provided - com.google.apis - google-api-services-androidenterprise - v1-rev186-1.25.0 + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.core + provided org.wso2.carbon.devicemgt - org.wso2.carbon.device.application.mgt.common + org.wso2.carbon.policy.mgt.common provided - org.apache.httpcomponents - httpclient + org.wso2.carbon.devicemgt + org.wso2.carbon.policy.mgt.core 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/AndroidEnterpriseService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/AndroidEnterpriseService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java index a76a57ada..3ffd40654 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/AndroidEnterpriseService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java @@ -15,9 +15,8 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.services; +package org.wso2.carbon.device.mgt.mobile.android.api; -import com.google.api.services.androidenterprise.model.Device; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -32,22 +31,17 @@ import io.swagger.annotations.Tag; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationPolicyDTO; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.mdm.services.android.bean.DeviceState; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStoreCluster; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePage; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePageLinks; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseInstallPolicy; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseUser; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; - -import javax.validation.Valid; -import javax.validation.constraints.Size; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStoreCluster; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePage; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePageLinks; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; + import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; @@ -69,10 +63,11 @@ import javax.ws.rs.core.Response; } ), tags = { - @Tag(name = "android,device_management", description = "") + @Tag(name = "android,device_management", description = "Android Device Management Service") } ) -@Api(value = "Android Enterprise Service", description = "Android Enterprise Service ") + +@Api(value = "Android Enterprise Service") @Path("/enterprise") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -92,7 +87,7 @@ import javax.ws.rs.core.Response; ) } ) -public interface AndroidEnterpriseService { +public interface AndroidEnterpriseAPI { @POST @Path("/user") @@ -148,8 +143,7 @@ public interface AndroidEnterpriseService { }) Response addUser(@ApiParam( name = "user", - value = "Enterprise user and device data.") - EnterpriseUser enterpriseUser); + value = "Enterprise user and device data.") EnterpriseUser enterpriseUser); //###################################################################################################################### //###################################################################################################################### @@ -209,8 +203,7 @@ public interface AndroidEnterpriseService { }) Response updateUser(@ApiParam( name = "device", - value = "Enterprise user and device data.") - EnterpriseInstallPolicy device); + value = "Enterprise user and device data.") EnterpriseInstallPolicy device); //###################################################################################################################### //###################################################################################################################### @@ -269,43 +262,38 @@ public interface AndroidEnterpriseService { Response getStoreUrl( @ApiParam( name = "approveApps", - value = "Boolean flag indicating whether to permanently delete the device.", - required = false) + value = "Boolean flag indicating whether to permanently delete the device.") @QueryParam("approveApps") boolean approveApps, @ApiParam( name = "searchEnabled", - value = "Boolean flag indicating whether to permanently delete the device.", - required = false) + value = "Boolean flag indicating whether to permanently delete the device.") @QueryParam("searchEnabled") boolean searchEnabled, @ApiParam( name = "isPrivateAppsEnabled", - value = "Boolean flag indicating whether to permanently delete the device.", - required = false) @QueryParam("isPrivateAppsEnabled") boolean isPrivateAppsEnabled, + value = "Boolean flag indicating whether to permanently delete the device.") + @QueryParam("isPrivateAppsEnabled") boolean isPrivateAppsEnabled, @ApiParam( name = "isWebAppEnabled", - value = "Boolean flag indicating whether to permanently delete the device.", - required = false) @QueryParam("isWebAppEnabled") boolean isWebAppEnabled, + value = "Boolean flag indicating whether to permanently delete the device.") + @QueryParam("isWebAppEnabled") boolean isWebAppEnabled, @ApiParam( name = "isOrganizeAppPageVisible", - value = "Boolean flag indicating whether to permanently delete the device.", - required = false) @QueryParam("isOrganizeAppPageVisible") boolean isOrganizeAppPageVisible, + value = "Boolean flag indicating whether to permanently delete the device.") + @QueryParam("isOrganizeAppPageVisible") boolean isOrganizeAppPageVisible, @ApiParam( name = "isManagedConfigEnabled", - value = "Boolean flag indicating whether to permanently delete the device.", - required = false) @QueryParam("isManagedConfigEnabled") boolean isManagedConfigEnabled, + value = "Boolean flag indicating whether to permanently delete the device.") + @QueryParam("isManagedConfigEnabled") boolean isManagedConfigEnabled, @ApiParam(name = "host", value = "Boolean flag indicating whether to permanently delete the device.", required = true) @QueryParam("host") String host); - - - @GET @Path("/products/sync") @ApiOperation( @@ -416,8 +404,7 @@ public interface AndroidEnterpriseService { }) Response addPage(@ApiParam( name = "page", - value = "Enterprise page.") - EnterpriseStorePage page); + value = "Enterprise page.") EnterpriseStorePage page); //###################################################################################################################### //###################################################################################################################### @@ -777,8 +764,7 @@ public interface AndroidEnterpriseService { }) Response addCluster(@ApiParam( name = "storeCluster", - value = "Enterprise cluster.") - EnterpriseStoreCluster storeCluster); + value = "Enterprise cluster.") EnterpriseStoreCluster storeCluster); //###################################################################################################################### //###################################################################################################################### @@ -965,7 +951,7 @@ public interface AndroidEnterpriseService { @ApiParam( name = "pageId", value = "The unique page pageId") - @PathParam("pageId") String pageId); + @PathParam("id") String pageId); //###################################################################################################################### //###################################################################################################################### @@ -1025,8 +1011,7 @@ public interface AndroidEnterpriseService { }) Response updateLinks(@ApiParam( name = "links", - value = "Enterprise page links.") - EnterpriseStorePageLinks links); + value = "Enterprise page links.") EnterpriseStorePageLinks links); //###################################################################################################################### //###################################################################################################################### 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/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceManagementAPI.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceManagementAPI.java index a3910c870..73db4dd71 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/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceManagementAPI.java @@ -32,16 +32,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.services; +package org.wso2.carbon.device.mgt.mobile.android.api; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; import javax.validation.Valid; import javax.validation.constraints.NotNull; @@ -73,11 +73,10 @@ import java.util.List; } ), tags = { - @Tag(name = "android,device_management", description = "") + @Tag(name = "android,device_management", description = "Android Device Management Service") } ) -@Api(value = "Android Device Management", - description = "This carries all the resources related to the Android device management functionalities.") +@Api(value = "Android Device Management") @Path("/devices") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -97,7 +96,7 @@ import java.util.List; ) } ) -public interface DeviceManagementService { +public interface DeviceManagementAPI { @PUT @Path("/{id}/applications") @@ -211,8 +210,7 @@ public interface DeviceManagementService { Response getPendingOperations( @ApiParam( name = "disableGoogleApps", - value = "Specifically disable having Google apps installed.", - required = false) + value = "Specifically disable having Google apps installed.") @QueryParam("disableGoogleApps") boolean disableGoogleApps, @ApiParam( name = "id", @@ -223,8 +221,7 @@ public interface DeviceManagementService { name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200.", - required = false) + "Example: Mon, 05 Jan 2014 15:10:00 +0200.") @HeaderParam("If-Modified-Since") String ifModifiedSince, @ApiParam( name = "resultOperations", @@ -339,8 +336,7 @@ public interface DeviceManagementService { name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) + "Example: Mon, 05 Jan 2014 15:10:00 +0200") @HeaderParam("If-Modified-Since") String ifModifiedSince); @PUT 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/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceManagementAdminAPI.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceManagementAdminAPI.java index 89787ea68..118874bec 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/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceManagementAdminAPI.java @@ -33,7 +33,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.services; +package org.wso2.carbon.device.mgt.mobile.android.api; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Info; @@ -49,8 +49,26 @@ import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; -import org.wso2.carbon.mdm.services.android.bean.wrapper.*; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationInstallationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationRestrictionBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUninstallationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUpdateBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.BlacklistApplicationsBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.CameraBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DeviceLockBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DisplayMessageBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EncryptionBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.FileTransferBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.GlobalProxyBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.LockCodeBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.NotificationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.PasswordPolicyBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.UpgradeFirmwareBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -75,11 +93,11 @@ import java.util.List; } ), tags = { - @Tag(name = "android,device_management", description = "") + @Tag(name = "android,device_management", description = "Android Device Management Admin Service") } ) @Path("/admin/devices") -@Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.") +@Api(value = "Android Device Management Administrative Service") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Scopes( @@ -266,7 +284,7 @@ import java.util.List; ) } ) -public interface DeviceManagementAdminService { +public interface DeviceManagementAdminAPI { @POST @Path("/file-transfer") @@ -632,8 +650,7 @@ public interface DeviceManagementAdminService { "Disable the camera on the device by assigning true as the value or enable the " + "camera on the device to function by defining false as the value and the ID of the Android device. " + "Multiple device IDs can be added by using comma separated values. ", - required = true) - CameraBeanWrapper cameraBeanWrapper); + required = true) CameraBeanWrapper cameraBeanWrapper); @POST @Path("/info") @@ -880,8 +897,7 @@ public interface DeviceManagementAdminService { name = "wipeData", value = "Provide the the passcode, which is the passcode that the Android agent prompts the device owner to set at the time of device enrollment, " + "to enable the factory reset operation, and the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", - required = true) - WipeDataBeanWrapper wipeDataBeanWrapper); + required = true) WipeDataBeanWrapper wipeDataBeanWrapper); @POST @Path("/applications") @@ -1248,8 +1264,7 @@ public interface DeviceManagementAdminService { value = "Properties required to install an application on Android devices. Provide the the package name, type," + " URL and name of the application, the date and time for the scheduled installation, and the ID of the " + "Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); + required = true) ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); @POST @Path("/update-application") @@ -1313,8 +1328,7 @@ public interface DeviceManagementAdminService { value = "Properties required to update an application on Android devices. Provide the the package name, type," + "URL and name of the application, the date and time for the scheduled installation, and the ID of the" + "Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); + required = true) ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); @POST @Path("/uninstall-application") @@ -1375,8 +1389,7 @@ public interface DeviceManagementAdminService { value = "Properties required to uninstall an application. Provide the the package name, type," + "URL and name of the application, the date and time for the scheduled installation, and the ID of the" + "Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper); + required = true) ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper); @POST @Path("/blacklist-applications") @@ -1504,8 +1517,7 @@ public interface DeviceManagementAdminService { "yyyy-MM-dd'T'HH:mm:ss.SSSXXX format, the OTA upgrade server URL in one of the following formats " + "(example: http//abc.com, http://abc.com/ota), " + "and the ID of the Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper); + required = true) UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper); @POST @Path("/configure-vpn") @@ -1565,8 +1577,7 @@ public interface DeviceManagementAdminService { @ApiParam( name = "vpnBean", value = "VPN configuration and DeviceIds", - required = true) - VpnBeanWrapper vpnBeanWrapper); + required = true) VpnBeanWrapper vpnBeanWrapper); @POST @Path("/send-notification") @@ -1626,8 +1637,7 @@ public interface DeviceManagementAdminService { name = "notification", value = "The properties required to send a notification. Provide the message you wish to send and the ID of the " + "Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - NotificationBeanWrapper notificationBeanWrapper); + required = true) NotificationBeanWrapper notificationBeanWrapper); @POST @Path("/configure-wifi") @@ -1688,8 +1698,7 @@ public interface DeviceManagementAdminService { value = "The properties required to configure Wi-Fi. Provide the password to connect to the specified Wi-Fi network," + "the ssid or the name of the Wi-Fi network that you wish to configure and the ID of the Android device." + " Multiple device IDs can be added by using comma separated values.", - required = true) - WifiBeanWrapper wifiBeanWrapper); + required = true) WifiBeanWrapper wifiBeanWrapper); @POST @Path("/encrypt-storage") @@ -1750,8 +1759,7 @@ public interface DeviceManagementAdminService { value = "Properties required to encrypt the storage. Encrypt the storage on the device by assigning " + "true as the value or do not encrypt the storage on the device by assigning false as the value and " + "provide the ID of the Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - EncryptionBeanWrapper encryptionBeanWrapper); + required = true) EncryptionBeanWrapper encryptionBeanWrapper); @POST @Path("/change-lock-code") @@ -1812,8 +1820,7 @@ public interface DeviceManagementAdminService { value = "The properties to change th lock code. Provide the lock code that will replace the current lock code on Android devices and " + "the ID of the Android device. Multiple device IDs can be added by using comma separated values. " + "If a passcode policy has been set in EMM, the lock code should comply to the passcode policy.\t", - required = true) - LockCodeBeanWrapper lockCodeBeanWrapper); + required = true) LockCodeBeanWrapper lockCodeBeanWrapper); @POST @Path("/set-password-policy") @@ -1872,8 +1879,7 @@ public interface DeviceManagementAdminService { @ApiParam( name = "passwordPolicy", value = "The properties required to set a password policy.", - required = true) - PasswordPolicyBeanWrapper passwordPolicyBeanWrapper); + required = true) PasswordPolicyBeanWrapper passwordPolicyBeanWrapper); @POST @Path("/set-webclip") @@ -1932,8 +1938,7 @@ public interface DeviceManagementAdminService { @ApiParam( name = "webClip", value = "The properties to set the web clip.", - required = true) - WebClipBeanWrapper webClipBeanWrapper); + required = true) WebClipBeanWrapper webClipBeanWrapper); @POST @Path("/send-app-conf") @ApiOperation( @@ -1994,8 +1999,7 @@ public interface DeviceManagementAdminService { value = "The properties required to send application restrictions. Provide the restriction you " + "wish to send and the ID of the Android device. Multiple device IDs can be added by using" + " comma separated values.", - required = true) - ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper); + required = true) ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper); @POST @Path("/configure-global-proxy") @@ -2056,8 +2060,7 @@ public interface DeviceManagementAdminService { @ApiParam( name = "globalProxyInfo", value = "The properties to set the global proxy settings.", - required = true) - GlobalProxyBeanWrapper globalProxyBeanWrapper); + required = true) GlobalProxyBeanWrapper globalProxyBeanWrapper); @POST @Path("/configure-display-message") @@ -2107,6 +2110,5 @@ public interface DeviceManagementAdminService { name = "display-message", value = "The properties required to send a messages. Provide the message you wish to send and the ID of the " + "Android device. Multiple device IDs can be added by using comma separated values.", - required = true) - DisplayMessageBeanWrapper displayMessageBeanWrapper); + required = true) DisplayMessageBeanWrapper displayMessageBeanWrapper); } 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/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java index 5e2440941..6e8e324ea 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/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.services; +package org.wso2.carbon.device.mgt.mobile.android.api; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Info; @@ -32,9 +32,9 @@ import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration; -import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidAgentException; import javax.validation.Valid; import javax.ws.rs.*; @@ -55,10 +55,10 @@ import javax.ws.rs.core.Response; } ), tags = { - @Tag(name = "android,device_management", description = "") + @Tag(name = "android,device_management", description = "Device Type Configuration Service") } ) -@Api(value = "Android Configuration Management", description = "This API carries all the resource used to mange the Android platform configurations.") +@Api(value = "Android Configuration Management") @Path("/configuration") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -84,7 +84,7 @@ import javax.ws.rs.core.Response; ) } ) -public interface DeviceTypeConfigurationService { +public interface DeviceTypeConfigurationAPI { @GET @ApiOperation( @@ -136,8 +136,7 @@ public interface DeviceTypeConfigurationService { name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) + "Example: Mon, 05 Jan 2014 15:10:00 +0200") @HeaderParam("If-Modified-Since") String ifModifiedSince); @PUT @@ -245,8 +244,7 @@ public interface DeviceTypeConfigurationService { name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200.", - required = false) + "Example: Mon, 05 Jan 2014 15:10:00 +0200.") @HeaderParam("If-Modified-Since") String ifModifiedSince) throws AndroidAgentException; } 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/EventReceiverService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/EventReceiverAPI.java similarity index 92% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/EventReceiverAPI.java index 93b914a5f..09f61943c 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/EventReceiverService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/EventReceiverAPI.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.services; +package org.wso2.carbon.device.mgt.mobile.android.api; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Info; @@ -31,9 +31,9 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.mdm.services.android.bean.DeviceState; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWrapper; import javax.validation.Valid; import javax.validation.constraints.Size; @@ -53,12 +53,10 @@ import javax.ws.rs.core.Response; } ), tags = { - @Tag(name = "android,device_management", description = "") + @Tag(name = "android,device_management", description = "Android Even Receiver Service") } ) -@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs. To enable event publishing/retrieving you need to" + - " configure WSO2 EMM as explained in https://docs.wso2.com/display/EMM220/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " + - "https://docs.wso2.com/display/EMM220/Creating+a+New+Event+Stream+and+Receiver") +@Api(value = "Event Receiver") @Path("/events") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -72,7 +70,7 @@ import javax.ws.rs.core.Response; ) } ) -public interface EventReceiverService { +public interface EventReceiverAPI { @POST @Path("/publish") @@ -131,8 +129,7 @@ public interface EventReceiverService { @ApiParam( name = "eventBeanWrapper", value = "Information of the agent event to be published on DAS.") - @Valid - EventBeanWrapper eventBeanWrapper); + @Valid EventBeanWrapper eventBeanWrapper); @GET @ApiOperation( @@ -207,8 +204,7 @@ public interface EventReceiverService { name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) + "Example: Mon, 05 Jan 2014 15:10:00 +0200") @HeaderParam("If-Modified-Since") String ifModifiedSince); } 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/exception/GlobalThrowableMapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java similarity index 88% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/GlobalThrowableMapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java index 31370bd88..f45df54d3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/GlobalThrowableMapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java @@ -16,12 +16,17 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; import com.google.gson.JsonParseException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.ForbiddenException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.naming.AuthenticationException; import javax.validation.ConstraintViolationException; 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/exception/ParameterValidationException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java similarity index 89% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/ParameterValidationException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java index efb38a3d7..bf729a9e9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/ParameterValidationException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java @@ -16,10 +16,10 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; -import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.validation.ConstraintViolation; import javax.ws.rs.WebApplicationException; 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/AndroidEnterpriseServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/AndroidEnterpriseServiceImpl.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java index 26805efd7..e4b541506 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/AndroidEnterpriseServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java @@ -16,9 +16,8 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.services.impl; +package org.wso2.carbon.device.mgt.mobile.android.api.impl; -import com.google.api.services.androidenterprise.model.AppRestrictionsSchema; import com.google.api.services.androidenterprise.model.ProductsListResponse; import com.google.api.services.androidenterprise.model.StoreCluster; import com.google.api.services.androidenterprise.model.StoreLayout; @@ -33,29 +32,29 @@ import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManage import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; -import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseConfigs; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStoreCluster; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePackages; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePage; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePageLinks; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseTokenUrl; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.GoogleAppSyncResponse; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseApp; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseInstallPolicy; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseUser; -import org.wso2.carbon.mdm.services.android.bean.wrapper.TokenWrapper; -import org.wso2.carbon.mdm.services.android.common.GoogleAPIInvoker; -import org.wso2.carbon.mdm.services.android.exception.BadRequestException; -import org.wso2.carbon.mdm.services.android.exception.NotFoundException; -import org.wso2.carbon.mdm.services.android.services.AndroidEnterpriseService; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -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.AndroidEnterpriseUtils; +import org.wso2.carbon.device.mgt.mobile.android.api.AndroidEnterpriseAPI; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.GoogleAPIInvoker; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseConfigs; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStoreCluster; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePackages; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePage; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePageLinks; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.GoogleAppSyncResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseApp; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.TokenWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; import org.wso2.carbon.policy.mgt.common.FeatureManagementException; import javax.ws.rs.Consumes; @@ -76,8 +75,8 @@ import java.util.List; @Path("/enterprise") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public class AndroidEnterpriseServiceImpl implements AndroidEnterpriseService { - private static final Log log = LogFactory.getLog(AndroidEnterpriseServiceImpl.class); +public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { + private static final Log log = LogFactory.getLog(AndroidEnterpriseAPIImpl.class); @Override @Produces(MediaType.APPLICATION_JSON) @@ -784,9 +783,7 @@ public class AndroidEnterpriseServiceImpl implements AndroidEnterpriseService { log.error(errorMessage); throw new NotFoundException( new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.INTERNAL_SERVER_ERROR - .getStatusCode()).setMessage(errorMessage).build()); - } - + .getStatusCode()).setMessage(errorMessage).build()); } } if (sentToDevice) { 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/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java similarity index 95% rename from 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 rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 1ffadb887..ac075fb6f 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/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -32,7 +32,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.services.impl; +package org.wso2.carbon.device.mgt.mobile.android.api.impl; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -54,17 +54,19 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceExce import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; -import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseUser; -import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException; -import org.wso2.carbon.mdm.services.android.services.DeviceManagementService; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -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.device.mgt.mobile.android.api.DeviceManagementAPI; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.Message; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; @@ -90,10 +92,10 @@ import java.util.List; @Path("/devices") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public class DeviceManagementServiceImpl implements DeviceManagementService { +public class DeviceManagementAPIImpl implements DeviceManagementAPI { private static final String OPERATION_ERROR_STATUS = "ERROR"; - private static final Log log = LogFactory.getLog(DeviceManagementServiceImpl.class); + private static final Log log = LogFactory.getLog(DeviceManagementAPIImpl.class); public static final String GOOGLE_AFW_EMM_ANDROID_ID = "googleEMMAndroidId"; public static final String GOOGLE_AFW_DEVICE_ID = "googleEMMDeviceId"; @@ -233,7 +235,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { if (androidDevice == null) { String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage); - throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException( + throw new BadRequestException( new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } try { @@ -264,7 +266,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { EnterpriseUser user = new EnterpriseUser(); user.setAndroidPlayDeviceId(googleEMMAndroidId); user.setEmmDeviceIdentifier(googleEMMDeviceId); - AndroidEnterpriseServiceImpl enterpriseService = new AndroidEnterpriseServiceImpl(); + AndroidEnterpriseAPIImpl enterpriseService = new AndroidEnterpriseAPIImpl(); token = enterpriseService.insertUser(user); } } @@ -427,13 +429,13 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { if (androidDevice == null) { String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage); - throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException( + throw new BadRequestException( new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } if (device == null) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage); - throw new org.wso2.carbon.mdm.services.android.exception.NotFoundException( + throw new NotFoundException( new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); } if(androidDevice.getEnrolmentInfo() != null){ 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/DeviceManagementAdminServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java similarity index 93% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 0ed723cce..82bd09b53 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/DeviceManagementAdminServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -33,7 +33,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.services.impl; +package org.wso2.carbon.device.mgt.mobile.android.api.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -45,51 +45,51 @@ 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.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationRestriction; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate; -import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications; -import org.wso2.carbon.mdm.services.android.bean.Camera; -import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption; -import org.wso2.carbon.mdm.services.android.bean.DeviceLock; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.FileTransfer; -import org.wso2.carbon.mdm.services.android.bean.GlobalProxy; -import org.wso2.carbon.mdm.services.android.bean.LockCode; -import org.wso2.carbon.mdm.services.android.bean.DisplayMessage; -import org.wso2.carbon.mdm.services.android.bean.Notification; -import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy; -import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware; -import org.wso2.carbon.mdm.services.android.bean.Vpn; -import org.wso2.carbon.mdm.services.android.bean.WebClip; -import org.wso2.carbon.mdm.services.android.bean.Wifi; -import org.wso2.carbon.mdm.services.android.bean.WipeData; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationInstallationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationRestrictionBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUninstallationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUpdateBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.BlacklistApplicationsBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.CameraBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.DeviceLockBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EncryptionBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.FileTransferBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.GlobalProxyBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.LockCodeBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.DisplayMessageBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.NotificationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.PasswordPolicyBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.UpgradeFirmwareBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.VpnBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WebClipBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WifiBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WipeDataBeanWrapper; -import org.wso2.carbon.mdm.services.android.exception.BadRequestException; -import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException; -import org.wso2.carbon.mdm.services.android.services.DeviceManagementAdminService; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; -import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils; +import org.wso2.carbon.device.mgt.mobile.android.api.DeviceManagementAdminAPI; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstallation; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationRestriction; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Camera; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DisplayMessage; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.FileTransfer; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.GlobalProxy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Notification; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.PasscodePolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.UpgradeFirmware; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Vpn; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.WebClip; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Wifi; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.WipeData; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationInstallationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationRestrictionBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUninstallationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUpdateBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.BlacklistApplicationsBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.CameraBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DeviceLockBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DisplayMessageBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EncryptionBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.FileTransferBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.GlobalProxyBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.LockCodeBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.NotificationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.PasswordPolicyBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.UpgradeFirmwareBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -110,9 +110,9 @@ import java.util.List; @Path("/admin/devices") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService { +public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { - private static final Log log = LogFactory.getLog(DeviceManagementAdminServiceImpl.class); + private static final Log log = LogFactory.getLog(DeviceManagementAdminAPIImpl.class); private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; @POST @@ -140,7 +140,8 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe operation.setType(Operation.Type.PROFILE); operation.setEnabled(true); operation.setPayLoad(file.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); + Activity activity = AndroidDeviceUtils + .getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); return Response.status(Response.Status.CREATED).entity(activity).build(); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java new file mode 100644 index 000000000..b2150f215 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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. + * + * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you 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.android.api.impl; + +import com.google.api.client.http.HttpStatusCodes; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.device.mgt.mobile.android.api.DeviceTypeConfigurationAPI; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; + +import javax.validation.Valid; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/configuration") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAPI { + + private static final Log log = LogFactory.getLog(DeviceTypeConfigurationAPIImpl.class); + + @GET + @Override + public Response getConfiguration( + @HeaderParam("If-Modified-Since") String ifModifiedSince) { + try { + AndroidService androidService = AndroidAPIUtils.getAndroidnService(); + PlatformConfiguration platformConfiguration = androidService.getPlatformConfig(); + return Response.status(Response.Status.OK).entity(platformConfiguration).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred while retrieving the Android tenant configuration"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()); + } + } + + @PUT + @Override + public Response updateConfiguration( + @Valid AndroidPlatformConfiguration androidPlatformConfiguration) { + try { + AndroidService androidService = AndroidAPIUtils.getAndroidnService(); + androidService.updateConfiguration(androidPlatformConfiguration); + return Response.status(Response.Status.OK) + .entity("Android platform configuration has been updated successfully.").build(); + } catch (BadRequestExceptionDup e) { + String msg = "The payload of the android platform configuration is incorrect."; + log.error(msg, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()); + } catch (AndroidDeviceMgtPluginException e) { + String msg = "Error occurred while modifying configuration settings of Android platform"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()); + } + + } + + @GET + @Path("/license") + @Produces(MediaType.TEXT_PLAIN) + public Response getLicense( + @HeaderParam("If-Modified-Since") String ifModifiedSince) { + try { + License license = AndroidAPIUtils.getDeviceManagementService() + .getLicense(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, + DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); + return Response.status(Response.Status.OK).entity((license == null) ? null : license.getText()).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred while retrieving the license configured for Android device enrolment"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()); + } + } +} 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/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 20c0f4921..3f3f85527 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/EventReceiverServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.services.impl; +package org.wso2.carbon.device.mgt.mobile.android.api.impl; import com.google.gson.Gson; import com.google.gson.JsonObject; @@ -29,17 +29,17 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; -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.bean.wrapper.EventBeanWrapper; -import org.wso2.carbon.mdm.services.android.exception.BadRequestException; -import org.wso2.carbon.mdm.services.android.exception.NotFoundException; -import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException; -import org.wso2.carbon.mdm.services.android.services.EventReceiverService; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -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.device.mgt.mobile.android.api.EventReceiverAPI; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.Message; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.validation.Valid; import javax.validation.constraints.Size; @@ -52,9 +52,9 @@ import javax.ws.rs.core.Response; import java.util.List; @Path("/events") -public class EventReceiverServiceImpl implements EventReceiverService { +public class EventReceiverAPIImpl implements EventReceiverAPI { private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; - private static final Log log = LogFactory.getLog(EventReceiverServiceImpl.class); + private static final Log log = LogFactory.getLog(EventReceiverAPIImpl.class); private Gson gson = new Gson(); private static final String LONGITUDE = "longitude"; 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/bean/ProxyType.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ProxyType.java deleted file mode 100644 index 3fdc4e1ba..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ProxyType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.wso2.carbon.mdm.services.android.bean; - -public enum ProxyType { - MANUAL, AUTO -} 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/DeviceTypeConfigurationServiceImpl.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/DeviceTypeConfigurationServiceImpl.java deleted file mode 100644 index 385460e7c..000000000 --- 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/DeviceTypeConfigurationServiceImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you 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.mdm.services.android.services.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.ServerConfiguration; -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.EnrolmentInfo; -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.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; -import org.wso2.carbon.device.mgt.common.license.mgt.License; -import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; -import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.NotifierFrequency; -import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException; -import org.wso2.carbon.mdm.services.android.services.DeviceTypeConfigurationService; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; - -import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; - -@Path("/configuration") -@Produces(MediaType.APPLICATION_JSON) -@Consumes(MediaType.APPLICATION_JSON) -public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurationService { - - private static final Log log = LogFactory.getLog(DeviceTypeConfigurationServiceImpl.class); - - @GET - @Override - public Response getConfiguration( - @HeaderParam("If-Modified-Since") String ifModifiedSince) { - String msg; - PlatformConfiguration platformConfiguration; - List configs; - try { - platformConfiguration = AndroidAPIUtils.getDeviceManagementService(). - getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - if (platformConfiguration != null) { - configs = platformConfiguration.getConfiguration(); - } else { - platformConfiguration = new PlatformConfiguration(); - configs = new ArrayList<>(); - } - ConfigurationEntry entry = new ConfigurationEntry(); - License license = AndroidAPIUtils.getDeviceManagementService().getLicense( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, AndroidConstants. - TenantConfigProperties.LANGUAGE_US); - - if (configs != null) { - ConfigurationEntry versionEntry = new ConfigurationEntry(); - versionEntry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); - versionEntry.setName(AndroidConstants.TenantConfigProperties.SERVER_VERSION); - versionEntry.setValue(ServerConfiguration.getInstance().getFirstProperty("Version")); - configs.add(versionEntry); - if (license != null) { - entry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); - entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY); - entry.setValue(license.getText()); - configs.add(entry); - } - platformConfiguration.setConfiguration(configs); - } - } catch (DeviceManagementException e) { - msg = "Error occurred while retrieving the Android tenant configuration"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - return Response.status(Response.Status.OK).entity(platformConfiguration).build(); - } - - @PUT - @Override - public Response updateConfiguration(@Valid AndroidPlatformConfiguration androidPlatformConfiguration) { - String msg; - ConfigurationEntry licenseEntry = null; - PlatformConfiguration configuration = new PlatformConfiguration(); - if (androidPlatformConfiguration == null) { - String errorMessage = "The payload of the android platform configuration is incorrect."; - log.error(errorMessage); - throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - configuration.setConfiguration(androidPlatformConfiguration.getConfiguration()); - try { - configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - List configs = configuration.getConfiguration(); - NotifierFrequency notifierFrequency = new NotifierFrequency(); - for (ConfigurationEntry entry : configs) { - if (AndroidConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { - License license = new License(); - license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - license.setLanguage(AndroidConstants.TenantConfigProperties.LANGUAGE_US); - license.setVersion("1.0.0"); - license.setText(entry.getValue().toString()); - AndroidAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, license); - licenseEntry = entry; - } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals(entry.getName())) { - if (entry.getValue() != null) { - notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString())); - } else { - return Response.status(Response.Status.BAD_REQUEST) - .entity("No value specified for notifierFrequency.").build(); - } - } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) { - if (entry.getValue() != null) { - notifierFrequency.setType(Integer.parseInt(entry.getValue().toString())); - } else { - return Response.status(Response.Status.BAD_REQUEST) - .entity("No value specified for notifierType.").build(); - } - } - } - - if (licenseEntry != null) { - configs.remove(licenseEntry); - } - configuration.setConfiguration(configs); - AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration); - notifyDevices(notifierFrequency); - } catch (DeviceManagementException e) { - msg = "Error occurred while modifying configuration settings of Android platform"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (NumberFormatException e) { - msg = "Error occurred while reading notification frequency."; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (OperationManagementException e) { - msg = "Error occurred while modifying configuration settings of Android platform."; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (InvalidDeviceException e) { - msg = "Error occurred with the device."; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - return Response.status(Response.Status.OK) - .entity("Android platform configuration has been updated successfully.").build(); - } - - private void notifyDevices(NotifierFrequency notifierFrequency) throws DeviceManagementException, - OperationManagementException, InvalidDeviceException { - List deviceList = AndroidAPIUtils. - getDeviceManagementService(). - getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false); - List deviceIdList = new ArrayList<>(); - for (Device device : deviceList) { - if (EnrolmentInfo.Status.REMOVED != device.getEnrolmentInfo().getStatus()) { - deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - } - } - if (!deviceIdList.isEmpty()) { - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.NOTIFIER_FREQUENCY); - operation.setPayLoad(notifierFrequency.toJSON()); - operation.setEnabled(true); - AndroidAPIUtils.getDeviceManagementService().addOperation( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, - operation, deviceIdList); - } - } - - @GET - @Path("/license") - @Produces(MediaType.TEXT_PLAIN) - public Response getLicense( - @HeaderParam("If-Modified-Since") String ifModifiedSince) { - License license; - try { - license = - AndroidAPIUtils.getDeviceManagementService().getLicense( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, - DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); - } catch (DeviceManagementException e) { - String msg = "Error occurred while retrieving the license configured for Android device enrolment"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - return Response.status(Response.Status.OK).entity((license == null) ? null : license.getText()).build(); - } - -} 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/DeviceIDHolder.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/DeviceIDHolder.java deleted file mode 100644 index 7b09fc700..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/DeviceIDHolder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.mdm.services.android.util; - -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; - -import java.util.List; - -/** - * Holder class for storing valid & invalid device-ids. - */ -public class DeviceIDHolder { - - private List errorDeviceIdList; - private List validDeviceIDList; - - public List getErrorDeviceIdList() { - return errorDeviceIdList; - } - - public void setErrorDeviceIdList(List errorDeviceIdList) { - this.errorDeviceIdList = errorDeviceIdList; - } - - public List getValidDeviceIDList() { - return validDeviceIDList; - } - - public void setValidDeviceIDList(List validDeviceIDList) { - this.validDeviceIDList = validDeviceIDList; - } -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 9b8fd84e1..4d74e7e7f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -44,8 +44,8 @@ - - + + @@ -60,13 +60,13 @@ - - - - - - - + + + + + + + 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 b62410431..33eca93f1 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 @@ -76,7 +76,7 @@ ApiOriginFilter - org.wso2.carbon.mdm.services.android.util.ApiOriginFilter + org.wso2.carbon.device.mgt.mobile.android.addons.ApiOriginFilter ApiOriginFilter diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java deleted file mode 100644 index a8a267beb..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementAdminServiceTests.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.mdm.services.android; - -import org.mockito.MockitoAnnotations; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.testng.PowerMockObjectFactory; -import org.testng.Assert; -import org.testng.IObjectFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.ObjectFactory; -import org.testng.annotations.Test; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; -import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.mdm.services.android.mocks.DeviceManagementProviderServiceMock; -import org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementAdminServiceImpl; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -import org.wso2.carbon.mdm.services.android.utils.TestUtils; - -import javax.ws.rs.core.Response; - -@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"}) -@PrepareForTest(AndroidAPIUtils.class) -public class DeviceManagementAdminServiceTests { - - private DeviceManagementAdminServiceImpl deviceManagementAdminService; - - @ObjectFactory - public IObjectFactory getObjectFactory() { - return new PowerMockObjectFactory(); - } - - @BeforeClass - public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - MockitoAnnotations.initMocks(this); - deviceManagementAdminService = new DeviceManagementAdminServiceImpl(); - } - - private void mockDeviceManagementService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) - .toReturn(new DeviceManagementProviderServiceMock()); - } - - @Test - public void testConfigureDeviceLock() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testConfigureDeviceUnlock() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.configureDeviceUnlock(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetDeviceLocation() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.getDeviceLocation(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testRemovePassword() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.removePassword(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testConfigureCamera() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.configureCamera(TestUtils.getCamerabeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetDeviceInformation() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.getDeviceInformation(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetDeviceLogcat() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.getDeviceLogcat(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testWipeDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.wipeDevice(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testWipeData() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.wipeData(TestUtils.getWipeDataBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetApplications() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.getApplications(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testRingDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.ringDevice(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testRebootDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.rebootDevice(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testChangeLockTask() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.changeLockTask(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testMuteDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.muteDevice(TestUtils.getDeviceIds()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testInstallApplication() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService - .installApplication(TestUtils.getApplicationInstallationBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testUpdateApplication() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testUninstallApplicationPublic() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService - .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testUninstallApplicationWebApp() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService - .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testBlacklistApplications() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService - .blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testUpgradeFirmware() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testConfigureVPN() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.configureVPN(TestUtils.getVpnBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testSendNotification() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.sendNotification(TestUtils.getNotificationBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testConfigureWifi() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.configureWifi(TestUtils.getWifiBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testEncryptStorage() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.encryptStorage(TestUtils.getEncryptionBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testChangeLockCode() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.changeLockCode(TestUtils.getLockCodeBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testSetPasswordPolicy() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testSetWebClip() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementAdminService.setWebClip(TestUtils.getWebClipBeanWrapper()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - -} - diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java deleted file mode 100644 index af08bb863..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.mdm.services.android; - -import org.mockito.MockitoAnnotations; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.testng.PowerMockObjectFactory; -import org.testng.Assert; -import org.testng.IObjectFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.ObjectFactory; -import org.testng.annotations.Test; -import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; -import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; -import org.wso2.carbon.mdm.services.android.mocks.ApplicationManagementProviderServiceMock; -import org.wso2.carbon.mdm.services.android.mocks.DeviceInformationManagerServiceMock; -import org.wso2.carbon.mdm.services.android.mocks.DeviceManagementProviderServiceMock; -import org.wso2.carbon.mdm.services.android.mocks.NotificationManagementServiceMock; -import org.wso2.carbon.mdm.services.android.mocks.PolicyManagerServiceMock; -import org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementServiceImpl; -import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; -import org.wso2.carbon.mdm.services.android.utils.TestUtils; - -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; - -@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"}) -@PrepareForTest(AndroidAPIUtils.class) -public class DeviceManagementServiceTests { - - private DeviceManagementServiceImpl deviceManagementService; - - @ObjectFactory - public IObjectFactory getObjectFactory() { - return new PowerMockObjectFactory(); - } - - @BeforeClass - public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - MockitoAnnotations.initMocks(this); - deviceManagementService = new DeviceManagementServiceImpl(); - } - - private void mockDeviceManagementService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) - .toReturn(new DeviceManagementProviderServiceMock()); - } - - private void mockApplicationManagerService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getApplicationManagerService")) - .toReturn(new ApplicationManagementProviderServiceMock()); - } - - private void mockPolicyManagerService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getPolicyManagerService")) - .toReturn(new PolicyManagerServiceMock()); - } - - private void mockDeviceInformationManagerService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceInformationManagerService")) - .toReturn(new DeviceInformationManagerServiceMock()); - } - - private void mockNotificationManagementService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getNotificationManagementService")) - .toReturn(new NotificationManagementServiceMock()); - } - - private void mockUser() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getAuthenticatedUser")) - .toReturn("admin"); - } - - @Test - public void testUpdateApplicationList() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockApplicationManagerService(); - Response response = deviceManagementService - .updateApplicationList(TestUtils.getDeviceId(), TestUtils.getAndroidApplications()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode()); - } - - @Test - public void testGetPendingOperationsForNullDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - Response response = deviceManagementService - .getPendingOperations(true, null, null, null); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); - } - - @Test - public void testGetPendingOperationsInvalidDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService - .getPendingOperations(true, "1234", null, null); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); - } - - @Test - public void testGetPendingOperationsNullResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService - .getPendingOperations(true, TestUtils.getDeviceId(), null, null); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetPendingOperationsWithMonitorResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockPolicyManagerService(); - Response response = deviceManagementService - .getPendingOperations(true, TestUtils.getDeviceId(), null, - TestUtils.getSuccessMonitorOperationResponse()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetPendingOperationsWithApplicationResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockApplicationManagerService(); - Response response = deviceManagementService - .getPendingOperations(true, TestUtils.getDeviceId(), null, - TestUtils.getSuccessApplicationOperationResponse()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetPendingOperationsWithDeviceInfoResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockDeviceInformationManagerService(); - Response response = deviceManagementService - .getPendingOperations(true, TestUtils.getDeviceId(), null, - TestUtils.getSuccessInfoOperationResponse()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetPendingOperationsWithInProgressResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService - .getPendingOperations(true, TestUtils.getDeviceId(), null, - TestUtils.getInProgressOperationResponse()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testGetPendingOperationsWithErrorResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockNotificationManagementService(); - Response response = deviceManagementService - .getPendingOperations(true, TestUtils.getDeviceId(), null, - TestUtils.getErrorOperationResponse()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); - } - - @Test - public void testEnrollDeviceWithoutLocationSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockPolicyManagerService(); - mockUser(); - Response response = deviceManagementService.enrollDevice(TestUtils.getBasicAndroidDevice()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); - } - - @Test - public void testEnrollDeviceWithLocationSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockDeviceInformationManagerService(); - mockPolicyManagerService(); - mockUser(); - AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); - - List properties = new ArrayList<>(); - Device.Property property = new Device.Property(); - property.setName("LATITUDE"); - property.setValue("79.5"); - properties.add(property); - property = new Device.Property(); - property.setName("LONGITUDE"); - property.setValue("6.9"); - properties.add(property); - property = new Device.Property(); - property.setName("ALTITUDE"); - property.setValue("-59.8373726"); - properties.add(property); - property = new Device.Property(); - property.setName("SPEED"); - property.setValue("0.5123423333"); - properties.add(property); - property = new Device.Property(); - property.setName("BEARING"); - property.setValue("44.0"); - properties.add(property); - property = new Device.Property(); - property.setName("DISTANCE"); - property.setValue("44.0"); - properties.add(property); - androidDevice.setProperties(properties); - - Response response = deviceManagementService.enrollDevice(androidDevice); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); - } - - @Test - public void testEnrollDeviceUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockUser(); - AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); - androidDevice.setDeviceIdentifier("1234"); - Response response = deviceManagementService.enrollDevice(androidDevice); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); - } - - @Test - public void testIsEnrolledExists() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService.isEnrolled(TestUtils.getDeviceId(), null); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); - } - - @Test - public void testIsEnrolledNonExist() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService.isEnrolled("1234", null); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); - } - - @Test - public void testIsEnrolledNull() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService.isEnrolled(null, null); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); - } - - @Test - public void testModifyEnrollmentSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockUser(); - Response response = deviceManagementService - .modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode()); - } - - @Test - public void testModifyEnrollmentUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - mockUser(); - AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); - androidDevice.setDeviceIdentifier("1234"); - Response response = deviceManagementService - .modifyEnrollment(TestUtils.getDeviceId(), androidDevice); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); - } - - @Test - public void testDisEnrollDeviceSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService.disEnrollDevice(TestUtils.getDeviceId()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); - } - - @Test - public void testDisenrollUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - mockDeviceManagementService(); - Response response = deviceManagementService.disEnrollDevice("1234"); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); - } - -} - diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml new file mode 100644 index 000000000..b04328c70 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml @@ -0,0 +1,117 @@ + + + + + + android-plugin + org.wso2.carbon.devicemgt-plugins + 5.0.5-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.mobile.android.common + bundle + WSO2 Carbon - Mobile Device Management Android Common Impl + WSO2 Carbon - Mobile Device Management Android Common Implementation + https://entgra.io/ + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.devicemgt.plugins.version} + Device Management Mobile Android Impl Bundle + + io.swagger.annotations.*;resolution:=optional, + javax.validation.constraints, + javax.xml.bind.annotation.*, + javax.xml, + javax.xml.stream, + javax.xml.bind.*, + javax.xml.parsers; version=0.0.0, + javax.naming, + org.wso2.carbon.context, + org.wso2.carbon.utils.*, + org.wso2.carbon.device.mgt.common.*, + org.wso2.carbon.ndatasource.core, + org.wso2.carbon.policy.mgt.common.*, + org.wso2.carbon.device.mgt.extensions.license.mgt.registry, + com.google.gson.* + + + org.wso2.carbon.device.mgt.mobile.android.common.* + + + + + + + + + + org.wso2.carbon + org.wso2.carbon.logging + + + com.google.code.gson + gson + + + com.google.apis + google-api-services-androidenterprise + v1-rev186-1.25.0 + + + io.swagger + swagger-annotations + + + org.hibernate + hibernate-validator + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common + provided + + + javax.ws.rs + javax.ws.rs-api + + + org.codehaus.jackson + jackson-core-asl + + + 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/AndroidConstants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/AndroidConstants.java similarity index 99% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidConstants.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/AndroidConstants.java index e7d618b70..d96c8d0e5 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/AndroidConstants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/AndroidConstants.java @@ -50,7 +50,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.common; /** * Defines constants used in Android-REST API bundle. 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/util/AndroidPluginConstants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/AndroidPluginConstants.java similarity index 98% 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/util/AndroidPluginConstants.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/AndroidPluginConstants.java index a0c7a332d..79835c2bb 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/util/AndroidPluginConstants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/AndroidPluginConstants.java @@ -34,7 +34,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.util; +package org.wso2.carbon.device.mgt.mobile.android.common; /** * Defines constants used by android plugin. 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/common/ErrorHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorHandler.java similarity index 89% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/ErrorHandler.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorHandler.java index 542cd6078..2bcbbed6f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/ErrorHandler.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorHandler.java @@ -15,9 +15,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.common; +package org.wso2.carbon.device.mgt.mobile.android.common; -import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidAgentException; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; 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/common/ErrorMessage.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorMessage.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/ErrorMessage.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorMessage.java index fd880c04c..793fb7291 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/ErrorMessage.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorMessage.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.common; +package org.wso2.carbon.device.mgt.mobile.android.common; public class ErrorMessage { 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/common/GoogleAPIInvoker.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GoogleAPIInvoker.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GoogleAPIInvoker.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GoogleAPIInvoker.java index 4e700a7e1..da1cc2023 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GoogleAPIInvoker.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GoogleAPIInvoker.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.common; +package org.wso2.carbon.device.mgt.mobile.android.common; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; @@ -49,11 +49,11 @@ import com.google.api.services.androidenterprise.model.User; import com.google.common.collect.ImmutableList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStoreCluster; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePackages; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePage; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseTokenUrl; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStoreCluster; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePackages; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePage; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import java.io.ByteArrayInputStream; import java.io.IOException; 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/common/GsonMessageBodyHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GsonMessageBodyHandler.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GsonMessageBodyHandler.java index 297630029..9ffe273a4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GsonMessageBodyHandler.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.common; +package org.wso2.carbon.device.mgt.mobile.android.common; import com.google.gson.Gson; import com.google.gson.GsonBuilder; 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/Message.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/Message.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/Message.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/Message.java index 8cb5f6d14..b8168d837 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/Message.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/Message.java @@ -16,9 +16,8 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.common; -import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; 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/bean/AndroidOperation.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AndroidOperation.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/AndroidOperation.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AndroidOperation.java index 3361b90dc..aeccd384d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/AndroidOperation.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AndroidOperation.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import com.google.gson.Gson; /* 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/bean/AndroidPlatformConfiguration.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AndroidPlatformConfiguration.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/AndroidPlatformConfiguration.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AndroidPlatformConfiguration.java index 9832c3f03..7dc0505ec 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/AndroidPlatformConfiguration.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AndroidPlatformConfiguration.java @@ -16,12 +16,11 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; -import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; 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/bean/ApiRegistrationProfile.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApiRegistrationProfile.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApiRegistrationProfile.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApiRegistrationProfile.java index 6b14c0d38..a88a907e7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApiRegistrationProfile.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApiRegistrationProfile.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; public class ApiRegistrationProfile { 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/bean/AppRestriction.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AppRestriction.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/AppRestriction.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AppRestriction.java index 2c8d8c93d..4f82dcc7c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/AppRestriction.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/AppRestriction.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/ApplicationInstallation.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationInstallation.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationInstallation.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationInstallation.java index 4c90d42cb..3fcfc34a1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationInstallation.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationInstallation.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/ApplicationRestriction.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationRestriction.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationRestriction.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationRestriction.java index b3773376d..1ed7f1243 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationRestriction.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationRestriction.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/ApplicationUninstallation.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationUninstallation.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUninstallation.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationUninstallation.java index a5356ae59..e8efbdef0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUninstallation.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationUninstallation.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/ApplicationUpdate.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationUpdate.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUpdate.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationUpdate.java index 95241b444..cd9084df1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUpdate.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ApplicationUpdate.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/BasicUserInfo.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/BasicUserInfo.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BasicUserInfo.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/BasicUserInfo.java index 6117fb246..1f361b336 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BasicUserInfo.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/BasicUserInfo.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/BlacklistApplications.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/BlacklistApplications.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/BlacklistApplications.java index b7db28976..cf99c2cf4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/BlacklistApplications.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/Camera.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Camera.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Camera.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Camera.java index 0dad70364..21ee35f08 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Camera.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Camera.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/DeviceEncryption.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceEncryption.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DeviceEncryption.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceEncryption.java index 68ab6ae94..0b5473de1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DeviceEncryption.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceEncryption.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/DeviceLock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceLock.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DeviceLock.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceLock.java index e76ff6f1a..f0475d7c3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DeviceLock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceLock.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/DeviceState.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceState.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DeviceState.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceState.java index fb23b0fcc..911fe5f37 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DeviceState.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DeviceState.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/Disenrollment.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Disenrollment.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Disenrollment.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Disenrollment.java index c591d2ae0..99e329c7d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Disenrollment.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Disenrollment.java @@ -16,11 +16,11 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; + import java.io.Serializable; @ApiModel(value = "Disenrollment", 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/bean/DisplayMessage.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DisplayMessage.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DisplayMessage.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DisplayMessage.java index 20531f6f9..eda425738 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/DisplayMessage.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/DisplayMessage.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/EnterpriseConfigs.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseConfigs.java similarity index 90% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseConfigs.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseConfigs.java index 41abaa380..81d58ec42 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseConfigs.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseConfigs.java @@ -1,4 +1,4 @@ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; public class EnterpriseConfigs { 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/bean/EnterpriseStoreCluster.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStoreCluster.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStoreCluster.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStoreCluster.java index a29e46e1a..59d2eff9c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStoreCluster.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStoreCluster.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import java.util.List; 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/bean/EnterpriseStorePackages.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePackages.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStorePackages.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePackages.java index a93672892..69dba56d9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStorePackages.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePackages.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; public class EnterpriseStorePackages { 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/bean/EnterpriseStorePage.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePage.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStorePage.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePage.java index 841338d52..b6b578897 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStorePage.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePage.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import java.util.List; 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/bean/EnterpriseStorePageLinks.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePageLinks.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStorePageLinks.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePageLinks.java index 9fb4f5050..73b514830 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseStorePageLinks.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseStorePageLinks.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import java.util.List; 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/bean/EnterpriseTokenUrl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseTokenUrl.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseTokenUrl.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseTokenUrl.java index e93e20c10..7aaf2739d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/EnterpriseTokenUrl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/EnterpriseTokenUrl.java @@ -17,7 +17,7 @@ * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; public class EnterpriseTokenUrl { 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/bean/ErrorListItem.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ErrorListItem.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ErrorListItem.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ErrorListItem.java index 1e48b0183..2d8ca0856 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ErrorListItem.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ErrorListItem.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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/bean/ErrorResponse.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ErrorResponse.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ErrorResponse.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ErrorResponse.java index 457782ade..97b7eb768 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ErrorResponse.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ErrorResponse.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; 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/bean/FileTransfer.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/FileTransfer.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/FileTransfer.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/FileTransfer.java index 2e8af23a7..8677147f5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/FileTransfer.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/FileTransfer.java @@ -15,11 +15,10 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.AndroidOperation; import java.io.Serializable; 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/bean/GlobalProxy.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/GlobalProxy.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/GlobalProxy.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/GlobalProxy.java index 5414a1407..46fb31c73 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/GlobalProxy.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/GlobalProxy.java @@ -17,7 +17,7 @@ * */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/GoogleAppSyncResponse.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/GoogleAppSyncResponse.java similarity index 77% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/GoogleAppSyncResponse.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/GoogleAppSyncResponse.java index 3eafae848..896eeef08 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/GoogleAppSyncResponse.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/GoogleAppSyncResponse.java @@ -1,4 +1,4 @@ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; public class GoogleAppSyncResponse { 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/bean/LockCode.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/LockCode.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/LockCode.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/LockCode.java index 4c2764dad..0e139e924 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/LockCode.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/LockCode.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/Notification.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Notification.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Notification.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Notification.java index 7cc4d4627..ade05a1a4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Notification.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Notification.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/NotifierFrequency.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/NotifierFrequency.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/NotifierFrequency.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/NotifierFrequency.java index b38a8b802..f441ffb1e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/NotifierFrequency.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/NotifierFrequency.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/PasscodePolicy.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/PasscodePolicy.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java index c2e48ce70..8cd56e51e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/PasscodePolicy.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/PasscodePolicy.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ProxyType.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ProxyType.java new file mode 100644 index 000000000..d638b071f --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/ProxyType.java @@ -0,0 +1,5 @@ +package org.wso2.carbon.device.mgt.mobile.android.common.bean; + +public enum ProxyType { + MANUAL, AUTO +} 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/bean/UpgradeFirmware.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/UpgradeFirmware.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/UpgradeFirmware.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/UpgradeFirmware.java index 748ee0e59..f07a519db 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/UpgradeFirmware.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/UpgradeFirmware.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/Vpn.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Vpn.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Vpn.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Vpn.java index 188d44f8f..76be3fc28 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Vpn.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Vpn.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/WebClip.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/WebClip.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WebClip.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/WebClip.java index cf39b1070..06b815df4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WebClip.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/WebClip.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/Wifi.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Wifi.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Wifi.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Wifi.java index 8cdf3c58b..d8e130987 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Wifi.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/Wifi.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/WipeData.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/WipeData.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WipeData.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/WipeData.java index 83efddc12..ff1c05bc0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WipeData.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/WipeData.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean; +package org.wso2.carbon.device.mgt.mobile.android.common.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/wrapper/AndroidApplication.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidApplication.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidApplication.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidApplication.java index 8dee1a60d..1c1776350 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidApplication.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidApplication.java @@ -1,4 +1,4 @@ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/wrapper/AndroidDevice.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidDevice.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDevice.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidDevice.java index 6c5fcec34..274b6ec89 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDevice.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidDevice.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModelProperty; import org.wso2.carbon.device.mgt.common.Device; 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/bean/wrapper/AndroidDeviceInfo.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidDeviceInfo.java similarity index 99% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidDeviceInfo.java index 41fbb5857..148d46d56 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AndroidDeviceInfo.java @@ -1,4 +1,4 @@ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; 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/bean/wrapper/AppRestrictionBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AppRestrictionBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AppRestrictionBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AppRestrictionBeanWrapper.java index 64412336e..70a520b89 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AppRestrictionBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/AppRestrictionBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.AppRestriction; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.AppRestriction; import java.util.List; 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/bean/wrapper/ApplicationInstallationBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationInstallationBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationInstallationBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationInstallationBeanWrapper.java index b0bd54cf3..688703080 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationInstallationBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationInstallationBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstallation; import java.util.List; 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/bean/wrapper/ApplicationRestrictionBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationRestrictionBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationRestrictionBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationRestrictionBeanWrapper.java index 147a577da..0f6e8b979 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationRestrictionBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationRestrictionBeanWrapper.java @@ -16,11 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.ApplicationRestriction; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationRestriction; import java.util.List; 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/bean/wrapper/ApplicationUninstallationBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationUninstallationBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationUninstallationBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationUninstallationBeanWrapper.java index 28c72c6cd..ad88bbb35 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationUninstallationBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationUninstallationBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation; import java.util.List; 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/bean/wrapper/ApplicationUpdateBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationUpdateBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationUpdateBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationUpdateBeanWrapper.java index b202bf883..241cec506 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/ApplicationUpdateBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/ApplicationUpdateBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate; import java.util.List; 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/bean/wrapper/BlacklistApplicationsBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/BlacklistApplicationsBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/BlacklistApplicationsBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/BlacklistApplicationsBeanWrapper.java index 32b107bf4..19f0e5a36 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/BlacklistApplicationsBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/BlacklistApplicationsBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications; import javax.validation.Valid; import java.util.List; 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/bean/wrapper/CameraBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/CameraBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/CameraBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/CameraBeanWrapper.java index 9f9a014f2..04ac86a90 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/CameraBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/CameraBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.Camera; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Camera; import java.util.List; 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/bean/wrapper/DeviceEnrollmentInfo.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DeviceEnrollmentInfo.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DeviceEnrollmentInfo.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DeviceEnrollmentInfo.java index b2f77cc31..c6882a6e7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DeviceEnrollmentInfo.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DeviceEnrollmentInfo.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/wrapper/DeviceLockBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DeviceLockBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DeviceLockBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DeviceLockBeanWrapper.java index bd668faba..31e5e41aa 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DeviceLockBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DeviceLockBeanWrapper.java @@ -16,11 +16,11 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.DeviceLock; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock; import java.util.List; 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/bean/wrapper/DisenrollmentBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DisenrollmentBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DisenrollmentBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DisenrollmentBeanWrapper.java index fdcab0120..308da5161 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DisenrollmentBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DisenrollmentBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.Disenrollment; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Disenrollment; import java.util.List; 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/bean/wrapper/DisplayMessageBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DisplayMessageBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DisplayMessageBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DisplayMessageBeanWrapper.java index 8ef1fe644..ca1330b3c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/DisplayMessageBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/DisplayMessageBeanWrapper.java @@ -16,11 +16,11 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.DisplayMessage; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DisplayMessage; import java.util.List; 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/bean/wrapper/EncryptionBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EncryptionBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EncryptionBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EncryptionBeanWrapper.java index aeb01400a..557d39540 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EncryptionBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EncryptionBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption; import java.util.List; 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/bean/wrapper/EnterpriseApp.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseApp.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EnterpriseApp.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseApp.java index e20d1547d..1d12d1d95 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EnterpriseApp.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseApp.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import com.google.api.services.androidenterprise.model.VariableSet; 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/bean/wrapper/EnterpriseInstallPolicy.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseInstallPolicy.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EnterpriseInstallPolicy.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseInstallPolicy.java index 677e6d33c..fe659659b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EnterpriseInstallPolicy.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseInstallPolicy.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import java.io.Serializable; import java.util.List; 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/bean/wrapper/EnterpriseUser.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseUser.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EnterpriseUser.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseUser.java index 990e3fa4e..ff9bc4b38 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EnterpriseUser.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EnterpriseUser.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; public class EnterpriseUser { 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/bean/wrapper/EventBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EventBeanWrapper.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EventBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EventBeanWrapper.java index c4fb13e07..ed4e314d3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/EventBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/EventBeanWrapper.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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/bean/wrapper/FileTransferBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/FileTransferBeanWrapper.java similarity index 93% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/FileTransferBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/FileTransferBeanWrapper.java index d34b00e66..4777c3133 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/FileTransferBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/FileTransferBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.FileTransfer; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.FileTransfer; import java.util.List; 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/bean/wrapper/GlobalProxyBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/GlobalProxyBeanWrapper.java similarity index 92% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/GlobalProxyBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/GlobalProxyBeanWrapper.java index 1063ee260..09c3bc0e3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/GlobalProxyBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/GlobalProxyBeanWrapper.java @@ -17,11 +17,11 @@ * */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.GlobalProxy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.GlobalProxy; import java.util.List; 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/bean/wrapper/LockCodeBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/LockCodeBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/LockCodeBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/LockCodeBeanWrapper.java index 364fd39d2..4cf164d46 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/LockCodeBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/LockCodeBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.LockCode; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode; import java.util.List; 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/bean/wrapper/NotificationBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/NotificationBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/NotificationBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/NotificationBeanWrapper.java index eb82e49ee..97bb7f706 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/NotificationBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/NotificationBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.Notification; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Notification; import java.util.List; 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/bean/wrapper/PasswordPolicyBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/PasswordPolicyBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/PasswordPolicyBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/PasswordPolicyBeanWrapper.java index e47ece1c5..b9e728624 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/PasswordPolicyBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/PasswordPolicyBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.PasscodePolicy; import java.util.List; 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/bean/wrapper/TokenWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/TokenWrapper.java similarity index 72% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/TokenWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/TokenWrapper.java index a3a706efa..7bf731e18 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/TokenWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/TokenWrapper.java @@ -1,4 +1,4 @@ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; public class TokenWrapper { 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/bean/wrapper/UpgradeFirmwareBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/UpgradeFirmwareBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/UpgradeFirmwareBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/UpgradeFirmwareBeanWrapper.java index b881422c2..ed0231d6a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/UpgradeFirmwareBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/UpgradeFirmwareBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.UpgradeFirmware; import java.util.List; 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/bean/wrapper/VpnBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/VpnBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/VpnBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/VpnBeanWrapper.java index e71270d22..1a2d67a59 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/VpnBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/VpnBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.Vpn; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Vpn; import java.util.List; 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/bean/wrapper/WebClipBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WebClipBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/WebClipBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WebClipBeanWrapper.java index fb2edc239..6f8667311 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/WebClipBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WebClipBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.WebClip; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.WebClip; import java.util.List; 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/bean/wrapper/WifiBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WifiBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/WifiBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WifiBeanWrapper.java index 2d63a27d9..85e6df2d3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/WifiBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WifiBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.Wifi; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Wifi; import java.util.List; 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/bean/wrapper/WipeDataBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WipeDataBeanWrapper.java similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/WipeDataBeanWrapper.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WipeDataBeanWrapper.java index b7ebb2903..fe753bd3f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/WipeDataBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/bean/wrapper/WipeDataBeanWrapper.java @@ -15,11 +15,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.bean.wrapper; +package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.mdm.services.android.bean.WipeData; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.WipeData; import java.util.List; 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/config/datasource/AndroidDataSourceConfigurations.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/AndroidDataSourceConfigurations.java similarity index 94% 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/config/datasource/AndroidDataSourceConfigurations.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/AndroidDataSourceConfigurations.java index 9409bab13..a0d3fbbd7 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/config/datasource/AndroidDataSourceConfigurations.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/AndroidDataSourceConfigurations.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource; +package org.wso2.carbon.device.mgt.mobile.android.common.config.datasource; import javax.xml.bind.annotation.XmlElement; 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/config/datasource/DataSourceConfigAdapter.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/DataSourceConfigAdapter.java similarity index 96% 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/config/datasource/DataSourceConfigAdapter.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/DataSourceConfigAdapter.java index 75a95c7c7..5b0aa5713 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/config/datasource/DataSourceConfigAdapter.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/DataSourceConfigAdapter.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource; +package org.wso2.carbon.device.mgt.mobile.android.common.config.datasource; import javax.xml.bind.annotation.adapters.XmlAdapter; import java.util.HashMap; 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/config/datasource/JNDILookupDefinition.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/JNDILookupDefinition.java similarity index 96% 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/config/datasource/JNDILookupDefinition.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/JNDILookupDefinition.java index d98022058..770963989 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/config/datasource/JNDILookupDefinition.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/JNDILookupDefinition.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource; +package org.wso2.carbon.device.mgt.mobile.android.common.config.datasource; import javax.xml.bind.annotation.*; import java.util.List; 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/config/datasource/MobileDataSourceConfig.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/MobileDataSourceConfig.java similarity index 95% 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/config/datasource/MobileDataSourceConfig.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/MobileDataSourceConfig.java index cb0e78fb2..09bb84de4 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/config/datasource/MobileDataSourceConfig.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/MobileDataSourceConfig.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource; +package org.wso2.carbon.device.mgt.mobile.android.common.config.datasource; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; 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/config/datasource/MobileDataSourceConfigurations.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/MobileDataSourceConfigurations.java similarity index 95% 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/config/datasource/MobileDataSourceConfigurations.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/MobileDataSourceConfigurations.java index c698e7800..b4613bd99 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/config/datasource/MobileDataSourceConfigurations.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/datasource/MobileDataSourceConfigurations.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource; +package org.wso2.carbon.device.mgt.mobile.android.common.config.datasource; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; 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/config/task/TaskConfiguration.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/task/TaskConfiguration.java similarity index 96% 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/config/task/TaskConfiguration.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/task/TaskConfiguration.java index 9c98306fb..56b873c34 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/config/task/TaskConfiguration.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/config/task/TaskConfiguration.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.config.task; +package org.wso2.carbon.device.mgt.mobile.android.common.config.task; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; 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/dto/AndroidEnterpriseManagedConfig.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/AndroidEnterpriseManagedConfig.java similarity index 96% 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/dto/AndroidEnterpriseManagedConfig.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/AndroidEnterpriseManagedConfig.java index 687327d6d..30e717dc7 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/dto/AndroidEnterpriseManagedConfig.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/AndroidEnterpriseManagedConfig.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; public class AndroidEnterpriseManagedConfig { 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/dto/AndroidEnterpriseUser.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/AndroidEnterpriseUser.java similarity index 97% 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/dto/AndroidEnterpriseUser.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/AndroidEnterpriseUser.java index 48bddbb03..afd64a12e 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/dto/AndroidEnterpriseUser.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/AndroidEnterpriseUser.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; public class AndroidEnterpriseUser { String emmUsername; 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/exception/ErrorDTO.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/ErrorDTO.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/ErrorDTO.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/ErrorDTO.java index ebd5ec8fc..44e3385ca 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/ErrorDTO.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/ErrorDTO.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; import java.util.ArrayList; import java.util.List; 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/dto/MobileDevice.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileDevice.java similarity index 97% 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/dto/MobileDevice.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileDevice.java index 2b064452a..7644cb3cc 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/dto/MobileDevice.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileDevice.java @@ -16,10 +16,9 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; import java.io.Serializable; -import java.util.Date; import java.util.HashMap; import java.util.Map; 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/dto/MobileDeviceOperationMapping.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileDeviceOperationMapping.java similarity index 96% 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/dto/MobileDeviceOperationMapping.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileDeviceOperationMapping.java index ae855e2ab..279f93883 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/dto/MobileDeviceOperationMapping.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileDeviceOperationMapping.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; /** * DTO of Mobile Device Operation Mappings. 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/dto/MobileFeature.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileFeature.java similarity index 97% 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/dto/MobileFeature.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileFeature.java index 1778f8560..576fd92c7 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/dto/MobileFeature.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileFeature.java @@ -34,7 +34,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; import java.io.Serializable; 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/dto/MobileOperation.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileOperation.java similarity index 96% 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/dto/MobileOperation.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileOperation.java index fa9723484..5f1571394 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/dto/MobileOperation.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileOperation.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; import java.util.List; 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/dto/MobileOperationProperty.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileOperationProperty.java similarity index 95% 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/dto/MobileOperationProperty.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileOperationProperty.java index 5147bb004..04f7b58d5 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/dto/MobileOperationProperty.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/dto/MobileOperationProperty.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dto; +package org.wso2.carbon.device.mgt.mobile.android.common.dto; /** * DTO of Mobile Operation property. 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/exception/AndroidAgentException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidAgentException.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/AndroidAgentException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidAgentException.java index c12d03538..697fefa26 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/AndroidAgentException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidAgentException.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * 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/dao/impl/AndroidDeviceMgtPluginException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidDeviceMgtPluginException.java similarity index 95% 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/dao/impl/AndroidDeviceMgtPluginException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidDeviceMgtPluginException.java index 4a0b6a1c7..117c42905 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/dao/impl/AndroidDeviceMgtPluginException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidDeviceMgtPluginException.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao.impl; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; public class AndroidDeviceMgtPluginException extends Exception{ 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/exception/AndroidOperationException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidOperationException.java similarity index 89% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/AndroidOperationException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidOperationException.java index 8c68866d8..527c1b45e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/AndroidOperationException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidOperationException.java @@ -16,9 +16,9 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; -import org.wso2.carbon.mdm.services.android.util.Message; +import org.wso2.carbon.device.mgt.mobile.android.common.Message; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; 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/exception/BadRequestException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java similarity index 87% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/BadRequestException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java index 5fa5ededc..3213a8ed7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/BadRequestException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java @@ -16,9 +16,9 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java new file mode 100644 index 000000000..0d1220e9d --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java @@ -0,0 +1,32 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you 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.android.common.exception; + +/** + * Represents the exception thrown during validating the request. + */ +public class BadRequestExceptionDup extends AndroidDeviceMgtPluginException { + + public BadRequestExceptionDup(String message, Throwable ex) { + super(message, ex); + } + + public BadRequestExceptionDup(String message) { + super(message); + } +} 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/dao/EnterpriseManagementDAOException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/EnterpriseManagementDAOException.java similarity index 97% 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/dao/EnterpriseManagementDAOException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/EnterpriseManagementDAOException.java index 86af32e80..4b8c17276 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/dao/EnterpriseManagementDAOException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/EnterpriseManagementDAOException.java @@ -33,7 +33,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Custom exception class for enterprise specific data access related exceptions. 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/EnterpriseServiceException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/EnterpriseServiceException.java similarity index 97% 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/EnterpriseServiceException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/EnterpriseServiceException.java index d8b5e80df..9153f5948 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/EnterpriseServiceException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/EnterpriseServiceException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Custom exception class for enterprise specific data access related exceptions. 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/exception/ForbiddenException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/ForbiddenException.java similarity index 87% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/ForbiddenException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/ForbiddenException.java index 75113f850..451a3e033 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/ForbiddenException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/ForbiddenException.java @@ -16,9 +16,10 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; 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/dao/MobileDeviceManagementDAOException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/MobileDeviceManagementDAOException.java similarity index 97% 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/dao/MobileDeviceManagementDAOException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/MobileDeviceManagementDAOException.java index f87ddbfec..395da6acd 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/dao/MobileDeviceManagementDAOException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/MobileDeviceManagementDAOException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Custom exception class for mobile device specific data access related exceptions. 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/exception/NotFoundException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java similarity index 83% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/NotFoundException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java index 53863c3ac..3f412587d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/NotFoundException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java @@ -16,10 +16,11 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; 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/exception/OperationConfigurationException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/OperationConfigurationException.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/OperationConfigurationException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/OperationConfigurationException.java index 1300b1481..93f677aa4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/OperationConfigurationException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/OperationConfigurationException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * 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/exception/UnexpectedServerErrorException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java similarity index 84% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/UnexpectedServerErrorException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java index a66c2f506..b00a4e51f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/UnexpectedServerErrorException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java @@ -16,10 +16,11 @@ * under the License. * */ -package org.wso2.carbon.mdm.services.android.exception; +package org.wso2.carbon.device.mgt.mobile.android.common.exception; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; 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/AndroidPluginService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java similarity index 79% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/AndroidPluginService.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java index 7bc4ad3be..a10fc418e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/AndroidPluginService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java @@ -16,15 +16,15 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android; +package org.wso2.carbon.device.mgt.mobile.android.common.spi; -import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import java.util.List; -public interface AndroidPluginService { +public interface AndroidGoogleEnterpriseService { void addEnterpriseUser(AndroidEnterpriseUser androidEnterpriseUser) throws EnterpriseServiceException; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java new file mode 100644 index 000000000..406038e79 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -0,0 +1,31 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you 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.android.common.spi; + +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; + +public interface AndroidService { + + PlatformConfiguration getPlatformConfig() throws DeviceManagementException; + + void updateConfiguration(AndroidPlatformConfiguration androidPlatformConfiguration) + throws AndroidDeviceMgtPluginException; +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml similarity index 69% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 99b428302..ee22567e1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -27,10 +27,10 @@ 4.0.0 - org.wso2.carbon.device.mgt.mobile.android + org.wso2.carbon.device.mgt.mobile.android.core bundle - WSO2 Carbon - Mobile Device Management Android Impl - WSO2 Carbon - Mobile Device Management Android Implementation + WSO2 Carbon - Mobile Device Management Android Core Impl + WSO2 Carbon - Mobile Device Management Android Core Implementation http://wso2.org @@ -53,7 +53,7 @@ ${project.artifactId} ${carbon.devicemgt.plugins.version} Device Management Mobile Android Impl Bundle - org.wso2.carbon.device.mgt.mobile.android.internal + org.wso2.carbon.device.mgt.mobile.android.core.internal org.osgi.framework, org.osgi.service.component, @@ -78,8 +78,8 @@ com.google.gson.* - !org.wso2.carbon.device.mgt.mobile.android.internal, - org.wso2.carbon.device.mgt.mobile.android.* + !org.wso2.carbon.device.mgt.mobile.android.core.internal, + org.wso2.carbon.device.mgt.mobile.android.core.* @@ -134,10 +134,6 @@ org.wso2.carbon org.wso2.carbon.utils - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.extensions @@ -146,29 +142,86 @@ org.wso2.carbon org.wso2.carbon.ndatasource.core + + org.wso2.carbon + org.wso2.carbon.registry.api + + + org.wso2.carbon + org.wso2.carbon.registry.core + + + org.apache.tomcat.wso2 + jdbc-pool + + + com.google.code.gson + gson + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.common + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.common + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + provided + + + org.slf4j + slf4j-api + + + org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common + provided org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core + provided - org.wso2.carbon - org.wso2.carbon.registry.api + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.application.extension + provided - org.wso2.carbon - org.wso2.carbon.registry.core + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common + provided + + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.annotations + provided org.testng testng + test - org.apache.tomcat.wso2 - jdbc-pool + org.powermock + powermock-module-testng + test + + + org.powermock + powermock-api-mockito + test com.h2database.wso2 @@ -176,8 +229,33 @@ test - com.google.code.gson - gson + org.wso2.carbon + org.wso2.carbon.queuing + test + + + org.wso2.carbon + org.wso2.carbon.ndatasource.core + + + commons-dbcp.wso2 + commons-dbcp + test + + + commons-pool.wso2 + commons-pool + test + + + org.wso2.carbon + javax.cache.wso2 + test + + + javassist + javassist + test 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/dao/AbstractMobileDeviceManagementDAOFactory.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/AbstractMobileDeviceManagementDAOFactory.java similarity index 90% 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/dao/AbstractMobileDeviceManagementDAOFactory.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/AbstractMobileDeviceManagementDAOFactory.java index 634951826..e22bfabcc 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/dao/AbstractMobileDeviceManagementDAOFactory.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/AbstractMobileDeviceManagementDAOFactory.java @@ -16,14 +16,14 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao; +package org.wso2.carbon.device.mgt.mobile.android.core.dao; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.JNDILookupDefinition; -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.MobileDataSourceConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.impl.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.util.MobileDeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.mobile.android.common.config.datasource.JNDILookupDefinition; +import org.wso2.carbon.device.mgt.mobile.android.common.config.datasource.MobileDataSourceConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.util.MobileDeviceManagementDAOUtil; import javax.sql.DataSource; import java.util.HashMap; 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/dao/AndroidDAOFactory.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/AndroidDAOFactory.java similarity index 95% 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/dao/AndroidDAOFactory.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/AndroidDAOFactory.java index 2ccd09374..d18cc0f8a 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/dao/AndroidDAOFactory.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/AndroidDAOFactory.java @@ -16,12 +16,13 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao; +package org.wso2.carbon.device.mgt.mobile.android.core.dao; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.impl.EnterpriseDAOImpl; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseManagementDAOException; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.impl.EnterpriseDAOImpl; import javax.sql.DataSource; import java.sql.Connection; 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/dao/EnterpriseDAO.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java similarity index 84% 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/dao/EnterpriseDAO.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java index 87aafb814..79c91e3e5 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/dao/EnterpriseDAO.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java @@ -16,10 +16,11 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao; +package org.wso2.carbon.device.mgt.mobile.android.core.dao; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseManagementDAOException; import java.util.List; 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/dao/MobileDeviceManagementDAOFactory.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/MobileDeviceManagementDAOFactory.java similarity index 92% 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/dao/MobileDeviceManagementDAOFactory.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/MobileDeviceManagementDAOFactory.java index d4746f623..6ba69f723 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/dao/MobileDeviceManagementDAOFactory.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/MobileDeviceManagementDAOFactory.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao; +package org.wso2.carbon.device.mgt.mobile.android.core.dao; public interface MobileDeviceManagementDAOFactory { 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/dao/impl/EnterpriseDAOImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java similarity index 93% 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/dao/impl/EnterpriseDAOImpl.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java index 8dbdb6e29..0abfa811c 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/dao/impl/EnterpriseDAOImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java @@ -16,19 +16,16 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao.impl; +package org.wso2.carbon.device.mgt.mobile.android.core.dao.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.AndroidDAOFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.EnterpriseDAO; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.EnterpriseManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileDeviceManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.util.MobileDeviceManagementDAOUtil; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileDevice; -import org.wso2.carbon.device.mgt.mobile.android.impl.util.AndroidPluginConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseManagementDAOException; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.AndroidDAOFactory; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.EnterpriseDAO; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.util.MobileDeviceManagementDAOUtil; import java.sql.Connection; import java.sql.PreparedStatement; @@ -37,9 +34,7 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * Implements EnterpriseDAO for Android Devices. 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/dao/util/MobileDeviceManagementDAOUtil.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/util/MobileDeviceManagementDAOUtil.java similarity index 98% 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/dao/util/MobileDeviceManagementDAOUtil.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/util/MobileDeviceManagementDAOUtil.java index 1892ddecb..decfbdb3b 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/dao/util/MobileDeviceManagementDAOUtil.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/util/MobileDeviceManagementDAOUtil.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.dao.util; +package org.wso2.carbon.device.mgt.mobile.android.core.dao.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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/AndroidPluginServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java similarity index 90% 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/AndroidPluginServiceImpl.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java index 1fc0754f9..67d79b8f4 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/AndroidPluginServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java @@ -32,29 +32,30 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl; +package org.wso2.carbon.device.mgt.mobile.android.core.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.device.mgt.mobile.android.AndroidPluginService; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.AndroidDAOFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.EnterpriseDAO; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.EnterpriseManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseManagementDAOException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.AndroidDAOFactory; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.EnterpriseDAO; import java.util.List; /** * This represents the Android implementation of DeviceManagerService. */ -public class AndroidPluginServiceImpl implements AndroidPluginService { +public class AndroidGoogleEnterpriseServiceImpl implements AndroidGoogleEnterpriseService { - private static final Log log = LogFactory.getLog(AndroidPluginServiceImpl.class); + private static final Log log = LogFactory.getLog(AndroidGoogleEnterpriseServiceImpl.class); private EnterpriseDAO enterpriseDAO; - public AndroidPluginServiceImpl() { + public AndroidGoogleEnterpriseServiceImpl() { enterpriseDAO = AndroidDAOFactory.getEnterpriseDAO(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidPluginServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidPluginServiceImpl.java new file mode 100644 index 000000000..a8a367c83 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidPluginServiceImpl.java @@ -0,0 +1,75 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you 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.android.core.impl; + +import org.wso2.carbon.base.ServerConfiguration; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.MDMAppConstants; +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.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.device.mgt.common.spi.DeviceTypePluginService; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class AndroidPluginServiceImpl implements DeviceTypePluginService { + + @Override + public Map getEnrollmentQRCode() throws DeviceManagementException { + return null; + } + +// private void getPlatformConfig() { +// PlatformConfiguration platformConfiguration; +// List configs; +// try { +// platformConfiguration = AndroidAPIUtils.getDeviceManagementService(). +// getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); +// if (platformConfiguration != null) { +// configs = platformConfiguration.getConfiguration(); +// } else { +// platformConfiguration = new PlatformConfiguration(); +// configs = new ArrayList<>(); +// } +// ConfigurationEntry entry = new ConfigurationEntry(); +// License license = AndroidAPIUtils.getDeviceManagementService().getLicense( +// DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, MDMAppConstants.AndroidConstants. +// TenantConfigProperties.LANGUAGE_US); +// +// if (configs != null) { +// ConfigurationEntry versionEntry = new ConfigurationEntry(); +// versionEntry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); +// versionEntry.setName(AndroidConstants.TenantConfigProperties.SERVER_VERSION); +// versionEntry.setValue(ServerConfiguration.getInstance().getFirstProperty("Version")); +// configs.add(versionEntry); +// if (license != null) { +// entry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); +// entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY); +// entry.setValue(license.getText()); +// configs.add(entry); +// } +// platformConfiguration.setConfiguration(configs); +// } +// } +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java new file mode 100644 index 000000000..78077948f --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -0,0 +1,184 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you 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.android.core.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.ServerConfiguration; +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.EnrolmentInfo; +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.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; +import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.NotifierFrequency; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; + +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; + +public class AndroidServiceImpl implements AndroidService { + + private static final Log log = LogFactory.getLog(AndroidServiceImpl.class); + + @Override + public PlatformConfiguration getPlatformConfig() throws DeviceManagementException { + List configs; + PlatformConfiguration platformConfiguration; + + DeviceManagementProviderService deviceManagementProviderService = AndroidAPIUtils.getDeviceManagementService(); + platformConfiguration = deviceManagementProviderService. + getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + if (platformConfiguration != null) { + configs = platformConfiguration.getConfiguration(); + } else { + platformConfiguration = new PlatformConfiguration(); + configs = new ArrayList<>(); + } + + if (configs != null) { + ConfigurationEntry versionEntry = new ConfigurationEntry(); + versionEntry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); + versionEntry.setName(AndroidConstants.TenantConfigProperties.SERVER_VERSION); + versionEntry.setValue(ServerConfiguration.getInstance().getFirstProperty("Version")); + configs.add(versionEntry); + + License license = deviceManagementProviderService + .getLicense(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, + AndroidConstants. + TenantConfigProperties.LANGUAGE_US); + if (license != null) { + ConfigurationEntry entry = new ConfigurationEntry(); + entry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); + entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY); + entry.setValue(license.getText()); + configs.add(entry); + } + platformConfiguration.setConfiguration(configs); + } + return platformConfiguration; + } + + @Override + public void updateConfiguration(AndroidPlatformConfiguration androidPlatformConfiguration) throws + AndroidDeviceMgtPluginException { + ConfigurationEntry licenseEntry = null; + PlatformConfiguration configuration = new PlatformConfiguration(); + if (androidPlatformConfiguration == null) { + String errorMessage = "The payload of the android platform configuration is null."; + log.error(errorMessage); + throw new BadRequestExceptionDup(errorMessage); + } + configuration.setConfiguration(androidPlatformConfiguration.getConfiguration()); + try { + DeviceManagementProviderService deviceManagementProviderService = AndroidAPIUtils + .getDeviceManagementService(); + configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + List configs = configuration.getConfiguration(); + NotifierFrequency notifierFrequency = new NotifierFrequency(); + for (ConfigurationEntry entry : configs) { + if (AndroidConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { + License license = new License(); + license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + license.setLanguage(AndroidConstants.TenantConfigProperties.LANGUAGE_US); + license.setVersion("1.0.0"); + license.setText(entry.getValue().toString()); + deviceManagementProviderService.addLicense(DeviceManagementConstants. + MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, license); + licenseEntry = entry; + } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals(entry.getName())) { + if (entry.getValue() != null) { + notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString())); + } else { + String msg = "No value specified for notifierFrequency."; + log.error(msg); + throw new BadRequestExceptionDup(msg); + } + } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) { + if (entry.getValue() != null) { + notifierFrequency.setType(Integer.parseInt(entry.getValue().toString())); + } else { + String msg = "No value specified for notifierType."; + log.error(msg); + throw new BadRequestExceptionDup(msg); + } + } + } + + if (licenseEntry != null) { + configs.remove(licenseEntry); + } + configuration.setConfiguration(configs); + deviceManagementProviderService.saveConfiguration(configuration); + notifyDevices(notifierFrequency); + } catch (DeviceManagementException e) { + String msg = "Error occurred while getting device management service to modify Android config settings"; + log.error(msg, e); + throw new AndroidDeviceMgtPluginException(msg, e); + } catch (NumberFormatException e) { + String msg = "Error occurred while reading notification frequency."; + log.error(msg, e); + throw new AndroidDeviceMgtPluginException(msg, e); + } catch (OperationManagementException e) { + String msg = "Error occurred while modifying configuration settings of Android platform."; + log.error(msg, e); + throw new AndroidDeviceMgtPluginException(msg, e); + } catch (InvalidDeviceException e) { + String msg = "Error occurred with the device."; + log.error(msg, e); + throw new AndroidDeviceMgtPluginException(msg, e); + } + } + + private void notifyDevices(NotifierFrequency notifierFrequency) throws DeviceManagementException, + OperationManagementException, InvalidDeviceException { + List deviceList = AndroidAPIUtils. + getDeviceManagementService(). + getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false); + List deviceIdList = new ArrayList<>(); + for (Device device : deviceList) { + if (EnrolmentInfo.Status.REMOVED != device.getEnrolmentInfo().getStatus()) { + deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); + } + } + if (!deviceIdList.isEmpty()) { + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.NOTIFIER_FREQUENCY); + operation.setPayLoad(notifierFrequency.toJSON()); + operation.setEnabled(true); + AndroidAPIUtils.getDeviceManagementService().addOperation( + DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, + operation, deviceIdList); + } + } +} 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/AndroidDeviceManagementDataHolder.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidDeviceManagementDataHolder.java similarity index 69% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/internal/AndroidDeviceManagementDataHolder.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidDeviceManagementDataHolder.java index 09d111fca..9f4740313 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/AndroidDeviceManagementDataHolder.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidDeviceManagementDataHolder.java @@ -16,10 +16,10 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.internal; +package org.wso2.carbon.device.mgt.mobile.android.core.internal; -import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.android.AndroidPluginService; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.registry.core.service.RegistryService; /** @@ -28,7 +28,8 @@ import org.wso2.carbon.registry.core.service.RegistryService; public class AndroidDeviceManagementDataHolder { private RegistryService registryService; - private AndroidPluginService androidDeviceManagementService; + private AndroidGoogleEnterpriseService androidDeviceManagementService; + private AndroidService androidService; private static AndroidDeviceManagementDataHolder thisInstance = new AndroidDeviceManagementDataHolder(); @@ -47,13 +48,20 @@ public class AndroidDeviceManagementDataHolder { this.registryService = registryService; } - public AndroidPluginService getAndroidDeviceManagementService() { + public AndroidGoogleEnterpriseService getAndroidDeviceManagementService() { return androidDeviceManagementService; } public void setAndroidDeviceManagementService( - AndroidPluginService androidDeviceManagementService) { + AndroidGoogleEnterpriseService androidDeviceManagementService) { this.androidDeviceManagementService = androidDeviceManagementService; } + public AndroidService getAndroidService() { + return androidService; + } + + public void setAndroidService(AndroidService androidService) { + this.androidService = androidService; + } } 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/AndroidPluginServiceComponent.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java similarity index 80% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/internal/AndroidPluginServiceComponent.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java index 08f0c1c95..2ee731c65 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/AndroidPluginServiceComponent.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java @@ -16,21 +16,23 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.internal; +package org.wso2.carbon.device.mgt.mobile.android.core.internal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.device.mgt.mobile.android.AndroidPluginService; -import org.wso2.carbon.device.mgt.mobile.android.impl.AndroidPluginServiceImpl; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.AbstractMobileDeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.mobile.android.impl.util.MobileDeviceManagementUtil; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; +import org.wso2.carbon.device.mgt.mobile.android.core.dao.AbstractMobileDeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.mobile.android.core.impl.AndroidGoogleEnterpriseServiceImpl; +import org.wso2.carbon.device.mgt.mobile.android.core.impl.AndroidServiceImpl; +import org.wso2.carbon.device.mgt.mobile.android.core.util.MobileDeviceManagementUtil; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; /** - * @scr.component name="org.wso2.carbon.device.mgt.mobile.android.impl.internal.AndroidPluginServiceComponent" + * @scr.component name="org.wso2.carbon.device.mgt.mobile.android.core.impl.internal.AndroidPluginServiceComponent" * immediate="true" * @scr.reference name="org.wso2.carbon.ndatasource" * interface="org.wso2.carbon.ndatasource.core.DataSourceService" @@ -58,15 +60,19 @@ public class AndroidPluginServiceComponent { try { BundleContext bundleContext = ctx.getBundleContext(); - MobileDeviceManagementUtil.initConfig(); AbstractMobileDeviceManagementDAOFactory.init("android", MobileDeviceManagementUtil .getIosDataSourceConfigurations().getIosDataSourceConfiguration()); - AndroidPluginService androidPluginService = new AndroidPluginServiceImpl(); + AndroidService androidService = new AndroidServiceImpl(); + AndroidDeviceManagementDataHolder.getInstance().setAndroidService( + androidService); + bundleContext.registerService(AndroidService.class.getName(), androidService, null); + + AndroidGoogleEnterpriseService androidPluginService = new AndroidGoogleEnterpriseServiceImpl(); AndroidDeviceManagementDataHolder.getInstance().setAndroidDeviceManagementService( androidPluginService); - bundleContext.registerService(AndroidPluginService.class.getName(), androidPluginService, null); + bundleContext.registerService(AndroidGoogleEnterpriseService.class.getName(), androidPluginService, null); if (log.isDebugEnabled()) { log.debug("Android Mobile Device Management Service Component has been successfully activated"); } 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.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java similarity index 87% rename from 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 rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java index f91e67424..5fe4f401d 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.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,9 +34,11 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementExcept import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.device.mgt.mobile.android.AndroidPluginService; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; @@ -55,10 +57,10 @@ public class AndroidAPIUtils { throw new IllegalStateException("Utility class"); } - public static AndroidPluginService getAndroidPluginService() { + public static AndroidGoogleEnterpriseService getAndroidPluginService() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - AndroidPluginService androidPluginService = - (AndroidPluginService) ctx.getOSGiService(AndroidPluginService.class, null); + AndroidGoogleEnterpriseService androidPluginService = + (AndroidGoogleEnterpriseService) ctx.getOSGiService(AndroidGoogleEnterpriseService.class, null); if (androidPluginService == null) { String msg = "Android plugin service has not initialized."; log.error(msg); @@ -67,6 +69,17 @@ public class AndroidAPIUtils { return androidPluginService; } + public static AndroidService getAndroidnService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + AndroidService androidService = (AndroidService) ctx.getOSGiService(AndroidService.class, null); + if (androidService == null) { + String msg = "Android service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return androidService; + } + public static String getAuthenticatedUser() { PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); String username = threadLocalCarbonContext.getUsername(); 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/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java index a66e3a07f..51edcb75d 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/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java @@ -33,7 +33,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.core.util; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -62,13 +62,13 @@ import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.application.mgt.common.SubAction; import org.wso2.carbon.device.application.mgt.common.SubscriptionType; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; 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.EnrolmentInfo; 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.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; @@ -85,17 +85,18 @@ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtExcept import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.core.search.mgt.impl.Utils; -import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.GoogleAPIInvoker; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseConfigs; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorListItem; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseApp; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; -import org.wso2.carbon.mdm.services.android.bean.DeviceState; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseConfigs; -import org.wso2.carbon.mdm.services.android.bean.ErrorListItem; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseApp; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseInstallPolicy; -import org.wso2.carbon.mdm.services.android.common.GoogleAPIInvoker; -import org.wso2.carbon.mdm.services.android.exception.BadRequestException; import org.wso2.carbon.policy.mgt.common.FeatureManagementException; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; @@ -207,7 +208,8 @@ public class AndroidDeviceUtils { } public static void updateOperation(String deviceId, Operation operation) - throws OperationManagementException, PolicyComplianceException, ApplicationManagementException { + throws OperationManagementException, PolicyComplianceException, + org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(deviceId); deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); @@ -351,35 +353,32 @@ public class AndroidDeviceUtils { * @param deviceIdentifier device to apply policy */ private static void sendPayloadToGoogle(String uuid, String payload, DeviceIdentifier deviceIdentifier) - throws org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException { + throws ApplicationManagementException { try { EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigsFromGoogle(); - if (enterpriseConfigs != null && enterpriseConfigs.getErrorResponse() == null) { + if (enterpriseConfigs.getErrorResponse() == null) { GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); AndroidEnterpriseUser userDetail = AndroidAPIUtils.getAndroidPluginService() .getEnterpriseUserByDevice(deviceIdentifier.getId()); if (userDetail != null && userDetail.getEnterpriseId() != null && !userDetail.getEnterpriseId() - .isEmpty() && userDetail.getEmmUsername() != null) { - - if (payload != null) { -// ProfileFeature feature = AndroidDeviceUtils.getEnrollmentPolicy(deviceIdentifier); - EnterpriseInstallPolicy enterpriseInstallPolicy = AndroidEnterpriseUtils - .getDeviceAppPolicy(payload, null, userDetail); - - List apps = new ArrayList<>(); - for (EnterpriseApp enterpriseApp : enterpriseInstallPolicy.getApps()) { - apps.add(enterpriseApp.getProductId()); - } - googleAPIInvoker.approveAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail - .getGoogleUserId(), apps, enterpriseInstallPolicy.getProductSetBehavior()); - googleAPIInvoker.updateAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail.getGoogleUserId(), - AndroidEnterpriseUtils.convertToDeviceInstance(enterpriseInstallPolicy)); - AndroidEnterpriseUtils.getAppSubscriptionService() - .performEntAppSubscription(uuid, - Arrays.asList(CarbonContext.getThreadLocalCarbonContext().getUsername()), - SubscriptionType.USER.toString(), SubAction.INSTALL.toString(), false); + .isEmpty() && userDetail.getEmmUsername() != null && payload != null) { + EnterpriseInstallPolicy enterpriseInstallPolicy = AndroidEnterpriseUtils + .getDeviceAppPolicy(payload, null, userDetail); + List apps = new ArrayList<>(); + for (EnterpriseApp enterpriseApp : enterpriseInstallPolicy.getApps()) { + apps.add(enterpriseApp.getProductId()); } + googleAPIInvoker + .approveAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail.getGoogleUserId(), apps, + enterpriseInstallPolicy.getProductSetBehavior()); + googleAPIInvoker + .updateAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail.getGoogleUserId(), + AndroidEnterpriseUtils.convertToDeviceInstance(enterpriseInstallPolicy)); + AndroidEnterpriseUtils.getAppSubscriptionService().performEntAppSubscription(uuid, + Arrays.asList(CarbonContext.getThreadLocalCarbonContext().getUsername()), + SubscriptionType.USER.toString(), SubAction.INSTALL.toString(), false); + } } @@ -390,7 +389,7 @@ public class AndroidDeviceUtils { } private static void updateApplicationList(Operation operation, DeviceIdentifier deviceIdentifier) - throws ApplicationManagementException { + throws org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException { // Parsing json string to get applications list. if (operation.getOperationResponse() != null) { if (operation.getOperationResponse().equals("SAME_APPLICATION_LIST")) { 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/AndroidEnterpriseUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidEnterpriseUtils.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java index 6bd4e0be8..1fc9549ed 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/AndroidEnterpriseUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.core.util; import com.google.api.services.androidenterprise.model.AppVersion; import com.google.api.services.androidenterprise.model.AutoInstallConstraint; @@ -51,16 +51,17 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; -import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser; -import org.wso2.carbon.mdm.services.android.bean.BasicUserInfo; -import org.wso2.carbon.mdm.services.android.bean.EnterpriseConfigs; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseApp; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseInstallPolicy; -import org.wso2.carbon.mdm.services.android.exception.NotFoundException; -import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.BasicUserInfo; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseConfigs; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseApp; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; @@ -141,13 +142,12 @@ public class AndroidEnterpriseUtils { variableSets.add(variableSet); } - if (variableSets != null && variableSets.size() > 0) { + if (!variableSets.isEmpty()) { configurationVariables.setVariableSet(variableSets); } managedConfiguration.setConfigurationVariables(configurationVariables); productPolicy.setManagedConfiguration(managedConfiguration); } - policyList.add(productPolicy); } 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/util/MobileDeviceManagementUtil.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/MobileDeviceManagementUtil.java similarity index 94% 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/util/MobileDeviceManagementUtil.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/MobileDeviceManagementUtil.java index 1ea1543a4..240043aad 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/util/MobileDeviceManagementUtil.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/MobileDeviceManagementUtil.java @@ -34,7 +34,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.impl.util; +package org.wso2.carbon.device.mgt.mobile.android.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -45,16 +45,15 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.AndroidDataSourceConfigurations; -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.MobileDataSourceConfig; -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.MobileDataSourceConfigurations; -import org.wso2.carbon.device.mgt.mobile.android.impl.dao.impl.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileDevice; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileDeviceOperationMapping; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileFeature; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileOperation; -import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileOperationProperty; -import org.wso2.carbon.device.mgt.mobile.android.internal.AndroidDeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidPluginConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.config.datasource.AndroidDataSourceConfigurations; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.MobileDevice; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.MobileDeviceOperationMapping; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.MobileFeature; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.MobileOperation; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.MobileOperationProperty; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.core.internal.AndroidDeviceManagementDataHolder; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; 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/OAuthUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/OAuthUtils.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/OAuthUtils.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/OAuthUtils.java index 53e0832c3..d4a6064aa 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/OAuthUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/OAuthUtils.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.util; +package org.wso2.carbon.device.mgt.mobile.android.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -24,7 +24,8 @@ import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.mdm.services.android.bean.ApiRegistrationProfile; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApiRegistrationProfile; import org.wso2.carbon.identity.jwt.client.extension.JWTClient; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java new file mode 100644 index 000000000..4c1e432b4 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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.android.core; + +import org.mockito.MockitoAnnotations; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.testng.PowerMockObjectFactory; +import org.testng.Assert; +import org.testng.IObjectFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.ObjectFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceManagementProviderServiceMock; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils.TestUtils; + +import javax.ws.rs.core.Response; + +@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"}) +@PrepareForTest(AndroidAPIUtils.class) +public class DeviceManagementAdminServiceTests { + +// private DeviceManagementAdminServiceImpl deviceManagementAdminService; + + @ObjectFactory + public IObjectFactory getObjectFactory() { + return new PowerMockObjectFactory(); + } + +// @BeforeClass +// public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// MockitoAnnotations.initMocks(this); +// deviceManagementAdminService = new DeviceManagementAdminServiceImpl(); +// } + + private void mockDeviceManagementService() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) + .toReturn(new DeviceManagementProviderServiceMock()); + } + +// @Test +// public void testConfigureDeviceLock() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testConfigureDeviceUnlock() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.configureDeviceUnlock(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetDeviceLocation() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.getDeviceLocation(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testRemovePassword() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.removePassword(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testConfigureCamera() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.configureCamera(TestUtils.getCamerabeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetDeviceInformation() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.getDeviceInformation(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetDeviceLogcat() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.getDeviceLogcat(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testWipeDevice() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.wipeDevice(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testWipeData() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.wipeData(TestUtils.getWipeDataBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetApplications() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.getApplications(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testRingDevice() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.ringDevice(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testRebootDevice() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.rebootDevice(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testChangeLockTask() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.changeLockTask(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testMuteDevice() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.muteDevice(TestUtils.getDeviceIds()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testInstallApplication() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService +// .installApplication(TestUtils.getApplicationInstallationBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testUpdateApplication() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testUninstallApplicationPublic() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService +// .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testUninstallApplicationWebApp() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService +// .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testBlacklistApplications() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService +// .blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testUpgradeFirmware() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testConfigureVPN() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.configureVPN(TestUtils.getVpnBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testSendNotification() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.sendNotification(TestUtils.getNotificationBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testConfigureWifi() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.configureWifi(TestUtils.getWifiBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testEncryptStorage() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.encryptStorage(TestUtils.getEncryptionBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testChangeLockCode() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.changeLockCode(TestUtils.getLockCodeBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testSetPasswordPolicy() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testSetWebClip() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementAdminService.setWebClip(TestUtils.getWebClipBeanWrapper()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } + +} + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java new file mode 100644 index 000000000..9ce61820d --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you 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.android.core; + +import org.mockito.MockitoAnnotations; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.testng.PowerMockObjectFactory; +import org.testng.Assert; +import org.testng.IObjectFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.ObjectFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; +import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.ApplicationManagementProviderServiceMock; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceInformationManagerServiceMock; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceManagementProviderServiceMock; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.NotificationManagementServiceMock; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.PolicyManagerServiceMock; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils.TestUtils; + +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; + +@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"}) +@PrepareForTest(AndroidAPIUtils.class) +public class DeviceManagementServiceTests { + +// private DeviceManagementServiceImpl deviceManagementService; + +// @ObjectFactory +// public IObjectFactory getObjectFactory() { +// return new PowerMockObjectFactory(); +// } + +// @BeforeClass +// public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// MockitoAnnotations.initMocks(this); +// deviceManagementService = new DeviceManagementServiceImpl(); +// } + +// private void mockDeviceManagementService() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) +// .toReturn(new DeviceManagementProviderServiceMock()); +// } +// +// private void mockApplicationManagerService() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getApplicationManagerService")) +// .toReturn(new ApplicationManagementProviderServiceMock()); +// } +// +// private void mockPolicyManagerService() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getPolicyManagerService")) +// .toReturn(new PolicyManagerServiceMock()); +// } +// +// private void mockDeviceInformationManagerService() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceInformationManagerService")) +// .toReturn(new DeviceInformationManagerServiceMock()); +// } +// +// private void mockNotificationManagementService() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getNotificationManagementService")) +// .toReturn(new NotificationManagementServiceMock()); +// } +// +// private void mockUser() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getAuthenticatedUser")) +// .toReturn("admin"); +// } +// +// @Test +// public void testUpdateApplicationList() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockApplicationManagerService(); +// Response response = deviceManagementService +// .updateApplicationList(TestUtils.getDeviceId(), TestUtils.getAndroidApplications()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsForNullDevice() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// Response response = deviceManagementService +// .getPendingOperations(true, null, null, null); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsInvalidDevice() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService +// .getPendingOperations(true, "1234", null, null); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsNullResponse() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService +// .getPendingOperations(true, TestUtils.getDeviceId(), null, null); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsWithMonitorResponse() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockPolicyManagerService(); +// Response response = deviceManagementService +// .getPendingOperations(true, TestUtils.getDeviceId(), null, +// TestUtils.getSuccessMonitorOperationResponse()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsWithApplicationResponse() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockApplicationManagerService(); +// Response response = deviceManagementService +// .getPendingOperations(true, TestUtils.getDeviceId(), null, +// TestUtils.getSuccessApplicationOperationResponse()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsWithDeviceInfoResponse() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockDeviceInformationManagerService(); +// Response response = deviceManagementService +// .getPendingOperations(true, TestUtils.getDeviceId(), null, +// TestUtils.getSuccessInfoOperationResponse()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsWithInProgressResponse() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService +// .getPendingOperations(true, TestUtils.getDeviceId(), null, +// TestUtils.getInProgressOperationResponse()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testGetPendingOperationsWithErrorResponse() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockNotificationManagementService(); +// Response response = deviceManagementService +// .getPendingOperations(true, TestUtils.getDeviceId(), null, +// TestUtils.getErrorOperationResponse()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); +// } +// +// @Test +// public void testEnrollDeviceWithoutLocationSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockPolicyManagerService(); +// mockUser(); +// Response response = deviceManagementService.enrollDevice(TestUtils.getBasicAndroidDevice()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); +// } +// +// @Test +// public void testEnrollDeviceWithLocationSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockDeviceInformationManagerService(); +// mockPolicyManagerService(); +// mockUser(); +// AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); +// +// List properties = new ArrayList<>(); +// Device.Property property = new Device.Property(); +// property.setName("LATITUDE"); +// property.setValue("79.5"); +// properties.add(property); +// property = new Device.Property(); +// property.setName("LONGITUDE"); +// property.setValue("6.9"); +// properties.add(property); +// property = new Device.Property(); +// property.setName("ALTITUDE"); +// property.setValue("-59.8373726"); +// properties.add(property); +// property = new Device.Property(); +// property.setName("SPEED"); +// property.setValue("0.5123423333"); +// properties.add(property); +// property = new Device.Property(); +// property.setName("BEARING"); +// property.setValue("44.0"); +// properties.add(property); +// property = new Device.Property(); +// property.setName("DISTANCE"); +// property.setValue("44.0"); +// properties.add(property); +// androidDevice.setProperties(properties); +// +// Response response = deviceManagementService.enrollDevice(androidDevice); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); +// } +// +// @Test +// public void testEnrollDeviceUnSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockUser(); +// AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); +// androidDevice.setDeviceIdentifier("1234"); +// Response response = deviceManagementService.enrollDevice(androidDevice); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); +// } +// +// @Test +// public void testIsEnrolledExists() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService.isEnrolled(TestUtils.getDeviceId(), null); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); +// } +// +// @Test +// public void testIsEnrolledNonExist() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService.isEnrolled("1234", null); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); +// } +// +// @Test +// public void testIsEnrolledNull() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService.isEnrolled(null, null); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); +// } +// +// @Test +// public void testModifyEnrollmentSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockUser(); +// Response response = deviceManagementService +// .modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode()); +// } +// +// @Test +// public void testModifyEnrollmentUnSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// mockUser(); +// AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); +// androidDevice.setDeviceIdentifier("1234"); +// Response response = deviceManagementService +// .modifyEnrollment(TestUtils.getDeviceId(), androidDevice); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); +// } +// +// @Test +// public void testDisEnrollDeviceSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService.disEnrollDevice(TestUtils.getDeviceId()); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); +// } +// +// @Test +// public void testDisenrollUnSuccess() +// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { +// mockDeviceManagementService(); +// Response response = deviceManagementService.disEnrollDevice("1234"); +// Assert.assertNotNull(response); +// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); +// } + +} + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/ApplicationManagementProviderServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/ApplicationManagementProviderServiceMock.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/ApplicationManagementProviderServiceMock.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/ApplicationManagementProviderServiceMock.java index 563258b3c..29de8de79 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/ApplicationManagementProviderServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/ApplicationManagementProviderServiceMock.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.mocks; +package org.wso2.carbon.device.mgt.mobile.android.core.mokcs; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.app.mgt.Application; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceInformationManagerServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceInformationManagerServiceMock.java similarity index 93% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceInformationManagerServiceMock.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceInformationManagerServiceMock.java index 2be212e52..37a5ac425 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceInformationManagerServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceInformationManagerServiceMock.java @@ -1,6 +1,5 @@ -package org.wso2.carbon.mdm.services.android.mocks; +package org.wso2.carbon.device.mgt.mobile.android.core.mokcs; -import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java similarity index 99% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java index 6d5bf8937..67dbd2b12 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/DeviceManagementProviderServiceMock.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.mocks; +package org.wso2.carbon.device.mgt.mobile.android.core.mokcs; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; @@ -53,7 +53,7 @@ import org.wso2.carbon.device.mgt.core.geo.GeoCluster; import org.wso2.carbon.device.mgt.core.geo.geoHash.GeoCoordinate; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; -import org.wso2.carbon.mdm.services.android.utils.TestUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils.TestUtils; import java.util.Date; import java.util.HashMap; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/NotificationManagementServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/NotificationManagementServiceMock.java similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/NotificationManagementServiceMock.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/NotificationManagementServiceMock.java index 4fd989de6..1f9cafbd3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/NotificationManagementServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/NotificationManagementServiceMock.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.mocks; +package org.wso2.carbon.device.mgt.mobile.android.core.mokcs; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.PaginationRequest; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/PolicyManagerServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/PolicyManagerServiceMock.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/PolicyManagerServiceMock.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/PolicyManagerServiceMock.java index a71dafebf..36283e5d3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/PolicyManagerServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/PolicyManagerServiceMock.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.mdm.services.android.mocks; +package org.wso2.carbon.device.mgt.mobile.android.core.mokcs; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.Feature; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/utils/TestUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java similarity index 86% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/utils/TestUtils.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java index 994cb9423..2a0bb71ea 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/utils/TestUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java @@ -16,8 +16,9 @@ * under the License. */ -package org.wso2.carbon.mdm.services.android.utils; +package org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils; +import javafx.scene.Camera; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; @@ -26,40 +27,39 @@ import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate; -import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications; -import org.wso2.carbon.mdm.services.android.bean.Camera; -import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption; -import org.wso2.carbon.mdm.services.android.bean.DeviceLock; -import org.wso2.carbon.mdm.services.android.bean.LockCode; -import org.wso2.carbon.mdm.services.android.bean.Notification; -import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy; -import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware; -import org.wso2.carbon.mdm.services.android.bean.Vpn; -import org.wso2.carbon.mdm.services.android.bean.WebClip; -import org.wso2.carbon.mdm.services.android.bean.Wifi; -import org.wso2.carbon.mdm.services.android.bean.WipeData; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; -import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationInstallationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUninstallationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUpdateBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.BlacklistApplicationsBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.CameraBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.DeviceLockBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EncryptionBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.LockCodeBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.NotificationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.PasswordPolicyBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.UpgradeFirmwareBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.VpnBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WebClipBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WifiBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WipeDataBeanWrapper; -import org.wso2.carbon.mdm.services.android.util.AndroidConstants; -import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils; +import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstallation; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Notification; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.PasscodePolicy; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.UpgradeFirmware; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Vpn; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.WebClip; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Wifi; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.WipeData; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationInstallationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUninstallationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUpdateBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.BlacklistApplicationsBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.CameraBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DeviceLockBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EncryptionBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.LockCodeBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.NotificationBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.PasswordPolicyBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.UpgradeFirmwareBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import java.util.ArrayList; import java.util.List; @@ -108,14 +108,14 @@ public class TestUtils { return deviceLockBeanWrapper; } - public static CameraBeanWrapper getCamerabeanWrapper() { - CameraBeanWrapper cameraBeanWrapper = new CameraBeanWrapper(); - cameraBeanWrapper.setDeviceIDs(getDeviceIds()); - Camera camera = new Camera(); - camera.setEnabled(false); - cameraBeanWrapper.setOperation(camera); - return cameraBeanWrapper; - } +// public static CameraBeanWrapper getCamerabeanWrapper() { +// CameraBeanWrapper cameraBeanWrapper = new CameraBeanWrapper(); +// cameraBeanWrapper.setDeviceIDs(getDeviceIds()); +// Camera camera = new Camera(); +// camera.setEnabled(false); +// cameraBeanWrapper.setOperation(camera); +// return cameraBeanWrapper; +// } public static WipeDataBeanWrapper getWipeDataBeanWrapper() { WipeDataBeanWrapper wipeDataBeanWrapper = new WipeDataBeanWrapper(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/resources/log4j.properties b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/resources/log4j.properties similarity index 100% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/resources/log4j.properties rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/resources/log4j.properties diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/resources/testng.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/resources/testng.xml similarity index 80% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/resources/testng.xml rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/resources/testng.xml index 865a1e85b..edecf75b9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/resources/testng.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/resources/testng.xml @@ -23,8 +23,8 @@ - - + + 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/config/MobileDeviceConfigurationManager.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/config/MobileDeviceConfigurationManager.java deleted file mode 100644 index ded87ad71..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/config/MobileDeviceConfigurationManager.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.impl.config; - -import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.android.impl.util.MobileDeviceManagementUtil; -import org.wso2.carbon.utils.CarbonUtils; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Unmarshaller; -import java.io.File; - -/** - * Class responsible for the mobile device manager configuration initialization. - */ -public class MobileDeviceConfigurationManager { - - private static final String MOBILE_DEVICE_CONFIG_XML_NAME = "mobile-config.xml"; - private static final String MOBILE_DEVICE_PLUGIN_DIRECTORY = "mobile"; - private static final String DEVICE_MGT_PLUGIN_CONFIGS_DIRECTORY = "device-mgt-plugin-configs"; - private MobileDeviceManagementConfig currentMobileDeviceConfig; - private static MobileDeviceConfigurationManager mobileDeviceConfigManager; - - private final String mobileDeviceMgtConfigXMLPath = - CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + - DEVICE_MGT_PLUGIN_CONFIGS_DIRECTORY + - File.separator + - MOBILE_DEVICE_PLUGIN_DIRECTORY + File.separator + MOBILE_DEVICE_CONFIG_XML_NAME; - - public static MobileDeviceConfigurationManager getInstance() { - if (mobileDeviceConfigManager == null) { - synchronized (MobileDeviceConfigurationManager.class) { - if (mobileDeviceConfigManager == null) { - mobileDeviceConfigManager = new MobileDeviceConfigurationManager(); - } - } - } - return mobileDeviceConfigManager; - } - - public synchronized void initConfig() throws DeviceManagementException { - try { - File mobileDeviceMgtConfig = new File(mobileDeviceMgtConfigXMLPath); - Document doc = MobileDeviceManagementUtil.convertToDocument(mobileDeviceMgtConfig); - JAXBContext mobileDeviceMgmtContext = - JAXBContext.newInstance(MobileDeviceManagementConfig.class); - Unmarshaller unmarshaller = mobileDeviceMgmtContext.createUnmarshaller(); - this.currentMobileDeviceConfig = - (MobileDeviceManagementConfig) unmarshaller.unmarshal(doc); - } catch (Exception e) { - throw new DeviceManagementException( - "Error occurred while initializing Mobile Device Management config", e); - } - } - - public MobileDeviceManagementConfig getMobileDeviceManagementConfig() { - return currentMobileDeviceConfig; - } - - -} 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/config/MobileDeviceManagementConfig.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/config/MobileDeviceManagementConfig.java deleted file mode 100644 index 2c65375c7..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/config/MobileDeviceManagementConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.impl.config; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Represents Mobile Device Mgt configuration. - */ -@XmlRootElement(name = "MobileDeviceMgtConfiguration") -public final class MobileDeviceManagementConfig { - - private MobileDeviceManagementRepository mobileDeviceMgtRepository; - - @XmlElement(name = "ManagementRepository", nillable = false) - public MobileDeviceManagementRepository getMobileDeviceMgtRepository() { - return mobileDeviceMgtRepository; - } - - public void setMobileDeviceMgtRepository( - MobileDeviceManagementRepository mobileDeviceMgtRepository) { - this.mobileDeviceMgtRepository = mobileDeviceMgtRepository; - } - -} 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/config/MobileDeviceManagementRepository.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/config/MobileDeviceManagementRepository.java deleted file mode 100644 index e40202acf..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/config/MobileDeviceManagementRepository.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.impl.config; - -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.DataSourceConfigAdapter; -import org.wso2.carbon.device.mgt.mobile.android.impl.config.datasource.MobileDataSourceConfig; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.util.List; -import java.util.Map; - -/** - * Class for holding management repository data. - */ -@XmlRootElement(name = "ManagementRepository") -public class MobileDeviceManagementRepository { - - private Map mobileDataSourceConfigMap; - private List mobileDataSourceConfigs; - - public MobileDataSourceConfig getMobileDataSourceConfig(String provider) { - return mobileDataSourceConfigMap.get(provider); - } - - @XmlElement(name = "DataSourceConfigurations") - @XmlJavaTypeAdapter(DataSourceConfigAdapter.class) - public Map getMobileDataSourceConfigMap() { - return mobileDataSourceConfigMap; - } - - public void setMobileDataSourceConfigMap(Map mobileDataSourceConfigMap) { - this.mobileDataSourceConfigMap = mobileDataSourceConfigMap; - } - - public List getMobileDataSourceConfigs() { - return (List) mobileDataSourceConfigMap.values(); - } - -} diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index abef3c20a..96bc4786c 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -33,7 +33,9 @@ http://wso2.org - org.wso2.carbon.device.mgt.mobile.android + org.wso2.carbon.device.mgt.mobile.android.common + org.wso2.carbon.device.mgt.mobile.android.addons + org.wso2.carbon.device.mgt.mobile.android.core org.wso2.carbon.device.mgt.mobile.android.api org.wso2.carbon.device.mgt.mobile.android.emulator org.wso2.carbon.device.mgt.mobile.android.ui 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 34cda052b..22690b491 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 @@ -39,7 +39,11 @@ org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.android + org.wso2.carbon.device.mgt.mobile.android.core + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.common com.h2database.wso2 @@ -243,7 +247,10 @@ - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android:${carbon.devicemgt.plugins.version} + org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android.core:${carbon.devicemgt.plugins.version} + + + org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android.common:${carbon.devicemgt.plugins.version} diff --git a/pom.xml b/pom.xml index 58d141fff..9633307cd 100644 --- a/pom.xml +++ b/pom.xml @@ -549,7 +549,17 @@ org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.android + org.wso2.carbon.device.mgt.mobile.android.common + ${carbon.devicemgt.plugins.version} + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.addons + ${carbon.devicemgt.plugins.version} + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.core ${carbon.devicemgt.plugins.version} From f35050c24ae92b79d9c32b849b5b3a5a32f62489 Mon Sep 17 00:00:00 2001 From: shamalka Date: Fri, 29 Nov 2019 21:53:04 +0530 Subject: [PATCH 02/30] Seperate android API logics --- .../api/impl/DeviceManagementAPIImpl.java | 348 +---- .../impl/DeviceManagementAdminAPIImpl.java | 575 +------ .../impl/DeviceTypeConfigurationAPIImpl.java | 4 +- .../api/impl/EventReceiverAPIImpl.java | 106 +- .../android/common/spi/AndroidService.java | 107 ++ .../android/core/impl/AndroidServiceImpl.java | 1324 ++++++++++++++++- .../android/core/util/AndroidAPIUtils.java | 4 +- 7 files changed, 1512 insertions(+), 956 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index ac075fb6f..66e775611 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -65,6 +65,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExce import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; @@ -94,10 +95,7 @@ import java.util.List; @Consumes(MediaType.APPLICATION_JSON) public class DeviceManagementAPIImpl implements DeviceManagementAPI { - private static final String OPERATION_ERROR_STATUS = "ERROR"; private static final Log log = LogFactory.getLog(DeviceManagementAPIImpl.class); - public static final String GOOGLE_AFW_EMM_ANDROID_ID = "googleEMMAndroidId"; - public static final String GOOGLE_AFW_DEVICE_ID = "googleEMMDeviceId"; @PUT @Path("/{id}/applications") @@ -107,30 +105,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { @Size(min = 2, max = 45) @Pattern(regexp = "^[A-Za-z0-9]*$") String id, List androidApplications) { - Application application; - List applications = new ArrayList<>(); - for (AndroidApplication androidApplication : androidApplications) { - application = new Application(); - application.setPlatform(androidApplication.getPlatform()); - application.setCategory(androidApplication.getCategory()); - application.setName(androidApplication.getName()); - application.setLocationUrl(androidApplication.getLocationUrl()); - application.setImageUrl(androidApplication.getImageUrl()); - application.setVersion(androidApplication.getVersion()); - application.setType(androidApplication.getType()); - application.setAppProperties(androidApplication.getAppProperties()); - application.setApplicationIdentifier(androidApplication.getApplicationIdentifier()); - application.setMemoryUsage(androidApplication.getMemoryUsage()); - applications.add(application); - } - Message responseMessage = new Message(); - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(id); - deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); try { - AndroidAPIUtils.getApplicationManagerService(). - updateApplicationListInstalledInDevice(deviceIdentifier, applications); - responseMessage.setResponseMessage("Device information has modified successfully."); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Message responseMessage = androidService.updateApplicationList(id, androidApplications); return Response.status(Response.Status.ACCEPTED).entity(responseMessage).build(); } catch (ApplicationManagementException e) { String msg = "Error occurred while modifying the application list."; @@ -154,42 +131,13 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); try { - if (!AndroidDeviceUtils.isValidDeviceIdentifier(deviceIdentifier)) { - String msg = "Device not found for identifier '" + id + "'"; - log.error(msg); - return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); - } - if (log.isDebugEnabled()) { - log.debug("Invoking Android pending operations:" + id); - } - if (resultOperations != null && !resultOperations.isEmpty()) { - updateOperations(id, resultOperations); - } - } catch (OperationManagementException e) { - String msg = "Issue in retrieving operation management service instance"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (PolicyComplianceException e) { - String msg = "Issue in updating Monitoring operation"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + androidService.getPendingOperations(id, resultOperations); } catch (DeviceManagementException e) { String msg = "Issue in retrieving device management service instance"; log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (ApplicationManagementException e) { - String msg = "Issue in retrieving application management service instance"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (NotificationManagementException e) { - String msg = "Issue in retrieving Notification management service instance"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); } List pendingOperations; @@ -204,30 +152,7 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { return Response.status(Response.Status.CREATED).entity(pendingOperations).build(); } - private void updateOperations(String deviceId, List operations) - throws OperationManagementException, PolicyComplianceException, - ApplicationManagementException, NotificationManagementException, DeviceManagementException { - for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : operations) { - AndroidDeviceUtils.updateOperation(deviceId, operation); - if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { - org.wso2.carbon.device.mgt.common.notification.mgt.Notification notification = new - org.wso2.carbon.device.mgt.common.notification.mgt.Notification(); - DeviceIdentifier id = new DeviceIdentifier(); - id.setId(deviceId); - id.setType(AndroidConstants.DEVICE_TYPE_ANDROID); - String deviceName = AndroidAPIUtils.getDeviceManagementService().getDevice(id, false).getName(); - notification.setOperationId(operation.getId()); - notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. - Status.NEW.toString()); - notification.setDescription(operation.getCode() + " operation failed to execute on device " + - deviceName + " (ID: " + deviceId + ")"); - AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); - } - if (log.isDebugEnabled()) { - log.debug("Updating operation '" + operation.toString() + "'"); - } - } - } + @POST @Override @@ -239,144 +164,15 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } try { - String token = null; - Device device = new Device(); - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - device.setEnrolmentInfo(androidDevice.getEnrolmentInfo()); - device.getEnrolmentInfo().setOwner(AndroidAPIUtils.getAuthenticatedUser()); - device.setDeviceInfo(androidDevice.getDeviceInfo()); - device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); - device.setDescription(androidDevice.getDescription()); - device.setName(androidDevice.getName()); - device.setFeatures(androidDevice.getFeatures()); - device.setProperties(androidDevice.getProperties()); - - String googleEMMAndroidId = null; - String googleEMMDeviceId = null; - if (androidDevice.getProperties() != null) { - for (Device.Property property : androidDevice.getProperties()) { - if (property.getName().equals(GOOGLE_AFW_EMM_ANDROID_ID)) { - googleEMMAndroidId = property.getValue(); - } else if (property.getName().equals(GOOGLE_AFW_DEVICE_ID)) { - googleEMMDeviceId = property.getValue(); - } - } - - if (googleEMMAndroidId != null && googleEMMDeviceId != null) { - EnterpriseUser user = new EnterpriseUser(); - user.setAndroidPlayDeviceId(googleEMMAndroidId); - user.setEmmDeviceIdentifier(googleEMMDeviceId); - AndroidEnterpriseAPIImpl enterpriseService = new AndroidEnterpriseAPIImpl(); - token = enterpriseService.insertUser(user); - } - } - - - boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device); - if (status) { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(androidDevice.getDeviceIdentifier(), - device.getType()); - - //Immediately update location information from initial payload - DeviceLocation deviceLocation = extractLocation(deviceIdentifier, androidDevice.getProperties()); - if (deviceLocation != null) { - try { - DeviceInformationManager informationManager = AndroidAPIUtils - .getDeviceInformationManagerService(); - informationManager.addDeviceLocation(deviceLocation); - } catch (DeviceDetailsMgtException e) { - String msg = "Error occurred while updating the device location upon android " + - "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - } - - //Adding Tasks to get device information - List deviceIdentifiers = new ArrayList<>(); - deviceIdentifiers.add(deviceIdentifier); - - List taskOperaions = new ArrayList<>(); - taskOperaions.add(AndroidConstants.OperationCodes.APPLICATION_LIST); - taskOperaions.add(AndroidConstants.OperationCodes.DEVICE_INFO); - taskOperaions.add(AndroidConstants.OperationCodes.DEVICE_LOCATION); - - for (String str : taskOperaions) { - CommandOperation operation = new CommandOperation(); - operation.setEnabled(true); - operation.setType(Operation.Type.COMMAND); - operation.setCode(str); - AndroidAPIUtils.getDeviceManagementService(). - addOperation(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, - operation, deviceIdentifiers); - } - PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService(); - Policy effectivePolicy = policyManagerService. - getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.getType())); - - if (effectivePolicy != null) { - List effectiveProfileFeatures = effectivePolicy.getProfile(). - getProfileFeaturesList(); - for (ProfileFeature feature : effectiveProfileFeatures) { - if (AndroidConstants.ApplicationInstall.ENROLLMENT_APP_INSTALL_FEATURE_CODE - .equals(feature.getFeatureCode())) { - AndroidDeviceUtils.installEnrollmentApplications(feature, deviceIdentifier); - break; - } - } - } - - Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.OK.toString()); - if (token == null) { - responseMessage.setResponseMessage("Android device, which carries the id '" + - androidDevice.getDeviceIdentifier() + "' has successfully been enrolled"); - } else { - responseMessage.setResponseMessage("Google response token" + token); - } - return Response.status(Response.Status.OK).entity(responseMessage).build(); - } else { - Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - responseMessage.setResponseMessage("Failed to enroll '" + - device.getType() + "' device, which carries the id '" + - androidDevice.getDeviceIdentifier() + "'"); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(responseMessage).build(); - } + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Response response = androidService.enrollDevice(androidDevice); + return response; } catch (DeviceManagementException e) { String msg = "Error occurred while enrolling the android, which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (PolicyManagementException e) { - String msg = "Error occurred while enforcing default enrollment policy upon android " + - "', which carries the id '" + - androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (OperationManagementException e) { - String msg = "Error occurred while enforcing default enrollment policy upon android " + - "', which carries the id '" + - androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (InvalidDeviceException e) { - String msg = "Error occurred while enforcing default enrollment policy upon android " + - "', which carries the id '" + - androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (EnterpriseServiceException e) { - String msg = "Error occurred while adding user via Google Apis '" + - androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); } } @@ -386,20 +182,10 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { public Response isEnrolled(@PathParam("id") String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) { DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); try { - Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - if (device != null) { - String status = String.valueOf(device.getEnrolmentInfo().getStatus()); - Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.OK.toString()); - responseMessage - .setResponseMessage("Status of android device that carries the id '" + id + "' is " + status); - return Response.status(Response.Status.OK).entity(responseMessage).build(); - } else { - Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.NOT_FOUND.toString()); - responseMessage.setResponseMessage("No Android device is found upon the id '" + id + "'"); - return Response.status(Response.Status.NOT_FOUND).entity(responseMessage).build(); - } + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Message responseMessage = androidService.isEnrolled(id, deviceIdentifier); + return Response.status(Response.Status.NOT_FOUND).entity(responseMessage).build(); + } catch (DeviceManagementException e) { String msg = "Error occurred while checking enrollment status of the device."; log.error(msg, e); @@ -412,52 +198,8 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { @Path("/{id}") @Override public Response modifyEnrollment(@PathParam("id") String id, @Valid AndroidDevice androidDevice) { - Device device; - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(id); - deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID); - try { - device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + - id + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - - if (androidDevice == null) { - String errorMessage = "The payload of the android device enrollment is incorrect."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - if (device == null) { - String errorMessage = "The device to be modified doesn't exist."; - log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); - } - if(androidDevice.getEnrolmentInfo() != null){ - device.setEnrolmentInfo(device.getEnrolmentInfo()); - } - device.getEnrolmentInfo().setOwner(AndroidAPIUtils.getAuthenticatedUser()); - if(androidDevice.getDeviceInfo() != null) { - device.setDeviceInfo(androidDevice.getDeviceInfo()); - } - device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); - if(androidDevice.getDescription() != null) { - device.setDescription(androidDevice.getDescription()); - } - if(androidDevice.getName() != null) { - device.setName(androidDevice.getName()); - } - if(androidDevice.getFeatures() != null) { - device.setFeatures(androidDevice.getFeatures()); - } - if(androidDevice.getProperties() != null) { - device.setProperties(androidDevice.getProperties()); - } + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Device device = androidService.modifyEnrollment(id, androidDevice); boolean result; try { device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); @@ -488,11 +230,10 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { @Path("/{id}") @Override public Response disEnrollDevice(@PathParam("id") String id) { - boolean result; - DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); + try { - AndroidDeviceUtils.updateDisEnrollOperationStatus(deviceIdentifier); - result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + boolean result = androidService.disEnrollDevice(id); if (result) { String msg = "Android device that carries id '" + id + "' is successfully "; Message responseMessage = new Message(); @@ -514,58 +255,5 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } } - /** - * Extracts the device location - * - * @param deviceIdentifier - * @param properties - * @return returns null when location not found - */ - private DeviceLocation extractLocation(DeviceIdentifier deviceIdentifier, List properties) - throws DeviceManagementException { - - DeviceLocation location = null; - String latitude = "", longitude = "", altitude = "", speed = "", bearing = "", distance = ""; - if (properties == null) return null; - - for (Device.Property property : properties) { - String propertyName = property.getName(); - if (propertyName == null) continue; - if (propertyName.equals("LATITUDE")) { - latitude = property.getValue(); - } - if (propertyName.equals("LONGITUDE")) { - longitude = property.getValue(); - } - if (propertyName.equals("ALTITUDE")) { - altitude = property.getValue(); - } - if (propertyName.equals("SPEED")) { - speed = property.getValue(); - } - if (propertyName.equals("BEARING")) { - bearing = property.getValue(); - } - if (propertyName.equals("DISTANCE")) { - distance = property.getValue(); - } - } - - if (StringUtils.isNotBlank(latitude) && StringUtils.isNotBlank(longitude) && - StringUtils.isNotBlank(altitude) && StringUtils.isNotBlank(speed) && - StringUtils.isNotBlank(bearing) && StringUtils.isNotBlank(distance)) { - location = new DeviceLocation(); - location.setLatitude(Double.valueOf(latitude)); - location.setLongitude(Double.valueOf(longitude)); - location.setAltitude(Double.valueOf(altitude)); - location.setSpeed(Float.valueOf(speed)); - location.setBearing(Float.valueOf(bearing)); - location.setDistance(Double.valueOf(distance)); - location.setDeviceIdentifier(deviceIdentifier); - Device savedDevice = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false); - location.setDeviceId(savedDevice.getId()); - } - return location; - } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 82bd09b53..6da17c3ed 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -88,6 +88,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWra import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; @@ -120,34 +121,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { @Override public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) { try { - if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null - || fileTransferBeanWrapper.getDeviceIDs() == null) { - String errorMessage = "The payload of the file transfer operation is incorrect."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - if (log.isDebugEnabled()) { - log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); - } - FileTransfer file = fileTransferBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - if (fileTransferBeanWrapper.isUpload()) { - operation.setCode(AndroidConstants.OperationCodes.FILE_DOWNLOAD); - } else { - operation.setCode(AndroidConstants.OperationCodes.FILE_UPLOAD); - } - operation.setType(Operation.Type.PROFILE); - operation.setEnabled(true); - operation.setPayLoad(file.toJSON()); - Activity activity = AndroidDeviceUtils - .getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.fileTransfer(fileTransferBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance for file transfer operation"; log.error(errorMessage, e); @@ -165,25 +141,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) { - String errorMessage = "Lock bean is empty."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - DeviceLock lock = deviceLockBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCK); - operation.setType(Operation.Type.PROFILE); - operation.setEnabled(true); - operation.setPayLoad(lock.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.configureDeviceLock(deviceLockBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -201,17 +161,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK); - operation.setType(Operation.Type.COMMAND); - operation.setEnabled(true); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.configureDeviceUnlock(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -229,16 +181,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.getDeviceLocation(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -256,16 +201,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.removePassword(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance."; log.error(errorMessage, e); @@ -283,24 +221,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the configure camera operation is incorrect."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - Camera camera = cameraBeanWrapper.getOperation(); - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.CAMERA); - operation.setType(Operation.Type.COMMAND); - operation.setEnabled(camera.isEnabled()); - Activity activity = AndroidDeviceUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.configureCamera(cameraBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -318,16 +241,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.getDeviceInformation(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -344,16 +260,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.LOGCAT); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.getDeviceLogcat(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -370,16 +279,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.wipeDevice(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -397,24 +299,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (wipeDataBeanWrapper == null || wipeDataBeanWrapper.getOperation() == null) { - String errorMessage = "WipeData bean is empty."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - WipeData wipeData = wipeDataBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(wipeData.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.wipeData(wipeDataBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -432,16 +319,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.getApplications(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -459,16 +339,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.ringDevice(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -486,16 +359,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.rebootDevice(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -513,16 +379,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_TASK_MODE); - operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.changeLockTask(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -540,17 +399,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE); - operation.setType(Operation.Type.COMMAND); - operation.setEnabled(true); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.muteDevice(deviceIDs); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -569,31 +420,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (applicationInstallationBeanWrapper == null || applicationInstallationBeanWrapper.getOperation() == - null) { - String errorMessage = "The payload of the application installing operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - - ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); - validateApplicationUrl(applicationInstallation.getUrl()); - validateApplicationType(applicationInstallation.getType()); - validateScheduleDate(applicationInstallation.getSchedule()); - - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.INSTALL_APPLICATION); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(applicationInstallation.toJSON()); - Activity activity = AndroidDeviceUtils - .getOperationResponse(applicationInstallationBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.installApplication(applicationInstallationBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -611,30 +440,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (applicationUpdateBeanWrapper == null || applicationUpdateBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the application update operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); - validateApplicationUrl(applicationUpdate.getUrl()); - validateApplicationType(applicationUpdate.getType()); - validateScheduleDate(applicationUpdate.getSchedule()); - - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.UPDATE_APPLICATION); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(applicationUpdate.toJSON()); - - Activity activity = AndroidDeviceUtils - .getOperationResponse(applicationUpdateBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.updateApplication(applicationUpdateBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -653,28 +461,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (applicationUninstallationBeanWrapper == null || - applicationUninstallationBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the application uninstalling operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); - validateApplicationType(applicationUninstallation.getType()); - - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.UNINSTALL_APPLICATION); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(applicationUninstallation.toJSON()); - Activity activity = AndroidDeviceUtils - .getOperationResponse(applicationUninstallationBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.uninstallApplication(applicationUninstallationBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -692,25 +481,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (blacklistApplicationsBeanWrapper == null || blacklistApplicationsBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the blacklisting apps operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.BLACKLIST_APPLICATIONS); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(blacklistApplications.toJSON()); - Activity activity = AndroidDeviceUtils - .getOperationResponse(blacklistApplicationsBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.blacklistApplications(blacklistApplicationsBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -728,27 +501,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (upgradeFirmwareBeanWrapper == null || upgradeFirmwareBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the upgrade firmware operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); - validateScheduleDate(upgradeFirmware.getSchedule()); - - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.UPGRADE_FIRMWARE); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(upgradeFirmware.toJSON()); - Activity activity = AndroidDeviceUtils - .getOperationResponse(upgradeFirmwareBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.upgradeFirmware(upgradeFirmwareBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -766,24 +521,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (vpnConfiguration == null || vpnConfiguration.getOperation() == null) { - String errorMessage = "The payload of the VPN operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - Vpn vpn = vpnConfiguration.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.VPN); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(vpn.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(vpnConfiguration.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.configureVPN(vpnConfiguration); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -801,24 +541,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (notificationBeanWrapper == null || notificationBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the notification operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - Notification notification = notificationBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.NOTIFICATION); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(notification.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.sendNotification(notificationBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -836,25 +561,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (wifiBeanWrapper == null || wifiBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the wifi operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - Wifi wifi = wifiBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.WIFI); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(wifi.toJSON()); - - Activity activity = AndroidDeviceUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.configureWifi(wifiBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -872,24 +581,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (encryptionBeanWrapper == null || encryptionBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the device encryption operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); - CommandOperation operation = new CommandOperation(); - operation.setCode(AndroidConstants.OperationCodes.ENCRYPT_STORAGE); - operation.setType(Operation.Type.COMMAND); - operation.setEnabled(deviceEncryption.isEncrypted()); - Activity activity = AndroidDeviceUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.encryptStorage(encryptionBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -907,24 +601,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (lockCodeBeanWrapper == null || lockCodeBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the change lock code operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - LockCode lockCode = lockCodeBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_CODE); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(lockCode.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.changeLockCode(lockCodeBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -942,26 +621,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (passwordPolicyBeanWrapper == null || passwordPolicyBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the change password policy operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.PASSCODE_POLICY); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(passcodePolicy.toJSON()); - - Activity activity = AndroidDeviceUtils - .getOperationResponse(passwordPolicyBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.setPasswordPolicy(passwordPolicyBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -979,26 +641,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - - if (webClipBeanWrapper == null || webClipBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the add webclip operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - WebClip webClip = webClipBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.WEBCLIP); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(webClip.toJSON()); - - Activity activity = AndroidDeviceUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.setWebClip(webClipBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -1018,34 +663,9 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the global proxy operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); - } - - GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation(); - if (globalProxy.validateRequest()) { - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.GLOBAL_PROXY); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(globalProxy.toJSON()); - - Activity activity = AndroidDeviceUtils - .getOperationResponse(globalProxyBeanWrapper.getDeviceIDs(), operation); - return Response.status(Response.Status.CREATED).entity(activity).build(); - } else { - String errorMessage = "The payload of the global proxy operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); - } - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.setRecommendedGlobalProxy(globalProxyBeanWrapper); + return Response.status(Response.Status.CREATED).entity(activity).build(); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -1103,29 +723,10 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } try { - if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the display message operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST). - setMessage(errorMessage).build()); - } - DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.DISPLAY_MESSAGE_CONFIGURATION); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(configureDisplayMessage.toJSON()); - - Activity activity = AndroidDeviceUtils.getOperationResponse(displayMessageBeanWrapper. - getDeviceIDs(), operation); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Activity activity = androidService.configureDisplayMessage(displayMessageBeanWrapper); return Response.status(Response.Status.CREATED).entity(activity).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST). - setMessage(errorMessage).build()); } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); @@ -1135,60 +736,4 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } } - private static void validateApplicationUrl(String apkUrl) { - try { - URL url = new URL(apkUrl); - URLConnection conn = url.openConnection(); - if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) { - String errorMessage = "URL is not pointed to a downloadable file."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } catch (MalformedURLException e) { - String errorMessage = "Malformed application url."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } catch (IOException e) { - String errorMessage = "Invalid application url."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - private static void validateApplicationType(String type) { - if (type != null) { - if (!"enterprise".equalsIgnoreCase(type) - && !"public".equalsIgnoreCase(type) - && !"webapp".equalsIgnoreCase(type)) { - String errorMessage = "Invalid application type."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } else { - String errorMessage = "Application type is missing."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - private static void validateScheduleDate(String dateString) { - try { - if (dateString != null && !dateString.isEmpty()) { - SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); - sdf.setLenient(false); - sdf.parse(dateString); - } - } catch (ParseException e) { - String errorMessage = "Issue in validating the schedule date"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java index b2150f215..7635e1e8a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java @@ -72,7 +72,7 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP public Response getConfiguration( @HeaderParam("If-Modified-Since") String ifModifiedSince) { try { - AndroidService androidService = AndroidAPIUtils.getAndroidnService(); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); PlatformConfiguration platformConfiguration = androidService.getPlatformConfig(); return Response.status(Response.Status.OK).entity(platformConfiguration).build(); } catch (DeviceManagementException e) { @@ -89,7 +89,7 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP public Response updateConfiguration( @Valid AndroidPlatformConfiguration androidPlatformConfiguration) { try { - AndroidService androidService = AndroidAPIUtils.getAndroidnService(); + AndroidService androidService = AndroidAPIUtils.getAndroidService(); androidService.updateConfiguration(androidPlatformConfiguration); return Response.status(Response.Status.OK) .entity("Android platform configuration has been updated successfully.").build(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 3f3f85527..776ed4fed 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -38,6 +38,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWr import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; @@ -75,17 +76,8 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { } Device device; try { - if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { - return Response.status(Response.Status.ACCEPTED).entity("Event is publishing has not enabled.").build(); - } - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(), - AndroidConstants.DEVICE_TYPE_ANDROID); - device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){ - return Response.status(Response.Status.ACCEPTED).entity("Device is not in Active state.").build(); - } else if (device == null){ - return Response.status(Response.Status.ACCEPTED).entity("Device is not enrolled yet.").build(); - } + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + device = androidService.publishEvents(eventBeanWrapper); } catch (DeviceManagementException e) { log.error("Error occurred while checking Operation Analytics is Enabled.", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); @@ -142,94 +134,8 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { @QueryParam("type") String type, @HeaderParam("If-Modified-Since") String ifModifiedSince) { - if (from != 0l && to != 0l && deviceId != null) { - return retrieveAlertFromDate(deviceId, from, to); - } else if (deviceId != null && type != null) { - return retrieveAlertByType(deviceId, type); - } else if (deviceId != null) { - return retrieveAlert(deviceId); - } else { - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request must contain " + - "the device identifier. Optionally, both from and to value should be present to get " + - "alerts between times.").build()); - } - } - - private Response retrieveAlert(String deviceId) { - if (log.isDebugEnabled()) { - log.debug("Retrieving events for given device Identifier."); - } - String query = "deviceIdentifier:" + deviceId; - List deviceStates; - try { - deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); - if (deviceStates == null) { - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + - "published for Device: " + deviceId + ".").build()); - } else { - return Response.status(Response.Status.OK).entity(deviceStates).build(); - } - } catch (AnalyticsException e) { - String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - } - - private Response retrieveAlertFromDate(String deviceId, long from, long to) { - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - if (log.isDebugEnabled()) { - log.debug("Retrieving events for given device Identifier and time period."); - } - - String query = "deviceIdentifier:" + deviceId + " AND _timestamp: [" + fromDate + " TO " + toDate + "]"; - List deviceStates; - try { - deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); - if (deviceStates == null) { - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + - "published on given date for given Device: " + deviceId + ".").build()); - - } else { - return Response.status(Response.Status.OK).entity(deviceStates).build(); - } - } catch (AnalyticsException e) { - String msg = "Error occurred while getting published events for specific " + - "Device: " + deviceId + " on given Date."; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - } - - private Response retrieveAlertByType(String deviceId, String type) { - if (log.isDebugEnabled()) { - log.debug("Retrieving events for given device identifier and type."); - } - String query = "deviceIdentifier:" + deviceId + " AND type:" + type; - List deviceStates; - try { - deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); - if (deviceStates == null) { - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + - "published for given Device: '" + deviceId + "' and given specific Type.").build()); - - } else { - return Response.status(Response.Status.OK).entity(deviceStates).build(); - } - } catch (AnalyticsException e) { - String msg = "Error occurred while getting published events for specific " + - "Device: " + deviceId + "and given specific Type."; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Response response = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); + return response; } - } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index 406038e79..b9bb0923a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -17,10 +17,31 @@ package org.wso2.carbon.device.mgt.mobile.android.common.spi; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +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.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.GoogleAppSyncResponse; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.*; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; + +import javax.validation.Valid; +import javax.validation.constraints.Size; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; +import java.util.List; public interface AndroidService { @@ -28,4 +49,90 @@ public interface AndroidService { void updateConfiguration(AndroidPlatformConfiguration androidPlatformConfiguration) throws AndroidDeviceMgtPluginException; + + Message isEnrolled(String id, DeviceIdentifier deviceIdentifier) throws DeviceManagementException; + + Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) throws OperationManagementException; + + Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) throws OperationManagementException; + + Activity configureDeviceUnlock(List deviceIDs) throws OperationManagementException; + + Activity getDeviceLocation(List deviceIDs) throws OperationManagementException; + + Activity removePassword(List deviceIDs) throws OperationManagementException; + + Activity configureCamera(CameraBeanWrapper cameraBeanWrapper) throws OperationManagementException; + + Activity getDeviceInformation(List deviceIDs) throws OperationManagementException; + + Activity getDeviceLogcat(List deviceIDs) throws OperationManagementException; + + Activity wipeDevice(List deviceIDs) throws OperationManagementException; + + Activity wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) throws OperationManagementException; + + Activity getApplications(List deviceIDs) throws OperationManagementException; + + Activity ringDevice(List deviceIDs) throws OperationManagementException; + + Activity rebootDevice(List deviceIDs) throws OperationManagementException; + + Activity changeLockTask(List deviceIDs) throws OperationManagementException; + + Activity muteDevice(List deviceIDs) throws OperationManagementException; + + Activity installApplication(ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper) + throws OperationManagementException; + + Activity updateApplication(ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper) + throws OperationManagementException; + + Activity uninstallApplication(ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper) + throws OperationManagementException; + + Activity blacklistApplications(@Valid BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) + throws OperationManagementException; + + Activity upgradeFirmware(UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper) + throws OperationManagementException; + + Activity configureVPN(VpnBeanWrapper vpnConfiguration) throws OperationManagementException; + + Activity sendNotification(NotificationBeanWrapper notificationBeanWrapper) + throws OperationManagementException; + + Activity configureWifi(WifiBeanWrapper wifiBeanWrapper) throws OperationManagementException; + + Activity encryptStorage(EncryptionBeanWrapper encryptionBeanWrapper) throws OperationManagementException; + + Activity changeLockCode(LockCodeBeanWrapper lockCodeBeanWrapper) throws OperationManagementException; + + Activity setPasswordPolicy(PasswordPolicyBeanWrapper passwordPolicyBeanWrapper) throws OperationManagementException; + + Activity setWebClip(WebClipBeanWrapper webClipBeanWrapper) throws OperationManagementException; + + Activity setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) throws OperationManagementException; + + Activity configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) throws OperationManagementException; + + //DeviceManagementAPIImpl + Message updateApplicationList(String id, List androidApplications) throws ApplicationManagementException; + + void getPendingOperations(String id, List resultOperations) throws DeviceManagementException; + + Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException; + + Device modifyEnrollment(String id, AndroidDevice androidDevice); + + boolean disEnrollDevice(String id) throws DeviceManagementException; + + //EventReceiverAPI + Device publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException; + + Response retrieveAlerts(String deviceId, + long from, + long to, + String type, + String ifModifiedSince); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index 78077948f..b05728fe5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -17,40 +17,77 @@ package org.wso2.carbon.device.mgt.mobile.android.core.impl; +import com.google.api.services.androidenterprise.model.ProductsListResponse; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpStatus; +import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; import org.wso2.carbon.base.ServerConfiguration; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; 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.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.app.mgt.Application; 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.device.details.DeviceLocation; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; +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.Policy; +import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; +import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; +import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.NotifierFrequency; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.GoogleAPIInvoker; +import org.wso2.carbon.device.mgt.mobile.android.common.Message; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.*; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.*; +import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.*; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; +import org.wso2.carbon.policy.mgt.common.PolicyManagementException; +import org.wso2.carbon.policy.mgt.core.PolicyManagerService; +import javax.ws.rs.InternalServerErrorException; import javax.ws.rs.core.Response; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import static com.hazelcast.aws.impl.Constants.DATE_FORMAT; + public class AndroidServiceImpl implements AndroidService { private static final Log log = LogFactory.getLog(AndroidServiceImpl.class); + private static final String OPERATION_ERROR_STATUS = "ERROR"; + public static final String GOOGLE_AFW_EMM_ANDROID_ID = "googleEMMAndroidId"; + public static final String GOOGLE_AFW_DEVICE_ID = "googleEMMDeviceId"; + + private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; + @Override public PlatformConfiguration getPlatformConfig() throws DeviceManagementException { List configs; @@ -181,4 +218,1277 @@ public class AndroidServiceImpl implements AndroidService { operation, deviceIdList); } } + + @Override + public Message isEnrolled(String id, DeviceIdentifier deviceIdentifier) throws DeviceManagementException { + Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + if (device != null) { + String status = String.valueOf(device.getEnrolmentInfo().getStatus()); + Message responseMessage = new Message(); + responseMessage.setResponseCode(Response.Status.OK.toString()); + responseMessage + .setResponseMessage("Status of android device that carries the id '" + id + "' is " + status); + return responseMessage; + } else { + Message responseMessage = new Message(); + responseMessage.setResponseCode(Response.Status.NOT_FOUND.toString()); + responseMessage.setResponseMessage("No Android device is found upon the id '" + id + "'"); + return responseMessage; + } + } + + @Override + public Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) throws OperationManagementException { + if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null + || fileTransferBeanWrapper.getDeviceIDs() == null) { + String errorMessage = "The payload of the file transfer operation is incorrect."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + if (log.isDebugEnabled()) { + log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); + } + FileTransfer file = fileTransferBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + if (fileTransferBeanWrapper.isUpload()) { + operation.setCode(AndroidConstants.OperationCodes.FILE_DOWNLOAD); + } else { + operation.setCode(AndroidConstants.OperationCodes.FILE_UPLOAD); + } + operation.setType(Operation.Type.PROFILE); + operation.setEnabled(true); + operation.setPayLoad(file.toJSON()); + + try { + Activity activity = AndroidDeviceUtils + .getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) throws OperationManagementException { + if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) { + String errorMessage = "Lock bean is empty."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + DeviceLock lock = deviceLockBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCK); + operation.setType(Operation.Type.PROFILE); + operation.setEnabled(true); + operation.setPayLoad(lock.toJSON()); + + try { + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity configureDeviceUnlock(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK); + operation.setType(Operation.Type.COMMAND); + operation.setEnabled(true); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity getDeviceLocation(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity removePassword(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity configureCamera(CameraBeanWrapper cameraBeanWrapper) throws OperationManagementException { + try { + if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the configure camera operation is incorrect."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + Camera camera = cameraBeanWrapper.getOperation(); + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.CAMERA); + operation.setType(Operation.Type.COMMAND); + operation.setEnabled(camera.isEnabled()); + Activity activity = AndroidDeviceUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity getDeviceInformation(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity getDeviceLogcat(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.LOGCAT); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity wipeDevice(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) throws OperationManagementException { + try { + if (wipeDataBeanWrapper == null || wipeDataBeanWrapper.getOperation() == null) { + String errorMessage = "WipeData bean is empty."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + WipeData wipeData = wipeDataBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(wipeData.toJSON()); + Activity activity = AndroidDeviceUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity getApplications(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity ringDevice(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity rebootDevice(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity changeLockTask(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_TASK_MODE); + operation.setType(Operation.Type.COMMAND); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity muteDevice(List deviceIDs) throws OperationManagementException { + try { + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE); + operation.setType(Operation.Type.COMMAND); + operation.setEnabled(true); + Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity installApplication(ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper) + throws OperationManagementException { + try { + if (applicationInstallationBeanWrapper == null || applicationInstallationBeanWrapper.getOperation() == + null) { + String errorMessage = "The payload of the application installing operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + + ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); + validateApplicationUrl(applicationInstallation.getUrl()); + validateApplicationType(applicationInstallation.getType()); + validateScheduleDate(applicationInstallation.getSchedule()); + + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.INSTALL_APPLICATION); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(applicationInstallation.toJSON()); + Activity activity = AndroidDeviceUtils + .getOperationResponse(applicationInstallationBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity updateApplication(ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper) throws OperationManagementException { + try { + if (applicationUpdateBeanWrapper == null || applicationUpdateBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the application update operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); + validateApplicationUrl(applicationUpdate.getUrl()); + validateApplicationType(applicationUpdate.getType()); + validateScheduleDate(applicationUpdate.getSchedule()); + + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.UPDATE_APPLICATION); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(applicationUpdate.toJSON()); + + Activity activity = AndroidDeviceUtils + .getOperationResponse(applicationUpdateBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity uninstallApplication(ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper) throws OperationManagementException { + try { + if (applicationUninstallationBeanWrapper == null || + applicationUninstallationBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the application uninstalling operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); + validateApplicationType(applicationUninstallation.getType()); + + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.UNINSTALL_APPLICATION); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(applicationUninstallation.toJSON()); + Activity activity = AndroidDeviceUtils + .getOperationResponse(applicationUninstallationBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity blacklistApplications(BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) throws OperationManagementException { + try { + if (blacklistApplicationsBeanWrapper == null || blacklistApplicationsBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the blacklisting apps operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.BLACKLIST_APPLICATIONS); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(blacklistApplications.toJSON()); + Activity activity = AndroidDeviceUtils + .getOperationResponse(blacklistApplicationsBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity upgradeFirmware(UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper) throws OperationManagementException { + try { + if (upgradeFirmwareBeanWrapper == null || upgradeFirmwareBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the upgrade firmware operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); + validateScheduleDate(upgradeFirmware.getSchedule()); + + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.UPGRADE_FIRMWARE); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(upgradeFirmware.toJSON()); + Activity activity = AndroidDeviceUtils + .getOperationResponse(upgradeFirmwareBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity configureVPN(VpnBeanWrapper vpnConfiguration) throws OperationManagementException { + try { + if (vpnConfiguration == null || vpnConfiguration.getOperation() == null) { + String errorMessage = "The payload of the VPN operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + Vpn vpn = vpnConfiguration.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.VPN); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(vpn.toJSON()); + Activity activity = AndroidDeviceUtils.getOperationResponse(vpnConfiguration.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity sendNotification(NotificationBeanWrapper notificationBeanWrapper) throws OperationManagementException { + try { + if (notificationBeanWrapper == null || notificationBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the notification operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + Notification notification = notificationBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.NOTIFICATION); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(notification.toJSON()); + Activity activity = AndroidDeviceUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity configureWifi(WifiBeanWrapper wifiBeanWrapper) throws OperationManagementException { + try { + if (wifiBeanWrapper == null || wifiBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the wifi operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + Wifi wifi = wifiBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.WIFI); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(wifi.toJSON()); + + Activity activity = AndroidDeviceUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity encryptStorage(EncryptionBeanWrapper encryptionBeanWrapper) throws OperationManagementException { + try { + if (encryptionBeanWrapper == null || encryptionBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the device encryption operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); + CommandOperation operation = new CommandOperation(); + operation.setCode(AndroidConstants.OperationCodes.ENCRYPT_STORAGE); + operation.setType(Operation.Type.COMMAND); + operation.setEnabled(deviceEncryption.isEncrypted()); + Activity activity = AndroidDeviceUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity changeLockCode(LockCodeBeanWrapper lockCodeBeanWrapper) throws OperationManagementException { + try { + if (lockCodeBeanWrapper == null || lockCodeBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the change lock code operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + LockCode lockCode = lockCodeBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_CODE); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(lockCode.toJSON()); + Activity activity = AndroidDeviceUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity setPasswordPolicy(PasswordPolicyBeanWrapper passwordPolicyBeanWrapper) throws OperationManagementException { + try { + if (passwordPolicyBeanWrapper == null || passwordPolicyBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the change password policy operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.PASSCODE_POLICY); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(passcodePolicy.toJSON()); + + Activity activity = AndroidDeviceUtils + .getOperationResponse(passwordPolicyBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity setWebClip(WebClipBeanWrapper webClipBeanWrapper) throws OperationManagementException { + try { + + if (webClipBeanWrapper == null || webClipBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the add webclip operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + WebClip webClip = webClipBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.WEBCLIP); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(webClip.toJSON()); + + Activity activity = AndroidDeviceUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(), operation); + return activity; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + @Override + public Activity setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) throws OperationManagementException { + try { + if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the global proxy operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + } + + GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation(); + if (globalProxy.validateRequest()) { + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.GLOBAL_PROXY); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(globalProxy.toJSON()); + + Activity activity = AndroidDeviceUtils + .getOperationResponse(globalProxyBeanWrapper.getDeviceIDs(), operation); + return activity; + } else { + String errorMessage = "The payload of the global proxy operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + } + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + } + } + + + @Override + public Activity configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) throws OperationManagementException { + try { + if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the display message operation is incorrect"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST). + setMessage(errorMessage).build()); + } + DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.DISPLAY_MESSAGE_CONFIGURATION); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(configureDisplayMessage.toJSON()); + + Activity activity = AndroidDeviceUtils.getOperationResponse(displayMessageBeanWrapper. + getDeviceIDs(), operation); + return activity; + + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST). + setMessage(errorMessage).build()); + } + } + + + + @Override + public Message updateApplicationList(String id, List androidApplications) throws org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException { + Application application; + List applications = new ArrayList<>(); + for (AndroidApplication androidApplication : androidApplications) { + application = new Application(); + application.setPlatform(androidApplication.getPlatform()); + application.setCategory(androidApplication.getCategory()); + application.setName(androidApplication.getName()); + application.setLocationUrl(androidApplication.getLocationUrl()); + application.setImageUrl(androidApplication.getImageUrl()); + application.setVersion(androidApplication.getVersion()); + application.setType(androidApplication.getType()); + application.setAppProperties(androidApplication.getAppProperties()); + application.setApplicationIdentifier(androidApplication.getApplicationIdentifier()); + application.setMemoryUsage(androidApplication.getMemoryUsage()); + applications.add(application); + } + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(id); + deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + + AndroidAPIUtils.getApplicationManagerService(). + updateApplicationListInstalledInDevice(deviceIdentifier, applications); + Message responseMessage = new Message(); + responseMessage.setResponseMessage("Device information has modified successfully."); + return responseMessage; + } + + @Override + public void getPendingOperations(String id, List resultOperations) throws DeviceManagementException { + DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); + if (!AndroidDeviceUtils.isValidDeviceIdentifier(deviceIdentifier)) { + String msg = "Device not found for identifier '" + id + "'"; + log.error(msg); + throw new NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()); + } + if (log.isDebugEnabled()) { + log.debug("Invoking Android pending operations:" + id); + } + if (resultOperations != null && !resultOperations.isEmpty()) { + try { + updateOperations(id, resultOperations); + } catch (OperationManagementException e) { + String msg = "Issue in retrieving operation management service instance"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (PolicyComplianceException e) { + String msg = "Issue in updating Monitoring operation"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (DeviceManagementException e) { + String msg = "Issue in retrieving device management service instance"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException e) { + String msg = "Issue in retrieving application management service instance"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (NotificationManagementException e) { + String msg = "Issue in retrieving Notification management service instance"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + } + } + + @Override + public Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException { + try { + String token = null; + Device device = new Device(); + device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + device.setEnrolmentInfo(androidDevice.getEnrolmentInfo()); + device.getEnrolmentInfo().setOwner(AndroidAPIUtils.getAuthenticatedUser()); + device.setDeviceInfo(androidDevice.getDeviceInfo()); + device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); + device.setDescription(androidDevice.getDescription()); + device.setName(androidDevice.getName()); + device.setFeatures(androidDevice.getFeatures()); + device.setProperties(androidDevice.getProperties()); + + String googleEMMAndroidId = null; + String googleEMMDeviceId = null; + if (androidDevice.getProperties() != null) { + for (Device.Property property : androidDevice.getProperties()) { + if (property.getName().equals(GOOGLE_AFW_EMM_ANDROID_ID)) { + googleEMMAndroidId = property.getValue(); + } else if (property.getName().equals(GOOGLE_AFW_DEVICE_ID)) { + googleEMMDeviceId = property.getValue(); + } + } + + if (googleEMMAndroidId != null && googleEMMDeviceId != null) { + EnterpriseUser user = new EnterpriseUser(); + user.setAndroidPlayDeviceId(googleEMMAndroidId); + user.setEmmDeviceIdentifier(googleEMMDeviceId); + try { + token = insertUser(user); + } catch (EnterpriseServiceException e) { + + } + } + } + + + boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device); + if (status) { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(androidDevice.getDeviceIdentifier(), + device.getType()); + + //Immediately update location information from initial payload + DeviceLocation deviceLocation = extractLocation(deviceIdentifier, androidDevice.getProperties()); + if (deviceLocation != null) { + try { + DeviceInformationManager informationManager = AndroidAPIUtils + .getDeviceInformationManagerService(); + informationManager.addDeviceLocation(deviceLocation); + } catch (DeviceDetailsMgtException e) { + String msg = "Error occurred while updating the device location upon android " + + "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + } + + //Adding Tasks to get device information + List deviceIdentifiers = new ArrayList<>(); + deviceIdentifiers.add(deviceIdentifier); + + List taskOperaions = new ArrayList<>(); + taskOperaions.add(AndroidConstants.OperationCodes.APPLICATION_LIST); + taskOperaions.add(AndroidConstants.OperationCodes.DEVICE_INFO); + taskOperaions.add(AndroidConstants.OperationCodes.DEVICE_LOCATION); + + for (String str : taskOperaions) { + CommandOperation operation = new CommandOperation(); + operation.setEnabled(true); + operation.setType(Operation.Type.COMMAND); + operation.setCode(str); + AndroidAPIUtils.getDeviceManagementService(). + addOperation(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, + operation, deviceIdentifiers); + } + PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService(); + Policy effectivePolicy = policyManagerService. + getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.getType())); + + if (effectivePolicy != null) { + List effectiveProfileFeatures = effectivePolicy.getProfile(). + getProfileFeaturesList(); + for (ProfileFeature feature : effectiveProfileFeatures) { + if (AndroidConstants.ApplicationInstall.ENROLLMENT_APP_INSTALL_FEATURE_CODE + .equals(feature.getFeatureCode())) { + AndroidDeviceUtils.installEnrollmentApplications(feature, deviceIdentifier); + break; + } + } + } + + Message responseMessage = new Message(); + responseMessage.setResponseCode(Response.Status.OK.toString()); + if (token == null) { + responseMessage.setResponseMessage("Android device, which carries the id '" + + androidDevice.getDeviceIdentifier() + "' has successfully been enrolled"); + } else { + responseMessage.setResponseMessage("Google response token" + token); + } + return Response.status(Response.Status.OK).entity(responseMessage).build(); + } else { + Message responseMessage = new Message(); + responseMessage.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); + responseMessage.setResponseMessage("Failed to enroll '" + + device.getType() + "' device, which carries the id '" + + androidDevice.getDeviceIdentifier() + "'"); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(responseMessage).build(); + } + } catch (PolicyManagementException e) { + String msg = "Error occurred while enforcing default enrollment policy upon android " + + "', which carries the id '" + + androidDevice.getDeviceIdentifier() + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (OperationManagementException e) { + String msg = "Error occurred while enforcing default enrollment policy upon android " + + "', which carries the id '" + + androidDevice.getDeviceIdentifier() + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (InvalidDeviceException e) { + String msg = "Error occurred while enforcing default enrollment policy upon android " + + "', which carries the id '" + + androidDevice.getDeviceIdentifier() + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + } + + @Override + public Device modifyEnrollment(String id, AndroidDevice androidDevice){ + Device device; + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(id); + deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID); + try { + device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + } catch (DeviceManagementException e) { + String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + + id + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + + if (androidDevice == null) { + String errorMessage = "The payload of the android device enrollment is incorrect."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + if (device == null) { + String errorMessage = "The device to be modified doesn't exist."; + log.error(errorMessage); + throw new NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); + } + if(androidDevice.getEnrolmentInfo() != null){ + device.setEnrolmentInfo(device.getEnrolmentInfo()); + } + device.getEnrolmentInfo().setOwner(AndroidAPIUtils.getAuthenticatedUser()); + if(androidDevice.getDeviceInfo() != null) { + device.setDeviceInfo(androidDevice.getDeviceInfo()); + } + device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); + if(androidDevice.getDescription() != null) { + device.setDescription(androidDevice.getDescription()); + } + if(androidDevice.getName() != null) { + device.setName(androidDevice.getName()); + } + if(androidDevice.getFeatures() != null) { + device.setFeatures(androidDevice.getFeatures()); + } + if(androidDevice.getProperties() != null) { + device.setProperties(androidDevice.getProperties()); + } + return device; + } + + @Override + public boolean disEnrollDevice(String id) throws DeviceManagementException{ + boolean result; + DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); + AndroidDeviceUtils.updateDisEnrollOperationStatus(deviceIdentifier); + result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); + return result; + } + + @Override + public Device publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException{ + Device device; + if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { + String msg = "Event is publishing has not enabled."; + log.error(msg); + throw new DeviceManagementException(msg); } + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(), + AndroidConstants.DEVICE_TYPE_ANDROID); + device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){ + String msg = "Device is not in Active state."; + log.error(msg); + throw new DeviceManagementException(msg); + } else if (device == null){ + String msg = "Device is not enrolled yet."; + log.error(msg); + throw new DeviceManagementException(msg); + } + + return device; + } + + @Override + public Response retrieveAlerts(String deviceId, + long from, + long to, + String type, + String ifModifiedSince) { + if (from != 0l && to != 0l && deviceId != null) { + return retrieveAlertFromDate(deviceId, from, to); + } else if (deviceId != null && type != null) { + return retrieveAlertByType(deviceId, type); + } else if (deviceId != null) { + return retrieveAlert(deviceId); + } else { + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request must contain " + + "the device identifier. Optionally, both from and to value should be present to get " + + "alerts between times.").build()); + } + } + + private Response retrieveAlert(String deviceId) { + if (log.isDebugEnabled()) { + log.debug("Retrieving events for given device Identifier."); + } + String query = "deviceIdentifier:" + deviceId; + List deviceStates; + try { + deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); + if (deviceStates == null) { + throw new NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + + "published for Device: " + deviceId + ".").build()); + } else { + return Response.status(Response.Status.OK).entity(deviceStates).build(); + } + } catch (AnalyticsException e) { + String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + } + + private Response retrieveAlertFromDate(String deviceId, long from, long to) { + String fromDate = String.valueOf(from); + String toDate = String.valueOf(to); + if (log.isDebugEnabled()) { + log.debug("Retrieving events for given device Identifier and time period."); + } + + String query = "deviceIdentifier:" + deviceId + " AND _timestamp: [" + fromDate + " TO " + toDate + "]"; + List deviceStates; + try { + deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); + if (deviceStates == null) { + throw new NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + + "published on given date for given Device: " + deviceId + ".").build()); + + } else { + return Response.status(Response.Status.OK).entity(deviceStates).build(); + } + } catch (AnalyticsException e) { + String msg = "Error occurred while getting published events for specific " + + "Device: " + deviceId + " on given Date."; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + } + + private Response retrieveAlertByType(String deviceId, String type) { + if (log.isDebugEnabled()) { + log.debug("Retrieving events for given device identifier and type."); + } + String query = "deviceIdentifier:" + deviceId + " AND type:" + type; + List deviceStates; + try { + deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); + if (deviceStates == null) { + throw new NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + + "published for given Device: '" + deviceId + "' and given specific Type.").build()); + + } else { + return Response.status(Response.Status.OK).entity(deviceStates).build(); + } + } catch (AnalyticsException e) { + String msg = "Error occurred while getting published events for specific " + + "Device: " + deviceId + "and given specific Type."; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } + } + + private void updateOperations(String deviceId, List operations) + throws OperationManagementException, PolicyComplianceException, + org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException, NotificationManagementException, DeviceManagementException { + for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : operations) { + AndroidDeviceUtils.updateOperation(deviceId, operation); + if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { + org.wso2.carbon.device.mgt.common.notification.mgt.Notification notification = new + org.wso2.carbon.device.mgt.common.notification.mgt.Notification(); + DeviceIdentifier id = new DeviceIdentifier(); + id.setId(deviceId); + id.setType(AndroidConstants.DEVICE_TYPE_ANDROID); + String deviceName = AndroidAPIUtils.getDeviceManagementService().getDevice(id, false).getName(); + notification.setOperationId(operation.getId()); + notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. + Status.NEW.toString()); + notification.setDescription(operation.getCode() + " operation failed to execute on device " + + deviceName + " (ID: " + deviceId + ")"); + AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); + } + if (log.isDebugEnabled()) { + log.debug("Updating operation '" + operation.toString() + "'"); + } + } + } + + /** + * Extracts the device location + * + * @param deviceIdentifier + * @param properties + * @return returns null when location not found + */ + private DeviceLocation extractLocation(DeviceIdentifier deviceIdentifier, List properties) + throws DeviceManagementException { + + DeviceLocation location = null; + String latitude = "", longitude = "", altitude = "", speed = "", bearing = "", distance = ""; + + if (properties == null) return null; + + for (Device.Property property : properties) { + String propertyName = property.getName(); + if (propertyName == null) continue; + if (propertyName.equals("LATITUDE")) { + latitude = property.getValue(); + } + if (propertyName.equals("LONGITUDE")) { + longitude = property.getValue(); + } + if (propertyName.equals("ALTITUDE")) { + altitude = property.getValue(); + } + if (propertyName.equals("SPEED")) { + speed = property.getValue(); + } + if (propertyName.equals("BEARING")) { + bearing = property.getValue(); + } + if (propertyName.equals("DISTANCE")) { + distance = property.getValue(); + } + } + + if (StringUtils.isNotBlank(latitude) && StringUtils.isNotBlank(longitude) && + StringUtils.isNotBlank(altitude) && StringUtils.isNotBlank(speed) && + StringUtils.isNotBlank(bearing) && StringUtils.isNotBlank(distance)) { + location = new DeviceLocation(); + location.setLatitude(Double.valueOf(latitude)); + location.setLongitude(Double.valueOf(longitude)); + location.setAltitude(Double.valueOf(altitude)); + location.setSpeed(Float.valueOf(speed)); + location.setBearing(Float.valueOf(bearing)); + location.setDistance(Double.valueOf(distance)); + location.setDeviceIdentifier(deviceIdentifier); + Device savedDevice = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false); + location.setDeviceId(savedDevice.getId()); + } + return location; + } + + private int recursiveSync(GoogleAPIInvoker googleAPIInvoker, String enterpriseId, ProductsListResponse + productsListResponse) throws EnterpriseServiceException, ApplicationManagementException { + // Are there more pages + if (productsListResponse == null || productsListResponse.getTokenPagination() == null + || productsListResponse.getTokenPagination().getNextPageToken() == null) { + return 0; + } + + // Get next page + ProductsListResponse productsListResponseNext = googleAPIInvoker.listProduct(enterpriseId, + productsListResponse.getTokenPagination().getNextPageToken()); + AndroidEnterpriseUtils.persistApp(productsListResponseNext); + if (productsListResponseNext != null && productsListResponseNext.getTokenPagination() != null && + productsListResponseNext.getTokenPagination().getNextPageToken() != null) { + return recursiveSync(googleAPIInvoker, enterpriseId, productsListResponseNext) + + productsListResponseNext.getProduct().size(); + } else { + return productsListResponseNext.getProduct().size(); + } + } + + public String insertUser(EnterpriseUser enterpriseUser) throws EnterpriseServiceException { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + String token; + boolean deviceIdExist = false; + + String googleUserId; + List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() + .getEnterpriseUser(CarbonContext.getThreadLocalCarbonContext().getUsername()); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + if (androidEnterpriseUsers != null && androidEnterpriseUsers.size() > 0) { + googleUserId = androidEnterpriseUsers.get(0).getGoogleUserId(); + // If this device is also present, only need to provide a token for this request. + for (AndroidEnterpriseUser enterprise : androidEnterpriseUsers) { + if (enterprise.getEmmDeviceId() != null + && enterprise.getEmmDeviceId().equals(enterpriseUser.getAndroidPlayDeviceId())) { + deviceIdExist = true; + } + } + } else { + googleUserId = googleAPIInvoker.insertUser(enterpriseConfigs.getEnterpriseId(), CarbonContext + .getThreadLocalCarbonContext() + .getUsername()); + } + // Fetching an auth token from Google EMM API + token = googleAPIInvoker.getToken(enterpriseConfigs.getEnterpriseId(), googleUserId); + + if (!deviceIdExist) { + AndroidEnterpriseUser androidEnterpriseUser = new AndroidEnterpriseUser(); + androidEnterpriseUser.setEmmUsername(CarbonContext.getThreadLocalCarbonContext().getUsername()); + androidEnterpriseUser.setTenantId(CarbonContext.getThreadLocalCarbonContext().getTenantId()); + androidEnterpriseUser.setAndroidPlayDeviceId(enterpriseUser.getAndroidPlayDeviceId()); + androidEnterpriseUser.setEnterpriseId(enterpriseConfigs.getEnterpriseId()); + androidEnterpriseUser.setEmmDeviceId(enterpriseUser.getEmmDeviceIdentifier()); + androidEnterpriseUser.setGoogleUserId(googleUserId); + + AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser); + } + + return token; + + } + + + private static void validateApplicationUrl(String apkUrl) { + try { + URL url = new URL(apkUrl); + URLConnection conn = url.openConnection(); + if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) { + String errorMessage = "URL is not pointed to a downloadable file."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } catch (MalformedURLException e) { + String errorMessage = "Malformed application url."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } catch (IOException e) { + String errorMessage = "Invalid application url."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + private static void validateApplicationType(String type) { + if (type != null) { + if (!"enterprise".equalsIgnoreCase(type) + && !"public".equalsIgnoreCase(type) + && !"webapp".equalsIgnoreCase(type)) { + String errorMessage = "Invalid application type."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } else { + String errorMessage = "Application type is missing."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } + + private static void validateScheduleDate(String dateString) { + try { + if (dateString != null && !dateString.isEmpty()) { + SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); + sdf.setLenient(false); + sdf.parse(dateString); + } + } catch (ParseException e) { + String errorMessage = "Issue in validating the schedule date"; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java index 5fe4f401d..63abcfdf7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java @@ -69,7 +69,7 @@ public class AndroidAPIUtils { return androidPluginService; } - public static AndroidService getAndroidnService() { + public static AndroidService getAndroidService() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); AndroidService androidService = (AndroidService) ctx.getOSGiService(AndroidService.class, null); if (androidService == null) { @@ -79,7 +79,7 @@ public class AndroidAPIUtils { } return androidService; } - + public static String getAuthenticatedUser() { PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); String username = threadLocalCarbonContext.getUsername(); From acbfdad962c3b2f182eb3ad532d7a98e874baa31 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Sun, 1 Dec 2019 09:05:21 +0530 Subject: [PATCH 03/30] Fix test failures in Android plugins --- .../api/impl/DeviceManagementAPIImpl.java | 66 +-- .../exception/NotFoundExceptionDup.java | 32 + .../android/common/spi/AndroidService.java | 7 +- .../android/core/impl/AndroidServiceImpl.java | 186 +++--- .../DeviceManagementAdminServiceTests.java | 516 ++++++++-------- .../core/DeviceManagementServiceTests.java | 552 +++++++++--------- .../android/core/mokcs/utils/TestUtils.java | 18 +- 7 files changed, 667 insertions(+), 710 deletions(-) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 66e775611..f958dd87a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -34,42 +34,24 @@ */ package org.wso2.carbon.device.mgt.mobile.android.api.impl; -import org.apache.commons.lang.StringUtils; +import com.google.api.client.http.HttpStatusCodes; 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.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; -import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; 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.Policy; -import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; -import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; -import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; -import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; -import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.mobile.android.api.DeviceManagementAPI; -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import javax.validation.Valid; import javax.validation.constraints.NotNull; @@ -87,7 +69,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.ArrayList; import java.util.List; @Path("/devices") @@ -129,31 +110,24 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { log.error(msg); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } - DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); try { AndroidService androidService = AndroidAPIUtils.getAndroidService(); - androidService.getPendingOperations(id, resultOperations); - } catch (DeviceManagementException e) { - String msg = "Issue in retrieving device management service instance"; + List pendingOperations = androidService + .getPendingOperations(id, resultOperations, disableGoogleApps); + return Response.status(Response.Status.CREATED).entity(pendingOperations).build(); + } catch (InvalidDeviceException e) { + String msg = "Device identifier is invalid. Device identifier " + id; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - - List pendingOperations; - try { - pendingOperations = AndroidDeviceUtils.getPendingOperations(deviceIdentifier, !disableGoogleApps); - } catch (OperationManagementException e) { - String msg = "Issue in retrieving operation management service instance"; + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } catch (DeviceManagementException e) { + String msg = "Error occurred while getting pending operations of the device."; log.error(msg, e); throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()); } - return Response.status(Response.Status.CREATED).entity(pendingOperations).build(); } - - @POST @Override public Response enrollDevice(@Valid AndroidDevice androidDevice) { @@ -184,13 +158,13 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { try { AndroidService androidService = AndroidAPIUtils.getAndroidService(); Message responseMessage = androidService.isEnrolled(id, deviceIdentifier); - return Response.status(Response.Status.NOT_FOUND).entity(responseMessage).build(); - + return Response.status(Integer.parseInt(responseMessage.getResponseCode())).entity(responseMessage).build(); } catch (DeviceManagementException e) { String msg = "Error occurred while checking enrollment status of the device."; log.error(msg, e); throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()); } } @@ -198,13 +172,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { @Path("/{id}") @Override public Response modifyEnrollment(@PathParam("id") String id, @Valid AndroidDevice androidDevice) { - AndroidService androidService = AndroidAPIUtils.getAndroidService(); - Device device = androidService.modifyEnrollment(id, androidDevice); - boolean result; try { - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - result = AndroidAPIUtils.getDeviceManagementService().modifyEnrollment(device); - if (result) { + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + if (androidService.modifyEnrollment(id, androidDevice)) { Message responseMessage = new Message(); responseMessage.setResponseCode(Response.Status.ACCEPTED.toString()); responseMessage.setResponseMessage("Enrollment of Android device that " + @@ -230,11 +200,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { @Path("/{id}") @Override public Response disEnrollDevice(@PathParam("id") String id) { - try { AndroidService androidService = AndroidAPIUtils.getAndroidService(); - boolean result = androidService.disEnrollDevice(id); - if (result) { + if (androidService.disEnrollDevice(id)) { String msg = "Android device that carries id '" + id + "' is successfully "; Message responseMessage = new Message(); responseMessage.setResponseCode(Response.Status.OK.toString()); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java new file mode 100644 index 000000000..6d0f90cef --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java @@ -0,0 +1,32 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you 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.android.common.exception; + +/** + * Represents the exception thrown during validating the request. + */ +public class NotFoundExceptionDup extends AndroidDeviceMgtPluginException { + + public NotFoundExceptionDup(String message, Throwable ex) { + super(message, ex); + } + + public NotFoundExceptionDup(String message) { + super(message); + } +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index b9bb0923a..04e5039a3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -22,6 +22,8 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; +import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; 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; @@ -119,11 +121,12 @@ public interface AndroidService { //DeviceManagementAPIImpl Message updateApplicationList(String id, List androidApplications) throws ApplicationManagementException; - void getPendingOperations(String id, List resultOperations) throws DeviceManagementException; + List getPendingOperations(String id, List resultOperations, boolean disableGoogleApps) + throws DeviceManagementException, InvalidDeviceException; Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException; - Device modifyEnrollment(String id, AndroidDevice androidDevice); + boolean modifyEnrollment(String id, AndroidDevice androidDevice) throws DeviceManagementException; boolean disEnrollDevice(String id) throws DeviceManagementException; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index b05728fe5..aed7c4170 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -17,6 +17,7 @@ package org.wso2.carbon.device.mgt.mobile.android.core.impl; +import com.google.api.client.http.HttpStatusCodes; import com.google.api.services.androidenterprise.model.ProductsListResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -35,6 +36,7 @@ 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.device.details.DeviceLocation; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; @@ -261,9 +263,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setPayLoad(file.toJSON()); try { - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); @@ -288,8 +289,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setPayLoad(lock.toJSON()); try { - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -305,8 +305,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK); operation.setType(Operation.Type.COMMAND); operation.setEnabled(true); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -321,8 +320,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -337,8 +335,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -361,8 +358,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.CAMERA); operation.setType(Operation.Type.COMMAND); operation.setEnabled(camera.isEnabled()); - Activity activity = AndroidDeviceUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -377,8 +373,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -393,8 +388,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.LOGCAT); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -409,8 +403,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -433,8 +426,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(wipeData.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -449,8 +441,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -465,8 +456,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -481,8 +471,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -497,8 +486,7 @@ public class AndroidServiceImpl implements AndroidService { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_TASK_MODE); operation.setType(Operation.Type.COMMAND); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -514,8 +502,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE); operation.setType(Operation.Type.COMMAND); operation.setEnabled(true); - Activity activity = AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(deviceIDs, operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -545,9 +532,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.INSTALL_APPLICATION); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationInstallation.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(applicationInstallationBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -575,9 +561,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationUpdate.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(applicationUpdateBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -603,9 +588,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.UNINSTALL_APPLICATION); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationUninstallation.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(applicationUninstallationBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -628,9 +612,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.BLACKLIST_APPLICATIONS); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(blacklistApplications.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(blacklistApplicationsBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -655,9 +638,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.UPGRADE_FIRMWARE); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(upgradeFirmware.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(upgradeFirmwareBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -680,8 +662,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.VPN); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(vpn.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(vpnConfiguration.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(vpnConfiguration.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -704,8 +685,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.NOTIFICATION); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(notification.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -729,8 +709,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(wifi.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -753,8 +732,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.ENCRYPT_STORAGE); operation.setType(Operation.Type.COMMAND); operation.setEnabled(deviceEncryption.isEncrypted()); - Activity activity = AndroidDeviceUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -777,8 +755,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_CODE); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(lockCode.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -802,9 +779,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(passcodePolicy.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(passwordPolicyBeanWrapper.getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -829,8 +805,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(webClip.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(), operation); - return activity; + return AndroidDeviceUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(), operation); } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); @@ -856,9 +831,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(globalProxy.toJSON()); - Activity activity = AndroidDeviceUtils + return AndroidDeviceUtils .getOperationResponse(globalProxyBeanWrapper.getDeviceIDs(), operation); - return activity; } else { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); @@ -890,9 +864,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(configureDisplayMessage.toJSON()); - Activity activity = AndroidDeviceUtils.getOperationResponse(displayMessageBeanWrapper. + return AndroidDeviceUtils.getOperationResponse(displayMessageBeanWrapper. getDeviceIDs(), operation); - return activity; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; @@ -935,47 +908,67 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public void getPendingOperations(String id, List resultOperations) throws DeviceManagementException { - DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); + public List getPendingOperations(String deviceId, List resultOperations, + boolean disableGoogleApps) throws DeviceManagementException, InvalidDeviceException { + DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(deviceId); if (!AndroidDeviceUtils.isValidDeviceIdentifier(deviceIdentifier)) { - String msg = "Device not found for identifier '" + id + "'"; + String msg = "Device not found for identifier '" + deviceId + "'"; log.error(msg); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()); + throw new InvalidDeviceException(msg); } if (log.isDebugEnabled()) { - log.debug("Invoking Android pending operations:" + id); + log.debug("Invoking Android pending operations:" + deviceId); } if (resultOperations != null && !resultOperations.isEmpty()) { try { - updateOperations(id, resultOperations); + for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : resultOperations) { + AndroidDeviceUtils.updateOperation(deviceId, operation); + if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { + org.wso2.carbon.device.mgt.common.notification.mgt.Notification notification = new org.wso2.carbon.device.mgt.common.notification.mgt.Notification(); + DeviceIdentifier id = new DeviceIdentifier(); + id.setId(deviceId); + id.setType(AndroidConstants.DEVICE_TYPE_ANDROID); + String deviceName = AndroidAPIUtils.getDeviceManagementService().getDevice(id, false).getName(); + notification.setOperationId(operation.getId()); + notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. + Status.NEW.toString()); + notification.setDescription( + operation.getCode() + " operation failed to execute on device " + deviceName + " (ID: " + + deviceId + ")"); + AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); + } + if (log.isDebugEnabled()) { + log.debug("Updating operation '" + operation.toString() + "'"); + } + } } catch (OperationManagementException e) { String msg = "Issue in retrieving operation management service instance"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new DeviceManagementException(msg, e); } catch (PolicyComplianceException e) { String msg = "Issue in updating Monitoring operation"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (DeviceManagementException e) { - String msg = "Issue in retrieving device management service instance"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new DeviceManagementException(msg, e); } catch (org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException e) { String msg = "Issue in retrieving application management service instance"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new DeviceManagementException(msg, e); } catch (NotificationManagementException e) { String msg = "Issue in retrieving Notification management service instance"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new DeviceManagementException(msg, e); } } + + try { + return AndroidDeviceUtils.getPendingOperations(deviceIdentifier, !disableGoogleApps); + } catch (OperationManagementException e) { + String msg = "Issue in retrieving operation management service instance"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()); + } } @Override @@ -1114,7 +1107,7 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public Device modifyEnrollment(String id, AndroidDevice androidDevice){ + public boolean modifyEnrollment(String id, AndroidDevice androidDevice) throws DeviceManagementException { Device device; DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(id); @@ -1161,16 +1154,14 @@ public class AndroidServiceImpl implements AndroidService { if(androidDevice.getProperties() != null) { device.setProperties(androidDevice.getProperties()); } - return device; + return AndroidAPIUtils.getDeviceManagementService().modifyEnrollment(device); } @Override public boolean disEnrollDevice(String id) throws DeviceManagementException{ - boolean result; DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); AndroidDeviceUtils.updateDisEnrollOperationStatus(deviceIdentifier); - result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); - return result; + return AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); } @Override @@ -1292,31 +1283,6 @@ public class AndroidServiceImpl implements AndroidService { } } - private void updateOperations(String deviceId, List operations) - throws OperationManagementException, PolicyComplianceException, - org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException, NotificationManagementException, DeviceManagementException { - for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : operations) { - AndroidDeviceUtils.updateOperation(deviceId, operation); - if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { - org.wso2.carbon.device.mgt.common.notification.mgt.Notification notification = new - org.wso2.carbon.device.mgt.common.notification.mgt.Notification(); - DeviceIdentifier id = new DeviceIdentifier(); - id.setId(deviceId); - id.setType(AndroidConstants.DEVICE_TYPE_ANDROID); - String deviceName = AndroidAPIUtils.getDeviceManagementService().getDevice(id, false).getName(); - notification.setOperationId(operation.getId()); - notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. - Status.NEW.toString()); - notification.setDescription(operation.getCode() + " operation failed to execute on device " + - deviceName + " (ID: " + deviceId + ")"); - AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); - } - if (log.isDebugEnabled()) { - log.debug("Updating operation '" + operation.toString() + "'"); - } - } - } - /** * Extracts the device location * @@ -1402,7 +1368,7 @@ public class AndroidServiceImpl implements AndroidService { List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() .getEnterpriseUser(CarbonContext.getThreadLocalCarbonContext().getUsername()); GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); - if (androidEnterpriseUsers != null && androidEnterpriseUsers.size() > 0) { + if (androidEnterpriseUsers != null && !androidEnterpriseUsers.isEmpty()) { googleUserId = androidEnterpriseUsers.get(0).getGoogleUserId(); // If this device is also present, only need to provide a token for this request. for (AndroidEnterpriseUser enterprise : androidEnterpriseUsers) { @@ -1430,9 +1396,7 @@ public class AndroidServiceImpl implements AndroidService { AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser); } - return token; - } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java index 4c1e432b4..d67ad8ab0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java @@ -18,294 +18,290 @@ package org.wso2.carbon.device.mgt.mobile.android.core; +import org.junit.Assert; +import org.junit.Test; import org.mockito.MockitoAnnotations; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.testng.PowerMockObjectFactory; -import org.testng.Assert; import org.testng.IObjectFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; -import org.testng.annotations.Test; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.mobile.android.core.impl.AndroidServiceImpl; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceManagementProviderServiceMock; -import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils.TestUtils; - -import javax.ws.rs.core.Response; +import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"}) @PrepareForTest(AndroidAPIUtils.class) public class DeviceManagementAdminServiceTests { -// private DeviceManagementAdminServiceImpl deviceManagementAdminService; + private AndroidServiceImpl androidService; @ObjectFactory public IObjectFactory getObjectFactory() { return new PowerMockObjectFactory(); } -// @BeforeClass -// public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// MockitoAnnotations.initMocks(this); -// deviceManagementAdminService = new DeviceManagementAdminServiceImpl(); -// } + @BeforeClass + public void init() { + MockitoAnnotations.initMocks(this); + androidService = new AndroidServiceImpl(); + } - private void mockDeviceManagementService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockDeviceManagementService() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) .toReturn(new DeviceManagementProviderServiceMock()); } -// @Test -// public void testConfigureDeviceLock() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testConfigureDeviceUnlock() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.configureDeviceUnlock(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetDeviceLocation() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.getDeviceLocation(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testRemovePassword() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.removePassword(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testConfigureCamera() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.configureCamera(TestUtils.getCamerabeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetDeviceInformation() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.getDeviceInformation(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetDeviceLogcat() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.getDeviceLogcat(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testWipeDevice() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.wipeDevice(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testWipeData() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.wipeData(TestUtils.getWipeDataBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetApplications() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.getApplications(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testRingDevice() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.ringDevice(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testRebootDevice() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.rebootDevice(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testChangeLockTask() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.changeLockTask(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testMuteDevice() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.muteDevice(TestUtils.getDeviceIds()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testInstallApplication() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService -// .installApplication(TestUtils.getApplicationInstallationBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testUpdateApplication() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testUninstallApplicationPublic() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService -// .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testUninstallApplicationWebApp() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService -// .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testBlacklistApplications() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService -// .blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testUpgradeFirmware() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testConfigureVPN() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.configureVPN(TestUtils.getVpnBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testSendNotification() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.sendNotification(TestUtils.getNotificationBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testConfigureWifi() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.configureWifi(TestUtils.getWifiBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testEncryptStorage() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.encryptStorage(TestUtils.getEncryptionBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testChangeLockCode() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.changeLockCode(TestUtils.getLockCodeBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testSetPasswordPolicy() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testSetWebClip() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementAdminService.setWebClip(TestUtils.getWebClipBeanWrapper()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } + @Test + public void testConfigureDeviceLock() throws OperationManagementException { + mockDeviceManagementService(); + Activity activity = androidService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } -} + @Test + public void testConfigureDeviceUnlock() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.configureDeviceUnlock(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testGetDeviceLocation() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.getDeviceLocation(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testRemovePassword() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.removePassword(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testConfigureCamera() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.configureCamera(TestUtils.getCamerabeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testGetDeviceInformation() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.getDeviceInformation(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testGetDeviceLogcat() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.getDeviceLogcat(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testWipeDevice() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.wipeDevice(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testWipeData() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.wipeData(TestUtils.getWipeDataBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testGetApplications() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.getApplications(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testRingDevice() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.ringDevice(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testRebootDevice() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.rebootDevice(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testChangeLockTask() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.changeLockTask(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + @Test + public void testMuteDevice() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.muteDevice(TestUtils.getDeviceIds()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testInstallApplication() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService + .installApplication(TestUtils.getApplicationInstallationBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testUpdateApplication() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testUninstallApplicationPublic() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService + .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testUninstallApplicationWebApp() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService + .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testBlacklistApplications() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService + .blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testUpgradeFirmware() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testConfigureVPN() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.configureVPN(TestUtils.getVpnBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testSendNotification() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.sendNotification(TestUtils.getNotificationBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testConfigureWifi() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.configureWifi(TestUtils.getWifiBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testEncryptStorage() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.encryptStorage(TestUtils.getEncryptionBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testChangeLockCode() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.changeLockCode(TestUtils.getLockCodeBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testSetPasswordPolicy() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } + + @Test + public void testSetWebClip() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Activity activity = androidService.setWebClip(TestUtils.getWebClipBeanWrapper()); + Assert.assertNotNull(activity); + Assert.assertNotNull(activity.getActivityId()); + } +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java index 9ce61820d..ead8db2d2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java @@ -29,10 +29,14 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; +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.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; +import org.wso2.carbon.device.mgt.mobile.android.core.impl.AndroidServiceImpl; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.ApplicationManagementProviderServiceMock; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceInformationManagerServiceMock; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceManagementProviderServiceMock; @@ -49,285 +53,275 @@ import java.util.List; @PrepareForTest(AndroidAPIUtils.class) public class DeviceManagementServiceTests { -// private DeviceManagementServiceImpl deviceManagementService; - -// @ObjectFactory -// public IObjectFactory getObjectFactory() { -// return new PowerMockObjectFactory(); -// } - -// @BeforeClass -// public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// MockitoAnnotations.initMocks(this); -// deviceManagementService = new DeviceManagementServiceImpl(); -// } - -// private void mockDeviceManagementService() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) -// .toReturn(new DeviceManagementProviderServiceMock()); -// } -// -// private void mockApplicationManagerService() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getApplicationManagerService")) -// .toReturn(new ApplicationManagementProviderServiceMock()); -// } -// -// private void mockPolicyManagerService() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getPolicyManagerService")) -// .toReturn(new PolicyManagerServiceMock()); -// } -// -// private void mockDeviceInformationManagerService() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceInformationManagerService")) -// .toReturn(new DeviceInformationManagerServiceMock()); -// } -// -// private void mockNotificationManagementService() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getNotificationManagementService")) -// .toReturn(new NotificationManagementServiceMock()); -// } -// -// private void mockUser() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getAuthenticatedUser")) -// .toReturn("admin"); -// } -// -// @Test -// public void testUpdateApplicationList() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockApplicationManagerService(); -// Response response = deviceManagementService -// .updateApplicationList(TestUtils.getDeviceId(), TestUtils.getAndroidApplications()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsForNullDevice() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// Response response = deviceManagementService -// .getPendingOperations(true, null, null, null); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsInvalidDevice() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService -// .getPendingOperations(true, "1234", null, null); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsNullResponse() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService -// .getPendingOperations(true, TestUtils.getDeviceId(), null, null); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsWithMonitorResponse() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockPolicyManagerService(); -// Response response = deviceManagementService -// .getPendingOperations(true, TestUtils.getDeviceId(), null, -// TestUtils.getSuccessMonitorOperationResponse()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsWithApplicationResponse() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockApplicationManagerService(); -// Response response = deviceManagementService -// .getPendingOperations(true, TestUtils.getDeviceId(), null, -// TestUtils.getSuccessApplicationOperationResponse()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsWithDeviceInfoResponse() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockDeviceInformationManagerService(); -// Response response = deviceManagementService -// .getPendingOperations(true, TestUtils.getDeviceId(), null, -// TestUtils.getSuccessInfoOperationResponse()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsWithInProgressResponse() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService -// .getPendingOperations(true, TestUtils.getDeviceId(), null, -// TestUtils.getInProgressOperationResponse()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testGetPendingOperationsWithErrorResponse() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockNotificationManagementService(); -// Response response = deviceManagementService -// .getPendingOperations(true, TestUtils.getDeviceId(), null, -// TestUtils.getErrorOperationResponse()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); -// } -// -// @Test -// public void testEnrollDeviceWithoutLocationSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockPolicyManagerService(); -// mockUser(); -// Response response = deviceManagementService.enrollDevice(TestUtils.getBasicAndroidDevice()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); -// } -// -// @Test -// public void testEnrollDeviceWithLocationSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockDeviceInformationManagerService(); -// mockPolicyManagerService(); -// mockUser(); -// AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); -// -// List properties = new ArrayList<>(); -// Device.Property property = new Device.Property(); -// property.setName("LATITUDE"); -// property.setValue("79.5"); -// properties.add(property); -// property = new Device.Property(); -// property.setName("LONGITUDE"); -// property.setValue("6.9"); -// properties.add(property); -// property = new Device.Property(); -// property.setName("ALTITUDE"); -// property.setValue("-59.8373726"); -// properties.add(property); -// property = new Device.Property(); -// property.setName("SPEED"); -// property.setValue("0.5123423333"); -// properties.add(property); -// property = new Device.Property(); -// property.setName("BEARING"); -// property.setValue("44.0"); -// properties.add(property); -// property = new Device.Property(); -// property.setName("DISTANCE"); -// property.setValue("44.0"); -// properties.add(property); -// androidDevice.setProperties(properties); -// -// Response response = deviceManagementService.enrollDevice(androidDevice); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); -// } -// -// @Test -// public void testEnrollDeviceUnSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockUser(); -// AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); -// androidDevice.setDeviceIdentifier("1234"); -// Response response = deviceManagementService.enrollDevice(androidDevice); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); -// } -// -// @Test -// public void testIsEnrolledExists() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService.isEnrolled(TestUtils.getDeviceId(), null); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); -// } -// -// @Test -// public void testIsEnrolledNonExist() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService.isEnrolled("1234", null); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); -// } -// -// @Test -// public void testIsEnrolledNull() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService.isEnrolled(null, null); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); -// } -// -// @Test -// public void testModifyEnrollmentSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockUser(); -// Response response = deviceManagementService -// .modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode()); -// } -// -// @Test -// public void testModifyEnrollmentUnSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// mockUser(); -// AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); -// androidDevice.setDeviceIdentifier("1234"); -// Response response = deviceManagementService -// .modifyEnrollment(TestUtils.getDeviceId(), androidDevice); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode()); -// } -// -// @Test -// public void testDisEnrollDeviceSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService.disEnrollDevice(TestUtils.getDeviceId()); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); -// } -// -// @Test -// public void testDisenrollUnSuccess() -// throws DeviceManagementException, OperationManagementException, InvalidDeviceException { -// mockDeviceManagementService(); -// Response response = deviceManagementService.disEnrollDevice("1234"); -// Assert.assertNotNull(response); -// Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); -// } + private AndroidServiceImpl androidService; + @ObjectFactory + public IObjectFactory getObjectFactory() { + return new PowerMockObjectFactory(); + } + + @BeforeClass + public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + MockitoAnnotations.initMocks(this); + androidService = new AndroidServiceImpl(); + } + + private void mockDeviceManagementService() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) + .toReturn(new DeviceManagementProviderServiceMock()); + } + + private void mockApplicationManagerService() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getApplicationManagerService")) + .toReturn(new ApplicationManagementProviderServiceMock()); + } + + private void mockPolicyManagerService() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getPolicyManagerService")) + .toReturn(new PolicyManagerServiceMock()); + } + + private void mockDeviceInformationManagerService() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceInformationManagerService")) + .toReturn(new DeviceInformationManagerServiceMock()); + } + + private void mockNotificationManagementService() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getNotificationManagementService")) + .toReturn(new NotificationManagementServiceMock()); + } + + private void mockUser() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getAuthenticatedUser")) + .toReturn("admin"); + } + + @Test + public void testUpdateApplicationList() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + ApplicationManagementException { + mockApplicationManagerService(); + Message message = androidService + .updateApplicationList(TestUtils.getDeviceId(), TestUtils.getAndroidApplications()); + Assert.assertNotNull(message); + Assert.assertEquals(message.getResponseCode(), Response.Status.ACCEPTED.toString()); + } + + @Test (expectedExceptions = {InvalidDeviceException.class}) + public void testGetPendingOperationsForNullDevice() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + List resultOperations = new ArrayList<>(); + androidService.getPendingOperations(null, resultOperations, true); + } + + @Test (expectedExceptions = {InvalidDeviceException.class}) + public void testGetPendingOperationsForInvalidDevice() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + List resultOperations = new ArrayList<>(); + androidService.getPendingOperations("1234", resultOperations, true); + } + + @Test + public void testGetPendingOperationsNullResponse() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + List pendingOperations = androidService + .getPendingOperations(TestUtils.getDeviceId(), null, true); + Assert.assertNotNull(pendingOperations); + Assert.assertFalse((pendingOperations.isEmpty())); + } + + @Test + public void testGetPendingOperationsWithMonitorResponse() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockPolicyManagerService(); + List pendingOperations = androidService + .getPendingOperations(TestUtils.getDeviceId(), TestUtils.getSuccessMonitorOperationResponse(), true); + Assert.assertNotNull(pendingOperations); + Assert.assertFalse((pendingOperations.isEmpty())); + } + + @Test + public void testGetPendingOperationsWithApplicationResponse() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockApplicationManagerService(); + List pendingOperations = androidService + .getPendingOperations(TestUtils.getDeviceId(), TestUtils.getSuccessApplicationOperationResponse(), + true); + Assert.assertNotNull(pendingOperations); + Assert.assertFalse((pendingOperations.isEmpty())); + } + + @Test + public void testGetPendingOperationsWithDeviceInfoResponse() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockDeviceInformationManagerService(); + List pendingOperations = androidService + .getPendingOperations(TestUtils.getDeviceId(), + TestUtils.getSuccessInfoOperationResponse(), true); + Assert.assertNotNull(pendingOperations); + Assert.assertFalse((pendingOperations.isEmpty())); + } + + @Test + public void testGetPendingOperationsWithInProgressResponse() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + List pendingOperations = androidService + .getPendingOperations(TestUtils.getDeviceId(), + TestUtils.getInProgressOperationResponse(), true); + Assert.assertNotNull(pendingOperations); + Assert.assertFalse((pendingOperations.isEmpty())); + } + + @Test + public void testGetPendingOperationsWithErrorResponse() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockNotificationManagementService(); + List pendingOperations = androidService + .getPendingOperations(TestUtils.getDeviceId(), + TestUtils.getErrorOperationResponse(), true); + Assert.assertNotNull(pendingOperations); + Assert.assertFalse((pendingOperations.isEmpty())); + } + + @Test + public void testEnrollDeviceWithoutLocationSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockPolicyManagerService(); + mockUser(); + Response response = androidService.enrollDevice(TestUtils.getBasicAndroidDevice()); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + } + + @Test + public void testEnrollDeviceWithLocationSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockDeviceInformationManagerService(); + mockPolicyManagerService(); + mockUser(); + AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); + + List properties = new ArrayList<>(); + Device.Property property = new Device.Property(); + property.setName("LATITUDE"); + property.setValue("79.5"); + properties.add(property); + property = new Device.Property(); + property.setName("LONGITUDE"); + property.setValue("6.9"); + properties.add(property); + property = new Device.Property(); + property.setName("ALTITUDE"); + property.setValue("-59.8373726"); + properties.add(property); + property = new Device.Property(); + property.setName("SPEED"); + property.setValue("0.5123423333"); + properties.add(property); + property = new Device.Property(); + property.setName("BEARING"); + property.setValue("44.0"); + properties.add(property); + property = new Device.Property(); + property.setName("DISTANCE"); + property.setValue("44.0"); + properties.add(property); + androidDevice.setProperties(properties); + + Response response = androidService.enrollDevice(androidDevice); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + } + + @Test + public void testEnrollDeviceUnSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockUser(); + AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); + androidDevice.setDeviceIdentifier("1234"); + Response response = androidService.enrollDevice(androidDevice); + Assert.assertNotNull(response); + Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + } + + @Test + public void testIsEnrolledExists() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Message message = androidService.isEnrolled(TestUtils.getDeviceId(), null); + Assert.assertNotNull(message); + Assert.assertEquals(message.getResponseCode(), Response.Status.OK.toString()); + } + + @Test + public void testIsEnrolledNonExist() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Message message = androidService.isEnrolled("1234", null); + Assert.assertNotNull(message); + Assert.assertEquals(message.getResponseCode(), Response.Status.NOT_FOUND.toString()); + } + + @Test + public void testIsEnrolledNull() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + Message response = androidService.isEnrolled(null, null); + Assert.assertNotNull(response); + Assert.assertEquals(response.getResponseCode(), Response.Status.NOT_FOUND.toString()); + } + + @Test + public void testModifyEnrollmentSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockUser(); + boolean status = androidService.modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice()); + Assert.assertTrue(status); + } + + @Test + public void testModifyEnrollmentUnSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + mockUser(); + AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); + androidDevice.setDeviceIdentifier("1234"); + boolean status = androidService + .modifyEnrollment(TestUtils.getDeviceId(), androidDevice); + Assert.assertFalse(status); + } + + @Test + public void testDisEnrollDeviceSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + boolean status = androidService.disEnrollDevice(TestUtils.getDeviceId()); + Assert.assertTrue(status); + } + + @Test + public void testDisEnrollUnSuccess() + throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + mockDeviceManagementService(); + boolean status = androidService.disEnrollDevice("1234"); + Assert.assertFalse(status); + } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java index 2a0bb71ea..61169ecfa 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/mokcs/utils/TestUtils.java @@ -18,7 +18,6 @@ package org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils; -import javafx.scene.Camera; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; @@ -32,6 +31,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstalla import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate; import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.Camera; import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption; import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock; import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode; @@ -108,14 +108,14 @@ public class TestUtils { return deviceLockBeanWrapper; } -// public static CameraBeanWrapper getCamerabeanWrapper() { -// CameraBeanWrapper cameraBeanWrapper = new CameraBeanWrapper(); -// cameraBeanWrapper.setDeviceIDs(getDeviceIds()); -// Camera camera = new Camera(); -// camera.setEnabled(false); -// cameraBeanWrapper.setOperation(camera); -// return cameraBeanWrapper; -// } + public static CameraBeanWrapper getCamerabeanWrapper() { + CameraBeanWrapper cameraBeanWrapper = new CameraBeanWrapper(); + cameraBeanWrapper.setDeviceIDs(getDeviceIds()); + Camera camera = new Camera(); + camera.setEnabled(false); + cameraBeanWrapper.setOperation(camera); + return cameraBeanWrapper; + } public static WipeDataBeanWrapper getWipeDataBeanWrapper() { WipeDataBeanWrapper wipeDataBeanWrapper = new WipeDataBeanWrapper(); From 70c980f46f166a215ed342a3d8ec61bfb00e220a Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 3 Dec 2019 11:21:14 +0530 Subject: [PATCH 04/30] Replace BadRequestException in Android APIs --- .../api/impl/DeviceManagementAPIImpl.java | 14 + .../impl/DeviceManagementAdminAPIImpl.java | 530 +++++++++++++++--- .../api/impl/EventReceiverAPIImpl.java | 26 +- .../android/common/spi/AndroidService.java | 484 +++++++++++++--- .../android/core/impl/AndroidServiceImpl.java | 283 +++++----- 5 files changed, 1045 insertions(+), 292 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index f958dd87a..633d37231 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -47,7 +47,9 @@ import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -193,6 +195,18 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 6da17c3ed..a7032677e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -35,6 +35,7 @@ */ package org.wso2.carbon.device.mgt.mobile.android.api.impl; +import com.google.api.client.http.HttpStatusCodes; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; @@ -86,7 +87,9 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrap import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -127,8 +130,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance for file transfer operation"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e) { + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing file tranfer operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -147,8 +163,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing device lock operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -167,8 +196,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing device unlock operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -187,8 +229,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while retrieving device location"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -207,8 +262,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance."; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing remove password operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -227,8 +295,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing control camera operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -248,6 +329,18 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while retrieving device information"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -267,6 +360,18 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while retrieving device logcat"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -285,8 +390,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing enterprice wipe device operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -305,8 +423,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing Android wipe-data device operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -325,8 +456,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing Android getApplicationList device operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -345,8 +489,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing Android ring device operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -365,8 +522,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing Android reboot device operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -385,8 +555,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing Android change LockTask mode operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -405,8 +588,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing mute device operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -426,8 +622,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing install application operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -446,8 +655,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing update application operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -467,8 +689,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing uninstall application operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -487,8 +722,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing blacklist application operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -507,8 +755,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing upgrade firmware operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -527,8 +788,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing configure vpn operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -547,8 +821,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing send notification operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -567,8 +854,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing configure wifi operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -587,8 +887,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing encrypt operation operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -607,8 +920,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing change lock code operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -627,8 +953,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing set password policy operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -647,8 +986,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing set webclip operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -669,8 +1021,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500L).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while applying 'configure-global-proxy' operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @POST @@ -682,35 +1047,22 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { log.debug("Invoking 'send application configuration' operation"); } - try { - if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the application configuration operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(applicationRestriction.toJSON()); - return (Response) AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(), - operation); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; + try{ + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Response response = androidService.sendApplicationConfiguration(applicationRestrictionBeanWrapper); + return Response.status(Response.Status.CREATED).entity(response).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while sending app configuration"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -730,9 +1082,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder(). - setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR).setMessage(errorMessage).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing configure-display-message operation"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 776ed4fed..4d55877c7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.device.mgt.mobile.android.api.impl; +import com.google.api.client.http.HttpStatusCodes; import com.google.gson.Gson; import com.google.gson.JsonObject; import org.apache.commons.logging.Log; @@ -35,9 +36,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWrapper; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.*; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; @@ -133,9 +132,22 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { @Size(min = 2, max = 45) @QueryParam("type") String type, @HeaderParam("If-Modified-Since") String ifModifiedSince) { - - AndroidService androidService = AndroidAPIUtils.getAndroidService(); - Response response = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); - return response; + try{ + AndroidService androidService = AndroidAPIUtils.getAndroidService(); + Response response = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); + return response; + } catch (BadRequestExceptionDup e){ + String msg = "Invalid request"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while retrieving alerts"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index 04e5039a3..b6565ad95 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -35,6 +35,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl; import org.wso2.carbon.device.mgt.mobile.android.common.bean.GoogleAppSyncResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.*; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import javax.validation.Valid; @@ -47,95 +48,438 @@ import java.util.List; public interface AndroidService { + /** + * Method to retrieve platform configurations + * + * @return {@link PlatformConfiguration} + * @throws {@link DeviceManagementException} + */ PlatformConfiguration getPlatformConfig() throws DeviceManagementException; + /** + * Method to update configurations + * + * @param androidPlatformConfiguration + * @throws {@link AndroidDeviceMgtPluginException} + */ void updateConfiguration(AndroidPlatformConfiguration androidPlatformConfiguration) throws AndroidDeviceMgtPluginException; - Message isEnrolled(String id, DeviceIdentifier deviceIdentifier) throws DeviceManagementException; - - Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) throws OperationManagementException; - - Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) throws OperationManagementException; - - Activity configureDeviceUnlock(List deviceIDs) throws OperationManagementException; - - Activity getDeviceLocation(List deviceIDs) throws OperationManagementException; - - Activity removePassword(List deviceIDs) throws OperationManagementException; - - Activity configureCamera(CameraBeanWrapper cameraBeanWrapper) throws OperationManagementException; - - Activity getDeviceInformation(List deviceIDs) throws OperationManagementException; - - Activity getDeviceLogcat(List deviceIDs) throws OperationManagementException; - - Activity wipeDevice(List deviceIDs) throws OperationManagementException; - - Activity wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) throws OperationManagementException; - - Activity getApplications(List deviceIDs) throws OperationManagementException; - - Activity ringDevice(List deviceIDs) throws OperationManagementException; - - Activity rebootDevice(List deviceIDs) throws OperationManagementException; - - Activity changeLockTask(List deviceIDs) throws OperationManagementException; - - Activity muteDevice(List deviceIDs) throws OperationManagementException; - + /** + * Method for file transfer operation + * + * @param fileTransferBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) + throws AndroidDeviceMgtPluginException, OperationManagementException; + + /** + * Method for device lock operation + * + * @param deviceLockBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for device unlock operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity configureDeviceUnlock(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for get device location operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity getDeviceLocation(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for remove password operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity removePassword(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for configure camera operation + * + * @param cameraBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity configureCamera(CameraBeanWrapper cameraBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method to get device information + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity getDeviceInformation(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method to get device logcat + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity getDeviceLogcat(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for wipe device operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity wipeDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for wipe data operation + * + * @param wipeDataBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for get applications operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity getApplications(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for ring device operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity ringDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for reboot device operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity rebootDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for change lock task operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity changeLockTask(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for mute device operation + * + * @param deviceIDs + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity muteDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for install application operation + * + * @param applicationInstallationBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ Activity installApplication(ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper) - throws OperationManagementException; - + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for update application operation + * + * @param applicationUpdateBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ Activity updateApplication(ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper) - throws OperationManagementException; - + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for uninstall application operation + * + * @param applicationUninstallationBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ Activity uninstallApplication(ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper) - throws OperationManagementException; - + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for blacklist application operation + * + * @param blacklistApplicationsBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ Activity blacklistApplications(@Valid BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) - throws OperationManagementException; - + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for upgrade firmware operation + * + * @param upgradeFirmwareBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ Activity upgradeFirmware(UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper) - throws OperationManagementException; - - Activity configureVPN(VpnBeanWrapper vpnConfiguration) throws OperationManagementException; - + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for configure vpn operation + * + * @param vpnConfiguration + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity configureVPN(VpnBeanWrapper vpnConfiguration) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for send notification operation + * + * @param notificationBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ Activity sendNotification(NotificationBeanWrapper notificationBeanWrapper) - throws OperationManagementException; - - Activity configureWifi(WifiBeanWrapper wifiBeanWrapper) throws OperationManagementException; - - Activity encryptStorage(EncryptionBeanWrapper encryptionBeanWrapper) throws OperationManagementException; - - Activity changeLockCode(LockCodeBeanWrapper lockCodeBeanWrapper) throws OperationManagementException; - - Activity setPasswordPolicy(PasswordPolicyBeanWrapper passwordPolicyBeanWrapper) throws OperationManagementException; - - Activity setWebClip(WebClipBeanWrapper webClipBeanWrapper) throws OperationManagementException; - - Activity setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) throws OperationManagementException; - - Activity configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) throws OperationManagementException; - - //DeviceManagementAPIImpl - Message updateApplicationList(String id, List androidApplications) throws ApplicationManagementException; + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for configure wifi operation + * + * @param wifiBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity configureWifi(WifiBeanWrapper wifiBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for encypt storage operation + * + * @param encryptionBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity encryptStorage(EncryptionBeanWrapper encryptionBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for change lock code operation + * + * @param lockCodeBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity changeLockCode(LockCodeBeanWrapper lockCodeBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for set password policy operation + * + * @param passwordPolicyBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity setPasswordPolicy(PasswordPolicyBeanWrapper passwordPolicyBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for set webclip operation + * + * @param webClipBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity setWebClip(WebClipBeanWrapper webClipBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for set recommended global proxy operation + * + * @param globalProxyBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for send application configuration operation + * + * @param applicationRestrictionBeanWrapper + * @return + * @throws {@link AndroidDeviceMgtPluginException} + */ + Response sendApplicationConfiguration( + ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper) + throws AndroidDeviceMgtPluginException; - List getPendingOperations(String id, List resultOperations, boolean disableGoogleApps) + /** + * method for configure display message operation + * + * @param displayMessageBeanWrapper + * @return {@link Activity} + * @throws {@link AndroidDeviceMgtPluginException} + * @throws {@link OperationManagementException} + */ + Activity configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException; + + /** + * Method for update application list + * + * @param id + * @param androidApplications + * @return {@link Message} + * @throws {@link ApplicationManagementException} + */ + Message updateApplicationList(String id, List androidApplications) + throws ApplicationManagementException; + + /** + * Method for get pending operations + * + * @param id + * @param resultOperations + * @param disableGoogleApps + * @return + * @throws {@link DeviceManagementException} + * @throws {@link InvalidDeviceException} + */ + List getPendingOperations + (String id, List resultOperations, boolean disableGoogleApps) throws DeviceManagementException, InvalidDeviceException; + /** + * Method to enroll device + * + * @param androidDevice + * @return {@link Response} + * @throws {@link DeviceManagementException} + */ Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException; - boolean modifyEnrollment(String id, AndroidDevice androidDevice) throws DeviceManagementException; + /** + * Method to check if a device is enrolled + * + * @param id + * @param deviceIdentifier + * @return {@link Message} + * @throws {@link DeviceManagementException} + */ + Message isEnrolled(String id, DeviceIdentifier deviceIdentifier) throws DeviceManagementException; + /** + * Method to modify enrollment + * + * @param id + * @param androidDevice + * @return + * @throws {@link DeviceManagementException} + * @throws {@link AndroidDeviceMgtPluginException} + */ + boolean modifyEnrollment(String id, AndroidDevice androidDevice) + throws DeviceManagementException, AndroidDeviceMgtPluginException; + + /** + * Method to disenroll a device + * + * @param id + * @return + * @throws {@link DeviceManagementException} + */ boolean disEnrollDevice(String id) throws DeviceManagementException; - //EventReceiverAPI + /** + * Method to publish events + * + * @param eventBeanWrapper + * @return {@link Device} + * @throws {@link DeviceManagementException} + */ Device publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException; - Response retrieveAlerts(String deviceId, - long from, - long to, - String type, - String ifModifiedSince); + /** + * Method to retrieve alerts + * + * @param deviceId + * @param from + * @param to + * @param type + * @param ifModifiedSince + * @return {@link Response} + * @throws {@link AndroidDeviceMgtPluginException} + */ + Response retrieveAlerts(String deviceId, long from, long to, String type, String ifModifiedSince) + throws AndroidDeviceMgtPluginException; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index aed7c4170..041d58442 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -240,13 +240,13 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) throws OperationManagementException { + public Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null || fileTransferBeanWrapper.getDeviceIDs() == null) { String errorMessage = "The payload of the file transfer operation is incorrect."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } if (log.isDebugEnabled()) { log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); @@ -268,13 +268,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) throws OperationManagementException { + public Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) { String errorMessage = "Lock bean is empty."; log.error(errorMessage); @@ -293,13 +293,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity configureDeviceUnlock(List deviceIDs) throws OperationManagementException { + public Activity configureDeviceUnlock(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK); @@ -309,13 +309,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity getDeviceLocation(List deviceIDs) throws OperationManagementException { + public Activity getDeviceLocation(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException{ try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION); @@ -324,13 +324,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity removePassword(List deviceIDs) throws OperationManagementException { + public Activity removePassword(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD); @@ -339,13 +339,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity configureCamera(CameraBeanWrapper cameraBeanWrapper) throws OperationManagementException { + public Activity configureCamera(CameraBeanWrapper cameraBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the configure camera operation is incorrect."; @@ -362,13 +362,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity getDeviceInformation(List deviceIDs) throws OperationManagementException { + public Activity getDeviceInformation(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO); @@ -377,13 +377,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity getDeviceLogcat(List deviceIDs) throws OperationManagementException { + public Activity getDeviceLogcat(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.LOGCAT); @@ -392,13 +392,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity wipeDevice(List deviceIDs) throws OperationManagementException { + public Activity wipeDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); @@ -407,19 +407,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) throws OperationManagementException { + public Activity wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (wipeDataBeanWrapper == null || wipeDataBeanWrapper.getOperation() == null) { String errorMessage = "WipeData bean is empty."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } WipeData wipeData = wipeDataBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -430,13 +429,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity getApplications(List deviceIDs) throws OperationManagementException { + public Activity getApplications(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST); @@ -445,13 +444,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity ringDevice(List deviceIDs) throws OperationManagementException { + public Activity ringDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING); @@ -460,13 +459,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity rebootDevice(List deviceIDs) throws OperationManagementException { + public Activity rebootDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT); @@ -475,13 +474,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity changeLockTask(List deviceIDs) throws OperationManagementException { + public Activity changeLockTask(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_TASK_MODE); @@ -490,13 +489,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity muteDevice(List deviceIDs) throws OperationManagementException { + public Activity muteDevice(List deviceIDs) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { CommandOperation operation = new CommandOperation(); operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE); @@ -506,21 +505,19 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override public Activity installApplication(ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper) - throws OperationManagementException { + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (applicationInstallationBeanWrapper == null || applicationInstallationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application installing operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); @@ -537,19 +534,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity updateApplication(ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper) throws OperationManagementException { + public Activity updateApplication(ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (applicationUpdateBeanWrapper == null || applicationUpdateBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application update operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); validateApplicationUrl(applicationUpdate.getUrl()); @@ -566,20 +562,19 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity uninstallApplication(ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper) throws OperationManagementException { + public Activity uninstallApplication(ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (applicationUninstallationBeanWrapper == null || applicationUninstallationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application uninstalling operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); validateApplicationType(applicationUninstallation.getType()); @@ -593,19 +588,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity blacklistApplications(BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) throws OperationManagementException { + public Activity blacklistApplications(BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (blacklistApplicationsBeanWrapper == null || blacklistApplicationsBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the blacklisting apps operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -617,19 +611,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity upgradeFirmware(UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper) throws OperationManagementException { + public Activity upgradeFirmware(UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (upgradeFirmwareBeanWrapper == null || upgradeFirmwareBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the upgrade firmware operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); validateScheduleDate(upgradeFirmware.getSchedule()); @@ -643,19 +636,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity configureVPN(VpnBeanWrapper vpnConfiguration) throws OperationManagementException { + public Activity configureVPN(VpnBeanWrapper vpnConfiguration) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (vpnConfiguration == null || vpnConfiguration.getOperation() == null) { String errorMessage = "The payload of the VPN operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } Vpn vpn = vpnConfiguration.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -666,19 +658,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity sendNotification(NotificationBeanWrapper notificationBeanWrapper) throws OperationManagementException { + public Activity sendNotification(NotificationBeanWrapper notificationBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException{ try { if (notificationBeanWrapper == null || notificationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the notification operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } Notification notification = notificationBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -689,19 +680,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity configureWifi(WifiBeanWrapper wifiBeanWrapper) throws OperationManagementException { + public Activity configureWifi(WifiBeanWrapper wifiBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (wifiBeanWrapper == null || wifiBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the wifi operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } Wifi wifi = wifiBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -713,19 +703,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity encryptStorage(EncryptionBeanWrapper encryptionBeanWrapper) throws OperationManagementException { + public Activity encryptStorage(EncryptionBeanWrapper encryptionBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException{ try { if (encryptionBeanWrapper == null || encryptionBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the device encryption operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); CommandOperation operation = new CommandOperation(); @@ -736,19 +725,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity changeLockCode(LockCodeBeanWrapper lockCodeBeanWrapper) throws OperationManagementException { + public Activity changeLockCode(LockCodeBeanWrapper lockCodeBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (lockCodeBeanWrapper == null || lockCodeBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the change lock code operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } LockCode lockCode = lockCodeBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -759,19 +747,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity setPasswordPolicy(PasswordPolicyBeanWrapper passwordPolicyBeanWrapper) throws OperationManagementException { + public Activity setPasswordPolicy(PasswordPolicyBeanWrapper passwordPolicyBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (passwordPolicyBeanWrapper == null || passwordPolicyBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the change password policy operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -784,20 +771,19 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity setWebClip(WebClipBeanWrapper webClipBeanWrapper) throws OperationManagementException { + public Activity setWebClip(WebClipBeanWrapper webClipBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (webClipBeanWrapper == null || webClipBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the add webclip operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } WebClip webClip = webClipBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -809,19 +795,18 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @Override - public Activity setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) throws OperationManagementException { + public Activity setRecommendedGlobalProxy(GlobalProxyBeanWrapper globalProxyBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation(); @@ -836,27 +821,62 @@ public class AndroidServiceImpl implements AndroidService { } else { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400L).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); + } + } + + @Override + public Response sendApplicationConfiguration(ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper) + throws AndroidDeviceMgtPluginException { + try { + if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the application configuration operation is incorrect"; + log.error(errorMessage); + throw new BadRequestExceptionDup(errorMessage); + } + ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG); + operation.setType(Operation.Type.PROFILE); + operation.setPayLoad(applicationRestriction.toJSON()); + Response response = AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(), + operation); + return response; + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + throw new BadRequestExceptionDup(errorMessage, e); + } catch (OperationManagementException e) { + String errorMessage = "Issue in retrieving operation management service instance"; + log.error(errorMessage, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder() + .setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()); + } catch (DeviceManagementException e) { + String errorMessage = "Issue in retrieving device management service instance"; + log.error(errorMessage, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder() + .setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()); } } @Override - public Activity configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) throws OperationManagementException { + public Activity configureDisplayMessage(DisplayMessageBeanWrapper displayMessageBeanWrapper) + throws OperationManagementException, AndroidDeviceMgtPluginException { try { if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the display message operation is incorrect"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST). - setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -870,9 +890,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST). - setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage, e); } } @@ -1107,7 +1125,8 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public boolean modifyEnrollment(String id, AndroidDevice androidDevice) throws DeviceManagementException { + public boolean modifyEnrollment(String id, AndroidDevice androidDevice) + throws DeviceManagementException, AndroidDeviceMgtPluginException { Device device; DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(id); @@ -1125,8 +1144,7 @@ public class AndroidServiceImpl implements AndroidService { if (androidDevice == null) { String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } if (device == null) { String errorMessage = "The device to be modified doesn't exist."; @@ -1192,18 +1210,19 @@ public class AndroidServiceImpl implements AndroidService { long from, long to, String type, - String ifModifiedSince) { - if (from != 0l && to != 0l && deviceId != null) { + String ifModifiedSince) throws AndroidDeviceMgtPluginException { + if (from != 0l && to != 0l && deviceId != null){ return retrieveAlertFromDate(deviceId, from, to); } else if (deviceId != null && type != null) { return retrieveAlertByType(deviceId, type); } else if (deviceId != null) { return retrieveAlert(deviceId); } else { - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request must contain " + - "the device identifier. Optionally, both from and to value should be present to get " + - "alerts between times.").build()); + String errorMessage = "Request must contain " + + "the device identifier. Optionally, both from and to value should be present to get " + + "alerts between times."; + log.error(errorMessage); + throw new BadRequestExceptionDup(errorMessage); } } From 7c69a296c52a4fe9d3ec4d61054e63cb1dbc2927 Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 3 Dec 2019 14:56:51 +0530 Subject: [PATCH 05/30] Add wipe API for Google enterprise --- .../android/api/AndroidEnterpriseAPI.java | 89 +++++++++---------- .../api/impl/AndroidEnterpriseAPIImpl.java | 87 ++++++++++++++---- .../spi/AndroidGoogleEnterpriseService.java | 3 + .../android/core/dao/EnterpriseDAO.java | 3 + .../core/dao/impl/EnterpriseDAOImpl.java | 38 ++++++++ .../AndroidGoogleEnterpriseServiceImpl.java | 26 ++++++ .../android/core/util/AndroidDeviceUtils.java | 49 ++++++---- 7 files changed, 214 insertions(+), 81 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java index 3ffd40654..19ad49afb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/AndroidEnterpriseAPI.java @@ -1322,59 +1322,56 @@ public interface AndroidEnterpriseAPI { //###################################################################################################################### //###################################################################################################################### - @PUT - @Path("/unenroll") + @GET + @Path("/wipe-device") @ApiOperation( produces = MediaType.APPLICATION_JSON, - consumes = MediaType.APPLICATION_JSON, - httpMethod = "PUT", - value = "Unenroll an enterprise from EMM", - notes = "Unenroll an enterprise from EMM.", - tags = "Android Enterprise Service", + httpMethod = "GET", + value = "Getting managed configs", + notes = "Getting managed configs.", + tags = "Device Type Management Administrative Service", extensions = { @Extension(properties = { @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:enterprise:modify") }) } ) - @ApiResponses( - value = { - @ApiResponse(code = 201, message = "Created. \n Successfully removed", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The URL of the added policy."), - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.") - }), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while unenrolling.") - }) - - Response unenroll(); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Created. \n Successfully fetched managed configs", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The URL of the added policy."), + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.") + }), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while getting managed configs.") + }) + Response wipeEnterprise(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java index e4b541506..1ea0effe3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java @@ -30,8 +30,16 @@ import org.wso2.carbon.device.application.mgt.common.dto.ApplicationPolicyDTO; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; +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.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; +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.ProfileFeature; +import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.mobile.android.api.AndroidEnterpriseAPI; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.GoogleAPIInvoker; @@ -795,28 +803,75 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { } } - @PUT - @Path("/{id}/unenroll") @Override - public Response unenroll() { + @Produces(MediaType.APPLICATION_JSON) + @GET + @Path("/wipe-device") + public Response wipeEnterprise() { + log.warn("Wiping all devices!!!"); EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { - googleAPIInvoker.unenroll(enterpriseConfigs.getEnterpriseId()); - } catch (IOException e) { - String errorMessage = "Could not unenroll the enterprise " + enterpriseConfigs.getEnterpriseId(); - log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.INTERNAL_SERVER_ERROR - .getStatusCode()).setMessage(errorMessage).build()); + // Take all enterprise devices in the DB. + List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() + .getAllEnterpriseDevices(enterpriseConfigs.getEnterpriseId()); + + // Extract the device identifiers of enterprise devices. + List deviceID = new ArrayList<>(); + if (androidEnterpriseUsers != null && !androidEnterpriseUsers.isEmpty()) { + for (AndroidEnterpriseUser userDevice: androidEnterpriseUsers) { + deviceID.add(userDevice.getEmmDeviceId()); + } + } + + List byodDevices = new ArrayList<>(); + List copeDevices = new ArrayList<>(); + // Get all registered device + List devices = AndroidAPIUtils.getDeviceManagementService(). + getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false); + for (Device device : devices) { // Go through all enrolled devices + if (deviceID.contains(device.getDeviceIdentifier())) { // Filter out only enterprise enrolled devices. + if (device.getEnrolmentInfo().getOwnership().equals(EnrolmentInfo.OwnerShip.BYOD)) { + byodDevices.add(device.getDeviceIdentifier()); + } else { + copeDevices.add(device.getDeviceIdentifier()); + } + } + } + + CommandOperation operation = new CommandOperation(); + operation.setType(Operation.Type.COMMAND);//TODO: Check if this should be profile + // type when implementing COPE/COSU + if (byodDevices != null && !byodDevices.isEmpty()) { // BYOD devices only needs a data wipe(work profile) + log.warn("Wiping " + byodDevices.size() + " BYOD devices"); + operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); + } else if (copeDevices != null && !copeDevices.isEmpty()) { + log.warn("Wiping " + copeDevices.size() + " COPE/COSU devices"); + operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); + } + AndroidDeviceUtils.getOperationResponse(deviceID, operation); + log.warn("Added wipe to all devices"); + return Response.status(Response.Status.OK).build(); } catch (EnterpriseServiceException e) { - String errorMessage = "Could not get client to call Google to unenroll enterprise " + enterpriseConfigs.getEnterpriseId(); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving configs").build()).build(); + } catch (OperationManagementException e) { + String errorMessage = "Could not add wipe command to enterprise " + enterpriseConfigs.getEnterpriseId(); log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.INTERNAL_SERVER_ERROR - .getStatusCode()).setMessage(errorMessage).build()); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (DeviceManagementException e) { + String errorMessage = "Could not add wipe command to enterprise " + enterpriseConfigs.getEnterpriseId() + + " due to an error in device management"; + log.error(errorMessage); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (InvalidDeviceException e) { + String errorMessage = "Could not add wipe command to enterprise due to invalid device ids"; + log.error(errorMessage); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } - return Response.status(Response.Status.OK).build(); + } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java index a10fc418e..d964ab6bd 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidGoogleEnterpriseService.java @@ -39,4 +39,7 @@ public interface AndroidGoogleEnterpriseService { boolean updateMobileDevice(AndroidEnterpriseManagedConfig managedConfig) throws EnterpriseServiceException; boolean deleteMobileDevice(String id) throws EnterpriseServiceException; + + List getAllEnterpriseDevices(String enterpriseId) + throws EnterpriseServiceException ; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java index 79c91e3e5..931f184f8 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/EnterpriseDAO.java @@ -50,4 +50,7 @@ public interface EnterpriseDAO { boolean updateConfig(AndroidEnterpriseManagedConfig managedConfig) throws EnterpriseManagementDAOException; boolean deleteConfig(String id, int tenantId) throws EnterpriseManagementDAOException; + + List getAllEnterpriseDevices(int tenantId, String enterpriseId) throws + EnterpriseManagementDAOException; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java index 0abfa811c..4e4f47e03 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/dao/impl/EnterpriseDAOImpl.java @@ -286,4 +286,42 @@ public class EnterpriseDAOImpl implements EnterpriseDAO { return status; } + public List getAllEnterpriseDevices(int tenantId, String enterpriseId) + throws EnterpriseManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + List enterpriseUsers = new ArrayList<>(); + ResultSet rs = null; + try { + conn = AndroidDAOFactory.getConnection(); + String selectDBQuery = + "SELECT * FROM AD_ENTERPRISE_USER_DEVICE WHERE ENTERPRISE_ID = ? AND TENANT_ID = ?"; + stmt = conn.prepareStatement(selectDBQuery); + stmt.setString(1, enterpriseId); + stmt.setInt(2, tenantId); + + rs = stmt.executeQuery(); + + while (rs.next()) { + AndroidEnterpriseUser enterpriseUser = new AndroidEnterpriseUser(); + enterpriseUser.setEmmUsername(rs.getString("EMM_USERNAME")); + enterpriseUser.setTenantId(rs.getInt("TENANT_ID")); + enterpriseUser.setLastUpdatedTime(rs.getString("LAST_UPDATED_TIMESTAMP")); + enterpriseUser.setAndroidPlayDeviceId(rs.getString("ANDROID_PLAY_DEVICE_ID")); + enterpriseUser.setEnterpriseId(rs.getString("ENTERPRISE_ID")); + enterpriseUser.setGoogleUserId(rs.getString("GOOGLE_USER_ID")); + enterpriseUser.setEmmDeviceId(rs.getString("EMM_DEVICE_ID")); + enterpriseUsers.add(enterpriseUser); + } + } catch (SQLException e) { + String msg = "Error occurred while fetching user of enterprise: '" + enterpriseId + "'"; + log.error(msg, e); + throw new EnterpriseManagementDAOException(msg, e); + } finally { + MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs); + AndroidDAOFactory.closeConnection(); + } + + return enterpriseUsers; + } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java index 67d79b8f4..ae59c266c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidGoogleEnterpriseServiceImpl.java @@ -216,4 +216,30 @@ public class AndroidGoogleEnterpriseServiceImpl implements AndroidGoogleEnterpri } return status; } + + @Override + public List getAllEnterpriseDevices(String enterpriseId) + throws EnterpriseServiceException { + + List androidEnterpriseUsers; + if (log.isDebugEnabled()) { + log.debug("Calling get enterprise device service by enterprise identifier: " + enterpriseId); + } + try { + AndroidDAOFactory.openConnection(); + androidEnterpriseUsers = this.enterpriseDAO.getAllEnterpriseDevices(CarbonContext + .getThreadLocalCarbonContext() + .getTenantId(), enterpriseId); + + } catch (EnterpriseManagementDAOException e) { + String msg = "Error occurred while adding the user " + + CarbonContext.getThreadLocalCarbonContext().getUsername(); + log.error(msg, e); + throw new EnterpriseServiceException(msg, e); + } finally { + AndroidDAOFactory.closeConnection(); + } + return androidEnterpriseUsers; + } + } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java index 51edcb75d..035bfd2d2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java @@ -323,6 +323,7 @@ public class AndroidDeviceUtils { JsonArray appListArray = appListElement.getAsJsonArray(); // Find if there are Apps with Work profile configurations + boolean alreadySendToGoogle = false; for (JsonElement appElement : appListArray) { JsonElement googlePolicyPayload = appElement.getAsJsonObject(). get(AndroidConstants.ApplicationInstall.GOOGLE_POLICY_PAYLOAD); @@ -332,12 +333,16 @@ public class AndroidDeviceUtils { containsGoogleAppPolicy = true;// breaking out of outer for loop try { uuid = uuid.replace("\"", ""); - sendPayloadToGoogle(uuid, payload, deviceIdentifier); + if (alreadySendToGoogle) { + sendPayloadToGoogle(uuid, payload, deviceIdentifier, false); + } else { + sendPayloadToGoogle(uuid, payload, deviceIdentifier, true); + alreadySendToGoogle = true; + } } catch (org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException e) { String errorMessage = "App install failed for device " + deviceIdentifier.getId(); log.error(errorMessage, e); } - break; } } @@ -352,8 +357,8 @@ public class AndroidDeviceUtils { * @param payload policy profile * @param deviceIdentifier device to apply policy */ - private static void sendPayloadToGoogle(String uuid, String payload, DeviceIdentifier deviceIdentifier) - throws ApplicationManagementException { + private static void sendPayloadToGoogle(String uuid, String payload, DeviceIdentifier deviceIdentifier, + boolean requireSendingToGoogle) throws ApplicationManagementException { try { EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigsFromGoogle(); if (enterpriseConfigs.getErrorResponse() == null) { @@ -369,12 +374,12 @@ public class AndroidDeviceUtils { for (EnterpriseApp enterpriseApp : enterpriseInstallPolicy.getApps()) { apps.add(enterpriseApp.getProductId()); } - googleAPIInvoker - .approveAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail.getGoogleUserId(), apps, - enterpriseInstallPolicy.getProductSetBehavior()); - googleAPIInvoker - .updateAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail.getGoogleUserId(), - AndroidEnterpriseUtils.convertToDeviceInstance(enterpriseInstallPolicy)); + if (requireSendingToGoogle) { + googleAPIInvoker.approveAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail + .getGoogleUserId(), apps, enterpriseInstallPolicy.getProductSetBehavior()); + googleAPIInvoker.updateAppsForUser(enterpriseConfigs.getEnterpriseId(), userDetail.getGoogleUserId(), + AndroidEnterpriseUtils.convertToDeviceInstance(enterpriseInstallPolicy)); + } AndroidEnterpriseUtils.getAppSubscriptionService().performEntAppSubscription(uuid, Arrays.asList(CarbonContext.getThreadLocalCarbonContext().getUsername()), SubscriptionType.USER.toString(), SubAction.INSTALL.toString(), false); @@ -697,15 +702,21 @@ public class AndroidDeviceUtils { StringEntity requestEntity = new StringEntity(payload.toString(), ContentType.APPLICATION_JSON); JsonArray appListArray = appListElement.getAsJsonArray(); for (JsonElement appElement : appListArray) { - uuid = appElement.getAsJsonObject(). - get(AndroidConstants.ApplicationInstall.ENROLLMENT_APP_INSTALL_UUID).getAsString(); - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpPost postRequest = new HttpPost(requestUrl.replace("{uuid}", uuid)); - postRequest.setHeader(AndroidConstants.ApplicationInstall.AUTHORIZATION, - AndroidConstants.ApplicationInstall.AUTHORIZATION_HEADER_VALUE + tokenInfo - .getAccessToken()); - postRequest.setEntity(requestEntity); - httpClient.execute(postRequest); + JsonElement googlePolicyPayload = appElement.getAsJsonObject(). + get(AndroidConstants.ApplicationInstall.GOOGLE_POLICY_PAYLOAD); + + if (googlePolicyPayload == null) { + uuid = appElement.getAsJsonObject(). + get(AndroidConstants.ApplicationInstall.ENROLLMENT_APP_INSTALL_UUID).getAsString(); + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { + HttpPost postRequest = new HttpPost(requestUrl.replace("{uuid}", uuid)); + postRequest.setHeader(AndroidConstants.ApplicationInstall.AUTHORIZATION, + AndroidConstants.ApplicationInstall.AUTHORIZATION_HEADER_VALUE + tokenInfo + .getAccessToken()); + postRequest.setEntity(requestEntity); + httpClient.execute(postRequest); + } + } } } catch (UserStoreException e) { From a04338e09e65b91fc41279c5215a30e840b818fb Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 3 Dec 2019 19:49:20 +0530 Subject: [PATCH 06/30] Replace class locations in cfx-servlet --- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 4d74e7e7f..290d6266b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -45,7 +45,7 @@ - + @@ -60,11 +60,11 @@ - - - - - + + + + + From 47e569fa08b7d9e0950f2a97ebcb7ccc4c16dfff Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Wed, 4 Dec 2019 18:18:19 +0530 Subject: [PATCH 07/30] Fix android web app deploying issue --- .../pom.xml | 4 + .../addons}/AndroidAgentException.java | 2 +- .../mobile/android/addons}/ErrorHandler.java | 4 +- .../mobile/android/addons}/ErrorMessage.java | 2 +- .../addons}/GsonMessageBodyHandler.java | 2 +- .../pom.xml | 92 +++++++++++++++++-- .../api/DeviceTypeConfigurationAPI.java | 3 +- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 4 +- .../pom.xml | 5 - .../android/core/impl/AndroidServiceImpl.java | 4 - .../DeviceManagementAdminServiceTests.java | 86 ++++++++++------- .../core/DeviceManagementServiceTests.java | 7 +- pom.xml | 2 +- 13 files changed, 157 insertions(+), 60 deletions(-) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception => org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons}/AndroidAgentException.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons}/ErrorHandler.java (89%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons}/ErrorMessage.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons}/GsonMessageBodyHandler.java (98%) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml index 3f658001d..cf5a51b2c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/pom.xml @@ -93,5 +93,9 @@ org.wso2.carbon org.wso2.carbon.logging + + com.google.code.gson + gson + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidAgentException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/AndroidAgentException.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidAgentException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/AndroidAgentException.java index 697fefa26..681c39f68 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidAgentException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/AndroidAgentException.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; +package org.wso2.carbon.device.mgt.mobile.android.addons; /** * diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ErrorHandler.java similarity index 89% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorHandler.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ErrorHandler.java index 2bcbbed6f..1023bdef2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorHandler.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ErrorHandler.java @@ -15,9 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common; - -import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidAgentException; +package org.wso2.carbon.device.mgt.mobile.android.addons; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorMessage.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ErrorMessage.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorMessage.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ErrorMessage.java index 793fb7291..a27c9b5ad 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/ErrorMessage.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/ErrorMessage.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common; +package org.wso2.carbon.device.mgt.mobile.android.addons; public class ErrorMessage { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GsonMessageBodyHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/GsonMessageBodyHandler.java similarity index 98% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GsonMessageBodyHandler.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/GsonMessageBodyHandler.java index 9ffe273a4..bd6b7931f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/GsonMessageBodyHandler.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.addons/src/main/java/org/wso2/carbon/device/mgt/mobile/android/addons/GsonMessageBodyHandler.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common; +package org.wso2.carbon.device.mgt.mobile.android.addons; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index d902ed524..b0cb54e0c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -90,6 +90,28 @@ org.apache.cxf cxf-rt-frontend-jaxws + + + asm + asm + + + neethi + org.apache.neethi + + + wsdl4j + wsdl4j + + + xml-resolver + xml-resolver + + + xmlschema-core + org.apache.ws.xmlschema + + org.apache.cxf @@ -108,6 +130,12 @@ org.wso2.carbon org.wso2.carbon.utils provided + + + commons-lang + commons-lang.wso2 + + org.wso2.carbon @@ -130,6 +158,12 @@ commons-httpclient.wso2 commons-httpclient provided + + + commons-logging + commons-logging + + com.google.code.gson @@ -144,12 +178,26 @@ org.slf4j slf4j-api + + commons-logging + commons-logging + + + neethi + org.wso2.orbit.org.apache.neethi + org.wso2.carbon.analytics org.wso2.carbon.analytics.api provided + + + asm + org.ow2.asm + + io.swagger @@ -183,21 +231,31 @@ javax.ws.rs javax.ws.rs-api + provided org.codehaus.jackson jackson-core-asl - - com.google.apis - google-api-services-androidenterprise - v1-rev186-1.25.0 - org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.common provided + + + commons-logging + commons-logging + + + neethi + org.apache.neethi.wso2 + + + wsdl4j + wsdl4j.wso2 + + org.apache.httpcomponents @@ -212,7 +270,6 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.android.addons - provided org.wso2.carbon.devicemgt-plugins @@ -227,6 +284,29 @@ org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core + provided + + + commons-logging + commons-logging + + + axis2-client + org.apache.axis2.wso2 + + + neethi + org.wso2.orbit.org.apache.neethi + + + wsdl4j + wsdl4j.wso2 + + + XmlSchema + org.apache.ws.commons.schema.wso2 + + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java index 6e8e324ea..e3cce4634 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/DeviceTypeConfigurationAPI.java @@ -34,7 +34,6 @@ import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidAgentException; import javax.validation.Valid; import javax.ws.rs.*; @@ -245,6 +244,6 @@ public interface DeviceTypeConfigurationAPI { value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + "Example: Mon, 05 Jan 2014 15:10:00 +0200.") - @HeaderParam("If-Modified-Since") String ifModifiedSince) throws AndroidAgentException; + @HeaderParam("If-Modified-Since") String ifModifiedSince); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 290d6266b..581b918e0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -65,8 +65,8 @@ - - + + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index ee22567e1..404950cb4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -162,11 +162,6 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.android.common - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.android.common - provided - org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.common diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index 041d58442..3d4562abb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -22,7 +22,6 @@ import com.google.api.services.androidenterprise.model.ProductsListResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpStatus; import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.context.CarbonContext; @@ -36,7 +35,6 @@ 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.device.details.DeviceLocation; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; @@ -66,7 +64,6 @@ import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtil import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; -import javax.ws.rs.InternalServerErrorException; import javax.ws.rs.core.Response; import java.io.IOException; import java.net.HttpURLConnection; @@ -87,7 +84,6 @@ public class AndroidServiceImpl implements AndroidService { private static final String OPERATION_ERROR_STATUS = "ERROR"; public static final String GOOGLE_AFW_EMM_ANDROID_ID = "googleEMMAndroidId"; public static final String GOOGLE_AFW_DEVICE_ID = "googleEMMDeviceId"; - private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; @Override diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java index d67ad8ab0..85a6f251f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java @@ -32,6 +32,7 @@ import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.core.impl.AndroidServiceImpl; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceManagementProviderServiceMock; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.utils.TestUtils; @@ -60,7 +61,7 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testConfigureDeviceLock() throws OperationManagementException { + public void testConfigureDeviceLock() throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper()); Assert.assertNotNull(activity); @@ -69,7 +70,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureDeviceUnlock() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureDeviceUnlock(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -78,7 +80,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetDeviceLocation() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getDeviceLocation(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -87,7 +90,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testRemovePassword() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.removePassword(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -96,7 +100,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureCamera() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureCamera(TestUtils.getCamerabeanWrapper()); Assert.assertNotNull(activity); @@ -105,7 +110,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetDeviceInformation() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getDeviceInformation(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -114,7 +120,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetDeviceLogcat() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getDeviceLogcat(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -122,8 +129,8 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testWipeDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void testWipeDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.wipeDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -131,8 +138,8 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testWipeData() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void testWipeData() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.wipeData(TestUtils.getWipeDataBeanWrapper()); Assert.assertNotNull(activity); @@ -141,7 +148,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetApplications() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getApplications(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -149,8 +157,8 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testRingDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void testRingDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.ringDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -159,7 +167,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testRebootDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.rebootDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -168,7 +177,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testChangeLockTask() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.changeLockTask(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -176,8 +186,8 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testMuteDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void testMuteDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.muteDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -186,7 +196,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testInstallApplication() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .installApplication(TestUtils.getApplicationInstallationBeanWrapper()); @@ -196,7 +207,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testUpdateApplication() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper()); Assert.assertNotNull(activity); @@ -205,7 +217,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testUninstallApplicationPublic() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic()); @@ -215,7 +228,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testUninstallApplicationWebApp() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp()); @@ -225,7 +239,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testBlacklistApplications() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper()); @@ -235,7 +250,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testUpgradeFirmware() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper()); Assert.assertNotNull(activity); @@ -244,7 +260,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureVPN() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureVPN(TestUtils.getVpnBeanWrapper()); Assert.assertNotNull(activity); @@ -253,7 +270,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testSendNotification() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.sendNotification(TestUtils.getNotificationBeanWrapper()); Assert.assertNotNull(activity); @@ -262,7 +280,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureWifi() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureWifi(TestUtils.getWifiBeanWrapper()); Assert.assertNotNull(activity); @@ -271,7 +290,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testEncryptStorage() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.encryptStorage(TestUtils.getEncryptionBeanWrapper()); Assert.assertNotNull(activity); @@ -280,7 +300,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testChangeLockCode() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.changeLockCode(TestUtils.getLockCodeBeanWrapper()); Assert.assertNotNull(activity); @@ -289,7 +310,8 @@ public class DeviceManagementAdminServiceTests { @Test public void testSetPasswordPolicy() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper()); Assert.assertNotNull(activity); @@ -297,8 +319,8 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testSetWebClip() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void testSetWebClip() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.setWebClip(TestUtils.getWebClipBeanWrapper()); Assert.assertNotNull(activity); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java index ead8db2d2..b8c749b63 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java @@ -36,6 +36,7 @@ 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.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.core.impl.AndroidServiceImpl; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.ApplicationManagementProviderServiceMock; import org.wso2.carbon.device.mgt.mobile.android.core.mokcs.DeviceInformationManagerServiceMock; @@ -289,7 +290,8 @@ public class DeviceManagementServiceTests { @Test public void testModifyEnrollmentSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockUser(); boolean status = androidService.modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice()); @@ -298,7 +300,8 @@ public class DeviceManagementServiceTests { @Test public void testModifyEnrollmentUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, + AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockUser(); AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); diff --git a/pom.xml b/pom.xml index 9633307cd..538938477 100644 --- a/pom.xml +++ b/pom.xml @@ -1360,7 +1360,7 @@ 7.0.85 1.0 - 2.0 + 2.0.1 github-scm From 49d518805eda6eb99fa934a3cf745acb7b31e59c Mon Sep 17 00:00:00 2001 From: shamalka Date: Wed, 4 Dec 2019 22:56:57 +0530 Subject: [PATCH 08/30] Replace custom exceptions --- .../api/impl/AndroidEnterpriseAPIImpl.java | 26 +++--- .../api/impl/DeviceManagementAPIImpl.java | 56 ++++++++---- .../impl/DeviceManagementAdminAPIImpl.java | 1 - .../impl/DeviceTypeConfigurationAPIImpl.java | 13 ++- .../api/impl/EventReceiverAPIImpl.java | 19 ++-- .../UnexpectedServerErrorExceptionDup.java | 12 +++ .../android/common/spi/AndroidService.java | 4 +- .../android/core/impl/AndroidServiceImpl.java | 87 +++++++------------ 8 files changed, 114 insertions(+), 104 deletions(-) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java index 1ea0effe3..aa195ed56 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.device.mgt.mobile.android.api.impl; +import com.google.api.client.http.HttpStatusCodes; import com.google.api.services.androidenterprise.model.ProductsListResponse; import com.google.api.services.androidenterprise.model.StoreCluster; import com.google.api.services.androidenterprise.model.StoreLayout; @@ -57,9 +58,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseU import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.TokenWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; @@ -191,8 +190,9 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { } catch (EnterpriseServiceException e) { String errorMessage = "App install failed. No user found for name " + device.getUsername(); log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); + return Response.status(Response.Status.NOT_FOUND).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) + .setMessage(errorMessage).build()).build(); } if (sentToDevice) { return Response.status(Response.Status.OK).build(); @@ -759,9 +759,9 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { String errorMessage = "App: " + applicationPolicyDTO.getApplicationDTO() .getPackageName() + " for device " + deviceIdentifier.getId(); log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.BAD_REQUEST - .getStatusCode()).setMessage(errorMessage).build()); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(errorMessage).build()).build(); } } googleAPIInvoker.installApps(enterpriseConfigs.getEnterpriseId(), userDetail @@ -783,15 +783,15 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { } catch (EnterpriseServiceException e) { String errorMessage = "App install failed for device " + deviceIdentifier.getId(); log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.NOT_FOUND - .getStatusCode()).setMessage(errorMessage).build()); + return Response.status(Response.Status.NOT_FOUND).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) + .setMessage(errorMessage).build()).build(); } catch (FeatureManagementException e) { String errorMessage = "Could not fetch effective policy for device " + deviceIdentifier.getId(); log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.INTERNAL_SERVER_ERROR - .getStatusCode()).setMessage(errorMessage).build()); } + return Response.status(Response.Status.NOT_FOUND).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) + .setMessage(errorMessage).build()).build(); } } if (sentToDevice) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 633d37231..445593c97 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -47,10 +47,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.*; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; @@ -95,8 +92,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } catch (ApplicationManagementException e) { String msg = "Error occurred while modifying the application list."; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); } } @@ -124,9 +122,15 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } catch (DeviceManagementException e) { String msg = "Error occurred while getting pending operations of the device."; log.error(msg, e); - throw new UnexpectedServerErrorException( + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing get pending operations"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()); + .setMessage(errorMessage).build()).build(); } } @@ -136,8 +140,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { if (androidDevice == null) { String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(errorMessage).build()).build(); } try { AndroidService androidService = AndroidAPIUtils.getAndroidService(); @@ -147,8 +152,15 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { String msg = "Error occurred while enrolling the android, which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while enrolling device"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } @@ -164,9 +176,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } catch (DeviceManagementException e) { String msg = "Error occurred while checking enrollment status of the device."; log.error(msg, e); - throw new UnexpectedServerErrorException( + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()); + .setMessage(msg).build()).build(); } } @@ -193,14 +205,21 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { String msg = "Error occurred while modifying enrollment of the Android device that carries the id '" + id + "'"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); } catch (BadRequestExceptionDup e){ String msg = "Invalid request"; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) .setMessage(msg).build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Class not found"; + log.error(errorMessage, e); + return Response.status(Response.Status.NOT_FOUND).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured"; log.error(errorMessage, e); @@ -232,8 +251,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { String msg = "Error occurred while %s the Android device that carries the id '" + id + "'"; msg = String.format(msg, "dis-enrolling"); log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index a7032677e..f186cd28b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -90,7 +90,6 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBea import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java index 7635e1e8a..03015fe74 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java @@ -46,7 +46,6 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -78,9 +77,9 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP } catch (DeviceManagementException e) { String msg = "Error occurred while retrieving the Android tenant configuration"; log.error(msg, e); - throw new UnexpectedServerErrorException( + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()); + .setMessage(msg).build()).build(); } } @@ -102,9 +101,9 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP } catch (AndroidDeviceMgtPluginException e) { String msg = "Error occurred while modifying configuration settings of Android platform"; log.error(msg, e); - throw new UnexpectedServerErrorException( + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()); + .setMessage(msg).build()).build(); } } @@ -122,9 +121,9 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP } catch (DeviceManagementException e) { String msg = "Error occurred while retrieving the license configured for Android device enrolment"; log.error(msg, e); - throw new UnexpectedServerErrorException( + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()); + .setMessage(msg).build()).build(); } } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 4d55877c7..172a02809 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -110,15 +110,18 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { log.warn("Error occurred while trying to publish the event. This could be due to unavailability " + "of the publishing service. Please make sure that analytics server is running and accessible " + "by this server"); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(503l).setMessage("Error occurred due to " + - "unavailability of the publishing service.").build()); + String msg = "Error occurred due to " + + "unavailability of the publishing service."; + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); } } catch (DataPublisherConfigurationException e) { String msg = "Error occurred while getting the Data publisher Service instance."; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(msg).build()).build(); } } @@ -142,6 +145,12 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) .setMessage(msg).build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Class not found"; + log.error(errorMessage, e); + return Response.status(Response.Status.NOT_FOUND).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while retrieving alerts"; log.error(errorMessage, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java new file mode 100644 index 000000000..156404ef3 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java @@ -0,0 +1,12 @@ +package org.wso2.carbon.device.mgt.mobile.android.common.exception; + +public class UnexpectedServerErrorExceptionDup extends AndroidDeviceMgtPluginException{ + + public UnexpectedServerErrorExceptionDup(String message, Throwable ex) { + super(message, ex); + } + + public UnexpectedServerErrorExceptionDup(String message) { + super(message); + } +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index b6565ad95..18d16ce31 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -418,7 +418,7 @@ public interface AndroidService { */ List getPendingOperations (String id, List resultOperations, boolean disableGoogleApps) - throws DeviceManagementException, InvalidDeviceException; + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException; /** * Method to enroll device @@ -427,7 +427,7 @@ public interface AndroidService { * @return {@link Response} * @throws {@link DeviceManagementException} */ - Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException; + Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException, AndroidDeviceMgtPluginException; /** * Method to check if a device is enrolled diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index 3d4562abb..a3043f352 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -274,8 +274,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) { String errorMessage = "Lock bean is empty."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } DeviceLock lock = deviceLockBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -346,8 +345,7 @@ public class AndroidServiceImpl implements AndroidService { if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the configure camera operation is incorrect."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } Camera camera = cameraBeanWrapper.getOperation(); CommandOperation operation = new CommandOperation(); @@ -850,17 +848,11 @@ public class AndroidServiceImpl implements AndroidService { } catch (OperationManagementException e) { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder() - .setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(errorMessage).build()); + throw new UnexpectedServerErrorExceptionDup(errorMessage); } catch (DeviceManagementException e) { String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder() - .setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(errorMessage).build()); + throw new UnexpectedServerErrorExceptionDup(errorMessage, e); } } @@ -923,7 +915,8 @@ public class AndroidServiceImpl implements AndroidService { @Override public List getPendingOperations(String deviceId, List resultOperations, - boolean disableGoogleApps) throws DeviceManagementException, InvalidDeviceException { + boolean disableGoogleApps) + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(deviceId); if (!AndroidDeviceUtils.isValidDeviceIdentifier(deviceIdentifier)) { String msg = "Device not found for identifier '" + deviceId + "'"; @@ -979,14 +972,13 @@ public class AndroidServiceImpl implements AndroidService { } catch (OperationManagementException e) { String msg = "Issue in retrieving operation management service instance"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } } @Override - public Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException { + public Response enrollDevice(AndroidDevice androidDevice) + throws DeviceManagementException, AndroidDeviceMgtPluginException { try { String token = null; Device device = new Device(); @@ -1040,8 +1032,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while updating the device location upon android " + "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } } @@ -1096,27 +1087,12 @@ public class AndroidServiceImpl implements AndroidService { androidDevice.getDeviceIdentifier() + "'"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(responseMessage).build(); } - } catch (PolicyManagementException e) { - String msg = "Error occurred while enforcing default enrollment policy upon android " + - "', which carries the id '" + - androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (OperationManagementException e) { - String msg = "Error occurred while enforcing default enrollment policy upon android " + - "', which carries the id '" + - androidDevice.getDeviceIdentifier() + "'"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } catch (InvalidDeviceException e) { + } catch (PolicyManagementException | InvalidDeviceException | OperationManagementException e) { String msg = "Error occurred while enforcing default enrollment policy upon android " + "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } } @@ -1133,8 +1109,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + id + "'"; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } if (androidDevice == null) { @@ -1145,8 +1120,7 @@ public class AndroidServiceImpl implements AndroidService { if (device == null) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage); - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); + throw new NotFoundExceptionDup(errorMessage); } if(androidDevice.getEnrolmentInfo() != null){ device.setEnrolmentInfo(device.getEnrolmentInfo()); @@ -1222,7 +1196,7 @@ public class AndroidServiceImpl implements AndroidService { } } - private Response retrieveAlert(String deviceId) { + private Response retrieveAlert(String deviceId) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device Identifier."); } @@ -1231,21 +1205,20 @@ public class AndroidServiceImpl implements AndroidService { try { deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); if (deviceStates == null) { - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + - "published for Device: " + deviceId + ".").build()); + String errorMessage = "No any alerts are " + + "published for Device: " + deviceId + "."; + throw new NotFoundExceptionDup(errorMessage); } else { return Response.status(Response.Status.OK).entity(deviceStates).build(); } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } } - private Response retrieveAlertFromDate(String deviceId, long from, long to) { + private Response retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { String fromDate = String.valueOf(from); String toDate = String.valueOf(to); if (log.isDebugEnabled()) { @@ -1257,9 +1230,9 @@ public class AndroidServiceImpl implements AndroidService { try { deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); if (deviceStates == null) { - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + - "published on given date for given Device: " + deviceId + ".").build()); + String errorMessage = "No any alerts are " + + "published on given date for given Device: " + deviceId + "."; + throw new NotFoundExceptionDup(errorMessage); } else { return Response.status(Response.Status.OK).entity(deviceStates).build(); @@ -1268,12 +1241,11 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting published events for specific " + "Device: " + deviceId + " on given Date."; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } } - private Response retrieveAlertByType(String deviceId, String type) { + private Response retrieveAlertByType(String deviceId, String type) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device identifier and type."); } @@ -1282,9 +1254,9 @@ public class AndroidServiceImpl implements AndroidService { try { deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); if (deviceStates == null) { - throw new NotFoundException( - new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " + - "published for given Device: '" + deviceId + "' and given specific Type.").build()); + String errorMessage = "No any alerts are " + + "published for given Device: '" + deviceId + "' and given specific Type."; + throw new NotFoundExceptionDup(errorMessage); } else { return Response.status(Response.Status.OK).entity(deviceStates).build(); @@ -1293,8 +1265,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting published events for specific " + "Device: " + deviceId + "and given specific Type."; log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); + throw new UnexpectedServerErrorExceptionDup(msg, e); } } From e0c15be8708c6b7a84a6dd4c5b935f2fc3dbf688 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Thu, 5 Dec 2019 07:15:52 +0530 Subject: [PATCH 09/30] Improve Android enterprise app install --- .../mdm/services/android/util/AndroidEnterpriseUtils.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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/AndroidEnterpriseUtils.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/AndroidEnterpriseUtils.java index d0d88d1fa..6bd4e0be8 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/AndroidEnterpriseUtils.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/AndroidEnterpriseUtils.java @@ -282,11 +282,8 @@ public class AndroidEnterpriseUtils { if (productListResponse != null && productListResponse.getProduct() != null && !productListResponse.getProduct().isEmpty()) { - List packageNamesOfApps = new ArrayList<>(); - for (Product product1 : productListResponse.getProduct()) { - String s = (product1.getProductId().replaceFirst("app:", "")); - packageNamesOfApps.add(s); - } + List packageNamesOfApps = productListResponse.getProduct().stream() + .map(product -> (product.getProductId().replaceFirst("app:", ""))).collect(Collectors.toList()); List existingApps = applicationManager.getApplications(packageNamesOfApps); List products = productListResponse.getProduct(); From 69874726baf48ad9085e34419bafd0349a1f50ef Mon Sep 17 00:00:00 2001 From: shamalka Date: Thu, 5 Dec 2019 17:37:30 +0530 Subject: [PATCH 10/30] Fix android webapp deployment issue --- .../pom.xml | 6 + .../exception/AndroidOperationException.java | 2 +- .../api}/exception/BadRequestException.java | 2 +- .../api}/exception/ForbiddenException.java | 2 +- .../api/exception/GlobalThrowableMapper.java | 6 +- .../api}/exception/NotFoundException.java | 2 +- .../UnexpectedServerErrorException.java | 2 +- .../api/impl/AndroidEnterpriseAPIImpl.java | 414 ++++++++++++++---- .../impl/DeviceManagementAdminAPIImpl.java | 1 - .../impl/DeviceTypeConfigurationAPIImpl.java | 5 +- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 4 +- .../pom.xml | 1 + .../android/core/impl/AndroidServiceImpl.java | 114 ++--- .../android/core/util/AndroidAPIUtils.java | 8 +- .../android/core/util/AndroidDeviceUtils.java | 12 +- .../core/util/AndroidEnterpriseUtils.java | 10 +- .../DeviceManagementAdminServiceTests.java | 78 ++-- .../core/DeviceManagementServiceTests.java | 61 ++- 18 files changed, 464 insertions(+), 266 deletions(-) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api}/exception/AndroidOperationException.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api}/exception/BadRequestException.java (94%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api}/exception/ForbiddenException.java (95%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api}/exception/NotFoundException.java (96%) rename components/mobile-plugins/android-plugin/{org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common => org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api}/exception/UnexpectedServerErrorException.java (96%) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index b0cb54e0c..dc36dd374 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -224,6 +224,12 @@ + + com.google.apis + google-api-services-androidenterprise + v1-rev186-1.25.0 + + org.hibernate hibernate-validator diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidOperationException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidOperationException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java index 527c1b45e..6cd49eded 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/AndroidOperationException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; import org.wso2.carbon.device.mgt.mobile.android.common.Message; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java similarity index 94% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java index 3213a8ed7..a93e39a8e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/ForbiddenException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ForbiddenException.java similarity index 95% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/ForbiddenException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ForbiddenException.java index 451a3e033..9c0741ded 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/ForbiddenException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ForbiddenException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java index f45df54d3..9d0c7fdc6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java @@ -21,11 +21,7 @@ package org.wso2.carbon.device.mgt.mobile.android.api.exception; import com.google.gson.JsonParseException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.ForbiddenException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.naming.AuthenticationException; @@ -58,7 +54,7 @@ public class GlobalThrowableMapper implements ExceptionMapper { if (log.isDebugEnabled()) { log.debug(errorMessage, e); } - return AndroidDeviceUtils.buildBadRequestException(errorMessage).getResponse(); + return new BadRequestException(AndroidDeviceUtils.buildBadRequestException(errorMessage)).getResponse(); } if (e instanceof NotFoundException) { return ((NotFoundException) e).getResponse(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java index 3f412587d..59367917b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java similarity index 96% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java index b00a4e51f..c4390aaa7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; +package org.wso2.carbon.device.mgt.mobile.android.api.exception; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java index aa195ed56..58ef349f3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java @@ -58,7 +58,10 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseU import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.TokenWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; @@ -117,11 +120,24 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { } catch (EnterpriseServiceException e) { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving user").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while adding user"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } return Response.status(Response.Status.OK).entity(token).build(); } - public String insertUser(EnterpriseUser enterpriseUser) throws EnterpriseServiceException { + public String insertUser(EnterpriseUser enterpriseUser) + throws EnterpriseServiceException, AndroidDeviceMgtPluginException { EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); String token; boolean deviceIdExist = false; @@ -171,9 +187,9 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { public Response updateUser(EnterpriseInstallPolicy device) { boolean sentToDevice = false; - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); List enterpriseUserInstances = AndroidAPIUtils.getAndroidPluginService() .getEnterpriseUser(device.getUsername()); GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); @@ -193,6 +209,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) .setMessage(errorMessage).build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while updating user"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } if (sentToDevice) { return Response.status(Response.Status.OK).build(); @@ -213,23 +241,24 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { @QueryParam("isOrganizeAppPageVisible") boolean isOrganizeAppPageVisible, @QueryParam("isManagedConfigEnabled") boolean isManagedConfigEnabled, @QueryParam("host") String host) { - - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); - EnterpriseTokenUrl enterpriseTokenUrl = new EnterpriseTokenUrl(); - if (enterpriseConfigs == null || enterpriseConfigs.getEnterpriseId() == null) { - return Response.status(Response.Status.NOT_FOUND).entity( - new ErrorResponse.ErrorResponseBuilder().setMessage("Not configured for AFW").build()).build(); - } - enterpriseTokenUrl.setEnterpriseId(enterpriseConfigs.getEnterpriseId()); - enterpriseTokenUrl.setApproveApps(approveApps); - enterpriseTokenUrl.setSearchEnabled(searchEnabled); - enterpriseTokenUrl.setPrivateAppsEnabled(isPrivateAppsEnabled); - enterpriseTokenUrl.setWebAppEnabled(isWebAppEnabled); - enterpriseTokenUrl.setOrganizeAppPageVisible(isOrganizeAppPageVisible); - enterpriseTokenUrl.setParentHost(host); - enterpriseTokenUrl.setManagedConfigEnabled(isManagedConfigEnabled); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + EnterpriseTokenUrl enterpriseTokenUrl = new EnterpriseTokenUrl(); + if (enterpriseConfigs == null || enterpriseConfigs.getEnterpriseId() == null) { + return Response.status(Response.Status.NOT_FOUND).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Not configured for AFW").build()).build(); + } + enterpriseTokenUrl.setEnterpriseId(enterpriseConfigs.getEnterpriseId()); + enterpriseTokenUrl.setApproveApps(approveApps); + enterpriseTokenUrl.setSearchEnabled(searchEnabled); + enterpriseTokenUrl.setPrivateAppsEnabled(isPrivateAppsEnabled); + enterpriseTokenUrl.setWebAppEnabled(isWebAppEnabled); + enterpriseTokenUrl.setOrganizeAppPageVisible(isOrganizeAppPageVisible); + enterpriseTokenUrl.setParentHost(host); + enterpriseTokenUrl.setManagedConfigEnabled(isManagedConfigEnabled); + String token = googleAPIInvoker.getAdministratorWebToken(enterpriseTokenUrl); TokenWrapper tokenWrapper = new TokenWrapper(); tokenWrapper.setToken(token); @@ -238,6 +267,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when calling get web token").build()) .build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while getting store url"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -245,9 +286,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { @GET @Path("/products/sync") public Response syncApps() { - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + ProductsListResponse productsListResponse = googleAPIInvoker .listProduct(enterpriseConfigs.getEnterpriseId(), null); AndroidEnterpriseUtils.persistApp(productsListResponse); @@ -265,6 +307,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when persisting app").build()) .build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while syncing apps"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -298,9 +352,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { new ErrorResponse.ErrorResponseBuilder().setMessage("Message body is empty or incorrect").build()) .build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + String id = googleAPIInvoker.insertPage(enterpriseConfigs.getEnterpriseId(), page); page.setPageId(id); return Response.status(Response.Status.OK).entity(page).build(); @@ -312,6 +367,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting page " + page.getPageName() + " , due to an error with ESA").build() ).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while adding page"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -325,9 +392,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { .build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + String id = googleAPIInvoker.updatePage(enterpriseConfigs.getEnterpriseId(), page); page.setPageId(id); return Response.status(Response.Status.OK).entity(page).build(); @@ -339,6 +407,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " + page.getPageName() + " , due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while updating page"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -353,9 +433,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { .build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + googleAPIInvoker.deletePage(enterpriseConfigs.getEnterpriseId(), id); return Response.status(Response.Status.OK).build(); } catch (IOException e) { @@ -366,6 +447,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " + id + " , Due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while deleting page"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -373,9 +466,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { @Path("/store-layout/page") @Override public Response getPages() { - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + StoreLayoutPagesListResponse pages = googleAPIInvoker.listPages(enterpriseConfigs.getEnterpriseId()); return Response.status(Response.Status.OK).entity(pages).build(); } catch (IOException e) { @@ -386,6 +480,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " + " , Due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while getting pages"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -399,9 +505,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { new ErrorResponse.ErrorResponseBuilder().setMessage("Id cannot be empty").build()) .build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + StoreLayout layout = googleAPIInvoker.setStoreLayout(enterpriseConfigs.getEnterpriseId(), id); return Response.status(Response.Status.OK).entity(layout).build(); } catch (IOException e) { @@ -412,6 +519,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting home page " + id + " , due to an error with ESA").build() ).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while setting home"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -419,9 +538,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { @Path("/store-layout/home-page") @Override public Response getHome() { - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + StoreLayout layout = googleAPIInvoker.getStoreLayout(enterpriseConfigs.getEnterpriseId()); return Response.status(Response.Status.OK).entity(layout).build(); } catch (IOException e) { @@ -431,6 +551,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching home page.").build() ) .build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while getting home"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -453,9 +585,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { new ErrorResponse.ErrorResponseBuilder().setMessage("Cluster order cannot be empty").build()).build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + String id = googleAPIInvoker.insertCluster(enterpriseConfigs.getEnterpriseId(), storeCluster); storeCluster.setClusterId(id); return Response.status(Response.Status.OK).entity(storeCluster).build(); @@ -467,6 +600,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " + storeCluster.getName() + " , due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while adding cluster"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -489,9 +634,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { new ErrorResponse.ErrorResponseBuilder().setMessage("Cluster order cannot be empty").build()).build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + String id = googleAPIInvoker.updateCluster(enterpriseConfigs.getEnterpriseId(), storeCluster); storeCluster.setClusterId(id); return Response.status(Response.Status.OK).entity(storeCluster).build(); @@ -503,6 +649,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " + storeCluster.getName() + " , due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while updating cluster"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -519,9 +677,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { new ErrorResponse.ErrorResponseBuilder().setMessage("Page id cannot be empty").build()).build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + googleAPIInvoker.deleteCluster(enterpriseConfigs.getEnterpriseId(), pageId, clusterId); return Response.status(Response.Status.OK).build(); } catch (IOException e) { @@ -532,6 +691,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when deleting cluster " + clusterId + " , due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while deleting cluster"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -544,9 +715,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { new ErrorResponse.ErrorResponseBuilder().setMessage("Page id cannot be empty").build()).build(); } - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + StoreLayoutClustersListResponse response = googleAPIInvoker.getClusters(enterpriseConfigs.getEnterpriseId(), pageId); if (response == null || response.getCluster() == null) { return Response.status(Response.Status.NOT_FOUND).entity( @@ -601,6 +773,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching all details in PageId " + pageId).build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while getting clusters in page"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -608,9 +792,10 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { @Path("/store-layout/page-link") @Override public Response updateLinks(EnterpriseStorePageLinks link) { - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + googleAPIInvoker.addLinks(enterpriseConfigs.getEnterpriseId(), link.getPageId(), link.getLinks()); return Response.status(Response.Status.OK).build(); @@ -622,6 +807,18 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " + " , Due to an error with ESA").build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while updating links"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } } @@ -725,11 +922,12 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { public Response updateUser(ApplicationPolicyDTO applicationPolicyDTO) { boolean sentToDevice = false; - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + for (DeviceIdentifier deviceIdentifier : applicationPolicyDTO.getDeviceIdentifierList()) { try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); AndroidEnterpriseUser userDetail = AndroidAPIUtils.getAndroidPluginService() .getEnterpriseUserByDevice(deviceIdentifier.getId()); @@ -791,7 +989,20 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { log.error(errorMessage); return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) - .setMessage(errorMessage).build()).build(); } + .setMessage(errorMessage).build()).build(); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while updating user"; + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } } if (sentToDevice) { @@ -809,69 +1020,82 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { @Path("/wipe-device") public Response wipeEnterprise() { log.warn("Wiping all devices!!!"); - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - try { - // Take all enterprise devices in the DB. - List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() - .getAllEnterpriseDevices(enterpriseConfigs.getEnterpriseId()); - - // Extract the device identifiers of enterprise devices. - List deviceID = new ArrayList<>(); - if (androidEnterpriseUsers != null && !androidEnterpriseUsers.isEmpty()) { - for (AndroidEnterpriseUser userDevice: androidEnterpriseUsers) { - deviceID.add(userDevice.getEmmDeviceId()); + try{ + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + try { + // Take all enterprise devices in the DB. + List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() + .getAllEnterpriseDevices(enterpriseConfigs.getEnterpriseId()); + + // Extract the device identifiers of enterprise devices. + List deviceID = new ArrayList<>(); + if (androidEnterpriseUsers != null && !androidEnterpriseUsers.isEmpty()) { + for (AndroidEnterpriseUser userDevice: androidEnterpriseUsers) { + deviceID.add(userDevice.getEmmDeviceId()); + } } - } - List byodDevices = new ArrayList<>(); - List copeDevices = new ArrayList<>(); - // Get all registered device - List devices = AndroidAPIUtils.getDeviceManagementService(). - getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false); - for (Device device : devices) { // Go through all enrolled devices - if (deviceID.contains(device.getDeviceIdentifier())) { // Filter out only enterprise enrolled devices. - if (device.getEnrolmentInfo().getOwnership().equals(EnrolmentInfo.OwnerShip.BYOD)) { - byodDevices.add(device.getDeviceIdentifier()); - } else { - copeDevices.add(device.getDeviceIdentifier()); + List byodDevices = new ArrayList<>(); + List copeDevices = new ArrayList<>(); + // Get all registered device + List devices = AndroidAPIUtils.getDeviceManagementService(). + getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false); + for (Device device : devices) { // Go through all enrolled devices + if (deviceID.contains(device.getDeviceIdentifier())) { // Filter out only enterprise enrolled devices. + if (device.getEnrolmentInfo().getOwnership().equals(EnrolmentInfo.OwnerShip.BYOD)) { + byodDevices.add(device.getDeviceIdentifier()); + } else { + copeDevices.add(device.getDeviceIdentifier()); + } } } - } - CommandOperation operation = new CommandOperation(); - operation.setType(Operation.Type.COMMAND);//TODO: Check if this should be profile - // type when implementing COPE/COSU - if (byodDevices != null && !byodDevices.isEmpty()) { // BYOD devices only needs a data wipe(work profile) - log.warn("Wiping " + byodDevices.size() + " BYOD devices"); - operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); - } else if (copeDevices != null && !copeDevices.isEmpty()) { - log.warn("Wiping " + copeDevices.size() + " COPE/COSU devices"); - operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); + CommandOperation operation = new CommandOperation(); + operation.setType(Operation.Type.COMMAND);//TODO: Check if this should be profile + // type when implementing COPE/COSU + if (byodDevices != null && !byodDevices.isEmpty()) { // BYOD devices only needs a data wipe(work profile) + log.warn("Wiping " + byodDevices.size() + " BYOD devices"); + operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); + } else if (copeDevices != null && !copeDevices.isEmpty()) { + log.warn("Wiping " + copeDevices.size() + " COPE/COSU devices"); + operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); + } + AndroidDeviceUtils.getOperationResponse(deviceID, operation); + log.warn("Added wipe to all devices"); + return Response.status(Response.Status.OK).build(); + } catch (EnterpriseServiceException e) { + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving configs").build()).build(); + } catch (OperationManagementException e) { + String errorMessage = "Could not add wipe command to enterprise " + enterpriseConfigs.getEnterpriseId(); + log.error(errorMessage); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (DeviceManagementException e) { + String errorMessage = "Could not add wipe command to enterprise " + enterpriseConfigs.getEnterpriseId() + + " due to an error in device management"; + log.error(errorMessage); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); + } catch (InvalidDeviceException e) { + String errorMessage = "Could not add wipe command to enterprise due to invalid device ids"; + log.error(errorMessage); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } - AndroidDeviceUtils.getOperationResponse(deviceID, operation); - log.warn("Added wipe to all devices"); - return Response.status(Response.Status.OK).build(); - } catch (EnterpriseServiceException e) { - return Response.serverError().entity( - new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving configs").build()).build(); - } catch (OperationManagementException e) { - String errorMessage = "Could not add wipe command to enterprise " + enterpriseConfigs.getEnterpriseId(); - log.error(errorMessage); + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (DeviceManagementException e) { - String errorMessage = "Could not add wipe command to enterprise " + enterpriseConfigs.getEnterpriseId() + - " due to an error in device management"; - log.error(errorMessage); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (InvalidDeviceException e) { - String errorMessage = "Could not add wipe command to enterprise due to invalid device ids"; - log.error(errorMessage); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing wipe enterprice command"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } - } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index f186cd28b..756c6d24e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -88,7 +88,6 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBean import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java index 03015fe74..30e27039e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java @@ -44,7 +44,6 @@ import org.wso2.carbon.device.mgt.mobile.android.api.DeviceTypeConfigurationAPI; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -95,9 +94,9 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP } catch (BadRequestExceptionDup e) { String msg = "The payload of the android platform configuration is incorrect."; log.error(msg, e); - throw new BadRequestException( + return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()); + .setMessage(msg).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String msg = "Error occurred while modifying configuration settings of Android platform"; log.error(msg, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 581b918e0..5523186c9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -34,7 +34,7 @@ - + @@ -44,7 +44,7 @@ - + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 404950cb4..9ba42d84a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -161,6 +161,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.android.common + provided org.wso2.carbon.devicemgt diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index a3043f352..e8279628a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -849,10 +849,10 @@ public class AndroidServiceImpl implements AndroidService { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); throw new UnexpectedServerErrorExceptionDup(errorMessage); - } catch (DeviceManagementException e) { + } catch (BadRequestExceptionDup e) { String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); - throw new UnexpectedServerErrorExceptionDup(errorMessage, e); + throw new BadRequestExceptionDup(errorMessage, e); } } @@ -1345,89 +1345,100 @@ public class AndroidServiceImpl implements AndroidService { } } - public String insertUser(EnterpriseUser enterpriseUser) throws EnterpriseServiceException { - EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); - String token; - boolean deviceIdExist = false; - - String googleUserId; - List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() - .getEnterpriseUser(CarbonContext.getThreadLocalCarbonContext().getUsername()); - GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); - if (androidEnterpriseUsers != null && !androidEnterpriseUsers.isEmpty()) { - googleUserId = androidEnterpriseUsers.get(0).getGoogleUserId(); - // If this device is also present, only need to provide a token for this request. - for (AndroidEnterpriseUser enterprise : androidEnterpriseUsers) { - if (enterprise.getEmmDeviceId() != null - && enterprise.getEmmDeviceId().equals(enterpriseUser.getAndroidPlayDeviceId())) { - deviceIdExist = true; + public String insertUser(EnterpriseUser enterpriseUser) + throws EnterpriseServiceException, AndroidDeviceMgtPluginException { + try { + EnterpriseConfigs enterpriseConfigs = AndroidEnterpriseUtils.getEnterpriseConfigs(); + + String token; + boolean deviceIdExist = false; + + String googleUserId; + List androidEnterpriseUsers = AndroidAPIUtils.getAndroidPluginService() + .getEnterpriseUser(CarbonContext.getThreadLocalCarbonContext().getUsername()); + GoogleAPIInvoker googleAPIInvoker = new GoogleAPIInvoker(enterpriseConfigs.getEsa()); + if (androidEnterpriseUsers != null && !androidEnterpriseUsers.isEmpty()) { + googleUserId = androidEnterpriseUsers.get(0).getGoogleUserId(); + // If this device is also present, only need to provide a token for this request. + for (AndroidEnterpriseUser enterprise : androidEnterpriseUsers) { + if (enterprise.getEmmDeviceId() != null + && enterprise.getEmmDeviceId().equals(enterpriseUser.getAndroidPlayDeviceId())) { + deviceIdExist = true; + } } + } else { + googleUserId = googleAPIInvoker.insertUser(enterpriseConfigs.getEnterpriseId(), CarbonContext + .getThreadLocalCarbonContext() + .getUsername()); } - } else { - googleUserId = googleAPIInvoker.insertUser(enterpriseConfigs.getEnterpriseId(), CarbonContext - .getThreadLocalCarbonContext() - .getUsername()); - } - // Fetching an auth token from Google EMM API - token = googleAPIInvoker.getToken(enterpriseConfigs.getEnterpriseId(), googleUserId); - - if (!deviceIdExist) { - AndroidEnterpriseUser androidEnterpriseUser = new AndroidEnterpriseUser(); - androidEnterpriseUser.setEmmUsername(CarbonContext.getThreadLocalCarbonContext().getUsername()); - androidEnterpriseUser.setTenantId(CarbonContext.getThreadLocalCarbonContext().getTenantId()); - androidEnterpriseUser.setAndroidPlayDeviceId(enterpriseUser.getAndroidPlayDeviceId()); - androidEnterpriseUser.setEnterpriseId(enterpriseConfigs.getEnterpriseId()); - androidEnterpriseUser.setEmmDeviceId(enterpriseUser.getEmmDeviceIdentifier()); - androidEnterpriseUser.setGoogleUserId(googleUserId); - - AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser); + // Fetching an auth token from Google EMM API + token = googleAPIInvoker.getToken(enterpriseConfigs.getEnterpriseId(), googleUserId); + + if (!deviceIdExist) { + AndroidEnterpriseUser androidEnterpriseUser = new AndroidEnterpriseUser(); + androidEnterpriseUser.setEmmUsername(CarbonContext.getThreadLocalCarbonContext().getUsername()); + androidEnterpriseUser.setTenantId(CarbonContext.getThreadLocalCarbonContext().getTenantId()); + androidEnterpriseUser.setAndroidPlayDeviceId(enterpriseUser.getAndroidPlayDeviceId()); + androidEnterpriseUser.setEnterpriseId(enterpriseConfigs.getEnterpriseId()); + androidEnterpriseUser.setEmmDeviceId(enterpriseUser.getEmmDeviceIdentifier()); + androidEnterpriseUser.setGoogleUserId(googleUserId); + + AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser); + } + return token; + } catch (NotFoundExceptionDup e) { + String errorMessage = "Not found"; + log.error(errorMessage); + throw new NotFoundExceptionDup(errorMessage); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Unexpected server error"; + log.error(errorMessage); + throw new UnexpectedServerErrorExceptionDup(errorMessage); + } catch (AndroidDeviceMgtPluginException e) { + String errorMessage = "Error occured while executing wipe enterprice command"; + log.error(errorMessage); + throw new AndroidDeviceMgtPluginException(errorMessage); } - return token; } - private static void validateApplicationUrl(String apkUrl) { + private static void validateApplicationUrl(String apkUrl) throws BadRequestExceptionDup{ try { URL url = new URL(apkUrl); URLConnection conn = url.openConnection(); if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) { String errorMessage = "URL is not pointed to a downloadable file."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } } catch (MalformedURLException e) { String errorMessage = "Malformed application url."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } catch (IOException e) { String errorMessage = "Invalid application url."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } } - private static void validateApplicationType(String type) { + private static void validateApplicationType(String type) throws BadRequestExceptionDup{ if (type != null) { if (!"enterprise".equalsIgnoreCase(type) && !"public".equalsIgnoreCase(type) && !"webapp".equalsIgnoreCase(type)) { String errorMessage = "Invalid application type."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } } else { String errorMessage = "Application type is missing."; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } } - private static void validateScheduleDate(String dateString) { + private static void validateScheduleDate(String dateString) throws BadRequestExceptionDup{ try { if (dateString != null && !dateString.isEmpty()) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); @@ -1437,8 +1448,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (ParseException e) { String errorMessage = "Issue in validating the schedule date"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java index 63abcfdf7..9eeced144 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java @@ -36,7 +36,8 @@ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManag import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; @@ -176,12 +177,11 @@ public class AndroidAPIUtils { } public static Response getOperationResponse(List deviceIDs, Operation operation) - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws AndroidDeviceMgtPluginException, OperationManagementException, InvalidDeviceException { if (deviceIDs == null || deviceIDs.size() == 0) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } DeviceIdentifier deviceIdentifier; List deviceIdentifiers = new ArrayList<>(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java index 035bfd2d2..2a1d4611f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java @@ -94,7 +94,8 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseApp; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.policy.mgt.common.FeatureManagementException; @@ -140,12 +141,11 @@ public class AndroidDeviceUtils { } public static Activity getOperationResponse(List deviceIDs, Operation operation) - throws OperationManagementException, InvalidDeviceException { + throws OperationManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { if (deviceIDs == null || deviceIDs.isEmpty()) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new BadRequestExceptionDup(errorMessage); } DeviceIdentifier deviceIdentifier; List deviceIdentifiers = new ArrayList<>(); @@ -637,10 +637,10 @@ public class AndroidDeviceUtils { * @param description description of the exception * @return a new BadRequestException with the specified details as a response DTO */ - public static BadRequestException buildBadRequestException(String description) { + public static ErrorResponse buildBadRequestException(String description) { ErrorResponse errorResponse = getErrorResponse(AndroidConstants. ErrorMessages.STATUS_BAD_REQUEST_MESSAGE_DEFAULT, 400l, description); - return new BadRequestException(errorResponse); + return errorResponse; } /** diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java index 1fc9549ed..1a10bc538 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java @@ -59,9 +59,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseA import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.*; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; @@ -223,13 +221,13 @@ public class AndroidEnterpriseUtils { return userInfo; } - public static EnterpriseConfigs getEnterpriseConfigs() { + public static EnterpriseConfigs getEnterpriseConfigs() throws AndroidDeviceMgtPluginException { EnterpriseConfigs enterpriseConfigs = getEnterpriseConfigsFromGoogle(); if (enterpriseConfigs.getErrorResponse() != null) { if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { - throw new UnexpectedServerErrorException(enterpriseConfigs.getErrorResponse()); + throw new UnexpectedServerErrorExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); } else if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { - throw new NotFoundException(enterpriseConfigs.getErrorResponse()); + throw new NotFoundExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); } } return enterpriseConfigs; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java index 85a6f251f..f2400f153 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementAdminServiceTests.java @@ -70,8 +70,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureDeviceUnlock() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureDeviceUnlock(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -80,8 +79,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetDeviceLocation() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getDeviceLocation(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -90,8 +88,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testRemovePassword() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.removePassword(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -100,8 +97,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureCamera() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureCamera(TestUtils.getCamerabeanWrapper()); Assert.assertNotNull(activity); @@ -110,8 +106,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetDeviceInformation() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getDeviceInformation(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -120,8 +115,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetDeviceLogcat() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getDeviceLogcat(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -129,8 +123,7 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testWipeDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + public void testWipeDevice() throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.wipeDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -138,8 +131,7 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testWipeData() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + public void testWipeData() throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.wipeData(TestUtils.getWipeDataBeanWrapper()); Assert.assertNotNull(activity); @@ -148,8 +140,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testGetApplications() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.getApplications(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -157,8 +148,7 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testRingDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + public void testRingDevice() throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.ringDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -167,8 +157,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testRebootDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.rebootDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -177,8 +166,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testChangeLockTask() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.changeLockTask(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -186,8 +174,7 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testMuteDevice() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + public void testMuteDevice() throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.muteDevice(TestUtils.getDeviceIds()); Assert.assertNotNull(activity); @@ -196,8 +183,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testInstallApplication() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .installApplication(TestUtils.getApplicationInstallationBeanWrapper()); @@ -207,8 +193,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testUpdateApplication() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper()); Assert.assertNotNull(activity); @@ -217,8 +202,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testUninstallApplicationPublic() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic()); @@ -228,8 +212,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testUninstallApplicationWebApp() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp()); @@ -239,8 +222,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testBlacklistApplications() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService .blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper()); @@ -250,8 +232,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testUpgradeFirmware() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper()); Assert.assertNotNull(activity); @@ -260,8 +241,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureVPN() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureVPN(TestUtils.getVpnBeanWrapper()); Assert.assertNotNull(activity); @@ -270,8 +250,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testSendNotification() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.sendNotification(TestUtils.getNotificationBeanWrapper()); Assert.assertNotNull(activity); @@ -280,8 +259,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testConfigureWifi() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.configureWifi(TestUtils.getWifiBeanWrapper()); Assert.assertNotNull(activity); @@ -290,8 +268,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testEncryptStorage() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.encryptStorage(TestUtils.getEncryptionBeanWrapper()); Assert.assertNotNull(activity); @@ -300,8 +277,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testChangeLockCode() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.changeLockCode(TestUtils.getLockCodeBeanWrapper()); Assert.assertNotNull(activity); @@ -310,8 +286,7 @@ public class DeviceManagementAdminServiceTests { @Test public void testSetPasswordPolicy() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper()); Assert.assertNotNull(activity); @@ -319,8 +294,7 @@ public class DeviceManagementAdminServiceTests { } @Test - public void testSetWebClip() throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + public void testSetWebClip() throws OperationManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); Activity activity = androidService.setWebClip(TestUtils.getWebClipBeanWrapper()); Assert.assertNotNull(activity); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java index b8c749b63..bea230479 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java @@ -62,51 +62,44 @@ public class DeviceManagementServiceTests { } @BeforeClass - public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void init() { MockitoAnnotations.initMocks(this); androidService = new AndroidServiceImpl(); } - private void mockDeviceManagementService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockDeviceManagementService() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService")) .toReturn(new DeviceManagementProviderServiceMock()); } - private void mockApplicationManagerService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockApplicationManagerService() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getApplicationManagerService")) .toReturn(new ApplicationManagementProviderServiceMock()); } - private void mockPolicyManagerService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockPolicyManagerService() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getPolicyManagerService")) .toReturn(new PolicyManagerServiceMock()); } - private void mockDeviceInformationManagerService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockDeviceInformationManagerService() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceInformationManagerService")) .toReturn(new DeviceInformationManagerServiceMock()); } - private void mockNotificationManagementService() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockNotificationManagementService() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getNotificationManagementService")) .toReturn(new NotificationManagementServiceMock()); } - private void mockUser() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + private void mockUser() { PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getAuthenticatedUser")) .toReturn("admin"); } @Test public void testUpdateApplicationList() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - ApplicationManagementException { + throws ApplicationManagementException { mockApplicationManagerService(); Message message = androidService .updateApplicationList(TestUtils.getDeviceId(), TestUtils.getAndroidApplications()); @@ -116,14 +109,14 @@ public class DeviceManagementServiceTests { @Test (expectedExceptions = {InvalidDeviceException.class}) public void testGetPendingOperationsForNullDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { List resultOperations = new ArrayList<>(); androidService.getPendingOperations(null, resultOperations, true); } @Test (expectedExceptions = {InvalidDeviceException.class}) public void testGetPendingOperationsForInvalidDevice() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); List resultOperations = new ArrayList<>(); androidService.getPendingOperations("1234", resultOperations, true); @@ -131,7 +124,7 @@ public class DeviceManagementServiceTests { @Test public void testGetPendingOperationsNullResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); List pendingOperations = androidService .getPendingOperations(TestUtils.getDeviceId(), null, true); @@ -141,7 +134,7 @@ public class DeviceManagementServiceTests { @Test public void testGetPendingOperationsWithMonitorResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockPolicyManagerService(); List pendingOperations = androidService @@ -152,7 +145,7 @@ public class DeviceManagementServiceTests { @Test public void testGetPendingOperationsWithApplicationResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockApplicationManagerService(); List pendingOperations = androidService @@ -164,7 +157,7 @@ public class DeviceManagementServiceTests { @Test public void testGetPendingOperationsWithDeviceInfoResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockDeviceInformationManagerService(); List pendingOperations = androidService @@ -176,7 +169,7 @@ public class DeviceManagementServiceTests { @Test public void testGetPendingOperationsWithInProgressResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, OperationManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); List pendingOperations = androidService .getPendingOperations(TestUtils.getDeviceId(), @@ -187,7 +180,7 @@ public class DeviceManagementServiceTests { @Test public void testGetPendingOperationsWithErrorResponse() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockNotificationManagementService(); List pendingOperations = androidService @@ -199,7 +192,7 @@ public class DeviceManagementServiceTests { @Test public void testEnrollDeviceWithoutLocationSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockPolicyManagerService(); mockUser(); @@ -210,7 +203,7 @@ public class DeviceManagementServiceTests { @Test public void testEnrollDeviceWithLocationSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockDeviceInformationManagerService(); mockPolicyManagerService(); @@ -251,7 +244,7 @@ public class DeviceManagementServiceTests { @Test public void testEnrollDeviceUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockUser(); AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); @@ -263,7 +256,7 @@ public class DeviceManagementServiceTests { @Test public void testIsEnrolledExists() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException { mockDeviceManagementService(); Message message = androidService.isEnrolled(TestUtils.getDeviceId(), null); Assert.assertNotNull(message); @@ -272,7 +265,7 @@ public class DeviceManagementServiceTests { @Test public void testIsEnrolledNonExist() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException { mockDeviceManagementService(); Message message = androidService.isEnrolled("1234", null); Assert.assertNotNull(message); @@ -281,7 +274,7 @@ public class DeviceManagementServiceTests { @Test public void testIsEnrolledNull() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException { mockDeviceManagementService(); Message response = androidService.isEnrolled(null, null); Assert.assertNotNull(response); @@ -290,8 +283,7 @@ public class DeviceManagementServiceTests { @Test public void testModifyEnrollmentSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws DeviceManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockUser(); boolean status = androidService.modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice()); @@ -300,8 +292,7 @@ public class DeviceManagementServiceTests { @Test public void testModifyEnrollmentUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException, - AndroidDeviceMgtPluginException { + throws DeviceManagementException, AndroidDeviceMgtPluginException { mockDeviceManagementService(); mockUser(); AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); @@ -313,7 +304,7 @@ public class DeviceManagementServiceTests { @Test public void testDisEnrollDeviceSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException { mockDeviceManagementService(); boolean status = androidService.disEnrollDevice(TestUtils.getDeviceId()); Assert.assertTrue(status); @@ -321,7 +312,7 @@ public class DeviceManagementServiceTests { @Test public void testDisEnrollUnSuccess() - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + throws DeviceManagementException { mockDeviceManagementService(); boolean status = androidService.disEnrollDevice("1234"); Assert.assertFalse(status); From b9c04a91e3a3897882bb3a112155f15a765360ec Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Fri, 6 Dec 2019 21:08:08 +0530 Subject: [PATCH 11/30] Fix policy loading issue when enrolling Android --- .../api/impl/DeviceManagementAPIImpl.java | 3 +-- .../pom.xml | 4 ++++ .../pom.xml | 17 +++++------------ .../android/core/impl/AndroidServiceImpl.java | 4 +--- .../internal/AndroidPluginServiceComponent.java | 2 +- .../android/core/util/AndroidAPIUtils.java | 4 +--- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 445593c97..a6a8e0046 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -146,8 +146,7 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } try { AndroidService androidService = AndroidAPIUtils.getAndroidService(); - Response response = androidService.enrollDevice(androidDevice); - return response; + return androidService.enrollDevice(androidDevice); } catch (DeviceManagementException e) { String msg = "Error occurred while enrolling the android, which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml index b04328c70..2f9db1994 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml @@ -79,6 +79,10 @@ + + org.eclipse.osgi + org.eclipse.osgi + org.wso2.carbon org.wso2.carbon.logging diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 9ba42d84a..342234c45 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -67,14 +67,19 @@ javax.naming, org.wso2.carbon.context, org.wso2.carbon.utils.*, + org.wso2.carbon.device.mgt.mobile.android.common.*, org.wso2.carbon.device.mgt.common.*, + org.wso2.carbon.device.mgt.core.*, org.wso2.carbon.ndatasource.core, org.wso2.carbon.policy.mgt.common.*, + org.wso2.carbon.policy.mgt.core.*, org.wso2.carbon.registry.core, org.wso2.carbon.registry.core.session, org.wso2.carbon.registry.core.service, org.wso2.carbon.registry.api, org.wso2.carbon.device.mgt.extensions.license.mgt.registry, + org.wso2.carbon.analytics.datasource.commons.*, + org.wso2.carbon.base, com.google.gson.* @@ -161,17 +166,14 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.android.common - provided org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.common - provided org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.core - provided org.slf4j @@ -182,27 +184,22 @@ org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - provided org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - provided org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.application.extension - provided org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common - provided org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations - provided org.testng @@ -229,10 +226,6 @@ org.wso2.carbon.queuing test - - org.wso2.carbon - org.wso2.carbon.ndatasource.core - commons-dbcp.wso2 commons-dbcp diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index e8279628a..cbd7e6b26 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -17,7 +17,6 @@ package org.wso2.carbon.device.mgt.mobile.android.core.impl; -import com.google.api.client.http.HttpStatusCodes; import com.google.api.services.androidenterprise.model.ProductsListResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -838,9 +837,8 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationRestriction.toJSON()); - Response response = AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(), + return AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(), operation); - return response; } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java index 2ee731c65..0465449d2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/internal/AndroidPluginServiceComponent.java @@ -32,7 +32,7 @@ import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; /** - * @scr.component name="org.wso2.carbon.device.mgt.mobile.android.core.impl.internal.AndroidPluginServiceComponent" + * @scr.component name="org.wso2.carbon.device.mgt.mobile.android.impl.internal.AndroidPluginServiceComponent" * immediate="true" * @scr.reference name="org.wso2.carbon.ndatasource" * interface="org.wso2.carbon.ndatasource.core.DataSourceService" diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java index 9eeced144..8318a36bb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java @@ -25,7 +25,6 @@ import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; @@ -35,7 +34,6 @@ import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; @@ -178,7 +176,7 @@ public class AndroidAPIUtils { public static Response getOperationResponse(List deviceIDs, Operation operation) throws AndroidDeviceMgtPluginException, OperationManagementException, InvalidDeviceException { - if (deviceIDs == null || deviceIDs.size() == 0) { + if (deviceIDs == null || deviceIDs.isEmpty()) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); throw new BadRequestExceptionDup(errorMessage); From 0fdff580170e6742d58e49fedd200f51d4bcf81a Mon Sep 17 00:00:00 2001 From: shamalka Date: Sat, 7 Dec 2019 00:19:21 +0530 Subject: [PATCH 12/30] Remove Response references from Android Service --- .../api/impl/DeviceManagementAPIImpl.java | 4 +- .../impl/DeviceManagementAdminAPIImpl.java | 17 +++++- .../api/impl/EventReceiverAPIImpl.java | 4 +- .../pom.xml | 4 ++ .../android/common/spi/AndroidService.java | 9 ++-- .../pom.xml | 2 + .../android/core/impl/AndroidServiceImpl.java | 52 ++++++++----------- 7 files changed, 54 insertions(+), 38 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index a6a8e0046..79db4baac 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -146,7 +146,9 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } try { AndroidService androidService = AndroidAPIUtils.getAndroidService(); - return androidService.enrollDevice(androidDevice); + Message message = androidService.enrollDevice(androidDevice); + return Response.status(Integer.parseInt(message.getResponseCode())) + .entity(message.getResponseMessage()).build(); } catch (DeviceManagementException e) { String msg = "Error occurred while enrolling the android, which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 756c6d24e..7791ee344 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -89,6 +89,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWra import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; @@ -1047,8 +1048,22 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { try{ AndroidService androidService = AndroidAPIUtils.getAndroidService(); - Response response = androidService.sendApplicationConfiguration(applicationRestrictionBeanWrapper); + ProfileOperation operation = androidService.sendApplicationConfiguration(applicationRestrictionBeanWrapper); + Response response = AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(), + operation); return Response.status(Response.Status.CREATED).entity(response).build(); + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) + .setMessage(errorMessage).build()).build(); + } catch (OperationManagementException e) { + String errorMessage = "Issue in retrieving operation management service instance"; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ String msg = "Invalid request"; log.error(msg, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 172a02809..0495c547b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -137,8 +137,8 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { @HeaderParam("If-Modified-Since") String ifModifiedSince) { try{ AndroidService androidService = AndroidAPIUtils.getAndroidService(); - Response response = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); - return response; + List deviceStates = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); + return Response.status(Response.Status.OK).entity(deviceStates).build(); } catch (BadRequestExceptionDup e){ String msg = "Invalid request"; log.error(msg, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml index 2f9db1994..ef36c1b9d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml @@ -117,5 +117,9 @@ org.codehaus.jackson jackson-core-asl + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index 18d16ce31..fac389e18 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -28,9 +28,10 @@ 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.core.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; +import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl; import org.wso2.carbon.device.mgt.mobile.android.common.bean.GoogleAppSyncResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.*; @@ -380,7 +381,7 @@ public interface AndroidService { * @return * @throws {@link AndroidDeviceMgtPluginException} */ - Response sendApplicationConfiguration( + ProfileOperation sendApplicationConfiguration( ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper) throws AndroidDeviceMgtPluginException; @@ -427,7 +428,7 @@ public interface AndroidService { * @return {@link Response} * @throws {@link DeviceManagementException} */ - Response enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException, AndroidDeviceMgtPluginException; + Message enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException, AndroidDeviceMgtPluginException; /** * Method to check if a device is enrolled @@ -480,6 +481,6 @@ public interface AndroidService { * @return {@link Response} * @throws {@link AndroidDeviceMgtPluginException} */ - Response retrieveAlerts(String deviceId, long from, long to, String type, String ifModifiedSince) + List retrieveAlerts(String deviceId, long from, long to, String type, String ifModifiedSince) throws AndroidDeviceMgtPluginException; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 342234c45..620d525f4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -81,6 +81,8 @@ org.wso2.carbon.analytics.datasource.commons.*, org.wso2.carbon.base, com.google.gson.* + org.wso2.carbon.device.application.mgt.common.* + org.wso2.carbon.user.core. !org.wso2.carbon.device.mgt.mobile.android.core.internal, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index cbd7e6b26..a0802448b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -17,6 +17,7 @@ package org.wso2.carbon.device.mgt.mobile.android.core.impl; +import com.google.api.client.http.HttpStatusCodes; import com.google.api.services.androidenterprise.model.ProductsListResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -63,7 +64,7 @@ import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtil import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; -import javax.ws.rs.core.Response; + import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -222,13 +223,13 @@ public class AndroidServiceImpl implements AndroidService { if (device != null) { String status = String.valueOf(device.getEnrolmentInfo().getStatus()); Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.OK.toString()); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_OK)); responseMessage .setResponseMessage("Status of android device that carries the id '" + id + "' is " + status); return responseMessage; } else { Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.NOT_FOUND.toString()); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_NOT_FOUND)); responseMessage.setResponseMessage("No Android device is found upon the id '" + id + "'"); return responseMessage; } @@ -824,7 +825,7 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public Response sendApplicationConfiguration(ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper) + public ProfileOperation sendApplicationConfiguration(ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper) throws AndroidDeviceMgtPluginException { try { if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) { @@ -837,16 +838,7 @@ public class AndroidServiceImpl implements AndroidService { operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG); operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationRestriction.toJSON()); - return AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.getDeviceIDs(), - operation); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorExceptionDup(errorMessage); + return operation; } catch (BadRequestExceptionDup e) { String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); @@ -975,7 +967,7 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public Response enrollDevice(AndroidDevice androidDevice) + public Message enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException, AndroidDeviceMgtPluginException { try { String token = null; @@ -1069,21 +1061,21 @@ public class AndroidServiceImpl implements AndroidService { } Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.OK.toString()); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_OK)); if (token == null) { responseMessage.setResponseMessage("Android device, which carries the id '" + androidDevice.getDeviceIdentifier() + "' has successfully been enrolled"); } else { responseMessage.setResponseMessage("Google response token" + token); } - return Response.status(Response.Status.OK).entity(responseMessage).build(); + return responseMessage; } else { Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)); responseMessage.setResponseMessage("Failed to enroll '" + device.getType() + "' device, which carries the id '" + androidDevice.getDeviceIdentifier() + "'"); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(responseMessage).build(); + return responseMessage; } } catch (PolicyManagementException | InvalidDeviceException | OperationManagementException e) { String msg = "Error occurred while enforcing default enrollment policy upon android " + @@ -1174,11 +1166,11 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public Response retrieveAlerts(String deviceId, - long from, - long to, - String type, - String ifModifiedSince) throws AndroidDeviceMgtPluginException { + public List retrieveAlerts(String deviceId, + long from, + long to, + String type, + String ifModifiedSince) throws AndroidDeviceMgtPluginException { if (from != 0l && to != 0l && deviceId != null){ return retrieveAlertFromDate(deviceId, from, to); } else if (deviceId != null && type != null) { @@ -1194,7 +1186,7 @@ public class AndroidServiceImpl implements AndroidService { } } - private Response retrieveAlert(String deviceId) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlert(String deviceId) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device Identifier."); } @@ -1207,7 +1199,7 @@ public class AndroidServiceImpl implements AndroidService { "published for Device: " + deviceId + "."; throw new NotFoundExceptionDup(errorMessage); } else { - return Response.status(Response.Status.OK).entity(deviceStates).build(); + return deviceStates; } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; @@ -1216,7 +1208,7 @@ public class AndroidServiceImpl implements AndroidService { } } - private Response retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { String fromDate = String.valueOf(from); String toDate = String.valueOf(to); if (log.isDebugEnabled()) { @@ -1233,7 +1225,7 @@ public class AndroidServiceImpl implements AndroidService { throw new NotFoundExceptionDup(errorMessage); } else { - return Response.status(Response.Status.OK).entity(deviceStates).build(); + return deviceStates; } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific " + @@ -1243,7 +1235,7 @@ public class AndroidServiceImpl implements AndroidService { } } - private Response retrieveAlertByType(String deviceId, String type) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlertByType(String deviceId, String type) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device identifier and type."); } @@ -1257,7 +1249,7 @@ public class AndroidServiceImpl implements AndroidService { throw new NotFoundExceptionDup(errorMessage); } else { - return Response.status(Response.Status.OK).entity(deviceStates).build(); + return deviceStates; } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific " + From 35b42b45a9463027fc13835068e9cd73cbbeade8 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Sat, 7 Dec 2019 20:54:57 +0530 Subject: [PATCH 13/30] Fix Android enrollment issue --- .../pom.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 620d525f4..5c1f77b66 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -78,11 +78,16 @@ org.wso2.carbon.registry.core.service, org.wso2.carbon.registry.api, org.wso2.carbon.device.mgt.extensions.license.mgt.registry, + org.wso2.carbon.apimgt.application.extension.*, org.wso2.carbon.analytics.datasource.commons.*, org.wso2.carbon.base, - com.google.gson.* - org.wso2.carbon.device.application.mgt.common.* - org.wso2.carbon.user.core. + com.google.gson.*, + org.wso2.carbon.device.application.mgt.common.*, + org.wso2.carbon.user.core.*, + org.wso2.carbon.user.api.*, + org.apache.commons.httpclient, + org.apache.http, + org.apache.http.client.methods !org.wso2.carbon.device.mgt.mobile.android.core.internal, From 9c34babe972869162ded575f40fde315f0bc4085 Mon Sep 17 00:00:00 2001 From: sandarudr Date: Mon, 9 Dec 2019 12:00:00 +0530 Subject: [PATCH 14/30] Add UI changes to enroll COPE using QR code --- .../configuration.hbs | 1 + .../public/js/type-view.js | 2 +- .../units/cdmf.unit.device.type.android.type-view/type-view.hbs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs index 84e23a02b..b8d938e31 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs @@ -166,6 +166,7 @@
+ ( ex: www.abc.com:8280 ) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/js/type-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/js/type-view.js index 16816e7ec..89c474f58 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/js/type-view.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/js/type-view.js @@ -108,7 +108,7 @@ function generateKIOSKQRCode(qrCodeClass) { function(data) { data = JSON.parse(data); if (data != null && data.configuration != null) { - if (ownership_type == "COSU") { + if (ownership_type == "COSU" || ownership_type == "COPE") { for (var i = 0; i < data.configuration.length; i++) { var config = data.configuration[i]; if (config.name === kioskConfigs["adminComponentName"]) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs index 105b7ea03..b034fb541 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs @@ -85,7 +85,7 @@

Step 02 - Enroll the Android Agent.


Your device can be enrolled with Entgra IoTS automatically via QR code or manually by a wizard. - To enroll automatically; first download agent as mentioned in Step 1 then proceed with the ENROLL WITH QR option from the device setup activity. + To enroll automatically, first download and install the agent as mentioned in Step 1 then proceed with the ENROLL WITH QR option from the device setup activity. Thereafter select the ownership configuration and scan the generated QR to complete the process. To enroll manually; select the Manual enrollment option from the setup activity and follow the succeeding steps.


From 082f2484f408b701b418256e50d1102cae3caafb Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Tue, 10 Dec 2019 09:21:08 +0530 Subject: [PATCH 15/30] Bump dependency versions to dev versions --- .../mdm/services/android/util/AndroidEnterpriseUtils.java | 7 +++++-- pom.xml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) 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/AndroidEnterpriseUtils.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/AndroidEnterpriseUtils.java index 6bd4e0be8..d0d88d1fa 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/AndroidEnterpriseUtils.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/AndroidEnterpriseUtils.java @@ -282,8 +282,11 @@ public class AndroidEnterpriseUtils { if (productListResponse != null && productListResponse.getProduct() != null && !productListResponse.getProduct().isEmpty()) { - List packageNamesOfApps = productListResponse.getProduct().stream() - .map(product -> (product.getProductId().replaceFirst("app:", ""))).collect(Collectors.toList()); + List packageNamesOfApps = new ArrayList<>(); + for (Product product1 : productListResponse.getProduct()) { + String s = (product1.getProductId().replaceFirst("app:", "")); + packageNamesOfApps.add(s); + } List existingApps = applicationManager.getApplications(packageNamesOfApps); List products = productListResponse.getProduct(); diff --git a/pom.xml b/pom.xml index 794dedbde..37e1c854f 100644 --- a/pom.xml +++ b/pom.xml @@ -1204,7 +1204,7 @@ - 4.1.5 + 4.1.6-SNAPSHOT [4.0.0, 5.0.0) From de548efd18aff3b5f25c10c27ecafd6ce2322fc2 Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 10 Dec 2019 15:17:00 +0530 Subject: [PATCH 16/30] Fix for enrollment app install without Google --- .../device/mgt/mobile/android/core/util/AndroidDeviceUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java index 2a1d4611f..eafcc6e37 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java @@ -705,7 +705,7 @@ public class AndroidDeviceUtils { JsonElement googlePolicyPayload = appElement.getAsJsonObject(). get(AndroidConstants.ApplicationInstall.GOOGLE_POLICY_PAYLOAD); - if (googlePolicyPayload == null) { + if (googlePolicyPayload == null || googlePolicyPayload.toString().equals("\"\"")) { uuid = appElement.getAsJsonObject(). get(AndroidConstants.ApplicationInstall.ENROLLMENT_APP_INSTALL_UUID).getAsString(); try (CloseableHttpClient httpClient = HttpClients.createDefault()) { From 127934e0b5fd7a60a8400f6eb34ec2c23f59bacc Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 10 Dec 2019 16:15:31 +0530 Subject: [PATCH 17/30] Fix test cases --- .../core/DeviceManagementServiceTests.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java index bea230479..2a5b818e4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/test/java/org/wso2/carbon/device/mgt/mobile/android/core/DeviceManagementServiceTests.java @@ -196,9 +196,9 @@ public class DeviceManagementServiceTests { mockDeviceManagementService(); mockPolicyManagerService(); mockUser(); - Response response = androidService.enrollDevice(TestUtils.getBasicAndroidDevice()); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Message message = androidService.enrollDevice(TestUtils.getBasicAndroidDevice()); + Assert.assertNotNull(message); + Assert.assertEquals(message.getResponseCode(), Response.Status.OK.getStatusCode()); } @Test @@ -237,9 +237,9 @@ public class DeviceManagementServiceTests { properties.add(property); androidDevice.setProperties(properties); - Response response = androidService.enrollDevice(androidDevice); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); + Message message = androidService.enrollDevice(androidDevice); + Assert.assertNotNull(message); + Assert.assertEquals(message.getResponseCode(), Response.Status.OK.getStatusCode()); } @Test @@ -249,9 +249,9 @@ public class DeviceManagementServiceTests { mockUser(); AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice(); androidDevice.setDeviceIdentifier("1234"); - Response response = androidService.enrollDevice(androidDevice); - Assert.assertNotNull(response); - Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + Message message = androidService.enrollDevice(androidDevice); + Assert.assertNotNull(message); + Assert.assertEquals(message.getResponseCode(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); } @Test From fe662f6d670db8899375c630a4bf4ffa1782dbfa Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Tue, 10 Dec 2019 17:58:18 +0530 Subject: [PATCH 18/30] Improve dependency importing in android plugins --- .../pom.xml | 76 ++++++++ .../pom.xml | 50 +++++- .../pom.xml | 166 ++++++++++++++++++ 3 files changed, 288 insertions(+), 4 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index dc36dd374..09c46731a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -111,6 +111,10 @@ xmlschema-core org.apache.ws.xmlschema + + stax2-api + org.codehaus.woodstox + @@ -186,6 +190,14 @@ neethi org.wso2.orbit.org.apache.neethi + + httpcore + org.apache.httpcomponents + + + geronimo-javamail_1.4_spec + org.apache.geronimo.specs + @@ -197,6 +209,14 @@ asm org.ow2.asm + + objenesis + org.objenesis + + + guava + com.google.guava + @@ -221,6 +241,10 @@ org.slf4j slf4j-api + + guava + com.google.guava + @@ -228,6 +252,16 @@ com.google.apis google-api-services-androidenterprise v1-rev186-1.25.0 + + + guava + com.google.guava + + + jackson-core + com.fasterxml.jackson.core + + @@ -261,6 +295,18 @@ wsdl4j wsdl4j.wso2 + + geronimo-stax-api_1.0_spec + org.apache.geronimo.specs.wso2 + + + org.wso2.securevault + org.wso2.securevault + + + axis2-client + org.apache.axis2.wso2 + @@ -281,6 +327,32 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.android.core provided + + + org.wso2.carbon.feature.mgt.core + org.wso2.carbon + + + commons-lang3 + org.apache.commons + + + annotations + com.google.code.findbugs + + + stax2-api + org.codehaus.woodstox + + + jaxb-impl + com.sun.xml.bind + + + jackson-datatype-joda + com.fasterxml.jackson.datatype + + org.wso2.carbon.devicemgt @@ -312,6 +384,10 @@ XmlSchema org.apache.ws.commons.schema.wso2 + + axiom-api + org.apache.ws.commons.axiom + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml index ef36c1b9d..fd5301fe1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/pom.xml @@ -95,6 +95,12 @@ com.google.apis google-api-services-androidenterprise v1-rev186-1.25.0 + + + commons-logging + commons-logging + + io.swagger @@ -108,10 +114,20 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common provided - - - javax.ws.rs - javax.ws.rs-api + + + commons-logging + commons-logging + + + objenesis + org.objenesis + + + guava + com.google.guava + + org.codehaus.jackson @@ -120,6 +136,32 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.core + + + woodstox-core-asl + org.codehaus.woodstox + + + commons-logging + commons-logging + + + axiom-api + org.apache.ws.commons.axiom + + + geronimo-stax-api_1.0_spec + org.apache.geronimo.specs.wso2 + + + axis2-client + org.apache.axis2.wso2 + + + httpcore + org.apache.httpcomponents + + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 5c1f77b66..4d20f4fe6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -149,10 +149,22 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.extensions + + + woodstox-core-asl + org.codehaus.woodstox + + org.wso2.carbon org.wso2.carbon.ndatasource.core + + + commons-logging + commons-logging + + org.wso2.carbon @@ -186,6 +198,22 @@ org.slf4j slf4j-api + + axis2-client + org.apache.axis2.wso2 + + + axiom-api + org.apache.ws.commons.axiom + + + httpcore + org.apache.httpcomponents + + + commons-logging + commons-logging + @@ -199,10 +227,142 @@ org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.application.extension + + + commons-logging + commons-logging + + + slf4j-api + org.slf4j + + + geronimo-stax-api_1.0_spec + org.apache.geronimo.specs.wso2 + + + xml-apis + xml-apis + + + jackson-core + com.fasterxml.jackson.core + + + validation-api + javax.validation + + + jackson-mapper-asl + org.codehaus.jackson + + + axiom-api + org.apache.ws.commons.axiom + + + axiom-impl + org.apache.ws.commons.axiom + + + xercesImpl + xerces + + + commons-httpclient + commons-httpclient + + + jackson-databind + com.fasterxml.jackson.core + + + commons-beanutils + commons-beanutils + + + org.eclipse.core.runtime + org.eclipse.core + + + commons-pool + commons-pool + + + XmlSchema + org.apache.ws.commons.schema + + + tomcat + org.wso2.tomcat + + + guava + com.google.guava + + + codemodel + com.sun.codemodel + + + hibernate + org.hibernate + + + asm + asm + + + geronimo-jta_1.1_spec + org.apache.geronimo.specs + + + wstx-asl + org.codehaus.woodstox + + + wsdl4j + wsdl4j.wso2 + + + commons-fileupload + commons-fileupload + + + org.wso2.carbon.ntask.core + org.wso2.carbon.commons + + + org.wso2.securevault + org.wso2.securevault + + + maven-scm-provider-svnexe + org.apache.maven.scm + + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.common + + + guava + com.google.guava + + + objenesis + org.objenesis + + + commons-logging + commons-logging + + + org.wso2.carbon.feature.mgt.core + org.wso2.carbon + + org.wso2.carbon.devicemgt @@ -217,6 +377,12 @@ org.powermock powermock-module-testng test + + + objenesis + org.objenesis + + org.powermock From 90e7e731faeaf5bebcb0af2f1ce8d43bfb846044 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Tue, 10 Dec 2019 19:17:19 +0530 Subject: [PATCH 19/30] Prepare for the release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 37e1c854f..9d12724b6 100644 --- a/pom.xml +++ b/pom.xml @@ -1204,7 +1204,7 @@ - 4.1.6-SNAPSHOT + 4.1.6 [4.0.0, 5.0.0) From ca3b778594b3c52365954204e1de7a03508e5edc Mon Sep 17 00:00:00 2001 From: shamalka Date: Tue, 10 Dec 2019 19:45:55 +0530 Subject: [PATCH 20/30] Change error messages in android API --- .../api/impl/DeviceManagementAPIImpl.java | 10 +- .../impl/DeviceManagementAdminAPIImpl.java | 180 +++++++++--------- .../api/impl/EventReceiverAPIImpl.java | 8 +- 3 files changed, 100 insertions(+), 98 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 79db4baac..1b85f1f1d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -210,19 +210,19 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(msg).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "The payload of the android device enrollment is incorrect."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (NotFoundExceptionDup e) { - String errorMessage = "Class not found"; + String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage, e); return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { - String errorMessage = "Error occured"; + String errorMessage = "Error occured while modifying enrollment"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 7791ee344..4e18c9cc2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -133,11 +133,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e) { - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing file tranfer operation"; log.error(errorMessage, e); @@ -166,11 +166,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing device lock operation"; log.error(errorMessage, e); @@ -199,11 +199,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing device unlock operation"; log.error(errorMessage, e); @@ -232,11 +232,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while retrieving device location"; log.error(errorMessage, e); @@ -265,11 +265,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing remove password operation"; log.error(errorMessage, e); @@ -298,11 +298,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing control camera operation"; log.error(errorMessage, e); @@ -329,11 +329,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while retrieving device information"; log.error(errorMessage, e); @@ -360,11 +360,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while retrieving device logcat"; log.error(errorMessage, e); @@ -393,11 +393,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing enterprice wipe device operation"; log.error(errorMessage, e); @@ -426,11 +426,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing Android wipe-data device operation"; log.error(errorMessage, e); @@ -459,11 +459,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing Android getApplicationList device operation"; log.error(errorMessage, e); @@ -492,11 +492,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing Android ring device operation"; log.error(errorMessage, e); @@ -525,11 +525,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing Android reboot device operation"; log.error(errorMessage, e); @@ -558,11 +558,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing Android change LockTask mode operation"; log.error(errorMessage, e); @@ -591,11 +591,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing mute device operation"; log.error(errorMessage, e); @@ -625,11 +625,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing install application operation"; log.error(errorMessage, e); @@ -658,11 +658,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing update application operation"; log.error(errorMessage, e); @@ -692,11 +692,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing uninstall application operation"; log.error(errorMessage, e); @@ -725,11 +725,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing blacklist application operation"; log.error(errorMessage, e); @@ -758,11 +758,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing upgrade firmware operation"; log.error(errorMessage, e); @@ -791,11 +791,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing configure vpn operation"; log.error(errorMessage, e); @@ -824,11 +824,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing send notification operation"; log.error(errorMessage, e); @@ -857,11 +857,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing configure wifi operation"; log.error(errorMessage, e); @@ -890,11 +890,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing encrypt operation operation"; log.error(errorMessage, e); @@ -923,11 +923,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing change lock code operation"; log.error(errorMessage, e); @@ -956,11 +956,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing set password policy operation"; log.error(errorMessage, e); @@ -989,11 +989,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing set webclip operation"; log.error(errorMessage, e); @@ -1024,11 +1024,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while applying 'configure-global-proxy' operation"; log.error(errorMessage, e); @@ -1065,11 +1065,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Issue in retrieving device management service instance"; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while sending app configuration"; log.error(errorMessage, e); @@ -1099,11 +1099,11 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing configure-display-message operation"; log.error(errorMessage, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 0495c547b..c7323f58e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -140,11 +140,13 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { List deviceStates = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); return Response.status(Response.Status.OK).entity(deviceStates).build(); } catch (BadRequestExceptionDup e){ - String msg = "Invalid request"; - log.error(msg, e); + String errorMessage = "Request must contain " + + "the device identifier. Optionally, both from and to value should be present to get " + + "alerts between times."; + log.error(errorMessage); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); } catch (NotFoundExceptionDup e) { String errorMessage = "Class not found"; log.error(errorMessage, e); From 63ecb3d4a2323cddc5e5f9c79f2888e40047f8b3 Mon Sep 17 00:00:00 2001 From: Entgra Builder Date: Tue, 10 Dec 2019 14:18:08 +0000 Subject: [PATCH 21/30] [maven-release-plugin] prepare release v5.0.6 --- .../org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/pull-notification-listeners/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/remote-session-extension/pom.xml | 2 +- .../org.wso2.extension.siddhi.device/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- .../org.wso2.gpl.siddhi.extension.geo.script/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- components/test-coverage/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- .../org.wso2.extension.siddhi.device.feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 2 +- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 90 files changed, 106 insertions(+), 106 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index e8f493ae6..68f24beb3 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 53823f6ac..802544daa 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index c83fa3651..0f067685b 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index 539db1e95..cb81fef74 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index 2aed4749a..7fae96f44 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index e6bf846f2..c3dc28516 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 16448cd23..39e9e309f 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 42d277edd..e6cb3ca53 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index fb00a61a5..abd1394af 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 034b709e3..c8bc91ffe 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 3cd8e89e3..76d9d913c 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index b46c3d756..c3000eb7f 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index 16e656d8f..0c884aa85 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 225e11b2a..9fdfccbf9 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index da1ccbf05..1450b3ba9 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index fc2121d84..b48bed9c9 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index 9ece62170..b51c80d33 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index 8d665239a..c006e4931 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 83c4702c0..56217a219 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index c0b69e38d..b4b41bb32 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index 8e00cf299..cd526d011 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index ed5096669..3efc977f9 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 7827ba6c6..66261e6d1 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 65ed08179..17d0bb38c 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 2c954be8c..416fc72ca 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index 9d314b857..a4c49ba6d 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index 2c068ad00..6196e9dd5 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index 5bbbf93de..16ca4706e 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 510c31777..261f6a15a 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml index 3c93ee130..a3f9fc0e3 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 99066ef2d..6387e748a 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index ff8152b65..435d3f385 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index fdd58c016..3a8a6b379 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index 3bb85df69..76949c585 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 290829a98..c368aa465 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index c5fd9bcf4..6cae9f3f9 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 5cb56cfd5..76485ca40 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 89a156da7..07f48d97e 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 2448565fc..9722196d8 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index 2dd725db6..2a7c32338 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index 606e15565..55b134f9b 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml index 586c18234..9c0085aff 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml index b392ac7fa..3943c5629 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/remote-session-extension/pom.xml b/components/extensions/remote-session-extension/pom.xml index 44e97d175..289106cbb 100644 --- a/components/extensions/remote-session-extension/pom.xml +++ b/components/extensions/remote-session-extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml index 982bb7f43..3b4de87f5 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index 8412a01a1..b3b0b10df 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index 2e5c21b42..7cead2406 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index ec801cc6b..17fc72e63 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 0d974340c..4833a8a17 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index 6fd066e4d..6382b2947 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index 687ab3dd0..f1a7ac8e6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 5.0.6-SNAPSHOT + 5.0.6 WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index e376a7821..93989a184 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 6d2acbc0f..d9fcc01ba 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 9cd445bfc..cc0356d27 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 690fce4aa..8bb32f0a3 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -22,7 +22,7 @@ carbon-device-mgt-plugins-parent org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml index cc776ac2e..595305b36 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index 967081287..c80031328 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 75fa4d300..667792aca 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index 0e8e367f2..ba97ca8a3 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index deed82a4e..5c4dcd49f 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml index cc030c65d..64f6290fb 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Android Sense Analytics Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml index 9142ea535..c816de092 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.backend.feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Android Sense Backend Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml index 97122d61e..0d1e37a46 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.ui.feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Android Sense UI Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index a1ccc516c..4ffae2575 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml index 44fe3ab1c..fe2d84755 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml index 8604f3998..e2cd71a40 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml index 56c1e6d29..655f8e474 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index 839321ae8..99d0471e9 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index e87b15b61..8d59259a3 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 device-types-feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml index 9c7539696..3cef01164 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml index 9223a9189..1eb7fa76d 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml index efa6a3faa..6fb1f38b7 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 1981b9546..58eb270b5 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml index e3c082928..200702500 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml index 393b9663a..b13bbc8eb 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml index 44958d8d9..297c98930 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index 11e4f1565..57426cef0 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index decfd4211..614fa0a92 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index d2db796d3..46bc72726 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index ce96fc02b..4d70525ed 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 5.0.6-SNAPSHOT + 5.0.6 WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml index 0c955e5ec..654cb1e8d 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.notification.listener.feature pom - 5.0.6-SNAPSHOT + 5.0.6 WSO2 Carbon - Notification Listener http://wso2.org This feature contains the core bundles required iot core listeners diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml index 433673b0f..819bee8fd 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 diff --git a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml index b19d8253c..7ee1b0c14 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 353fa0fc3..3d1969d23 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 5.0.6-SNAPSHOT + 5.0.6 WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml index ee30f89aa..cc7a77d48 100644 --- a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml +++ b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index b8d66ca4a..97371245e 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 extensions-feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management Extensions http://wso2.org 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 2e949922b..77baebf53 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 @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 5.0.6-SNAPSHOT + 5.0.6 WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index c1a0a7630..647e2198a 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 5.0.6-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 android-plugin-feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index 2ad825bd6..a23434eb9 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 mobile-plugins-feature - 5.0.6-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 9d12724b6..27bfb42fd 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 5.0.6-SNAPSHOT + 5.0.6 WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1208,7 +1208,7 @@ [4.0.0, 5.0.0) - 5.0.6-SNAPSHOT + 5.0.6 4.0.3 @@ -1391,7 +1391,7 @@ https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git - HEAD + v5.0.6 From 22abe89f05c874d9efafecf8618ef0067b8a5111 Mon Sep 17 00:00:00 2001 From: Entgra Builder Date: Tue, 10 Dec 2019 14:18:15 +0000 Subject: [PATCH 22/30] [maven-release-plugin] prepare for next development iteration --- .../org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/pull-notification-listeners/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/remote-session-extension/pom.xml | 2 +- .../org.wso2.extension.siddhi.device/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- .../org.wso2.gpl.siddhi.extension.geo.script/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- components/test-coverage/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- .../org.wso2.extension.siddhi.device.feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 2 +- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 90 files changed, 106 insertions(+), 106 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index 68f24beb3..a42bd7296 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 802544daa..fadfbdec3 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index 0f067685b..1c0a30747 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index cb81fef74..ccefefbe0 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index 7fae96f44..dfd8618e8 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index c3dc28516..a9fe618e0 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 39e9e309f..4ad612d9f 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index e6cb3ca53..15f7513d4 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index abd1394af..520d22943 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index c8bc91ffe..a4785bd54 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 76d9d913c..4bafeeadd 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index c3000eb7f..eb9151d86 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index 0c884aa85..7d85731c6 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 9fdfccbf9..6b7766ee9 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 1450b3ba9..4c1d4831d 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index b48bed9c9..0881f3e87 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index b51c80d33..5acfe53c9 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index c006e4931..1a1ad5946 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 56217a219..79d9289c0 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index b4b41bb32..40f948828 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index cd526d011..2337fa1a8 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 3efc977f9..389ee5159 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 66261e6d1..37e21ffd7 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 17d0bb38c..a17189b45 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 416fc72ca..863cadafa 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index a4c49ba6d..266811d02 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index 6196e9dd5..156d92f95 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index 16ca4706e..b9ef9070d 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 261f6a15a..d6f4d2f83 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml index a3f9fc0e3..73b20aad6 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 6387e748a..ffd93d12c 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index 435d3f385..5d5145cc3 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 3a8a6b379..2109bb41a 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index 76949c585..2f3d48f2d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index c368aa465..2939a854d 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index 6cae9f3f9..71092f0bc 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 76485ca40..c3cdc99ff 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 07f48d97e..aca8a3c20 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 9722196d8..99d0f8572 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index 2a7c32338..d51779668 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index 55b134f9b..921b855f6 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml index 9c0085aff..d5fb55f30 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml index 3943c5629..9e8667c25 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/pom.xml b/components/extensions/remote-session-extension/pom.xml index 289106cbb..d6488c370 100644 --- a/components/extensions/remote-session-extension/pom.xml +++ b/components/extensions/remote-session-extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml index 3b4de87f5..0774b29df 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index b3b0b10df..76e1148e8 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index 7cead2406..6c1f686ea 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index 17fc72e63..a28f2c5b3 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 4833a8a17..7610952c3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index 6382b2947..05587a133 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index f1a7ac8e6..6db3752a1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index 93989a184..97e023a72 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index d9fcc01ba..4813cdc09 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index cc0356d27..2116a9dd2 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 8bb32f0a3..ee4f9a78b 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -22,7 +22,7 @@ carbon-device-mgt-plugins-parent org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml index 595305b36..674063149 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index c80031328..ca0d98e1f 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 667792aca..49219ceff 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index ba97ca8a3..7922c0cf6 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 5c4dcd49f..38f348562 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml index 64f6290fb..fa4663742 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Analytics Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml index c816de092..530ae1ae4 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.backend.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Backend Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml index 0d1e37a46..491127f2c 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.ui.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense UI Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index 4ffae2575..2444a4f1b 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml index fe2d84755..ec5359cb6 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml index e2cd71a40..9392eede1 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml index 655f8e474..946424b74 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index 99d0471e9..b12b9c05f 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 8d59259a3..fc2b83ebb 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml index 3cef01164..51b1345f0 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml index 1eb7fa76d..608b5aeff 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml index 6fb1f38b7..734f06eff 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 58eb270b5..4ed617fbb 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml index 200702500..bc81e0a3f 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml index b13bbc8eb..235b0e31e 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml index 297c98930..e6d5b8541 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index 57426cef0..521bbebbb 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 614fa0a92..707814bd3 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index 46bc72726..63ee880e8 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index 4d70525ed..77288451f 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml index 654cb1e8d..f5409d54b 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.notification.listener.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Notification Listener http://wso2.org This feature contains the core bundles required iot core listeners diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml index 819bee8fd..2e5703410 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml index 7ee1b0c14..1b1666843 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 3d1969d23..94b145887 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml index cc7a77d48..f8e82f290 100644 --- a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml +++ b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 97371245e..77265a6c8 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management Extensions http://wso2.org 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 77baebf53..3281e9e36 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 @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index 647e2198a..63eb52b5d 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 android-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index a23434eb9..ddf778bf1 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 mobile-plugins-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 27bfb42fd..e46e0d8d3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1208,7 +1208,7 @@ [4.0.0, 5.0.0) - 5.0.6 + 5.0.7-SNAPSHOT 4.0.3 @@ -1391,7 +1391,7 @@ https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git - v5.0.6 + HEAD From 21da576b8f70878a3b4c4e1bb995bd49e872412a Mon Sep 17 00:00:00 2001 From: shamalka Date: Thu, 12 Dec 2019 20:46:06 +0530 Subject: [PATCH 23/30] Fix publishEvents API --- .../api/impl/DeviceManagementAPIImpl.java | 2 +- .../api/impl/EventReceiverAPIImpl.java | 66 +++----- .../android/common/spi/AndroidService.java | 2 +- .../pom.xml | 3 +- .../android/core/impl/AndroidServiceImpl.java | 145 +++++++++++++----- 5 files changed, 129 insertions(+), 89 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 1b85f1f1d..70daaccec 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -118,7 +118,7 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { } catch (InvalidDeviceException e) { String msg = "Device identifier is invalid. Device identifier " + id; log.error(msg, e); - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (DeviceManagementException e) { String msg = "Error occurred while getting pending operations of the device."; log.error(msg, e); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index c7323f58e..f9dce18a7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -70,58 +70,28 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { @Path("/publish") @Override public Response publishEvents(@Valid EventBeanWrapper eventBeanWrapper) { - if (log.isDebugEnabled()) { - log.debug("Invoking Android device event logging."); - } - Device device; - try { + try{ AndroidService androidService = AndroidAPIUtils.getAndroidService(); - device = androidService.publishEvents(eventBeanWrapper); + Message message = androidService.publishEvents(eventBeanWrapper); + return Response.status(Integer.parseInt(message.getResponseCode())).entity(message.getResponseMessage()).build(); } catch (DeviceManagementException e) { - log.error("Error occurred while checking Operation Analytics is Enabled.", e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); - } - String eventType = eventBeanWrapper.getType(); - if (!LOCATION_EVENT_TYPE.equals(eventType)) { - String msg = "Dropping Android " + eventType + " Event.Only Location Event Type is supported."; - log.warn(msg); - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); - } - Message message = new Message(); - Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(), - AndroidConstants.DEVICE_TYPE_ANDROID}; - String eventPayload = eventBeanWrapper.getPayload(); - JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class); - Object[] payload = { - jsonObject.get(TIME_STAMP).getAsLong(), - jsonObject.get(LATITUDE).getAsDouble(), - jsonObject.get(LONGITUDE).getAsDouble(), - jsonObject.get(ALTITUDE).getAsDouble(), - jsonObject.get(SPEED).getAsFloat(), - jsonObject.get(BEARING).getAsFloat(), - jsonObject.get(DISTANCE).getAsDouble() - }; - try { - if (AndroidAPIUtils.getEventPublisherService().publishEvent( - EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) { - message.setResponseCode("Event is published successfully."); - return Response.status(Response.Status.CREATED).entity(message).build(); - } else { - log.warn("Error occurred while trying to publish the event. This could be due to unavailability " + - "of the publishing service. Please make sure that analytics server is running and accessible " + - "by this server"); - String msg = "Error occurred due to " + - "unavailability of the publishing service."; - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()).build(); - } - } catch (DataPublisherConfigurationException e) { - String msg = "Error occurred while getting the Data publisher Service instance."; - log.error(msg, e); + String errorMessage = "Error occurred while checking Operation Analytics is Enabled."; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); + } catch (UnexpectedServerErrorExceptionDup e) { + String errorMessage = "Error occurred while getting the Data publisher Service instance."; + log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) - .setMessage(msg).build()).build(); + .setMessage(errorMessage).build()).build(); + } catch (AndroidDeviceMgtPluginException e){ + String errorMessage = "Error occurred while publishing events."; + log.error(errorMessage, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) + .setMessage(errorMessage).build()).build(); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index fac389e18..10fed2407 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -468,7 +468,7 @@ public interface AndroidService { * @return {@link Device} * @throws {@link DeviceManagementException} */ - Device publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException; + Message publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException, AndroidDeviceMgtPluginException; /** * Method to retrieve alerts diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index 60d07cdfb..c3ed1b453 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -87,7 +87,8 @@ org.wso2.carbon.user.api.*, org.apache.commons.httpclient, org.apache.http, - org.apache.http.client.methods + org.apache.http.client.methods, + org.wso2.carbon.device.mgt.analytics.data.publisher.* !org.wso2.carbon.device.mgt.mobile.android.core.internal, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index a0802448b..f45cf6cf0 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -19,6 +19,8 @@ package org.wso2.carbon.device.mgt.mobile.android.core.impl; import com.google.api.client.http.HttpStatusCodes; import com.google.api.services.androidenterprise.model.ProductsListResponse; +import com.google.gson.Gson; +import com.google.gson.JsonObject; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -26,6 +28,7 @@ import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; +import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; @@ -65,6 +68,7 @@ import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; +import javax.ws.rs.core.Response; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -86,6 +90,16 @@ public class AndroidServiceImpl implements AndroidService { public static final String GOOGLE_AFW_DEVICE_ID = "googleEMMDeviceId"; private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; + private Gson gson = new Gson(); + private static final String LONGITUDE = "longitude"; + private static final String LATITUDE = "latitude"; + private static final String ALTITUDE = "altitude"; + private static final String SPEED = "speed"; + private static final String DISTANCE = "distance"; + private static final String BEARING = "bearing"; + private static final String TIME_STAMP = "timeStamp"; + private static final String LOCATION_EVENT_TYPE = "location"; + @Override public PlatformConfiguration getPlatformConfig() throws DeviceManagementException { List configs; @@ -908,16 +922,16 @@ public class AndroidServiceImpl implements AndroidService { boolean disableGoogleApps) throws DeviceManagementException, InvalidDeviceException, AndroidDeviceMgtPluginException { DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(deviceId); - if (!AndroidDeviceUtils.isValidDeviceIdentifier(deviceIdentifier)) { - String msg = "Device not found for identifier '" + deviceId + "'"; - log.error(msg); - throw new InvalidDeviceException(msg); - } - if (log.isDebugEnabled()) { - log.debug("Invoking Android pending operations:" + deviceId); - } - if (resultOperations != null && !resultOperations.isEmpty()) { - try { + try { + if (!AndroidDeviceUtils.isValidDeviceIdentifier(deviceIdentifier)) { + String msg = "Device not found for identifier '" + deviceId + "'"; + log.error(msg); + throw new InvalidDeviceException(msg); + } + if (log.isDebugEnabled()) { + log.debug("Invoking Android pending operations:" + deviceId); + } + if (resultOperations != null && !resultOperations.isEmpty()) { for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : resultOperations) { AndroidDeviceUtils.updateOperation(deviceId, operation); if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { @@ -938,25 +952,24 @@ public class AndroidServiceImpl implements AndroidService { log.debug("Updating operation '" + operation.toString() + "'"); } } - } catch (OperationManagementException e) { - String msg = "Issue in retrieving operation management service instance"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } catch (PolicyComplianceException e) { - String msg = "Issue in updating Monitoring operation"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } catch (org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException e) { - String msg = "Issue in retrieving application management service instance"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } catch (NotificationManagementException e) { - String msg = "Issue in retrieving Notification management service instance"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); } + } catch (OperationManagementException e) { + String msg = "Issue in retrieving operation management service instance"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (PolicyComplianceException e) { + String msg = "Issue in updating Monitoring operation"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException e) { + String msg = "Issue in retrieving application management service instance"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (NotificationManagementException e) { + String msg = "Issue in retrieving Notification management service instance"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); } - try { return AndroidDeviceUtils.getPendingOperations(deviceIdentifier, !disableGoogleApps); } catch (OperationManagementException e) { @@ -1143,26 +1156,82 @@ public class AndroidServiceImpl implements AndroidService { } @Override - public Device publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException{ + public Message publishEvents(EventBeanWrapper eventBeanWrapper) throws AndroidDeviceMgtPluginException { + if (log.isDebugEnabled()) { + log.debug("Invoking Android device event logging."); + } Device device; + try { if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { - String msg = "Event is publishing has not enabled."; - log.error(msg); - throw new DeviceManagementException(msg); } + Message responseMessage = new Message(); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_ACCEPTED)); + responseMessage.setResponseMessage("Event is publishing has not enabled."); + return responseMessage; + } DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(), AndroidConstants.DEVICE_TYPE_ANDROID); device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){ - String msg = "Device is not in Active state."; - log.error(msg); - throw new DeviceManagementException(msg); + Message responseMessage = new Message(); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_ACCEPTED)); + responseMessage.setResponseMessage("Device is not in Active state."); + return responseMessage; } else if (device == null){ - String msg = "Device is not enrolled yet."; - log.error(msg); - throw new DeviceManagementException(msg); + Message responseMessage = new Message(); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_ACCEPTED)); + responseMessage.setResponseMessage("Device is not enrolled yet."); + return responseMessage; + } + } catch (DeviceManagementException e) { + log.error("Error occurred while checking Operation Analytics is Enabled.", e); + Message responseMessage = new Message(); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)); + responseMessage.setResponseMessage(e.getMessage()); + return responseMessage; + } + String eventType = eventBeanWrapper.getType(); + if (!LOCATION_EVENT_TYPE.equals(eventType)) { + String msg = "Dropping Android " + eventType + " Event.Only Location Event Type is supported."; + log.warn(msg); + Message responseMessage = new Message(); + responseMessage.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)); + responseMessage.setResponseMessage(msg); + return responseMessage; + } + Message message = new Message(); + Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(), + AndroidConstants.DEVICE_TYPE_ANDROID}; + String eventPayload = eventBeanWrapper.getPayload(); + JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class); + Object[] payload = { + jsonObject.get(TIME_STAMP).getAsLong(), + jsonObject.get(LATITUDE).getAsDouble(), + jsonObject.get(LONGITUDE).getAsDouble(), + jsonObject.get(ALTITUDE).getAsDouble(), + jsonObject.get(SPEED).getAsFloat(), + jsonObject.get(BEARING).getAsFloat(), + jsonObject.get(DISTANCE).getAsDouble() + }; + try { + if (AndroidAPIUtils.getEventPublisherService().publishEvent( + EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) { + message.setResponseCode("Event is published successfully."); + return message; + } else { + log.warn("Error occurred while trying to publish the event. This could be due to unavailability " + + "of the publishing service. Please make sure that analytics server is running and accessible " + + "by this server"); + String errorMessage = "Error occurred due to " + + "unavailability of the publishing service."; + message.setResponseCode(String.valueOf(HttpStatusCodes.STATUS_CODE_SERVICE_UNAVAILABLE)); + return message; } + } catch (DataPublisherConfigurationException e) { + String msg = "Error occurred while getting the Data publisher Service instance."; + log.error(msg, e); + throw new UnexpectedServerErrorExceptionDup(msg); + } - return device; } @Override From 1baf84089b914bba384883faaf0346d75053a238 Mon Sep 17 00:00:00 2001 From: shamalka Date: Thu, 12 Dec 2019 20:59:12 +0530 Subject: [PATCH 24/30] Add descriptive comments on AndroidService --- .../android/common/spi/AndroidService.java | 69 ++++++++----------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index 10fed2407..733144167 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -22,7 +22,6 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceNotFoundException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; @@ -32,18 +31,9 @@ import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.GoogleAppSyncResponse; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.*; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; - -import javax.validation.Valid; -import javax.validation.constraints.Size; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; + import javax.ws.rs.core.Response; import java.util.List; @@ -91,7 +81,7 @@ public interface AndroidService { /** * Method for device unlock operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -102,7 +92,7 @@ public interface AndroidService { /** * Method for get device location operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -113,7 +103,7 @@ public interface AndroidService { /** * Method for remove password operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -135,7 +125,7 @@ public interface AndroidService { /** * Method to get device information * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -146,7 +136,7 @@ public interface AndroidService { /** * Method to get device logcat * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -157,7 +147,7 @@ public interface AndroidService { /** * Method for wipe device operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -179,7 +169,7 @@ public interface AndroidService { /** * Method for get applications operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -190,7 +180,7 @@ public interface AndroidService { /** * Method for ring device operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -201,7 +191,7 @@ public interface AndroidService { /** * Method for reboot device operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -212,7 +202,7 @@ public interface AndroidService { /** * Method for change lock task operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -223,7 +213,7 @@ public interface AndroidService { /** * Method for mute device operation * - * @param deviceIDs + * @param deviceIDs A list of device IDs * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} @@ -272,7 +262,7 @@ public interface AndroidService { * @throws {@link AndroidDeviceMgtPluginException} * @throws {@link OperationManagementException} */ - Activity blacklistApplications(@Valid BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) + Activity blacklistApplications(BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) throws OperationManagementException, AndroidDeviceMgtPluginException; /** @@ -399,8 +389,8 @@ public interface AndroidService { /** * Method for update application list * - * @param id - * @param androidApplications + * @param id Id of the device to update application list + * @param androidApplications List of AndroidApplication objects to update * @return {@link Message} * @throws {@link ApplicationManagementException} */ @@ -410,9 +400,9 @@ public interface AndroidService { /** * Method for get pending operations * - * @param id - * @param resultOperations - * @param disableGoogleApps + * @param id Id of the device to get pending operations + * @param resultOperations Result operations list + * @param disableGoogleApps Check whether google apps are disabled * @return * @throws {@link DeviceManagementException} * @throws {@link InvalidDeviceException} @@ -424,7 +414,7 @@ public interface AndroidService { /** * Method to enroll device * - * @param androidDevice + * @param androidDevice Instance of AndroidDevice to enroll * @return {@link Response} * @throws {@link DeviceManagementException} */ @@ -433,8 +423,8 @@ public interface AndroidService { /** * Method to check if a device is enrolled * - * @param id - * @param deviceIdentifier + * @param id Id of the device to check + * @param deviceIdentifier Device Identifier of the device to check * @return {@link Message} * @throws {@link DeviceManagementException} */ @@ -443,8 +433,8 @@ public interface AndroidService { /** * Method to modify enrollment * - * @param id - * @param androidDevice + * @param id Id of the device to modify enrollement + * @param androidDevice AndroidDevice object of the device to modify enrollment * @return * @throws {@link DeviceManagementException} * @throws {@link AndroidDeviceMgtPluginException} @@ -455,7 +445,7 @@ public interface AndroidService { /** * Method to disenroll a device * - * @param id + * @param id Id of the device to disenroll * @return * @throws {@link DeviceManagementException} */ @@ -468,15 +458,16 @@ public interface AndroidService { * @return {@link Device} * @throws {@link DeviceManagementException} */ - Message publishEvents(EventBeanWrapper eventBeanWrapper) throws DeviceManagementException, AndroidDeviceMgtPluginException; + Message publishEvents(EventBeanWrapper eventBeanWrapper) + throws DeviceManagementException, AndroidDeviceMgtPluginException; /** * Method to retrieve alerts * - * @param deviceId - * @param from - * @param to - * @param type + * @param deviceId Id of the device to retrieve alerts + * @param from Start date to retrieve alerts + * @param to End date to retrieve alerts + * @param type Type to retrieve alerts * @param ifModifiedSince * @return {@link Response} * @throws {@link AndroidDeviceMgtPluginException} From c5bb7696984305013f196801f82d8e14743d3b85 Mon Sep 17 00:00:00 2001 From: shamalka Date: Fri, 13 Dec 2019 11:54:30 +0530 Subject: [PATCH 25/30] Remove unused imports --- .../impl/DeviceManagementAdminAPIImpl.java | 34 ---------- .../api/impl/EventReceiverAPIImpl.java | 21 +----- .../android/common/spi/AndroidService.java | 6 +- .../android/core/impl/AndroidServiceImpl.java | 64 +++++++++++-------- 4 files changed, 40 insertions(+), 85 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 4e18c9cc2..28d8da123 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -38,36 +38,12 @@ package org.wso2.carbon.device.mgt.mobile.android.api.impl; import com.google.api.client.http.HttpStatusCodes; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpStatus; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; 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.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.mobile.android.api.DeviceManagementAdminAPI; -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstallation; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationRestriction; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.Camera; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.DisplayMessage; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.FileTransfer; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.GlobalProxy; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.Notification; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.PasscodePolicy; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.UpgradeFirmware; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.Vpn; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.WebClip; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.Wifi; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.WipeData; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationInstallationBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationRestrictionBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUninstallationBeanWrapper; @@ -89,10 +65,8 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWra import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorExceptionDup; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; -import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -101,13 +75,6 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.List; @Path("/admin/devices") @@ -116,7 +83,6 @@ import java.util.List; public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { private static final Log log = LogFactory.getLog(DeviceManagementAdminAPIImpl.class); - private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; @POST @Path("/file-transfer") diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index f9dce18a7..438a31f4e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -20,18 +20,10 @@ package org.wso2.carbon.device.mgt.mobile.android.api.impl; import com.google.api.client.http.HttpStatusCodes; import com.google.gson.Gson; -import com.google.gson.JsonObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; -import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; -import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.device.mgt.mobile.android.api.EventReceiverAPI; -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.Message; import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; @@ -39,7 +31,6 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWr import org.wso2.carbon.device.mgt.mobile.android.common.exception.*; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; -import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import javax.validation.Valid; import javax.validation.constraints.Size; @@ -53,18 +44,8 @@ import java.util.List; @Path("/events") public class EventReceiverAPIImpl implements EventReceiverAPI { - private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream"; - private static final Log log = LogFactory.getLog(EventReceiverAPIImpl.class); - private Gson gson = new Gson(); - private static final String LONGITUDE = "longitude"; - private static final String LATITUDE = "latitude"; - private static final String ALTITUDE = "altitude"; - private static final String SPEED = "speed"; - private static final String DISTANCE = "distance"; - private static final String BEARING = "bearing"; - private static final String TIME_STAMP = "timeStamp"; - private static final String LOCATION_EVENT_TYPE = "location"; + private static final Log log = LogFactory.getLog(EventReceiverAPIImpl.class); @POST @Path("/publish") diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java index 733144167..9467460ef 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/spi/AndroidService.java @@ -43,7 +43,7 @@ public interface AndroidService { * Method to retrieve platform configurations * * @return {@link PlatformConfiguration} - * @throws {@link DeviceManagementException} + * @throws {@link DeviceManagementException} If some unusual behaviour is observed while getting platform configurations */ PlatformConfiguration getPlatformConfig() throws DeviceManagementException; @@ -62,7 +62,7 @@ public interface AndroidService { * @param fileTransferBeanWrapper * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} - * @throws {@link OperationManagementException} + * @throws {@link OperationManagementException} If some unusual behaviour is observed while executing file transfer operation */ Activity fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) throws AndroidDeviceMgtPluginException, OperationManagementException; @@ -73,7 +73,7 @@ public interface AndroidService { * @param deviceLockBeanWrapper * @return {@link Activity} * @throws {@link AndroidDeviceMgtPluginException} - * @throws {@link OperationManagementException} + * @throws {@link OperationManagementException} If some unusual behaviour is observed while executing device lock operation */ Activity configureDeviceLock(DeviceLockBeanWrapper deviceLockBeanWrapper) throws OperationManagementException, AndroidDeviceMgtPluginException; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index f45cf6cf0..1e1c9d06d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -28,6 +28,7 @@ import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; + import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; @@ -67,8 +68,6 @@ import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtil import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; - -import javax.ws.rs.core.Response; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -889,7 +888,8 @@ public class AndroidServiceImpl implements AndroidService { @Override - public Message updateApplicationList(String id, List androidApplications) throws org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException { + public Message updateApplicationList(String id, List androidApplications) + throws org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException { Application application; List applications = new ArrayList<>(); for (AndroidApplication androidApplication : androidApplications) { @@ -932,26 +932,7 @@ public class AndroidServiceImpl implements AndroidService { log.debug("Invoking Android pending operations:" + deviceId); } if (resultOperations != null && !resultOperations.isEmpty()) { - for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : resultOperations) { - AndroidDeviceUtils.updateOperation(deviceId, operation); - if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { - org.wso2.carbon.device.mgt.common.notification.mgt.Notification notification = new org.wso2.carbon.device.mgt.common.notification.mgt.Notification(); - DeviceIdentifier id = new DeviceIdentifier(); - id.setId(deviceId); - id.setType(AndroidConstants.DEVICE_TYPE_ANDROID); - String deviceName = AndroidAPIUtils.getDeviceManagementService().getDevice(id, false).getName(); - notification.setOperationId(operation.getId()); - notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. - Status.NEW.toString()); - notification.setDescription( - operation.getCode() + " operation failed to execute on device " + deviceName + " (ID: " - + deviceId + ")"); - AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); - } - if (log.isDebugEnabled()) { - log.debug("Updating operation '" + operation.toString() + "'"); - } - } + updateOperations(deviceId, resultOperations); } } catch (OperationManagementException e) { String msg = "Issue in retrieving operation management service instance"; @@ -961,12 +942,12 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Issue in updating Monitoring operation"; log.error(msg, e); throw new DeviceManagementException(msg, e); - } catch (org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException e) { - String msg = "Issue in retrieving application management service instance"; + } catch (NotificationManagementException e) { + String msg = "Issue in retrieving Notification management service instance"; log.error(msg, e); throw new DeviceManagementException(msg, e); - } catch (NotificationManagementException e) { - String msg = "Issue in retrieving Notification management service instance"; + } catch (org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException e) { + String msg = "Issue in retrieving application management service instance"; log.error(msg, e); throw new DeviceManagementException(msg, e); } @@ -979,6 +960,32 @@ public class AndroidServiceImpl implements AndroidService { } } + private void updateOperations(String deviceId, List operations) + throws OperationManagementException, PolicyComplianceException, NotificationManagementException, + DeviceManagementException, org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException { + for (org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation : operations) { + AndroidDeviceUtils.updateOperation(deviceId, operation); + if (OPERATION_ERROR_STATUS.equals(operation.getStatus().toString())) { + org.wso2.carbon.device.mgt.common.notification.mgt.Notification notification = new + org.wso2.carbon.device.mgt.common.notification.mgt.Notification(); + DeviceIdentifier id = new DeviceIdentifier(); + id.setId(deviceId); + id.setType(AndroidConstants.DEVICE_TYPE_ANDROID); + String deviceName = AndroidAPIUtils.getDeviceManagementService().getDevice(id, false).getName(); + notification.setOperationId(operation.getId()); + notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. + Status.NEW.toString()); + notification.setDescription(operation.getCode() + " operation failed to execute on device " + + deviceName + " (ID: " + deviceId + ")"); + AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); + } + if (log.isDebugEnabled()) { + log.debug("Updating operation '" + operation.toString() + "'"); + } + } + } + + @Override public Message enrollDevice(AndroidDevice androidDevice) throws DeviceManagementException, AndroidDeviceMgtPluginException { @@ -1304,7 +1311,8 @@ public class AndroidServiceImpl implements AndroidService { } } - private List retrieveAlertByType(String deviceId, String type) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlertByType(String deviceId, String type) + throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device identifier and type."); } From e4a789c2a4ea7ef049d0f09b450729f3f139036b Mon Sep 17 00:00:00 2001 From: shamalka Date: Fri, 13 Dec 2019 14:26:56 +0530 Subject: [PATCH 26/30] Remove unused exceptions --- .../exception/AndroidOperationException.java | 37 ------ .../api/exception/BadRequestException.java | 34 ----- .../api/exception/ForbiddenException.java | 52 -------- .../api/exception/GlobalThrowableMapper.java | 116 ------------------ .../api/exception/NotFoundException.java | 47 ------- .../ParameterValidationException.java | 56 --------- .../UnexpectedServerErrorException.java | 49 -------- .../api/impl/EventReceiverAPIImpl.java | 1 - .../src/main/webapp/WEB-INF/cxf-servlet.xml | 1 - 9 files changed, 393 deletions(-) delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ForbiddenException.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java deleted file mode 100644 index 6cd49eded..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/AndroidOperationException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import org.wso2.carbon.device.mgt.mobile.android.common.Message; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Custom exception class for wrapping Android Operation related exceptions. - */ -public class AndroidOperationException extends WebApplicationException { - - public AndroidOperationException(Message message, MediaType mediaType) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message). - type(mediaType).build()); - } -} - diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java deleted file mode 100644 index a93e39a8e..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/BadRequestException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -/** - * Custom exception class for wrapping BadRequest related exceptions. - */ -public class BadRequestException extends WebApplicationException { - - public BadRequestException(ErrorResponse error) { - super(Response.status(Response.Status.BAD_REQUEST).entity(error).build()); - } -} \ 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/device/mgt/mobile/android/api/exception/ForbiddenException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ForbiddenException.java deleted file mode 100644 index 9c0741ded..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ForbiddenException.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -/** - * Exception class that is corresponding to 401 Forbidden response - */ - -public class ForbiddenException extends WebApplicationException { - - private String message; - - public ForbiddenException() { - super(Response.status(Response.Status.FORBIDDEN) - .build()); - } - - public ForbiddenException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.FORBIDDEN) - .entity(errorDTO) - .header(AndroidConstants.HEADER_CONTENT_TYPE, AndroidConstants.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java deleted file mode 100644 index 9d0c7fdc6..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/GlobalThrowableMapper.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import com.google.gson.JsonParseException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; -import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; - -import javax.naming.AuthenticationException; -import javax.validation.ConstraintViolationException; -import javax.ws.rs.ClientErrorException; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; - -/** - * Handle the cxf level exceptions. - */ -public class GlobalThrowableMapper implements ExceptionMapper { - private static final Log log = LogFactory.getLog(GlobalThrowableMapper.class); - - private ErrorDTO e500 = new ErrorDTO(); - - GlobalThrowableMapper() { - e500.setCode((long) 500); - e500.setMessage("Internal server error."); - e500.setMoreInfo(""); - e500.setDescription("The server encountered an internal error. Please contact administrator."); - - } - - @Override - public Response toResponse(Throwable e) { - - if (e instanceof JsonParseException) { - String errorMessage = "Malformed request body."; - if (log.isDebugEnabled()) { - log.debug(errorMessage, e); - } - return new BadRequestException(AndroidDeviceUtils.buildBadRequestException(errorMessage)).getResponse(); - } - if (e instanceof NotFoundException) { - return ((NotFoundException) e).getResponse(); - } - if (e instanceof BadRequestException) { - return ((BadRequestException) e).getResponse(); - } - if (e instanceof UnexpectedServerErrorException) { - if (log.isDebugEnabled()) { - log.debug("Unexpected server error", e); - } - return ((UnexpectedServerErrorException) e).getResponse(); - } - if (e instanceof ConstraintViolationException) { - if (log.isDebugEnabled()) { - log.debug("Constraint violation issue.", e); - return ((ParameterValidationException) e).getResponse(); - } - } - if (e instanceof IllegalArgumentException) { - ErrorDTO errorDetail = new ErrorDTO(); - errorDetail.setCode((long) 400); - errorDetail.setMoreInfo(""); - errorDetail.setMessage(""); - errorDetail.setDescription(e.getMessage()); - return Response - .status(Response.Status.BAD_REQUEST) - .entity(errorDetail) - .build(); - } - if (e instanceof ClientErrorException) { - if (log.isDebugEnabled()) { - log.debug("Client error", e); - } - return ((ClientErrorException) e).getResponse(); - } - if (e instanceof AuthenticationException) { - ErrorDTO errorDetail = new ErrorDTO(); - errorDetail.setCode((long) 401); - errorDetail.setMoreInfo(""); - errorDetail.setMessage(""); - errorDetail.setDescription(e.getMessage()); - return Response - .status(Response.Status.UNAUTHORIZED) - .entity(errorDetail) - .build(); - } - if (e instanceof ForbiddenException) { - if (log.isDebugEnabled()) { - log.debug("Resource forbidden", e); - } - return ((ForbiddenException) e).getResponse(); - } - //unknown exception log and return - log.error("An Unknown exception has been captured by global exception mapper.", e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).header("Content-Type", "application/json") - .entity(e500).build(); - } -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java deleted file mode 100644 index 59367917b..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/NotFoundException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class NotFoundException extends WebApplicationException { - private String message; - private static final long serialVersionUID = 147943572342342340L; - - public NotFoundException(ErrorResponse error) { - super(Response.status(Response.Status.NOT_FOUND).entity(error).build()); - } - public NotFoundException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.NOT_FOUND) - .entity(errorDTO) - .header(AndroidConstants.HEADER_CONTENT_TYPE, AndroidConstants.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java deleted file mode 100644 index bf729a9e9..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/ParameterValidationException.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; - -import javax.validation.ConstraintViolation; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import java.util.Set; - -public class ParameterValidationException extends WebApplicationException { - - private String message; - public ParameterValidationException(Set> violations) { - super(Response.status(Response.Status.BAD_REQUEST) - .entity(AndroidDeviceUtils.getConstraintViolationErrorDTO(violations)) - .header(AndroidConstants.HEADER_CONTENT_TYPE, AndroidConstants.APPLICATION_JSON) - .build()); - - //Set the error message - StringBuilder stringBuilder = new StringBuilder(); - for (ConstraintViolation violation : violations) { - stringBuilder.append(violation.getRootBeanClass().getSimpleName()); - stringBuilder.append("."); - stringBuilder.append(violation.getPropertyPath()); - stringBuilder.append(": "); - stringBuilder.append(violation.getMessage()); - stringBuilder.append(", "); - } - message = stringBuilder.toString(); - } - - @Override - public String getMessage() { - return message; - } - -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java deleted file mode 100644 index c4390aaa7..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/exception/UnexpectedServerErrorException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.android.api.exception; - -import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; -import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class UnexpectedServerErrorException extends WebApplicationException { - private String message; - private static final long serialVersionUID = 147943579458906890L; - - public UnexpectedServerErrorException(ErrorResponse error) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); - } - public UnexpectedServerErrorException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(errorDTO) - .header(AndroidConstants.HEADER_CONTENT_TYPE, AndroidConstants.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } - - -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 438a31f4e..3011763d8 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -19,7 +19,6 @@ package org.wso2.carbon.device.mgt.mobile.android.api.impl; import com.google.api.client.http.HttpStatusCodes; -import com.google.gson.Gson; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 5523186c9..b3afc3e28 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -44,7 +44,6 @@ - From 4665eeac971b66f7bf423a3d63c7b189bc06daa7 Mon Sep 17 00:00:00 2001 From: Entgra Builder Date: Mon, 16 Dec 2019 14:56:34 +0000 Subject: [PATCH 27/30] [maven-release-plugin] prepare release v5.0.6 --- .../org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/pull-notification-listeners/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/remote-session-extension/pom.xml | 2 +- .../org.wso2.extension.siddhi.device/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- .../org.wso2.gpl.siddhi.extension.geo.script/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- components/test-coverage/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- .../org.wso2.extension.siddhi.device.feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 2 +- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 90 files changed, 106 insertions(+), 106 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index a42bd7296..68f24beb3 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index fadfbdec3..802544daa 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index 1c0a30747..0f067685b 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index ccefefbe0..cb81fef74 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index dfd8618e8..7fae96f44 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index a9fe618e0..c3dc28516 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 4ad612d9f..39e9e309f 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 15f7513d4..e6cb3ca53 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index 520d22943..abd1394af 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index a4785bd54..c8bc91ffe 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 4bafeeadd..76d9d913c 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index eb9151d86..c3000eb7f 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index 7d85731c6..0c884aa85 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 6b7766ee9..9fdfccbf9 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 4c1d4831d..1450b3ba9 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index 0881f3e87..b48bed9c9 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index 5acfe53c9..b51c80d33 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index 1a1ad5946..c006e4931 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 79d9289c0..56217a219 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index 40f948828..b4b41bb32 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index 2337fa1a8..cd526d011 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 389ee5159..3efc977f9 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 37e21ffd7..66261e6d1 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index a17189b45..17d0bb38c 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 863cadafa..416fc72ca 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index 266811d02..a4c49ba6d 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index 156d92f95..6196e9dd5 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index b9ef9070d..16ca4706e 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index d6f4d2f83..261f6a15a 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml index 73b20aad6..a3f9fc0e3 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index ffd93d12c..6387e748a 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index 5d5145cc3..435d3f385 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 2109bb41a..3a8a6b379 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index 2f3d48f2d..76949c585 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 2939a854d..c368aa465 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index 71092f0bc..6cae9f3f9 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index c3cdc99ff..76485ca40 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index aca8a3c20..07f48d97e 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 99d0f8572..9722196d8 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index d51779668..2a7c32338 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index 921b855f6..55b134f9b 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml index d5fb55f30..9c0085aff 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml index 9e8667c25..3943c5629 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/remote-session-extension/pom.xml b/components/extensions/remote-session-extension/pom.xml index d6488c370..289106cbb 100644 --- a/components/extensions/remote-session-extension/pom.xml +++ b/components/extensions/remote-session-extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml index 0774b29df..3b4de87f5 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index 76e1148e8..b3b0b10df 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index 6c1f686ea..7cead2406 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index a28f2c5b3..17fc72e63 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 7610952c3..4833a8a17 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index 05587a133..6382b2947 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index 6db3752a1..f1a7ac8e6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 5.0.7-SNAPSHOT + 5.0.6 WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index 97e023a72..93989a184 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 4813cdc09..d9fcc01ba 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 2116a9dd2..cc0356d27 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index ee4f9a78b..8bb32f0a3 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -22,7 +22,7 @@ carbon-device-mgt-plugins-parent org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml index 674063149..595305b36 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index ca0d98e1f..c80031328 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 49219ceff..667792aca 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index 7922c0cf6..ba97ca8a3 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 38f348562..5c4dcd49f 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml index fa4663742..64f6290fb 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Android Sense Analytics Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml index 530ae1ae4..c816de092 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.backend.feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Android Sense Backend Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml index 491127f2c..0d1e37a46 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.ui.feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - IoT Server Android Sense UI Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index 2444a4f1b..4ffae2575 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml index ec5359cb6..fe2d84755 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml index 9392eede1..e2cd71a40 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml index 946424b74..655f8e474 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index b12b9c05f..99d0471e9 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index fc2b83ebb..8d59259a3 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 device-types-feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml index 51b1345f0..3cef01164 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml index 608b5aeff..1eb7fa76d 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml index 734f06eff..6fb1f38b7 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 4ed617fbb..58eb270b5 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml index bc81e0a3f..200702500 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml index 235b0e31e..b13bbc8eb 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml index e6d5b8541..297c98930 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index 521bbebbb..57426cef0 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 707814bd3..614fa0a92 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index 63ee880e8..46bc72726 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index 77288451f..4d70525ed 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 5.0.7-SNAPSHOT + 5.0.6 WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml index f5409d54b..654cb1e8d 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.notification.listener.feature pom - 5.0.7-SNAPSHOT + 5.0.6 WSO2 Carbon - Notification Listener http://wso2.org This feature contains the core bundles required iot core listeners diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml index 2e5703410..819bee8fd 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 diff --git a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml index 1b1666843..7ee1b0c14 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 94b145887..3d1969d23 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 5.0.7-SNAPSHOT + 5.0.6 WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml index f8e82f290..cc7a77d48 100644 --- a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml +++ b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 77265a6c8..97371245e 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 extensions-feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management Extensions http://wso2.org 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 3281e9e36..77baebf53 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 @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 5.0.7-SNAPSHOT + 5.0.6 WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index 63eb52b5d..647e2198a 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 5.0.7-SNAPSHOT + 5.0.6 ../pom.xml 4.0.0 android-plugin-feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index ddf778bf1..a23434eb9 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.7-SNAPSHOT + 5.0.6 ../../pom.xml 4.0.0 mobile-plugins-feature - 5.0.7-SNAPSHOT + 5.0.6 pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/pom.xml b/pom.xml index e46e0d8d3..27bfb42fd 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 5.0.7-SNAPSHOT + 5.0.6 WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1208,7 +1208,7 @@ [4.0.0, 5.0.0) - 5.0.7-SNAPSHOT + 5.0.6 4.0.3 @@ -1391,7 +1391,7 @@ https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git - HEAD + v5.0.6 From 4398e53eb1163339e4f1f67c1733ebd3f928d903 Mon Sep 17 00:00:00 2001 From: Entgra Builder Date: Mon, 16 Dec 2019 14:56:40 +0000 Subject: [PATCH 28/30] [maven-release-plugin] prepare for next development iteration --- .../org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/pull-notification-listeners/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/remote-session-extension/pom.xml | 2 +- .../org.wso2.extension.siddhi.device/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- .../org.wso2.gpl.siddhi.extension.geo.script/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- components/test-coverage/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 2 +- .../org.wso2.extension.siddhi.device.feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 2 +- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 90 files changed, 106 insertions(+), 106 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index 68f24beb3..a42bd7296 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 802544daa..fadfbdec3 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index 0f067685b..1c0a30747 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index cb81fef74..ccefefbe0 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index 7fae96f44..dfd8618e8 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index c3dc28516..a9fe618e0 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 39e9e309f..4ad612d9f 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index e6cb3ca53..15f7513d4 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index abd1394af..520d22943 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index c8bc91ffe..a4785bd54 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 76d9d913c..4bafeeadd 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index c3000eb7f..eb9151d86 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index 0c884aa85..7d85731c6 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 9fdfccbf9..6b7766ee9 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 1450b3ba9..4c1d4831d 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index b48bed9c9..0881f3e87 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index b51c80d33..5acfe53c9 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index c006e4931..1a1ad5946 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 56217a219..79d9289c0 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index b4b41bb32..40f948828 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index cd526d011..2337fa1a8 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 3efc977f9..389ee5159 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 66261e6d1..37e21ffd7 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 17d0bb38c..a17189b45 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 416fc72ca..863cadafa 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index a4c49ba6d..266811d02 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index 6196e9dd5..156d92f95 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index 16ca4706e..b9ef9070d 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 261f6a15a..d6f4d2f83 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml index a3f9fc0e3..73b20aad6 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 6387e748a..ffd93d12c 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index 435d3f385..5d5145cc3 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 3a8a6b379..2109bb41a 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index 76949c585..2f3d48f2d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index c368aa465..2939a854d 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index 6cae9f3f9..71092f0bc 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 76485ca40..c3cdc99ff 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 07f48d97e..aca8a3c20 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 9722196d8..99d0f8572 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index 2a7c32338..d51779668 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index 55b134f9b..921b855f6 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml index 9c0085aff..d5fb55f30 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml index 3943c5629..9e8667c25 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/pom.xml b/components/extensions/remote-session-extension/pom.xml index 289106cbb..d6488c370 100644 --- a/components/extensions/remote-session-extension/pom.xml +++ b/components/extensions/remote-session-extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml index 3b4de87f5..0774b29df 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index b3b0b10df..76e1148e8 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index 7cead2406..6c1f686ea 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index 17fc72e63..a28f2c5b3 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 4833a8a17..7610952c3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index 6382b2947..05587a133 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index f1a7ac8e6..6db3752a1 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index 93989a184..97e023a72 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index d9fcc01ba..4813cdc09 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index cc0356d27..2116a9dd2 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 8bb32f0a3..ee4f9a78b 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -22,7 +22,7 @@ carbon-device-mgt-plugins-parent org.wso2.carbon.devicemgt-plugins - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml index 595305b36..674063149 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.cdmf.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index c80031328..ca0d98e1f 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 667792aca..49219ceff 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index ba97ca8a3..7922c0cf6 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 5c4dcd49f..38f348562 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml index 64f6290fb..fa4663742 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Analytics Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml index c816de092..530ae1ae4 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.backend.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.backend.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Backend Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml index 0d1e37a46..491127f2c 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.ui.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.ui.feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense UI Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index 4ffae2575..2444a4f1b 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml index fe2d84755..ec5359cb6 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml index e2cd71a40..9392eede1 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml index 655f8e474..946424b74 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index 99d0471e9..b12b9c05f 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 8d59259a3..fc2b83ebb 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml index 3cef01164..51b1345f0 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml index 1eb7fa76d..608b5aeff 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml index 6fb1f38b7..734f06eff 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 58eb270b5..4ed617fbb 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml index 200702500..bc81e0a3f 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml index b13bbc8eb..235b0e31e 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml index 297c98930..e6d5b8541 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index 57426cef0..521bbebbb 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml index 614fa0a92..707814bd3 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.api.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index 46bc72726..63ee880e8 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index 4d70525ed..77288451f 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml index 654cb1e8d..f5409d54b 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.notification.listener.feature/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.notification.listener.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Notification Listener http://wso2.org This feature contains the core bundles required iot core listeners diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml index 819bee8fd..2e5703410 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.remote.session.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml index 7ee1b0c14..1b1666843 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.device.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 3d1969d23..94b145887 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml index cc7a77d48..f8e82f290 100644 --- a/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml +++ b/features/extensions-feature/org.wso2.gpl.siddhi.extension.geo.script.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 97371245e..77265a6c8 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 extensions-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management Extensions http://wso2.org 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 77baebf53..3281e9e36 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 @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index 647e2198a..63eb52b5d 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 5.0.6 + 5.0.7-SNAPSHOT ../pom.xml 4.0.0 android-plugin-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index a23434eb9..ddf778bf1 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 5.0.6 + 5.0.7-SNAPSHOT ../../pom.xml 4.0.0 mobile-plugins-feature - 5.0.6 + 5.0.7-SNAPSHOT pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 27bfb42fd..e46e0d8d3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 5.0.6 + 5.0.7-SNAPSHOT WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1208,7 +1208,7 @@ [4.0.0, 5.0.0) - 5.0.6 + 5.0.7-SNAPSHOT 4.0.3 @@ -1391,7 +1391,7 @@ https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git scm:git:https://gitlab.com/entgra/carbon-device-mgt-plugins.git - v5.0.6 + HEAD From fd04cd7b12aba106632f11abeba932feb74cd353 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Mon, 16 Dec 2019 21:08:08 +0530 Subject: [PATCH 29/30] Rename exception class names in android module --- .../api/impl/AndroidEnterpriseAPIImpl.java | 72 ++++---- .../api/impl/DeviceManagementAPIImpl.java | 4 +- .../impl/DeviceManagementAdminAPIImpl.java | 62 +++---- .../impl/DeviceTypeConfigurationAPIImpl.java | 4 +- .../api/impl/EventReceiverAPIImpl.java | 6 +- ...ptionDup.java => BadRequestException.java} | 6 +- ...ceptionDup.java => NotFoundException.java} | 6 +- .../UnexpectedServerErrorException.java | 12 ++ .../UnexpectedServerErrorExceptionDup.java | 12 -- .../android/core/impl/AndroidServiceImpl.java | 169 +++++++++--------- .../android/core/util/AndroidAPIUtils.java | 4 +- .../android/core/util/AndroidDeviceUtils.java | 4 +- .../core/util/AndroidEnterpriseUtils.java | 4 +- 13 files changed, 183 insertions(+), 182 deletions(-) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/{NotFoundExceptionDup.java => BadRequestException.java} (82%) rename components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/{BadRequestExceptionDup.java => NotFoundException.java} (82%) create mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java delete mode 100644 components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java index 58ef349f3..23bbfa553 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/AndroidEnterpriseAPIImpl.java @@ -60,8 +60,8 @@ import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseMan import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundExceptionDup; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils; @@ -120,11 +120,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { } catch (EnterpriseServiceException e) { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when saving user").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -209,11 +209,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -267,11 +267,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when calling get web token").build()) .build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -307,11 +307,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when persisting app").build()) .build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -367,11 +367,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting page " + page.getPageName() + " , due to an error with ESA").build() ).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -407,11 +407,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " + page.getPageName() + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -447,11 +447,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating page " + id + " , Due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -480,11 +480,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " + " , Due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -519,11 +519,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when inserting home page " + id + " , due to an error with ESA").build() ).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -551,11 +551,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching home page.").build() ) .build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -600,11 +600,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " + storeCluster.getName() + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -649,11 +649,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when updating cluster " + storeCluster.getName() + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -691,11 +691,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when deleting cluster " + clusterId + " , due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -773,11 +773,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching all details in PageId " + pageId).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -807,11 +807,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage("Error when fetching page " + " , Due to an error with ESA").build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -990,11 +990,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.status(Response.Status.NOT_FOUND).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); @@ -1083,11 +1083,11 @@ public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); } - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java index 70daaccec..bccd9a4ce 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAPIImpl.java @@ -209,13 +209,13 @@ public class DeviceManagementAPIImpl implements DeviceManagementAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(msg).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage, e); return Response.status(Response.Status.NOT_FOUND).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java index 28d8da123..ab0581a99 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceManagementAdminAPIImpl.java @@ -64,7 +64,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBean import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -98,7 +98,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e) { + } catch (BadRequestException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -131,7 +131,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -164,7 +164,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -197,7 +197,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -230,7 +230,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -263,7 +263,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -294,7 +294,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -325,7 +325,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { String errorMessage = "Issue in retrieving operation management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -358,7 +358,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -391,7 +391,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -424,7 +424,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -457,7 +457,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -490,7 +490,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -523,7 +523,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -556,7 +556,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -590,7 +590,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -623,7 +623,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -657,7 +657,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -690,7 +690,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -723,7 +723,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -756,7 +756,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -789,7 +789,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -822,7 +822,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -855,7 +855,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -888,7 +888,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -921,7 +921,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -954,7 +954,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -989,7 +989,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -1030,7 +1030,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( @@ -1064,7 +1064,7 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); return Response.status(Response.Status.BAD_REQUEST).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java index 30e27039e..86cf58963 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/DeviceTypeConfigurationAPIImpl.java @@ -44,7 +44,7 @@ import org.wso2.carbon.device.mgt.mobile.android.api.DeviceTypeConfigurationAPI; import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration; import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils; @@ -91,7 +91,7 @@ public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAP androidService.updateConfiguration(androidPlatformConfiguration); return Response.status(Response.Status.OK) .entity("Android platform configuration has been updated successfully.").build(); - } catch (BadRequestExceptionDup e) { + } catch (BadRequestException e) { String msg = "The payload of the android platform configuration is incorrect."; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java index 3011763d8..fa60ca476 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/device/mgt/mobile/android/api/impl/EventReceiverAPIImpl.java @@ -60,7 +60,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR) .setMessage(errorMessage).build()).build(); - } catch (UnexpectedServerErrorExceptionDup e) { + } catch (UnexpectedServerErrorException e) { String errorMessage = "Error occurred while getting the Data publisher Service instance."; log.error(errorMessage, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( @@ -89,7 +89,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { AndroidService androidService = AndroidAPIUtils.getAndroidService(); List deviceStates = androidService.retrieveAlerts(deviceId, from, to, type, ifModifiedSince); return Response.status(Response.Status.OK).entity(deviceStates).build(); - } catch (BadRequestExceptionDup e){ + } catch (BadRequestException e){ String errorMessage = "Request must contain " + "the device identifier. Optionally, both from and to value should be present to get " + "alerts between times."; @@ -97,7 +97,7 @@ public class EventReceiverAPIImpl implements EventReceiverAPI { return Response.status(Response.Status.BAD_REQUEST).entity( new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST) .setMessage(errorMessage).build()).build(); - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Class not found"; log.error(errorMessage, e); return Response.status(Response.Status.NOT_FOUND).entity( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java similarity index 82% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java index 6d0f90cef..3ca97f7f6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundExceptionDup.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestException.java @@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Represents the exception thrown during validating the request. */ -public class NotFoundExceptionDup extends AndroidDeviceMgtPluginException { +public class BadRequestException extends AndroidDeviceMgtPluginException { - public NotFoundExceptionDup(String message, Throwable ex) { + public BadRequestException(String message, Throwable ex) { super(message, ex); } - public NotFoundExceptionDup(String message) { + public BadRequestException(String message) { super(message); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java similarity index 82% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java index 0d1220e9d..0a9679f61 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/BadRequestExceptionDup.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/NotFoundException.java @@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.mobile.android.common.exception; /** * Represents the exception thrown during validating the request. */ -public class BadRequestExceptionDup extends AndroidDeviceMgtPluginException { +public class NotFoundException extends AndroidDeviceMgtPluginException { - public BadRequestExceptionDup(String message, Throwable ex) { + public NotFoundException(String message, Throwable ex) { super(message, ex); } - public BadRequestExceptionDup(String message) { + public NotFoundException(String message) { super(message); } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java new file mode 100644 index 000000000..d6490f761 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorException.java @@ -0,0 +1,12 @@ +package org.wso2.carbon.device.mgt.mobile.android.common.exception; + +public class UnexpectedServerErrorException extends AndroidDeviceMgtPluginException{ + + public UnexpectedServerErrorException(String message, Throwable ex) { + super(message, ex); + } + + public UnexpectedServerErrorException(String message) { + super(message); + } +} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java deleted file mode 100644 index 156404ef3..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.common/src/main/java/org/wso2/carbon/device/mgt/mobile/android/common/exception/UnexpectedServerErrorExceptionDup.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.wso2.carbon.device.mgt.mobile.android.common.exception; - -public class UnexpectedServerErrorExceptionDup extends AndroidDeviceMgtPluginException{ - - public UnexpectedServerErrorExceptionDup(String message, Throwable ex) { - super(message, ex); - } - - public UnexpectedServerErrorExceptionDup(String message) { - super(message); - } -} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java index 1e1c9d06d..a70324eb9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/impl/AndroidServiceImpl.java @@ -145,7 +145,7 @@ public class AndroidServiceImpl implements AndroidService { if (androidPlatformConfiguration == null) { String errorMessage = "The payload of the android platform configuration is null."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } configuration.setConfiguration(androidPlatformConfiguration.getConfiguration()); try { @@ -170,7 +170,7 @@ public class AndroidServiceImpl implements AndroidService { } else { String msg = "No value specified for notifierFrequency."; log.error(msg); - throw new BadRequestExceptionDup(msg); + throw new BadRequestException(msg); } } else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) { if (entry.getValue() != null) { @@ -178,7 +178,7 @@ public class AndroidServiceImpl implements AndroidService { } else { String msg = "No value specified for notifierType."; log.error(msg); - throw new BadRequestExceptionDup(msg); + throw new BadRequestException(msg); } } } @@ -255,7 +255,7 @@ public class AndroidServiceImpl implements AndroidService { || fileTransferBeanWrapper.getDeviceIDs() == null) { String errorMessage = "The payload of the file transfer operation is incorrect."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } if (log.isDebugEnabled()) { log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); @@ -277,7 +277,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -287,7 +287,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceLockBeanWrapper == null || deviceLockBeanWrapper.getOperation() == null) { String errorMessage = "Lock bean is empty."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceLock lock = deviceLockBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -301,7 +301,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -317,7 +317,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -332,7 +332,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -347,7 +347,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -358,7 +358,7 @@ public class AndroidServiceImpl implements AndroidService { if (cameraBeanWrapper == null || cameraBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the configure camera operation is incorrect."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Camera camera = cameraBeanWrapper.getOperation(); CommandOperation operation = new CommandOperation(); @@ -369,7 +369,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -384,7 +384,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -399,7 +399,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -414,7 +414,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -425,7 +425,7 @@ public class AndroidServiceImpl implements AndroidService { if (wipeDataBeanWrapper == null || wipeDataBeanWrapper.getOperation() == null) { String errorMessage = "WipeData bean is empty."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } WipeData wipeData = wipeDataBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -436,7 +436,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -451,7 +451,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -466,7 +466,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -481,7 +481,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -496,7 +496,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -512,7 +512,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -524,7 +524,7 @@ public class AndroidServiceImpl implements AndroidService { null) { String errorMessage = "The payload of the application installing operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); @@ -541,7 +541,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -552,7 +552,7 @@ public class AndroidServiceImpl implements AndroidService { if (applicationUpdateBeanWrapper == null || applicationUpdateBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application update operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); validateApplicationUrl(applicationUpdate.getUrl()); @@ -569,7 +569,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -581,7 +581,7 @@ public class AndroidServiceImpl implements AndroidService { applicationUninstallationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application uninstalling operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); validateApplicationType(applicationUninstallation.getType()); @@ -595,7 +595,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -606,7 +606,7 @@ public class AndroidServiceImpl implements AndroidService { if (blacklistApplicationsBeanWrapper == null || blacklistApplicationsBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the blacklisting apps operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -618,7 +618,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -629,7 +629,7 @@ public class AndroidServiceImpl implements AndroidService { if (upgradeFirmwareBeanWrapper == null || upgradeFirmwareBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the upgrade firmware operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); validateScheduleDate(upgradeFirmware.getSchedule()); @@ -643,7 +643,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -654,7 +654,7 @@ public class AndroidServiceImpl implements AndroidService { if (vpnConfiguration == null || vpnConfiguration.getOperation() == null) { String errorMessage = "The payload of the VPN operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Vpn vpn = vpnConfiguration.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -665,7 +665,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -676,7 +676,7 @@ public class AndroidServiceImpl implements AndroidService { if (notificationBeanWrapper == null || notificationBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the notification operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Notification notification = notificationBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -687,7 +687,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -698,7 +698,7 @@ public class AndroidServiceImpl implements AndroidService { if (wifiBeanWrapper == null || wifiBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the wifi operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } Wifi wifi = wifiBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -710,7 +710,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -721,7 +721,7 @@ public class AndroidServiceImpl implements AndroidService { if (encryptionBeanWrapper == null || encryptionBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the device encryption operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); CommandOperation operation = new CommandOperation(); @@ -732,7 +732,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -743,7 +743,7 @@ public class AndroidServiceImpl implements AndroidService { if (lockCodeBeanWrapper == null || lockCodeBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the change lock code operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } LockCode lockCode = lockCodeBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -754,7 +754,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -765,7 +765,7 @@ public class AndroidServiceImpl implements AndroidService { if (passwordPolicyBeanWrapper == null || passwordPolicyBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the change password policy operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -778,7 +778,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -790,7 +790,7 @@ public class AndroidServiceImpl implements AndroidService { if (webClipBeanWrapper == null || webClipBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the add webclip operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } WebClip webClip = webClipBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -802,7 +802,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -813,7 +813,7 @@ public class AndroidServiceImpl implements AndroidService { if (globalProxyBeanWrapper == null || globalProxyBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } GlobalProxy globalProxy = globalProxyBeanWrapper.getOperation(); @@ -828,12 +828,12 @@ public class AndroidServiceImpl implements AndroidService { } else { String errorMessage = "The payload of the global proxy operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -844,7 +844,7 @@ public class AndroidServiceImpl implements AndroidService { if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the application configuration operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -852,10 +852,10 @@ public class AndroidServiceImpl implements AndroidService { operation.setType(Operation.Type.PROFILE); operation.setPayLoad(applicationRestriction.toJSON()); return operation; - } catch (BadRequestExceptionDup e) { + } catch (BadRequestException e) { String errorMessage = "Issue in retrieving device management service instance"; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -867,7 +867,7 @@ public class AndroidServiceImpl implements AndroidService { if (displayMessageBeanWrapper == null || displayMessageBeanWrapper.getOperation() == null) { String errorMessage = "The payload of the display message operation is incorrect"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DisplayMessage configureDisplayMessage = displayMessageBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); @@ -881,7 +881,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (InvalidDeviceException e) { String errorMessage = "Invalid Device Identifiers found."; log.error(errorMessage, e); - throw new BadRequestExceptionDup(errorMessage, e); + throw new BadRequestException(errorMessage, e); } } @@ -956,7 +956,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (OperationManagementException e) { String msg = "Issue in retrieving operation management service instance"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1042,7 +1042,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while updating the device location upon android " + "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1102,7 +1102,7 @@ public class AndroidServiceImpl implements AndroidService { "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1119,18 +1119,18 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + id + "'"; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } if (androidDevice == null) { String errorMessage = "The payload of the android device enrollment is incorrect."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } if (device == null) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage); - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } if(androidDevice.getEnrolmentInfo() != null){ device.setEnrolmentInfo(device.getEnrolmentInfo()); @@ -1236,7 +1236,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (DataPublisherConfigurationException e) { String msg = "Error occurred while getting the Data publisher Service instance."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg); + throw new UnexpectedServerErrorException(msg); } } @@ -1258,11 +1258,11 @@ public class AndroidServiceImpl implements AndroidService { "the device identifier. Optionally, both from and to value should be present to get " + "alerts between times."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } - private List retrieveAlert(String deviceId) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlert(String deviceId) throws NotFoundException, UnexpectedServerErrorException { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device Identifier."); } @@ -1273,18 +1273,19 @@ public class AndroidServiceImpl implements AndroidService { if (deviceStates == null) { String errorMessage = "No any alerts are " + "published for Device: " + deviceId + "."; - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } else { return deviceStates; } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific device: " + deviceId + "."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } - private List retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + private List retrieveAlertFromDate(String deviceId, long from, long to) throws NotFoundException, + UnexpectedServerErrorException { String fromDate = String.valueOf(from); String toDate = String.valueOf(to); if (log.isDebugEnabled()) { @@ -1298,7 +1299,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceStates == null) { String errorMessage = "No any alerts are " + "published on given date for given Device: " + deviceId + "."; - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } else { return deviceStates; @@ -1307,12 +1308,12 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting published events for specific " + "Device: " + deviceId + " on given Date."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } private List retrieveAlertByType(String deviceId, String type) - throws NotFoundExceptionDup, UnexpectedServerErrorExceptionDup { + throws NotFoundException, UnexpectedServerErrorException { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device identifier and type."); } @@ -1323,7 +1324,7 @@ public class AndroidServiceImpl implements AndroidService { if (deviceStates == null) { String errorMessage = "No any alerts are " + "published for given Device: '" + deviceId + "' and given specific Type."; - throw new NotFoundExceptionDup(errorMessage); + throw new NotFoundException(errorMessage); } else { return deviceStates; @@ -1332,7 +1333,7 @@ public class AndroidServiceImpl implements AndroidService { String msg = "Error occurred while getting published events for specific " + "Device: " + deviceId + "and given specific Type."; log.error(msg, e); - throw new UnexpectedServerErrorExceptionDup(msg, e); + throw new UnexpectedServerErrorException(msg, e); } } @@ -1453,14 +1454,14 @@ public class AndroidServiceImpl implements AndroidService { AndroidAPIUtils.getAndroidPluginService().addEnterpriseUser(androidEnterpriseUser); } return token; - } catch (NotFoundExceptionDup e) { + } catch (NotFoundException e) { String errorMessage = "Not found"; log.error(errorMessage); - throw new NotFoundExceptionDup(errorMessage); - } catch (UnexpectedServerErrorExceptionDup e) { + throw new NotFoundException(errorMessage); + } catch (UnexpectedServerErrorException e) { String errorMessage = "Unexpected server error"; log.error(errorMessage); - throw new UnexpectedServerErrorExceptionDup(errorMessage); + throw new UnexpectedServerErrorException(errorMessage); } catch (AndroidDeviceMgtPluginException e) { String errorMessage = "Error occured while executing wipe enterprice command"; log.error(errorMessage); @@ -1469,43 +1470,43 @@ public class AndroidServiceImpl implements AndroidService { } - private static void validateApplicationUrl(String apkUrl) throws BadRequestExceptionDup{ + private static void validateApplicationUrl(String apkUrl) throws BadRequestException { try { URL url = new URL(apkUrl); URLConnection conn = url.openConnection(); if (((HttpURLConnection) conn).getResponseCode() != HttpURLConnection.HTTP_OK) { String errorMessage = "URL is not pointed to a downloadable file."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } catch (MalformedURLException e) { String errorMessage = "Malformed application url."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } catch (IOException e) { String errorMessage = "Invalid application url."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } - private static void validateApplicationType(String type) throws BadRequestExceptionDup{ + private static void validateApplicationType(String type) throws BadRequestException { if (type != null) { if (!"enterprise".equalsIgnoreCase(type) && !"public".equalsIgnoreCase(type) && !"webapp".equalsIgnoreCase(type)) { String errorMessage = "Invalid application type."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } else { String errorMessage = "Application type is missing."; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } - private static void validateScheduleDate(String dateString) throws BadRequestExceptionDup{ + private static void validateScheduleDate(String dateString) throws BadRequestException { try { if (dateString != null && !dateString.isEmpty()) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); @@ -1515,7 +1516,7 @@ public class AndroidServiceImpl implements AndroidService { } catch (ParseException e) { String errorMessage = "Issue in validating the schedule date"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java index 8318a36bb..dae74b5f5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidAPIUtils.java @@ -35,7 +35,7 @@ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManag import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidGoogleEnterpriseService; import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; @@ -179,7 +179,7 @@ public class AndroidAPIUtils { if (deviceIDs == null || deviceIDs.isEmpty()) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceIdentifier deviceIdentifier; List deviceIdentifiers = new ArrayList<>(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java index aea93e1fd..be73152c6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidDeviceUtils.java @@ -95,7 +95,7 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseA import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy; import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser; import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup; +import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException; import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.policy.mgt.common.FeatureManagementException; @@ -145,7 +145,7 @@ public class AndroidDeviceUtils { if (deviceIDs == null || deviceIDs.isEmpty()) { String errorMessage = "Device identifier list is empty"; log.error(errorMessage); - throw new BadRequestExceptionDup(errorMessage); + throw new BadRequestException(errorMessage); } DeviceIdentifier deviceIdentifier; List deviceIdentifiers = new ArrayList<>(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java index 1a10bc538..dd516ba77 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/src/main/java/org/wso2/carbon/device/mgt/mobile/android/core/util/AndroidEnterpriseUtils.java @@ -225,9 +225,9 @@ public class AndroidEnterpriseUtils { EnterpriseConfigs enterpriseConfigs = getEnterpriseConfigsFromGoogle(); if (enterpriseConfigs.getErrorResponse() != null) { if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { - throw new UnexpectedServerErrorExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); + throw new UnexpectedServerErrorException(enterpriseConfigs.getErrorResponse().getMessage()); } else if (enterpriseConfigs.getErrorResponse().getCode() == 500l) { - throw new NotFoundExceptionDup(enterpriseConfigs.getErrorResponse().getMessage()); + throw new NotFoundException(enterpriseConfigs.getErrorResponse().getMessage()); } } return enterpriseConfigs; From f2cac66b113cb1c481ba395e21f2456668bbfcd0 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Mon, 16 Dec 2019 21:32:07 +0530 Subject: [PATCH 30/30] Fix build failure --- .../org.wso2.carbon.device.mgt.mobile.android.core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml index c3ed1b453..8d07d4532 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.core/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 5.0.6-SNAPSHOT + 5.0.7-SNAPSHOT ../pom.xml